/* =========================================================
   LabChat — theme tokens
   ========================================================= */
:root {
  --bg: #0a0d13;
  --bg-2: #0d121b;
  --panel: #111824;
  --panel-2: #151d2b;
  --panel-3: #1a2331;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #e9eef7;
  --muted: #8e99ab;
  --muted-2: #647086;
  --accent: #5b8cff;
  --accent-2: #a06bff;
  --accent-soft: rgba(91, 140, 255, 0.13);
  --bubble: #1a2332;
  --bubble-2: #202b3d;
  --danger: #ff6b81;
  --ok: #3ddc97;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.32);
  --radius: 16px;
  --radius-sm: 11px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f2f5fa;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f5f8fd;
  --panel-3: #ebf1fa;
  --line: rgba(16, 24, 40, 0.08);
  --line-2: rgba(16, 24, 40, 0.14);
  --text: #101828;
  --muted: #5f6b7e;
  --muted-2: #98a2b3;
  --accent-soft: rgba(91, 140, 255, 0.12);
  --bubble: #eef3fb;
  --bubble-2: #e3ebf8;
  --shadow: 0 24px 70px rgba(16, 24, 40, 0.12);
  --shadow-sm: 0 8px 24px rgba(16, 24, 40, 0.08);
  color-scheme: light;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: rgba(91, 140, 255, 0.35);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon.tiny {
  width: 15px;
  height: 15px;
}

/* scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
  background-clip: content-box;
}

/* =========================================================
   Shared bits
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 15px;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s;
  border: 1px solid transparent;
}
.btn.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #7b6bff 55%, var(--accent-2) 100%);
  box-shadow: 0 10px 26px rgba(91, 140, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 32px rgba(91, 140, 255, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn.primary:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.ghost {
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  font-size: 13.5px;
  transition: background 0.16s, border-color 0.16s;
}
.ghost:hover {
  background: var(--panel-3);
  border-color: var(--muted-2);
}
.ghost.small {
  height: 32px;
  padding: 0 11px;
  font-size: 12.5px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease;
  flex: none;
}
.icon-btn:hover {
  background: var(--panel-3);
  color: var(--text);
}
.icon-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--c, #5b8cff), color-mix(in srgb, var(--c, #5b8cff) 55%, #000));
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  flex: none;
  user-select: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.avatar.sm {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 14px;
}
.avatar.xs {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(61, 220, 151, 0.14);
  vertical-align: 1px;
  margin-right: 6px;
}

/* =========================================================
   Join screen
   ========================================================= */
.join {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 620px at 12% -10%, rgba(91, 140, 255, 0.2), transparent 62%),
    radial-gradient(760px 560px at 105% 15%, rgba(160, 107, 255, 0.16), transparent 60%),
    radial-gradient(700px 700px at 50% 120%, rgba(61, 220, 151, 0.08), transparent 65%),
    var(--bg);
}
.join::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
  opacity: 0.45;
  pointer-events: none;
}
.join-glow {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  filter: blur(120px);
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.26), rgba(160, 107, 255, 0.2));
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none;
}

.join-card {
  position: relative;
  width: min(440px, 100%);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  padding: 30px 30px 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.2);
  animation: rise 0.5s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.brand {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 26px;
}
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #7b6bff 60%, var(--accent-2) 100%);
  box-shadow: 0 12px 30px rgba(91, 140, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  flex: none;
}
.brand-mark .icon {
  width: 26px;
  height: 26px;
  stroke-width: 2;
}
.brand h1 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.6px;
  font-weight: 800;
}
.brand h1 span {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.join-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.field > span {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.field input {
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  padding: 0 14px;
  font-size: 15px;
  transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
  width: 100%;
}
.field input::placeholder {
  color: var(--muted-2);
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  background: var(--panel);
}

.swatches {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 2px;
}
.swatch {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  position: relative;
  transition: transform 0.14s ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.swatch:hover {
  transform: translateY(-2px);
}
.swatch[aria-checked="true"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  border: 2px solid currentColor;
}
.swatch[aria-checked="true"] {
  transform: translateY(-1px);
}

.form-error {
  margin: -4px 0 0;
  min-height: 18px;
  font-size: 13px;
  color: var(--danger);
  font-weight: 550;
}

.join-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
}
.join-url {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.join-tip {
  position: relative;
  margin: 18px 0 0;
  color: var(--muted-2);
  font-size: 12.5px;
  text-align: center;
}

/* =========================================================
   App shell
   ========================================================= */
.app {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 14px 14px 18px;
  border-bottom: 1px solid var(--line);
}
.side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.logo-sm {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px rgba(91, 140, 255, 0.35);
  flex: none;
}
.logo-sm .icon {
  width: 19px;
  height: 19px;
  stroke-width: 2;
}
.side-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.side-brand-text strong {
  font-size: 15px;
  letter-spacing: -0.2px;
}
.side-brand-text small {
  font-size: 11px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 12px;
  min-height: 0;
}

.side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.side-label .count {
  background: var(--panel-3);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 10.5px;
  letter-spacing: 0;
  color: var(--muted);
}
.mini {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  transition: background 0.15s, color 0.15s;
}
.mini:hover {
  background: var(--panel-3);
  color: var(--text);
}
.mini .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.room-list,
.user-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.room {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 550;
  text-align: left;
  transition: background 0.14s, color 0.14s;
  position: relative;
}
.room:hover {
  background: var(--panel-2);
  color: var(--text);
}
.room.active {
  background: var(--accent-soft);
  color: var(--text);
}
.room.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(var(--accent), var(--accent-2));
}
.room-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  color: var(--muted-2);
  flex: none;
}
.room.active .room-icon {
  background: rgba(91, 140, 255, 0.18);
  color: var(--accent);
}
.room-icon .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.1;
}
.room-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-badge {
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 750;
  min-width: 19px;
  height: 19px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  box-shadow: 0 2px 8px rgba(91, 140, 255, 0.5);
}
.room.dm .room-icon {
  background: transparent;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 10px;
  border-radius: 9px;
  text-align: left;
  transition: background 0.14s;
}
.user:hover {
  background: var(--panel-2);
}
.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.25;
}
.user-info strong {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-info small {
  font-size: 11px;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user .avatar {
  position: relative;
}
.user .avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ok);
  border: 2px solid var(--bg-2);
}

.side-me {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.me-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.me-info strong {
  font-size: 13.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.me-info small {
  font-size: 11px;
  color: var(--muted-2);
}

/* =========================================================
   Chat
   ========================================================= */
.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(1100px 500px at 80% -20%, rgba(91, 140, 255, 0.07), transparent 70%),
    var(--bg);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 66px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  flex: none;
  z-index: 5;
}
.chat-title {
  min-width: 0;
  flex: 1;
}
.chat-title h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-title h2 .icon {
  width: 17px;
  height: 17px;
  color: var(--muted-2);
  stroke-width: 2.2;
}
.chat-title p {
  margin: 1px 0 0;
  font-size: 12px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.head-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ok);
  background: rgba(61, 220, 151, 0.1);
  border: 1px solid rgba(61, 220, 151, 0.22);
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
}
.conn i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.conn[data-state="connecting"] {
  color: #ffc857;
  background: rgba(255, 200, 87, 0.1);
  border-color: rgba(255, 200, 87, 0.25);
}
.conn[data-state="connecting"] i {
  animation: blink 1s infinite;
}
.conn[data-state="offline"] {
  color: var(--danger);
  background: rgba(255, 107, 129, 0.1);
  border-color: rgba(255, 107, 129, 0.25);
}

.only-mobile {
  display: none;
}

.messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 24px 8px;
  min-height: 0;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.messages-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.sysline {
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  margin: 10px 0;
}
.sysline span {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}

.msg {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 7px 10px 7px 8px;
  border-radius: 12px;
  transition: background 0.12s;
  animation: msg-in 0.22s ease both;
}
.msg:hover {
  background: color-mix(in srgb, var(--panel) 55%, transparent);
}
.msg.grouped {
  margin-top: -3px;
}
.msg.grouped .msg-avatar {
  visibility: hidden;
}
.msg.grouped .msg-meta {
  display: none;
}
.msg.grouped::before {
  content: attr(data-time);
  position: absolute;
  left: 22px;
  top: 10px;
  width: 36px;
  text-align: right;
  font-size: 10px;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.14s;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.msg.grouped:hover::before {
  opacity: 1;
}

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(140deg, var(--c), color-mix(in srgb, var(--c) 52%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
  user-select: none;
  margin-top: 1px;
}
.msg-main {
  min-width: 0;
  flex: 1;
}
.msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
  line-height: 1.2;
}
.msg-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--c, var(--text));
  letter-spacing: -0.1px;
}
.msg-time {
  font-size: 10.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
}
.msg-tag {
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1.5px 6px;
  border-radius: 5px;
}
.msg-body {
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.msg.own .msg-body {
  color: color-mix(in srgb, var(--accent) 22%, var(--text));
}
.msg-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.msg-body a:hover {
  border-bottom-color: var(--accent);
}
.msg-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--panel-3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}
.msg-body .mention {
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 5px;
  padding: 0 4px;
  font-weight: 600;
}
.msg-body strong {
  font-weight: 750;
}
.msg-deleted {
  color: var(--muted-2);
  font-style: italic;
  font-size: 13px;
}

.msg-actions {
  position: absolute;
  right: 10px;
  top: -6px;
  display: flex;
  gap: 2px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 2px;
  box-shadow: var(--shadow-sm);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.14s, transform 0.14s;
  pointer-events: none;
}
.msg:hover .msg-actions,
.msg:focus-within .msg-actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.msg-actions button {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.msg-actions button:hover {
  background: var(--panel-3);
  color: var(--text);
}
.msg-actions button[data-act="delete"]:hover {
  color: var(--danger);
}
.msg-actions .icon {
  width: 14px;
  height: 14px;
}

.attach {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 400px;
}
.attach-img {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel-2);
  line-height: 0;
  cursor: zoom-in;
  max-width: min(360px, 100%);
}
.attach-img img {
  display: block;
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}
.attach-file {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
  max-width: 360px;
}
.attach-file:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.attach-ico {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), rgba(160, 107, 255, 0.14));
  color: var(--accent);
  flex: none;
}
.attach-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
}
.attach-meta strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-meta small {
  font-size: 11px;
  color: var(--muted-2);
}
.attach-file > .icon {
  color: var(--muted-2);
  width: 17px;
  height: 17px;
}

.empty {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  max-width: 380px;
}
.empty .big {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--accent);
}
.empty .big .icon {
  width: 28px;
  height: 28px;
}
.empty h3 {
  margin: 0 0 6px;
  font-size: 17px;
  color: var(--text);
}
.empty p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
}
.empty p b {
  color: var(--text);
}

.jump {
  position: absolute;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: 0 10px 26px rgba(91, 140, 255, 0.45);
  z-index: 6;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
}
.jump.show {
  opacity: 1;
  transform: translateX(-50%);
  pointer-events: auto;
}
.jump .icon {
  width: 14px;
  height: 14px;
}

.typing {
  height: 22px;
  padding: 0 26px;
  max-width: 930px;
  margin: 0 auto;
  width: 100%;
  font-size: 12px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}
.typing .dots {
  display: inline-flex;
  gap: 3px;
}
.typing .dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--muted-2);
  animation: bounce 1.1s infinite;
}
.typing .dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.typing .dots i:nth-child(3) {
  animation-delay: 0.3s;
}

/* composer */
.composer {
  flex: none;
  padding: 0 24px 14px;
  max-width: 930px;
  margin: 0 auto;
  width: 100%;
}
.composer-inner {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 15px;
  padding: 6px 8px 6px 6px;
  transition: border-color 0.16s, box-shadow 0.16s;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}
.composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 4px 18px rgba(0, 0, 0, 0.12);
}
.composer-inner .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  margin-bottom: 1px;
}
#input {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  padding: 9px 4px;
  max-height: 168px;
  min-height: 36px;
  line-height: 1.45;
  font-size: 14.5px;
  outline: none;
}
#input::placeholder {
  color: var(--muted-2);
}
.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px rgba(91, 140, 255, 0.4);
  transition: transform 0.14s, opacity 0.14s, box-shadow 0.14s;
  flex: none;
  margin-bottom: 0;
}
.send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgba(91, 140, 255, 0.5);
}
.send-btn:active {
  transform: scale(0.96);
}
.send-btn .icon {
  width: 18px;
  height: 18px;
  margin-left: -1px;
}
.composer-hint {
  margin: 7px 2px 0;
  font-size: 11px;
  color: var(--muted-2);
  text-align: right;
}
.composer-hint kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 0 4px;
}

.upload {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  padding: 8px 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
}
.upload-track {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  background: var(--panel-3);
  overflow: hidden;
}
.upload-track i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.15s;
}

.emoji-pop {
  position: absolute;
  bottom: 96px;
  right: 30px;
  width: 292px;
  max-height: 236px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  box-shadow: var(--shadow);
  z-index: 20;
  animation: pop 0.16s ease both;
}
.emoji-pop button {
  font-size: 20px;
  line-height: 1;
  height: 32px;
  border-radius: 7px;
  display: grid;
  place-items: center;
}
.emoji-pop button:hover {
  background: var(--panel-3);
  transform: scale(1.12);
}

/* =========================================================
   Overlays
   ========================================================= */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 12, 0.6);
  backdrop-filter: blur(3px);
  z-index: 40;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 5vh 5vw;
  background: rgba(3, 5, 9, 0.88);
  backdrop-filter: blur(8px);
}
.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: var(--shadow);
  object-fit: contain;
}
.lightbox .icon-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.dialog {
  border: 1px solid var(--line-2);
  background: var(--panel);
  color: var(--text);
  border-radius: 18px;
  padding: 24px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop {
  background: rgba(4, 7, 12, 0.62);
  backdrop-filter: blur(4px);
}
.dialog h3 {
  margin: 0 0 4px;
  font-size: 18px;
  letter-spacing: -0.3px;
}
.dialog p {
  margin: 0 0 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.55;
}
.dialog .field input {
  height: 44px;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}
.dialog-actions .btn {
  height: 42px;
}
.dialog form {
  display: block;
}

.toast-wrap {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 15px;
  border-radius: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 550;
  color: var(--text);
  animation: toast-in 0.24s ease both;
  max-width: 340px;
}
.toast.out {
  animation: toast-out 0.2s ease both;
}
.toast .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.toast.error .icon {
  color: var(--danger);
}

/* =========================================================
   Animations
   ========================================================= */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}
@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  30% {
    transform: translateY(-3px);
    opacity: 1;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
  }
  .only-mobile {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(300px, 84vw);
    z-index: 50;
    transform: translateX(-102%);
    transition: transform 0.26s cubic-bezier(0.3, 0.8, 0.3, 1);
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    transform: none;
  }
  .chat-head {
    height: 58px;
    padding: 0 12px;
    gap: 8px;
  }
  .chat-head .icon-btn {
    width: 34px;
    height: 34px;
  }
  .messages {
    padding: 12px 12px 4px;
  }
  .msg {
    padding: 6px 6px 6px 4px;
    gap: 9px;
  }
  .msg-avatar {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    font-size: 13px;
  }
  .msg.grouped::before {
    left: 14px;
  }
  .composer {
    padding: 0 10px calc(10px + env(safe-area-inset-bottom));
  }
  .typing {
    padding: 0 14px;
  }
  .composer-hint {
    display: none;
  }
  .emoji-pop {
    right: 12px;
    bottom: 88px;
    width: min(300px, calc(100vw - 24px));
  }
  .toast-wrap {
    left: 14px;
    right: 14px;
    bottom: 14px;
    align-items: stretch;
  }
  .toast {
    max-width: none;
  }
  .jump {
    bottom: 92px;
  }
  .join-card {
    padding: 24px 20px 16px;
  }
}

@media (max-width: 420px) {
  .brand {
    gap: 12px;
  }
  .brand h1 {
    font-size: 24px;
  }
  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }
  .join {
    padding: 14px;
  }
  .join-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

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

/* =========================================================
   Calls
   ========================================================= */
.secure-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 200, 87, 0.28);
  background: rgba(255, 200, 87, 0.08);
  color: #e8c98b;
  font-size: 12px;
  line-height: 1.55;
}
.secure-note a {
  color: #ffd77a;
  font-weight: 650;
  word-break: break-all;
}

.call-buttons {
  display: flex;
  align-items: center;
  gap: 2px;
}
.call-buttons[hidden] {
  display: none !important;
}

.avatar.xl {
  width: 96px;
  height: 96px;
  border-radius: 30px;
  font-size: 38px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* incoming call */
.incoming {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(4, 6, 11, 0.82);
  backdrop-filter: blur(16px);
  padding: 24px;
}
.incoming-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 44px 42px 30px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(26, 35, 50, 0.96), rgba(13, 18, 27, 0.98));
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
  max-width: 360px;
  width: 100%;
  overflow: hidden;
}
.incoming-card .avatar {
  position: relative;
  z-index: 2;
}
.ring-rings i {
  position: absolute;
  left: 50%;
  top: 92px;
  width: 96px;
  height: 96px;
  margin-left: -48px;
  border-radius: 50%;
  border: 2px solid rgba(91, 140, 255, 0.5);
  animation: ring-out 2.4s ease-out infinite;
}
.ring-rings i:nth-child(2) {
  animation-delay: 0.8s;
}
.ring-rings i:nth-child(3) {
  animation-delay: 1.6s;
}
@keyframes ring-out {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}
.incoming-card h3 {
  margin: 20px 0 0;
  font-size: 22px;
  letter-spacing: -0.4px;
  color: #fff;
}
.incoming-card p {
  margin: 0;
  color: #aab4c6;
  font-size: 14px;
}
.incoming-actions {
  display: flex;
  gap: 46px;
  margin: 26px 0 10px;
}
.call-round {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.call-round .icon {
  width: 26px;
  height: 26px;
  stroke-width: 2;
}
.call-round:hover {
  transform: translateY(-2px) scale(1.04);
}
.call-round.accept {
  background: linear-gradient(140deg, #35d98b, #1fa76a);
  box-shadow: 0 12px 30px rgba(53, 217, 139, 0.4);
}
.call-round.hangup {
  background: linear-gradient(140deg, #ff5d73, #d92a45);
  box-shadow: 0 12px 30px rgba(255, 93, 115, 0.4);
}
.incoming-hint {
  color: #7e8a9e;
  font-size: 11.5px;
}

/* active call */
.call-stage {
  position: fixed;
  inset: 0;
  z-index: 190;
  background:
    radial-gradient(900px 600px at 50% 0%, rgba(91, 140, 255, 0.16), transparent 70%),
    #05070c;
  color: #fff;
  overflow: hidden;
}
.remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05070c;
  opacity: 0;
  transition: opacity 0.3s;
}
.call-stage.has-video .remote-video {
  opacity: 1;
}
.call-stage.audio .remote-video {
  display: none;
}
.call-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 24px;
  z-index: 2;
  pointer-events: none;
}
.call-stage.has-video:not(.audio) .call-placeholder {
  opacity: 0;
  pointer-events: none;
}
.call-placeholder h2 {
  margin: 18px 0 0;
  font-size: 26px;
  letter-spacing: -0.5px;
}
.call-placeholder p {
  margin: 0;
  color: #9aa6ba;
  font-size: 14px;
}
.audio-bars {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  margin-top: 14px;
}
.audio-bars i {
  width: 4px;
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(180deg, #7ba2ff, #8b5cff);
  animation: eq 1.1s ease-in-out infinite;
}
.audio-bars i:nth-child(2) {
  animation-delay: 0.15s;
}
.audio-bars i:nth-child(3) {
  animation-delay: 0.3s;
}
.audio-bars i:nth-child(4) {
  animation-delay: 0.45s;
}
.audio-bars i:nth-child(5) {
  animation-delay: 0.6s;
}
@keyframes eq {
  0%,
  100% {
    height: 8px;
    opacity: 0.5;
  }
  50% {
    height: 28px;
    opacity: 1;
  }
}
.call-stage.speaking .audio-bars i {
  background: linear-gradient(180deg, #5eead4, #3ddc97);
}
.local-video {
  position: absolute;
  right: 22px;
  bottom: 108px;
  width: clamp(120px, 18vw, 190px);
  aspect-ratio: 3 / 4;
  border-radius: 16px;
  object-fit: cover;
  background: #0c111a;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  transform: scaleX(-1);
  z-index: 4;
}
.call-stage.audio .local-video,
.call-stage.cam-off .local-video {
  display: none;
}
.call-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px calc(18px + env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(3, 5, 9, 0.7), transparent);
  z-index: 5;
  font-size: 12.5px;
  font-weight: 600;
}
.call-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #dbe4f3;
}
.call-timer {
  font-variant-numeric: tabular-nums;
  color: #dbe4f3;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.call-remote-state {
  position: absolute;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 93, 115, 0.85);
  color: #fff;
  font-size: 11.5px;
  font-weight: 650;
}
.call-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 18px 22px calc(26px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(3, 5, 9, 0.85), transparent);
  z-index: 5;
}
.call-controls {
  display: flex;
  gap: 14px;
  align-items: center;
}
.call-ctl {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(14px);
  transition: transform 0.14s, background 0.14s;
}
.call-ctl:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}
.call-ctl .icon {
  width: 22px;
  height: 22px;
}
.call-ctl.off {
  background: rgba(255, 255, 255, 0.92);
  color: #101828;
}
.call-ctl.hangup {
  width: 62px;
  height: 62px;
  background: linear-gradient(140deg, #ff5d73, #d92a45);
  border-color: transparent;
  box-shadow: 0 14px 32px rgba(255, 93, 115, 0.42);
}
.call-ctl.hangup:hover {
  background: linear-gradient(140deg, #ff7184, #e02f4b);
}

/* call log cards in the message list */
.call-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  max-width: 350px;
}
.call-card .cc-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), rgba(160, 107, 255, 0.14));
  color: var(--accent);
  flex: none;
}
.call-card .cc-ico .icon {
  width: 18px;
  height: 18px;
}
.call-card .cc-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.35;
}
.call-card .cc-text strong {
  font-size: 13.5px;
  font-weight: 650;
}
.call-card .cc-text small {
  font-size: 11.5px;
  color: var(--muted-2);
}
.call-card .cc-status {
  margin-left: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: capitalize;
}
.call-card .cc-status.ended {
  color: var(--ok);
  background: rgba(61, 220, 151, 0.12);
}
.call-card .cc-status.missed,
.call-card .cc-status.declined {
  color: var(--danger);
  background: rgba(255, 107, 129, 0.12);
}

/* file drop overlay */
body.dragging::after {
  content: "Drop files to share";
  position: fixed;
  inset: 10px;
  z-index: 260;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(91, 140, 255, 0.8);
  border-radius: 22px;
  background: rgba(6, 9, 15, 0.72);
  backdrop-filter: blur(6px);
  color: #cfe0ff;
  font-size: 18px;
  font-weight: 700;
  pointer-events: none;
}

@media (max-width: 900px) {
  .conn span {
    display: none;
  }
  .conn {
    padding: 6px;
  }
  .call-buttons .icon-btn {
    width: 32px;
  }
  .incoming-card {
    padding: 38px 24px 26px;
  }
  .incoming-actions {
    gap: 36px;
  }
  .local-video {
    right: 12px;
    bottom: 96px;
    width: 108px;
    border-radius: 13px;
  }
  .call-ctl {
    width: 50px;
    height: 50px;
  }
  .call-ctl.hangup {
    width: 58px;
    height: 58px;
  }
  .call-topbar {
    padding: 14px 14px calc(14px + env(safe-area-inset-top));
  }
}

.icon-btn:disabled {
  opacity: 0.36;
  cursor: default;
}
.icon-btn:disabled:hover {
  background: none;
  color: var(--muted);
}

@media (hover: none) {
  .msg.own .msg-actions {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    top: 2px;
    right: 2px;
  }
  .msg.own .msg-actions button {
    width: 26px;
    height: 26px;
    background: var(--panel-3);
    border: 1px solid var(--line);
  }
}

.insecure-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 22px;
  background: rgba(255, 200, 87, 0.08);
  border-bottom: 1px solid rgba(255, 200, 87, 0.2);
  color: #e3c58c;
  font-size: 12px;
  flex: none;
}
.insecure-banner .icon {
  color: #ffc857;
}
.insecure-banner a {
  margin-left: auto;
  color: #ffd77a;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}
.insecure-banner a:hover {
  text-decoration: underline;
}
@media (max-width: 900px) {
  .insecure-banner {
    padding: 7px 12px;
    font-size: 11px;
  }
  .insecure-banner span {
    display: none;
  }
}

/* =========================================================
   Accounts, groups and invitations
   ========================================================= */
.auth-card {
  width: min(460px, 100%);
}
.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
}
.auth-tab {
  flex: 1;
  height: 38px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 650;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}
.auth-tab:hover {
  color: var(--text);
}
.auth-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
}
.hint {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted-2);
  letter-spacing: 0;
}

.group-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.group-actions[hidden] {
  display: none !important;
}

.side-me .icon-btn {
  width: 32px;
  height: 32px;
}
.side-me {
  gap: 6px;
}

.invite-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 4px 4px;
}
.invite {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.invite-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.invite-info strong {
  font-size: 12.5px;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-info small {
  font-size: 10.5px;
  color: var(--muted-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.invite-actions {
  display: flex;
  gap: 4px;
}
.invite-actions button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.invite-accept {
  background: rgba(61, 220, 151, 0.12);
  color: var(--ok);
}
.invite-decline {
  background: rgba(255, 107, 129, 0.1);
  color: var(--danger);
}
.invite-actions button:hover {
  filter: brightness(1.2);
}
.invite-actions .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.people-picker {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: var(--panel-2);
}
.person {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}
.person:hover {
  background: var(--panel-3);
}
.person input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: none;
}
.person-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.person-info strong {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-info small {
  font-size: 10.5px;
  color: var(--muted-2);
}
.picker-empty {
  margin: 0;
  padding: 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted-2);
}
.dialog {
  max-height: 88vh;
  overflow-y: auto;
}

.call-quality {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cfe0ff;
  font-size: 11.5px;
  font-weight: 600;
}
.call-quality i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3ddc97;
  box-shadow: 0 0 8px #3ddc97;
}
.call-quality[data-q="fair"] {
  color: #ffd77a;
}
.call-quality[data-q="fair"] i {
  background: #ffc857;
  box-shadow: 0 0 8px #ffc857;
}
.call-quality[data-q="poor"] {
  color: #ff9aa8;
}
.call-quality[data-q="poor"] i {
  background: #ff6b81;
  box-shadow: 0 0 8px #ff6b81;
}

@media (max-width: 900px) {
  .call-quality {
    font-size: 10.5px;
    padding: 4px 8px;
  }
  .call-quality span {
    display: none;
  }
  .side-me .icon-btn {
    width: 30px;
    height: 30px;
  }
}

/* =========================================================
   Device fit: notches, small phones, tablets
   ========================================================= */
button,
.person,
.room,
.user {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

@supports (padding: env(safe-area-inset-top)) {
  .chat-head {
    height: calc(66px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }
  .side-head {
    padding-top: calc(16px + env(safe-area-inset-top));
  }
  .side-me {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .join {
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .app {
    grid-template-columns: 262px minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  @supports (padding: env(safe-area-inset-top)) {
    .chat-head {
      height: calc(58px + env(safe-area-inset-top));
    }
  }
  .call-buttons .icon-btn,
  .group-actions .icon-btn {
    width: 32px;
    height: 32px;
  }
  .chat-title h2 {
    font-size: 15.5px;
  }
  .chat-title p {
    font-size: 11px;
  }
}

@media (max-width: 390px) {
  .chat-head {
    padding-left: 8px;
    padding-right: 8px;
    gap: 6px;
  }
  .chat-title h2 {
    font-size: 15px;
  }
  .messages {
    padding: 10px 8px 2px;
  }
  .msg {
    gap: 8px;
    padding: 6px 4px;
  }
  .msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 12px;
  }
  .msg-body {
    font-size: 14px;
  }
  .msg-name {
    font-size: 13px;
  }
  .composer {
    padding: 0 8px calc(8px + env(safe-area-inset-bottom));
  }
  .composer-inner {
    border-radius: 13px;
    padding: 4px 6px 4px 4px;
  }
  .composer-inner .icon-btn {
    width: 32px;
    height: 32px;
  }
  .send-btn {
    width: 38px;
    height: 38px;
  }
  #input {
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 8px 2px;
  }
  .side-me {
    padding-left: 10px;
    padding-right: 8px;
  }
  .side-me .icon-btn {
    width: 30px;
    height: 30px;
  }
  .me-info strong {
    font-size: 13px;
  }
  .auth-card {
    padding: 22px 18px 16px;
  }
  .brand {
    gap: 12px;
  }
  .brand h1 {
    font-size: 23px;
  }
  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }
  .join-form {
    gap: 12px;
  }
  .field input {
    height: 44px;
    font-size: 16px;
  }
  .auth-tabs {
    margin-bottom: 12px;
  }
  .incoming-actions {
    gap: 32px;
  }
  .call-round {
    width: 58px;
    height: 58px;
  }
  .call-controls {
    gap: 10px;
  }
  .call-ctl {
    width: 46px;
    height: 46px;
  }
  .call-ctl.hangup {
    width: 54px;
    height: 54px;
  }
  .local-video {
    width: 96px;
    bottom: 88px;
    right: 10px;
  }
}

@media (max-width: 900px) and (max-height: 680px) {
  .chat-head {
    height: calc(50px + env(safe-area-inset-top, 0px));
  }
  .side-head {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .composer-hint {
    display: none;
  }
  .messages {
    padding-top: 6px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .local-video {
    width: 90px;
    bottom: 84px;
  }
  .call-topbar {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .call-bar {
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .call-ctl {
    width: 44px;
    height: 44px;
  }
  .call-ctl.hangup {
    width: 52px;
    height: 52px;
  }
}

@media (min-width: 901px) {
  .only-mobile {
    display: none;
  }
}

/* =========================================================
   Profile and admin
   ========================================================= */
.avatar.lg {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  font-size: 26px;
}
.profile-dialog {
  width: min(470px, calc(100vw - 32px));
}
.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.profile-meta h3 {
  margin: 0 0 2px;
  font-size: 19px;
  letter-spacing: -0.3px;
}
.profile-meta p {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted-2);
}
.role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-3);
  border: 1px solid var(--line-2);
}
.role-badge.admin {
  color: #ffd77a;
  background: rgba(255, 200, 87, 0.12);
  border-color: rgba(255, 200, 87, 0.28);
}
.settings-block {
  margin: 16px 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 2px 12px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.settings-row:last-child {
  border-bottom: 0;
}
.settings-row strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.settings-row small {
  display: block;
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 1px;
}
.settings-row button {
  flex: none;
}

.admin-dialog {
  width: min(700px, calc(100vw - 24px));
  max-height: 90vh;
  overflow-y: auto;
}
.admin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.admin-head h3 {
  margin: 0 0 2px;
}
.admin-head p {
  margin: 0;
}
.admin-section {
  margin-top: 20px;
}
.admin-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-row {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  flex-wrap: wrap;
}
.admin-row input {
  flex: 1;
  min-width: 130px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 9px;
  font-size: 13px;
}
.admin-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.admin-row .admin-sub {
  width: 100%;
  font-size: 11px;
  color: var(--muted-2);
  padding-left: 2px;
}
.admin-row .admin-actions {
  display: flex;
  gap: 4px;
}
.admin-row button {
  height: 30px;
  padding: 0 9px;
  border-radius: 7px;
}
.admin-row .danger {
  color: var(--danger);
  border-color: rgba(255, 107, 129, 0.3);
  background: rgba(255, 107, 129, 0.08);
}
.admin-note {
  margin: 18px 0 0;
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.5;
}
.admin-empty {
  margin: 0;
  padding: 10px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}
@media (max-width: 520px) {
  .profile-head {
    gap: 11px;
  }
  .avatar.lg {
    width: 54px;
    height: 54px;
    font-size: 21px;
  }
  .admin-dialog,
  .profile-dialog {
    padding: 18px;
  }
}

.join-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
a.ghost {
  text-decoration: none;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

/* =========================================================
   Network status pill + network dialog
   ========================================================= */
.net-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
.net-pill:hover { color: var(--text); border-color: var(--line-2); }
.net-pill .net-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.net-pill.both .net-dot { background: var(--ok); box-shadow: 0 0 8px rgba(61,220,151,.6); }
.net-pill.lan .net-dot { background: #4dabf7; box-shadow: 0 0 8px rgba(77,171,247,.55); }
.net-pill.internet .net-dot { background: #b197fc; box-shadow: 0 0 8px rgba(177,151,252,.55); }
.net-pill.offline .net-dot { background: var(--danger); }
.net-pill.both { color: var(--ok); border-color: rgba(61,220,151,.28); }
.net-pill.lan { color: #4dabf7; border-color: rgba(77,171,247,.28); }
.net-pill.internet { color: #b197fc; border-color: rgba(177,151,252,.28); }
.net-pill.offline { color: var(--danger); border-color: rgba(255,107,129,.3); }

.net-dialog { width: min(520px, 94vw); }
.net-current {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; margin: 4px 0 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px; font-size: 13px; color: var(--muted);
}
.net-current strong { color: var(--text); }
.net-list { display: grid; gap: 8px; }
.net-row {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--panel-2);
}
.net-row.active { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.net-row strong { display: flex; align-items: center; gap: 7px; font-size: 13.5px; }
.net-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; word-break: break-all; }
.net-badge { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.net-badge.ok { color: var(--ok); background: rgba(61,220,151,.12); }
.net-badge.bad { color: var(--danger); background: rgba(255,107,129,.12); }
.net-row button { min-width: 64px; }

.select.small {
  height: 30px; border-radius: 8px; padding: 0 8px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
  font: inherit; font-size: 12px;
}

/* =========================================================
   Per-message translation
   ========================================================= */
.msg-translation {
  margin-top: 6px;
  padding: 7px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.45;
}
.msg-translation small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.msg-translation.loading { opacity: .65; font-style: italic; }
.msg-actions button[data-act="translate"]:hover { color: var(--accent); }

@media (hover: none) {
  .msg-actions { opacity: 1; transform: none; pointer-events: auto; top: 2px; }
}

/* =========================================================
   WhatsApp-style theme
   ========================================================= */
[data-theme="whatsapp"] {
  --bg: #efeae2;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --panel-3: #e9edef;
  --line: rgba(17, 27, 33, 0.08);
  --line-2: rgba(17, 27, 33, 0.14);
  --text: #111b21;
  --muted: #667781;
  --muted-2: #8696a0;
  --accent: #00a884;
  --accent-2: #25d366;
  --accent-soft: rgba(0, 168, 132, 0.12);
  --bubble: #ffffff;
  --bubble-2: #d9fdd3;
  --danger: #ea0038;
  --ok: #00a884;
  --shadow: 0 24px 70px rgba(11, 20, 26, 0.18);
  --shadow-sm: 0 8px 24px rgba(11, 20, 26, 0.12);
  color-scheme: light;
}
[data-theme="whatsapp"] body { background: #efeae2; }
[data-theme="whatsapp"] .app { background: #efeae2; }
[data-theme="whatsapp"] .sidebar {
  background: #ffffff;
  border-right: 1px solid rgba(17, 27, 33, 0.1);
}
[data-theme="whatsapp"] .side-head {
  background: #f0f2f5;
  border-bottom: 1px solid rgba(17, 27, 33, 0.08);
  min-height: 64px;
}
[data-theme="whatsapp"] .side-brand-text strong { color: #111b21; }
[data-theme="whatsapp"] .side-brand-text small { color: #667781; }
[data-theme="whatsapp"] .side-label { color: #667781; }
[data-theme="whatsapp"] .room { border-radius: 10px; }
[data-theme="whatsapp"] .room:hover { background: #f5f6f6; }
[data-theme="whatsapp"] .room.active { background: #f0f2f5; }
[data-theme="whatsapp"] .room.active::before { background: #00a884; }
[data-theme="whatsapp"] .room-name { color: #111b21; font-weight: 600; }
[data-theme="whatsapp"] .room-icon { color: #667781; }
[data-theme="whatsapp"] .side-me { background: #f0f2f5; border-top: 1px solid rgba(17,27,33,.08); }
[data-theme="whatsapp"] .side-me strong { color: #111b21; }
[data-theme="whatsapp"] .side-me small { color: #667781; }
[data-theme="whatsapp"] .chat {
  background:
    radial-gradient(circle at 18% 20%, rgba(255,255,255,.55), transparent 42%),
    radial-gradient(circle at 82% 70%, rgba(255,255,255,.4), transparent 45%),
    #efeae2;
}
[data-theme="whatsapp"] .chat-head {
  background: #f0f2f5;
  border-bottom: 1px solid rgba(17,27,33,.08);
  backdrop-filter: none;
}
[data-theme="whatsapp"] .chat-title h2 { color: #111b21; }
[data-theme="whatsapp"] .chat-title p { color: #667781; }
[data-theme="whatsapp"] .chat-head .icon-btn { color: #54656f; }
[data-theme="whatsapp"] .messages { background: transparent; }
[data-theme="whatsapp"] .msg { padding: 3px 18px; gap: 8px; border-radius: 0; }
[data-theme="whatsapp"] .msg:hover { background: transparent; }
[data-theme="whatsapp"] .msg.own { flex-direction: row-reverse; }
[data-theme="whatsapp"] .msg.own .msg-main { align-items: flex-end; }
[data-theme="whatsapp"] .msg-main { display: flex; flex-direction: column; align-items: flex-start; flex: 0 1 auto; max-width: min(78%, 620px); }
[data-theme="whatsapp"] .msg-avatar { width: 28px; height: 28px; border-radius: 50%; font-size: 12px; margin-top: 2px; }
[data-theme="whatsapp"] .msg-meta { padding: 0 4px 2px; gap: 6px; }
[data-theme="whatsapp"] .msg-name { color: #00a884; font-size: 12px; }
[data-theme="whatsapp"] .msg-time { color: #667781; font-size: 10px; }
[data-theme="whatsapp"] .msg-tag { display: none; }
[data-theme="whatsapp"] .msg-body {
  background: #ffffff;
  color: #111b21;
  padding: 7px 11px;
  border-radius: 10px;
  border-top-left-radius: 3px;
  box-shadow: 0 1px 1px rgba(11,20,26,.13);
  font-size: 14px;
  max-width: 100%;
  width: fit-content;
  word-break: break-word;
}
[data-theme="whatsapp"] .msg.own .msg-body {
  background: #d9fdd3;
  border-top-left-radius: 10px;
  border-top-right-radius: 3px;
}
[data-theme="whatsapp"] .msg.grouped .msg-meta { display: none; }
[data-theme="whatsapp"] .msg.grouped .msg-avatar { visibility: hidden; }
[data-theme="whatsapp"] .msg.grouped::before { display: none; }
[data-theme="whatsapp"] .msg-actions { top: -10px; right: 22px; background: #ffffff; border-color: rgba(17,27,33,.12); }
[data-theme="whatsapp"] .msg.own .msg-actions { right: auto; left: 22px; }
[data-theme="whatsapp"] .msg-translation { background: #f0f2f5; border-left-color: #00a884; color: #111b21; }
[data-theme="whatsapp"] .composer { padding: 6px 18px 12px; max-width: 100%; }
[data-theme="whatsapp"] .composer-inner {
  background: #ffffff;
  border: 0;
  border-radius: 24px;
  padding: 4px 6px 4px 10px;
  box-shadow: 0 1px 2px rgba(11,20,26,.18);
}
[data-theme="whatsapp"] .composer-inner:focus-within { border: 0; box-shadow: 0 1px 3px rgba(11,20,26,.25); }
[data-theme="whatsapp"] .send-btn {
  background: #00a884;
  color: #fff;
  border-radius: 50%;
  width: 40px;
  height: 40px;
}
[data-theme="whatsapp"] .send-btn:hover { background: #008f72; }
[data-theme="whatsapp"] .day-divider span { background: #ffffff; color: #667781; box-shadow: 0 1px 1px rgba(11,20,26,.12); }
[data-theme="whatsapp"] .system-line { color: #667781; }
[data-theme="whatsapp"] .composer-hint { color: #8696a0; }
[data-theme="whatsapp"] .net-pill { background: #ffffff; border-color: rgba(17,27,33,.12); }
[data-theme="whatsapp"] .net-dialog { background: #ffffff; color: #111b21; }
[data-theme="whatsapp"] .net-current, [data-theme="whatsapp"] .net-row { background: #f0f2f5; }
[data-theme="whatsapp"] .btn.primary {
  background: #00a884;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 168, 132, 0.28);
}
[data-theme="whatsapp"] .btn.primary:hover { background: #008f72; }
[data-theme="whatsapp"] .role-badge { background: #e7fce3; color: #008069; }

/* Media viewers */
.attach-video {
  max-width: min(420px, 100%);
  max-height: 360px;
  border-radius: 10px;
  background: #000;
}
.attach-audio {
  width: min(360px, 100%);
  height: 40px;
}

/* Bottom tabs (WhatsApp-style) */
.bottom-tabs {
  display: none;
  flex: none;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  gap: 2px;
}
.bottom-tabs button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 650;
  padding: 6px 2px;
  border-radius: 10px;
}
.bottom-tabs button .icon { width: 21px; height: 21px; }
.bottom-tabs button.active { color: var(--accent); background: var(--accent-soft); }
[data-theme="whatsapp"] .bottom-tabs { background: #ffffff; border-top-color: rgba(17,27,33,.08); }
[data-theme="whatsapp"] .bottom-tabs button.active { color: #00a884; background: #e7fce3; }

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    height: 100dvh;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: 100dvh;
    transform: none !important;
    box-shadow: none;
    z-index: 1;
    display: flex;
  }
  .sidebar .side-me { display: none; }
  .sidebar .bottom-tabs { display: flex; }
  .side-scroll { flex: 1; min-height: 0; }
  .scrim { display: none !important; }
  .chat { display: none; }
  body.mobile-chat-open .sidebar { display: none; }
  body.mobile-chat-open .chat { display: flex; }
  .chat-head .only-mobile { display: inline-flex; }
  .side-head { min-height: 58px; }
}
@media (max-width: 900px) {
  #closeSidebar { display: none; }
}
@media (max-width: 900px) {
  .toast-wrap { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* =========================================================
   Zchat v3 — corrections: chat list, calls, profiles, media,
   overflow menu, wallpaper, voice notes and group calls
   ========================================================= */

/* ---- chat header: clickable avatar / title + overflow menu ---- */
.room-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}
.room-avatar-btn .avatar { cursor: pointer; }
.chat-title { cursor: pointer; border-radius: 8px; padding: 2px 6px; margin-left: -6px; transition: background .14s; }
.chat-title:hover { background: var(--panel-2); }
.chat-head .group-actions { display: none !important; }

.chat-menu {
  position: absolute;
  top: 62px;
  right: 16px;
  z-index: 40;
  min-width: 230px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1px;
  animation: pop .14s ease both;
}
.chat-menu[hidden] { display: none !important; }
.chat-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: left;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text);
}
.chat-menu button:hover { background: var(--panel-3); }
.chat-menu button.danger { color: var(--danger); }
.chat-menu button .icon { color: var(--muted); }
.chat-menu button.danger .icon { color: var(--danger); }

/* ---- unified chat list: fixed time + badge columns ---- */
.side-label { gap: 8px; }
.chat-list { display: flex; flex-direction: column; gap: 2px; }
.chat-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 64px 34px;
  align-items: center;
  column-gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  text-align: left;
  color: var(--text);
  transition: background .14s;
}
.chat-row:hover { background: var(--panel-2); }
.chat-row.active { background: var(--accent-soft); }
.chat-row .chat-icon {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; flex: none;
  background: linear-gradient(140deg, var(--c, #5b8cff), color-mix(in srgb, var(--c, #5b8cff) 52%, #000));
  color: #fff; font-weight: 700; font-size: 14px;
}
.chat-row .chat-icon .icon { width: 17px; height: 17px; }
.chat-row .chat-body { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.chat-row .chat-name {
  font-size: 13.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-row .chat-preview {
  font-size: 11.5px; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-row .chat-time {
  width: 64px; min-width: 64px; max-width: 64px;
  text-align: right; justify-self: end;
  font-size: 10.5px; color: var(--muted-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  overflow: hidden;
}
.chat-row .chat-badges {
  width: 34px; min-width: 34px; max-width: 34px;
  display: flex; align-items: center; justify-content: flex-end; gap: 3px;
}
.chat-row .chat-badge {
  min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 10.5px; font-weight: 750;
  box-shadow: 0 2px 8px rgba(91, 140, 255, .45);
}
.chat-row .chat-mention {
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; display: grid; place-items: center;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800;
}
.chat-row .chat-badge.muted { background: var(--muted-2); box-shadow: none; }
.chat-list .chat-empty { padding: 10px 12px; font-size: 12px; color: var(--muted-2); }

/* ---- Calls tab ---- */
.calls-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 8px 8px; }
.calls-actions .ghost { flex: 1; justify-content: center; min-width: 96px; }
.calls-group-btn { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); color: var(--accent); }
.call-list { display: flex; flex-direction: column; gap: 2px; }
.call-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border-radius: 10px;
  text-align: left;
}
.call-row:hover { background: var(--panel-2); }
.call-row .call-ico {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--panel-2); color: var(--muted);
}
.call-row .call-ico.missed, .call-row .call-ico.declined { color: var(--danger); }
.call-row .call-ico.ok { color: var(--ok); }
.call-row .call-ico .icon { width: 15px; height: 15px; }
.call-row .call-body { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.call-row .call-body strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-row .call-body small { font-size: 11px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-row .call-when { font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.call-row .call-actions { display: flex; gap: 2px; grid-column: 2 / -1; }
.call-row .call-actions button { font-size: 11.5px; padding: 2px 8px; border-radius: 7px; color: var(--accent); background: var(--accent-soft); }
.call-empty { padding: 10px 12px; font-size: 12px; color: var(--muted-2); }

/* ---- v3 dialogs ---- */
.v3-dialog { width: min(520px, calc(100vw - 32px)); max-height: min(86vh, 780px); overflow-y: auto; }
.v3-dialog.media-hub, .v3-dialog.search-dialog { width: min(680px, calc(100vw - 32px)); }
.dialog.v3-dialog { padding: 20px; }
.pv-head { display: flex; align-items: center; gap: 14px; }
.pv-head .avatar.xl { width: 64px; height: 64px; border-radius: 18px; font-size: 24px; }
.pv-meta { flex: 1; min-width: 0; }
.pv-meta h3 { margin: 0; font-size: 19px; }
.pv-meta p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.pv-meta .pv-status { color: var(--muted-2); }
.pv-bio { margin: 12px 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.pv-bio:empty { display: none; }
.pv-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 4px; }
.pv-actions .ghost { font-size: 12px; }
.pv-section { margin-top: 16px; }
.pv-section h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); display: flex; align-items: center; gap: 8px; }
.pv-groups { display: flex; flex-direction: column; gap: 4px; }
.pv-groups .pv-group { font-size: 13px; color: var(--muted); padding: 6px 9px; border-radius: 8px; background: var(--panel-2); }
.member-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.member-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border-radius: 9px; text-align: left; }
.member-row:hover { background: var(--panel-2); }
.member-row .member-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.member-row .member-info strong { font-size: 13px; font-weight: 600; }
.member-row .member-info small { font-size: 11px; color: var(--muted-2); }
.member-row .role-tag { font-size: 10px; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; }

/* ---- media hub / profile media grid ---- */
.hub-tabs { display: flex; gap: 4px; padding: 4px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 12px; overflow-x: auto; }
.hub-tabs button { flex: 1; min-width: 62px; padding: 7px 10px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.hub-tabs button.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow-sm); }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.media-item {
  position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  background: var(--panel-2); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--muted-2); cursor: pointer; padding: 0;
}
.media-item img, .media-item video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-item .media-kind { position: absolute; inset: auto 0 0 0; padding: 3px 5px; font-size: 9.5px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.66)); text-align: left; }
.media-item .media-label { padding: 8px; font-size: 10.5px; text-align: center; overflow-wrap: anywhere; }
.media-item .icon { width: 22px; height: 22px; }
.media-item:hover { border-color: var(--accent); }
.hub-grid .media-item { aspect-ratio: 1; }
.media-empty { grid-column: 1 / -1; padding: 18px; text-align: center; color: var(--muted-2); font-size: 12.5px; }

/* ---- per-chat search ---- */
.search-results { display: flex; flex-direction: column; gap: 3px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.search-row { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 8px 10px; border-radius: 9px; text-align: left; }
.search-row:hover { background: var(--panel-2); }
.search-row strong { font-size: 12.5px; }
.search-row span { font-size: 11.5px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-row time { font-size: 10.5px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.search-row mark { background: var(--accent-soft); color: var(--accent); border-radius: 3px; }

/* ---- wallpaper ---- */
.wallpaper-preview {
  height: 150px; border-radius: 12px; border: 1px solid var(--line-2);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  padding: 12px; margin-bottom: 14px; background: var(--bg-2);
}
.wallpaper-preview span { display: block; height: 22px; border-radius: 9px; background: var(--bubble); width: 62%; }
.wallpaper-preview span:nth-child(2) { align-self: flex-end; background: var(--accent-soft); width: 48%; }
.wallpaper-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.wallpaper-swatch { width: 38px; height: 38px; border-radius: 10px; border: 2px solid transparent; }
.wallpaper-swatch[aria-checked="true"] { border-color: var(--text); box-shadow: 0 0 0 3px var(--accent-soft); }
.wallpaper-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ---- attach sheet ---- */
.attach-sheet {
  position: absolute; bottom: 92px; left: 20px; z-index: 30;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  width: min(340px, calc(100vw - 40px));
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 8px; box-shadow: var(--shadow);
  animation: pop .15s ease both;
}
.attach-sheet button { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 9px; font-size: 12.5px; font-weight: 550; text-align: left; color: var(--text); }
.attach-sheet button:hover { background: var(--panel-3); }
.attach-sheet button .icon { color: var(--accent); }

/* ---- voice recording bar ---- */
.recording {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 7px; padding: 8px 12px;
  background: var(--panel-2); border: 1px solid var(--danger);
  border-radius: 10px; font-size: 12.5px;
}
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; flex: none; }
.rec-time { font-family: var(--mono); font-variant-numeric: tabular-nums; color: var(--danger); font-weight: 700; }
.rec-hint { color: var(--muted); flex: 1; }
.recording .rec-send { height: 30px; padding: 0 12px; font-size: 12.5px; }

/* ---- received voice notes / attachments ---- */
.voice-note { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; padding: 9px 11px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); max-width: 340px; }
.voice-note .voice-head { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.voice-note .voice-head .icon { width: 15px; height: 15px; color: var(--accent); }
.voice-note audio { width: 100%; height: 34px; }
.voice-wave { display: flex; align-items: center; gap: 2px; height: 18px; }
.voice-wave i { width: 2.5px; border-radius: 2px; background: var(--accent); opacity: .75; }
.attach-audio { width: 100%; }
.attach-media { margin-top: 6px; }
.attach-media.video video { max-width: min(360px, 100%); max-height: 300px; border-radius: 12px; border: 1px solid var(--line); background: #000; }
.media-placeholder {
  display: flex; align-items: center; gap: 9px; margin-top: 6px; padding: 10px 12px;
  max-width: 330px; border-radius: 11px; border: 1px dashed var(--line-2);
  background: var(--panel-2); color: var(--muted); font-size: 12px;
}
.media-placeholder .icon { width: 16px; height: 16px; color: var(--muted-2); }
.media-placeholder.error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line-2)); color: var(--danger); }
.media-placeholder button { color: var(--accent); font-weight: 650; font-size: 12px; }
.media-unavailable { font-size: 12px; color: var(--danger); }
.viewonce-card {
  display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2);
  color: var(--text); font-size: 13px; cursor: pointer; max-width: 320px;
}
.viewonce-card:hover { border-color: var(--accent); }
.viewonce-card .icon { color: var(--accent); }
.viewonce-card small { color: var(--muted-2); font-size: 11px; }
.viewonce-card.consumed { opacity: .6; cursor: default; }
.msg.highlight { animation: v3flash 1.6s ease; }
@keyframes v3flash { 0%, 100% { background: transparent; } 20%, 60% { background: var(--accent-soft); } }

/* ---- lightbox media ---- */
.lightbox video { max-width: min(92vw, 1100px); max-height: 82vh; border-radius: 14px; background: #000; }
.lightbox-bar { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; color: #fff; font-size: 12.5px; background: rgba(8,12,20,.6); padding: 7px 14px; border-radius: 999px; max-width: 90vw; }
.lightbox-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox-bar a { color: #fff; text-decoration: none; }
.lightbox-circle { border-radius: 50%; }

/* ---- new-call / people picker ---- */
.pick-list { display: flex; flex-direction: column; gap: 3px; max-height: 340px; overflow-y: auto; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: 10px; }
.pick-row:hover { background: var(--panel-2); }
.pick-row .pick-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; text-align: left; }
.pick-row .pick-info strong { font-size: 13.5px; font-weight: 600; }
.pick-row .pick-info small { font-size: 11.5px; color: var(--muted-2); }
.pick-row .pick-actions { display: flex; gap: 4px; }
.pick-row .pick-actions button { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.pick-row .pick-actions button:hover { background: var(--panel-3); }
.pick-empty { padding: 16px; text-align: center; color: var(--muted-2); font-size: 12.5px; }

/* ---- ttl options ---- */
.ttl-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; margin: 14px 0; }
.ttl-options button { padding: 11px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; font-size: 13px; }
.ttl-options button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* ---- group call ---- */
.group-call {
  position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column;
  background: radial-gradient(900px 500px at 50% -10%, rgba(91,140,255,.16), transparent 60%), #070a0f;
  color: #eef2f8;
}
.gc-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; flex: none; }
.gc-title { font-weight: 700; font-size: 15px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gc-count { font-size: 12px; color: #8fa0b8; background: rgba(255,255,255,.08); padding: 3px 9px; border-radius: 999px; }
.gc-timer { font-family: var(--mono); font-size: 12.5px; color: #8fa0b8; font-variant-numeric: tabular-nums; }
.gc-grid { flex: 1; display: grid; gap: 8px; padding: 0 16px 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; min-height: 0; }
.gc-grid.solo { grid-template-columns: minmax(0, 1fr); }
.gc-grid.many { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gc-tile { position: relative; border-radius: 14px; overflow: hidden; background: #10151f; border: 1px solid rgba(255,255,255,.08); display: grid; place-items: center; min-height: 0; }
.gc-tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gc-tile .gc-avatar { width: 66px; height: 66px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; font-weight: 700; color: #fff; background: linear-gradient(140deg, var(--c, #5b8cff), color-mix(in srgb, var(--c, #5b8cff) 52%, #000)); }
.gc-tile .gc-name { position: absolute; left: 10px; bottom: 8px; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.5); }
.gc-tile .gc-badges { position: absolute; right: 8px; top: 8px; display: flex; gap: 4px; }
.gc-tile .gc-badge { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.55); color: #fff; }
.gc-tile .gc-badge .icon { width: 12px; height: 12px; }
.gc-bar { flex: none; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 20px calc(20px + env(safe-area-inset-bottom)); }
.gc-bar .call-ctl { background: rgba(255,255,255,.1); color: #fff; }
.gc-bar .call-ctl.off { background: #fff; color: #10151f; }
.gc-bar .call-ctl.hangup { background: var(--danger); color: #fff; }
.gc-invite {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 110; display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); width: min(420px, calc(100vw - 32px));
}
.gc-invite[hidden] { display: none !important; }
.gc-invite-info { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.gc-invite-info strong { font-size: 13.5px; }
.gc-invite-info small { font-size: 11.5px; color: var(--muted-2); }

/* ---- sidebar tab visibility (mobile) ---- */
@media (max-width: 900px) {
  #callsSection { display: block; }
  #chatListSection { display: block; }
  .chat-menu { position: fixed; top: 60px; right: 12px; }
  .attach-sheet { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .gc-invite { bottom: calc(90px + env(safe-area-inset-bottom)); }
  .gc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gc-grid.solo { grid-template-columns: minmax(0, 1fr); }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(74px, 1fr)); }
}
@media (min-width: 901px) {
  #callsSection { display: block; }
}
@media (max-width: 420px) {
  .chat-row { grid-template-columns: 38px minmax(0, 1fr) 56px 30px; column-gap: 7px; padding: 6px; }
  .chat-row .chat-time { width: 56px; min-width: 56px; max-width: 56px; font-size: 10px; }
  .chat-row .chat-badges { width: 30px; min-width: 30px; max-width: 30px; }
  .calls-actions .ghost { min-width: 0; }
}

/* ---- v3 message extras ---- */
.msg-quote {
  display: flex; flex-direction: column; gap: 1px; text-align: left;
  margin: 4px 0 2px; padding: 6px 9px; max-width: 420px;
  border-left: 3px solid var(--accent); border-radius: 6px;
  background: color-mix(in srgb, var(--panel-2) 82%, transparent);
  font-size: 12px; cursor: pointer;
}
.msg-quote strong { color: var(--accent); font-size: 11.5px; }
.msg-quote span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-ticks { font-size: 10.5px; letter-spacing: -1px; color: var(--muted-2); }
.msg-ticks.read { color: var(--accent); }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg-reaction { font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); }

/* ---- contacts rows with actions ---- */
.user { cursor: pointer; }
.user:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.user-actions { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity .14s; }
.user:hover .user-actions, .user:focus-within .user-actions { opacity: 1; }
.user-action { width: 27px; height: 27px; border-radius: 7px; color: var(--muted-2); }
.user-action:hover { background: var(--panel-3); color: var(--accent); }
.user-action .icon { width: 14px; height: 14px; }
@media (hover: none) {
  .user-actions { opacity: 1; }
}

/* ---- wallpaper-friendly conversation surface ---- */
#messages { transition: background-color .2s ease; }
[data-theme="light"] .media-placeholder { background: var(--panel-2); }
