/* =========================================================
   QCom v4 — Mobile-first UI (keeps existing JS hooks)
   Simplified shell for contact/chat flows
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Cairo:wght@500;700&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
img, video { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }

:root {
  --bg: #050a10;
  --bg2: #0a1424;
  --surface: rgba(12, 20, 32, .9);
  --surface-2: rgba(16, 30, 48, .75);
  --surface-3: rgba(8, 12, 20, .8);
  --stroke: rgba(255, 255, 255, .08);
  --stroke-2: rgba(86, 255, 220, .32);
  --text: #e8f3fb;
  --muted: #8ca5b6;
  --accent: #6ff3c5;
  --accent-2: #57c9ff;
  --good: #6ef4bd;
  --bad: #ff7f9e;
  --warn: #ffcc7a;

  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 26px;

  --s-1: 6px;
  --s-2: 10px;
  --s-3: 14px;
  --s-4: 18px;

  --shadow-1: 0 12px 28px rgba(0, 0, 0, .35);
  --shadow-2: 0 26px 68px rgba(0, 0, 0, .55);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --topbar-h: 64px;
  --chat-top-h: 64px;
  --bottom-h: 76px;
  --content-max: 1120px;
}

body.qcom {
  font-family: "Space Grotesk", "Cairo", "SF Pro Display", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 15%, rgba(245, 197, 66, 0.18), transparent 50%),
    radial-gradient(circle at 85% 20%, rgba(96, 255, 213, 0.16), transparent 45%),
    linear-gradient(135deg, #04131a, #0a1c25 40%, #08161f 100%);
  overflow-x: hidden;
  overflow-y: auto;
}

body.qcom::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at top left, rgba(0, 0, 0, .12), rgba(0, 0, 0, .62)),
    linear-gradient(180deg, rgba(6, 10, 16, 0), rgba(6, 10, 16, .55));
}

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr auto;
}

/* ---------------- Topbar ---------------- */
.topbar {
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-2);
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: linear-gradient(90deg, rgba(6, 12, 20, .94), rgba(10, 18, 30, .88));
  border-bottom: 1px solid var(--stroke);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4);
  backdrop-filter: blur(18px);
}

.topbar__menu { justify-self: start; }
.topbar__right { justify-self: end; display: flex; align-items: center; gap: var(--s-2); }

.brand { display: flex; align-items: center; gap: var(--s-2); justify-content: center; }
.brand__logo { width: 34px; height: 34px; border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.brand__name { font-weight: 800; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; }
.brand__sub { font-size: 11px; color: var(--muted); margin-top: -1px; letter-spacing: .06em; }

.icon-btn {
  border: none;
  background: rgba(255, 255, 255, .05);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: .18s ease;
}
.icon-btn:active { transform: translateY(1px); }
.icon-btn:hover { background: rgba(111, 243, 197, .18); color: #001018; }

.pill {
  font-size: 12px;
  font-weight: 800;
  padding: 5px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06);
  white-space: nowrap;
}
.pill--membership {
  background: linear-gradient(135deg, rgba(111, 243, 197, .25), rgba(87, 201, 255, .18));
  border-color: rgba(111, 243, 197, .5);
  color: #041914;
}

/* ---------------- Drawer ---------------- */
.drawer {
  position: fixed;
  top: var(--topbar-h);
  left: -110%;
  width: min(86vw, 340px);
  height: calc(100dvh - var(--topbar-h));
  background: linear-gradient(180deg, rgba(10, 16, 26, .92), rgba(6, 10, 16, .9));
  border-right: 1px solid var(--stroke);
  backdrop-filter: blur(18px);
  padding: 18px;
  z-index: 40;
  transition: left .25s ease;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.drawer.open { left: 0; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; }
.drawer__profile { display: flex; gap: var(--s-2); align-items: center; }
.avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 20%, rgba(111, 243, 197, .55), transparent 55%),
    rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}
.drawer__email { font-weight: 900; }
.drawer__rank {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .12);
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.drawer__nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
  transition: .18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, .05); border-color: var(--stroke); }
.nav-item.active {
  background: linear-gradient(135deg, rgba(111, 243, 197, .28), rgba(87, 201, 255, .18));
  color: #031b16;
}

.notif-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .12);
}

.drawer__cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.mini-card {
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 10px 12px;
}
.mini-card__label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.mini-card__value { margin-top: 6px; font-weight: 900; word-break: break-word; }

.drawer__footer { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.id-row { display: flex; justify-content: space-between; align-items: center; }

/* ---------------- Stage / screens ---------------- */
.stage {
  overflow: auto;
  padding: 18px;
  padding-bottom: calc(var(--safe-bottom) + 120px);
  -webkit-overflow-scrolling: touch;
  width: min(var(--content-max), 100%);
  margin: 0 auto;
}
.stage.stage--split {
  display: grid;
  grid-template-columns: minmax(320px, 380px) 1fr;
  gap: var(--s-3);
  align-items: start;
}
.stage.stage--split #contacts {
  position: sticky;
  top: var(--s-3);
  align-self: start;
  max-height: calc(100dvh - var(--topbar-h) - var(--safe-bottom) - 22px);
  overflow: auto;
}
.stage.stage--split #contact-services {
  min-height: calc(100dvh - var(--topbar-h) - var(--safe-bottom) - 40px);
}
.stage.stage--split .messages {
  height: auto;
  min-height: calc(100dvh - var(--topbar-h) - var(--bottom-h) - 220px);
}

@media (max-width: 899px) {
  .stage { padding-top: 26px; }
  .composer { bottom: calc(var(--safe-bottom) + 24px); }
  .messages { padding-bottom: calc(var(--safe-bottom) + 96px); }
}
.screen { display: none; animation: screenIn .25s ease; }
.screen.active { display: block; }
@keyframes screenIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- Card base ---------------- */
.card {
  background: linear-gradient(180deg, rgba(16, 26, 40, .82), rgba(10, 16, 26, .9));
  border: 1px solid var(--stroke);
  border-radius: 20px;
  box-shadow: var(--shadow-1);
  backdrop-filter: blur(12px);
  padding: 16px;
  position: relative;
}

/* ---------------- Session board ---------------- */
.session-board {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(145deg, rgba(16, 30, 46, .9), rgba(10, 16, 26, .92));
  margin-bottom: 12px;
}
.session-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.session-id {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .04em;
  color: #f1fbff;
}
.session-meta {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.session-email { font-weight: 600; }
.session-head__stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.session-stat-pill {
  min-width: 130px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  padding: 10px 12px;
}
.pill__label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.session-stat-pill__value { margin-top: 4px; font-weight: 800; }
.session-chip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.session-chip {
  background: rgba(255, 255, 255, .03);
  border: 1px dashed var(--stroke);
  border-radius: 14px;
  padding: 10px 12px;
}
.session-quiet { display: flex; justify-content: flex-start; margin-top: 4px; }
.pill--ghost { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .14); color: var(--text); }
.dot-divider { padding: 0 8px; color: var(--muted); }

/* ---------------- Status ---------------- */
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.status-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-dot.is-online { color: var(--good); border-color: rgba(124, 255, 216, .35); }
.status-dot.is-offline { color: var(--bad); border-color: rgba(255, 127, 158, .35); }

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
  background: rgba(0, 30, 50, .7);
  border: 1px solid var(--stroke);
}
.status-pill.is-online { color: var(--good); background: rgba(0, 150, 100, .15); }
.status-pill.is-offline { color: var(--bad); background: rgba(150, 0, 60, .15); }

/* ---------------- Heading / actions ---------------- */
.screen-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--s-2);
  margin: 6px 0 var(--s-2);
}
.eyebrow { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); }
.title { font-size: 20px; font-weight: 900; }
.actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ---------------- Chips ---------------- */
.chip {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .05);
  padding: 9px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: .18s ease;
}
.chip:hover { transform: translateY(-1px); background: rgba(255, 255, 255, .08); }
.chip.ghost { background: rgba(255, 255, 255, .04); border-color: rgba(255, 255, 255, .16); }
.chip.primary { background: linear-gradient(135deg, rgba(111, 243, 197, .25), rgba(87, 201, 255, .22)); border-color: rgba(111, 243, 197, .5); color: #041914; }
.chip.full { width: 100%; }

/* ---------------- Search ---------------- */
.search { padding: 12px 14px; margin-bottom: var(--s-2); display: flex; flex-direction: column; gap: 10px; }
.search input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .04);
  outline: none;
}
.filter-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-chip {
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: .18s ease;
}
.filter-chip.active {
  color: #041914;
  background: linear-gradient(135deg, rgba(111, 243, 197, .3), rgba(87, 201, 255, .22));
  border-color: rgba(111, 243, 197, .55);
}

/* ---------------- Lists / contacts ---------------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.contacts-list { min-height: 22vh; }
.contacts-list.card { padding: 12px; background: rgba(255, 255, 255, .02); }

.contact-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid transparent;
  border-radius: 14px;
  cursor: pointer;
  transition: .18s ease;
}
.contact-item:hover {
  border-color: var(--stroke-2);
  background: rgba(111, 243, 197, .08);
  transform: translateY(-1px);
}
.contact-avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 20%, rgba(111, 243, 197, .6), transparent 55%),
    rgba(255, 255, 255, .06);
  border: 1px solid var(--stroke);
  display: grid;
  place-items: center;
  font-weight: 900;
  color: #02161c;
}
.contact-meta strong { display: block; font-size: 15px; font-weight: 900; }
.contact-meta small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.contact-presence {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, .05);
}
.contact-presence.is-online { color: var(--good); border-color: rgba(124, 255, 216, .35); background: rgba(0, 120, 90, .18); }
.contact-presence.is-offline { color: var(--bad); border-color: rgba(255, 127, 158, .35); background: rgba(150, 0, 60, .12); }

/* ---------------- Sheet (add contact) ---------------- */
.sheet {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(520px, calc(100% - 32px));
  max-height: 80vh;
  overflow: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.field input, .field select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  outline: none;
}

/* ---------------- Chat top ---------------- */
.chat-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--s-2);
  align-items: center;
  padding: 8px 6px;
  margin: 0 0 8px;
  min-height: var(--chat-top-h);
  background: linear-gradient(180deg, rgba(8, 14, 22, .96), rgba(8, 14, 22, .75));
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
}
.chat-top__center { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-top__meta { min-width: 0; }
.chat-top__name { font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-top__sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 30% 20%, rgba(111, 243, 197, .6), transparent 55%),
    rgba(255, 255, 255, .06);
  border: 1px solid var(--stroke);
}
.avatar--call {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--accent);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.avatar--call:focus-visible,
.avatar--call:hover { box-shadow: 0 0 0 2px rgba(111, 243, 197, .35); transform: translateY(-1px); }
.chat-top__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.call-mini {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 12px;
  padding: 6px 8px;
}
.call-mini__timer { font-size: 12px; }
.call-status-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------------- Calls ---------------- */
.call-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.call-card {
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 12px;
}
.call-card.slim { padding: 8px 10px; }
.call-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.call-title { font-weight: 900; }
.video-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 8px; }
.video-grid video {
  width: 100%;
  height: 220px;
  object-fit: cover;
  background: #000;
  border-radius: 12px;
}

.incoming { border-color: rgba(255, 200, 90, .7); background: rgba(255, 219, 130, .12); }
.incoming__title { font-weight: 900; margin-bottom: 8px; }
.incoming__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.accept-btn, .reject-btn, .ignore-btn {
  flex: 1;
  border: none;
  padding: 10px;
  border-radius: 12px;
  font-weight: 900;
  cursor: pointer;
}
.accept-btn { background: #00e09b; color: #021b12; }
.reject-btn { background: #ff6f89; color: #22070d; }
.ignore-btn { background: #8a98a1; color: #0c1115; }

.call-shell {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  background: linear-gradient(145deg, rgba(87, 201, 255, .14), rgba(10, 18, 30, .75));
  position: sticky;
  top: calc(var(--chat-top-h) + var(--s-2));
  z-index: 12;
}
.call-toggle {
  align-self: flex-start;
  margin-bottom: 4px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  font-size: 18px;
  display: none;
}
.call-controls[hidden] { display: none; }
.call-controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.call-shell__actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}
.call-btn {
  border: 1px solid var(--stroke-2);
  background: rgba(111, 243, 197, .16);
  padding: 10px 12px;
  border-radius: 14px;
  font-weight: 900;
  cursor: pointer;
  transition: .18s ease;
}
.call-btn.ghost { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .16); }
.call-btn.danger { background: rgba(255, 127, 158, .2); border-color: rgba(255, 127, 158, .5); color: #ffd9e4; }
.call-btn:hover { transform: translateY(-1px); }

.call-shell__controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  align-items: stretch;
}
.control-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  font-weight: 900;
  cursor: pointer;
  transition: .16s ease;
}
.control-chip.ghost { cursor: default; background: rgba(255, 255, 255, .05); }
.control-chip.is-off { background: rgba(255, 127, 158, .18); border-color: rgba(255, 127, 158, .35); color: #ffdbe5; }
.control-chip.is-disabled { opacity: .6; cursor: not-allowed; }
.call-shell__controls.is-inactive { opacity: .65; pointer-events: none; }
.control-chip__icon { font-size: 16px; }
.control-chip__label { font-size: 13px; }

.call-shell__body {
  background: rgba(0, 20, 40, .55);
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  padding: 12px;
  display: grid;
  gap: 10px;
}

/* ---------------- Messages ---------------- */
.messages {
  max-height: calc(100dvh - var(--topbar-h) - var(--bottom-h) - 140px);
  min-height: 260px;
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: rgba(10, 18, 30, .65);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .08);
  scroll-behavior: smooth;
}
.message {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(12, 24, 40, .9);
  border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  position: relative;
}
.message.incoming { margin-right: auto; border-top-left-radius: 6px; }
.message.outgoing {
  margin-left: auto;
  color: #03150f;
  background: linear-gradient(135deg, rgba(111, 243, 197, .72), rgba(87, 201, 255, .55));
  border-top-right-radius: 6px;
}
.message-header { display: flex; gap: 8px; font-size: 11px; opacity: .9; margin-bottom: 6px; }
.message-header .sender { font-weight: 900; }
.message-header .timestamp { margin-left: auto; opacity: .6; }
.message-status { font-weight: 900; }
.message-content {
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.message-attachments {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.message-attachments__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.message-attachments__files {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.message-attachment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .04);
  font-size: 12px;
}
.message-attachment--image {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 8px;
  cursor: pointer;
}
.message-attachment--image img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
}
.message-attachment--image .message-attachment__meta {
  max-width: 100%;
}
.message.attachment-empty .message-attachment { border-style: dashed; }
.message-attachment__name { font-weight: 600; }
.message-attachment__size { opacity: .6; font-size: 11px; }
.message-attachment__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 70%;
}
.message-attachment__meta .message-attachment__name {
  font-size: 13px;
}
.message-attachment__meta .message-attachment__size {
  font-size: 11px;
}
.message-attachment__download {
  border: none;
  background: rgba(111, 243, 197, .18);
  color: #001018;
  font-weight: 800;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  transition: .18s ease;
}
.message-attachment__download:hover:not(:disabled) {
  background: rgba(111, 243, 197, .35);
}
.message-attachment__download[disabled] {
  opacity: .45;
  cursor: not-allowed;
  background: rgba(255, 255, 255, .05);
  color: rgba(255, 255, 255, .6);
}

.message-date-divider {
  margin: 8px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .7);
}
.message-date-divider::before,
.message-date-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .2);
}

.typing { font-size: 12px; color: var(--muted); padding: 6px 4px; }
.hidden { display: none !important; }

/* ---------------- Composer ---------------- */
.composer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 0 4px;
  background: transparent;
}

.composer__input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.composer__emoji {
  position: relative;
  display: inline-flex;
}
.composer__emoji-btn {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  transition: .18s ease;
}
.composer__emoji-btn:hover {
  border-color: rgba(111, 243, 197, .7);
  background: rgba(111, 243, 197, .12);
}
.composer__emoji-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 4px;
  padding: 8px;
  width: min(95vw, 460px);
  min-width: 360px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(15, 20, 26, .96);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .35);
  z-index: 10;
}
.composer__emoji-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.composer__emoji-item:hover {
  background: rgba(111, 243, 197, .2);
}

.composer__attachment-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .15);
  background: rgba(255, 255, 255, .05);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: .18s ease;
}
.composer__attachment-btn:hover {
  border-color: rgba(111, 243, 197, .7);
  background: rgba(111, 243, 197, .12);
}
.composer__attachment-btn input {
  display: none;
}
.composer__attachment-icon {
  font-size: 16px;
  font-weight: 900;
}
.composer__attachment-label {
  font-size: 12px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.composer__record-btn /* styled voice note trigger */ {
  flex: 0 0 auto;
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .15);
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .25), rgba(255, 255, 255, 0)),
    rgba(255, 255, 255, .08);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  transition: .2s ease, transform .2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.composer__record-btn.is-recording {
  background: rgba(255, 127, 158, .38);
  border-color: rgba(255, 127, 158, .7);
  box-shadow: 0 12px 24px rgba(255, 127, 158, .25);
  color: #fff;
}
.composer__record-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid rgba(111, 243, 197, .25);
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
}
.composer__record-btn::after {
  content: "";
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(255, 127, 158, .35), rgba(255, 127, 158, 0) 65%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 127, 158, .25) 0,
      rgba(255, 127, 158, .25) 4px,
      transparent 4px,
      transparent 12px
    );
  background-size: 140% 140%, 110% 110%;
  background-position: center center, 0 0;
  opacity: 0;
  transition: opacity .4s ease;
  filter: blur(3px);
}
.composer__record-btn:hover::before {
  opacity: 1;
  transform: scale(1.02);
}
.composer__record-btn.is-recording::before {
  border-color: rgba(255, 127, 158, .6);
  opacity: 1;
}
.composer__record-btn.is-recording::after {
  opacity: .8;
  animation:
    recordingGlow 2s ease-in-out infinite,
    recordingWave 1.4s linear infinite;
}
.composer__record-btn:hover:not(.is-recording) {
  border-color: rgba(111, 243, 197, .7);
  background: rgba(111, 243, 197, .12);
}
.composer__record-btn:active {
  transform: translateY(1px);
}

@keyframes recordingGlow {
  0% { transform: scale(0.98); opacity: .4; }
  50% { transform: scale(1.05); opacity: .8; }
  100% { transform: scale(0.98); opacity: .3; }
}

@keyframes recordingWave {
  0% { background-position: center center, 0 -4px; }
  100% { background-position: center center, 0 -16px; }
}

#msg-body {
  flex: 1;
  resize: none;
  min-height: 44px;
  max-height: 140px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  outline: none;
}

.send {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-weight: 900;
  background: var(--accent);
  color: #001018;
  box-shadow: 0 10px 22px rgba(111, 243, 197, .35);
  transition: .18s ease;
}
.send:hover {
  background: #86f7d4;
  transform: translateY(-1px);
}

.composer__meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: rgba(255, 255, 255, .6);
  padding: 0 2px;
}
.composer__auto-delete-note {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .7;
}

.composer__attachment-preview {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  min-height: 34px;
}
.attachment-thumb {
  position: relative;
  width: 92px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(6, 10, 16, .8);
  border: 1px solid rgba(111, 243, 197, .35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  cursor: pointer;
}
.attachment-thumb img {
  width: 100%;
  height: 74px;
  object-fit: cover;
  display: block;
}
.attachment-thumb__meta {
  display: grid;
  gap: 2px;
  padding: 6px;
  font-size: 10px;
}
.attachment-thumb__name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attachment-thumb__size {
  opacity: .7;
}
.attachment-thumb__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}
.attachment-thumb__remove:hover {
  background: rgba(255, 127, 158, .8);
}
.composer__recording-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(255, 127, 158, .08);
  color: #ffe7e3;
  margin-top: 8px;
  min-height: 58px;
}
.composer__recording-indicator.hidden {
  display: none;
}
.composer__recording-pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 90, 110, 1);
  box-shadow: 0 0 12px rgba(255, 90, 110, .8);
  animation: recordingPulse 1s infinite;
}
.composer__recording-label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.composer__recording-timer {
  font-size: 18px;
  font-weight: 800;
  margin-top: 2px;
}
.composer__recording-cancel {
  border-radius: 50%;
  padding: 6px 10px;
  align-self: flex-start;
  background: rgba(255, 255, 255, .1);
}
@keyframes recordingPulse {
  0% { transform: scale(0.9); }
  50% { transform: scale(1.1); }
  100% { transform: scale(0.9); }
}
.composer__attachment-preview[data-visible="true"] {
  display: flex;
}
.composer__attachment-empty {
  font-size: 12px;
  color: rgba(255, 255, 255, .5);
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 12px;
  background: rgba(6, 10, 16, .8);
  border: 1px solid rgba(111, 243, 197, .4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
  font-size: 12px;
}
.attachment-chip__name {
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip__size {
  font-size: 11px;
  opacity: .8;
}
.attachment-chip__remove {
  border: none;
  background: transparent;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}
.attachment-chip__remove:hover {
  color: #86f7d4;
}

.compose-gallery {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30;
}
.compose-gallery.hidden {
  display: none;
}
.compose-gallery__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 18, .85);
  backdrop-filter: blur(6px);
}
.compose-gallery__panel {
  position: relative;
  z-index: 1;
  width: min(92vw, 560px);
  background: rgba(15, 20, 26, .95);
  border-radius: 16px;
  border: 1px solid rgba(111, 243, 197, .2);
  box-shadow: 0 20px 40px rgba(0, 0, 0, .4);
  padding: 14px;
  display: grid;
  gap: 12px;
}
.compose-gallery__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.compose-gallery__image {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(0, 0, 0, .35);
}
.compose-gallery__actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.compose-gallery__btn {
  border: 1px solid rgba(111, 243, 197, .35);
  background: rgba(111, 243, 197, .15);
  color: #dff;
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
}
.compose-gallery__btn:hover {
  background: rgba(111, 243, 197, .25);
}

.attachment-viewer {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
  pointer-events: none;
}
.attachment-viewer.hidden {
  display: none;
}
.attachment-viewer__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  backdrop-filter: blur(8px);
  pointer-events: auto;
}
.attachment-viewer__content {
  position: relative;
  width: min(90vw, 520px);
  max-height: 80vh;
  background: rgba(8, 12, 18, .98);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, .12);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 24px 55px rgba(0, 0, 0, .65);
  pointer-events: auto;
}
.attachment-viewer__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.attachment-viewer__filename {
  font-weight: 700;
  font-size: 14px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.attachment-viewer__body {
  flex: 1;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.attachment-viewer__media {
  width: 100%;
  max-height: 60vh;
  border-radius: 14px;
  object-fit: contain;
  background: #000;
}
.attachment-viewer__text {
  width: 100%;
  white-space: pre-wrap;
  font-size: 12px;
  font-family: "Space Grotesk", "Cairo", monospace;
  color: var(--text);
}
.attachment-viewer__message {
  text-align: center;
  font-size: 13px;
  opacity: .9;
}
.attachment-viewer__actions {
  display: flex;
  justify-content: flex-end;
}
.attachment-viewer__download {
  border-radius: 12px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(111, 243, 197, .35), rgba(87, 201, 255, .25));
  color: #031918;
  font-weight: 700;
  border: 1px solid rgba(111, 243, 197, .35);
  text-decoration: none;
}
.attachment-viewer__download:hover {
  background: linear-gradient(135deg, rgba(111, 243, 197, .5), rgba(87, 201, 255, .35));
}

/* ---------------- Notifications ---------------- */
.notif-list {
  max-height: 70vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qcom-notif {
  background: rgba(12, 24, 40, 0.55);
  border-left: 3px solid rgba(111, 243, 197, 0.35);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.qcom-notif.is-unread { border-color: rgba(111, 243, 197, 0.55); box-shadow: 0 12px 28px rgba(111, 243, 197, 0.12); }
.qcom-notif.is-read { opacity: 0.78; }
.qcom-notif.level-success { border-color: rgba(0, 200, 140, 0.45); }
.qcom-notif.level-warning { border-color: rgba(255, 190, 90, 0.45); }
.qcom-notif.level-error,
.qcom-notif.level-danger { border-color: rgba(255, 90, 110, 0.55); }
.qcom-notif__title { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 8px; color: #eaffff; }
.qcom-notif__time { font-size: 12px; opacity: 0.65; color: #a9d9e6; }
.qcom-notif__body { font-size: 14px; color: #cdeff6; line-height: 1.5; }
.qcom-notif__actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.qcom-notif__btn {
  background: rgba(111, 243, 197, 0.2);
  color: #041914;
  padding: 6px 12px;
  border-radius: 10px;
  border: 1px solid rgba(111, 243, 197, 0.32);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.qcom-notif__btn.is-danger { background: rgba(255, 90, 110, 0.18); border-color: rgba(255, 90, 110, 0.3); color: #ffbfc9; }
.qcom-notif-empty { text-align: center; padding: 32px 16px; font-size: 14px; color: #9bd6e3; }
.qcom-notif-empty.error { color: #ffb6c1; }

/* ---------------- Utilities ---------------- */
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: var(--stroke); opacity: .7; }

/* ---------------- Bottom Nav ---------------- */
.bottom-nav {
  display: none !important;
}
.bottom-item {
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border-radius: 14px;
  transition: .18s ease;
}
.bottom-item__icon { font-size: 18px; }
.bottom-item.active {
  color: var(--text);
  background: rgba(111, 243, 197, .2);
}

/* ---------------- WS pill ---------------- */
.ws-pill {
  position: fixed;
  right: 10px;
  bottom: calc(var(--bottom-h) + var(--safe-bottom) + 10px);
  font-size: 12px;
  font-weight: 900;
  color: #ff91a6;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(255, 80, 100, .5);
  padding: 6px 10px;
  border-radius: 999px;
  z-index: 60;
}
.ws-pill.pulsing { animation: pulse 1.4s ease-in-out infinite; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 145, 166, .5); }
  70% { box-shadow: 0 0 0 10px rgba(255, 145, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 145, 166, 0); }
}

.contact-feedback {
  margin-top: 6px;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .3);
  color: var(--text);
  border: 1px solid var(--stroke);
}
.contact-feedback.success { border-color: rgba(123, 255, 215, .4); color: #d4fff1; background: rgba(0, 120, 90, .18); }
.contact-feedback.error { border-color: rgba(255, 132, 162, .4); color: #ffd5df; background: rgba(150, 10, 50, .18); }
.contact-feedback.info { border-color: rgba(0, 190, 255, .35); color: #c6f3ff; background: rgba(0, 40, 70, .35); }

#welcome-splash {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, rgba(0, 255, 255, 0.1), rgba(0, 0, 0, 0.9));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  animation: fadeInSplash 0.6s ease-out forwards;
}
#welcome-splash.hidden { display: none; }
.splash-circle { position: relative; width: 260px; height: 260px; border-radius: 50%; overflow: hidden; }
.splash-circle img { width: 100%; height: 100%; border-radius: 50%; animation: zoomIn 1.2s ease-out; }
.loading-ring {
  position: absolute;
  inset: 0;
  border: 6px solid transparent;
  border-top: 6px solid #00ffff;
  border-radius: 50%;
  animation: spin 2s linear infinite;
}
.splash-text { color: #0ff; margin-top: 20px; font-size: 1.5em; animation: fadeInText 1.2s ease-in-out; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeInSplash { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadeInText { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* ---------------- Desktop ---------------- */
@media (min-width: 900px) {
  .app { grid-template-rows: var(--topbar-h) 1fr; }
  .bottom-nav { display: none; }
  .drawer {
    position: sticky;
    left: 0;
    top: 0;
    height: 100dvh;
    width: 255px;
    transition: none;
  }
  .app { grid-template-columns: 255px 1fr; }
  .topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; }
  .drawer { grid-row: 2; grid-column: 1; }
  .stage { grid-row: 2; grid-column: 2; }
  .stage { padding: 18px; }
  .messages { height: min(62vh, 560px); }
  .video-grid { grid-template-columns: 1fr 1fr; }
  .drawer__cards { grid-template-columns: 1fr; }
}

/* ---------------- Reduce motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
