* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0e1117;
  --bg2: #161b26;
  --bg3: #1f2635;
  --border: #2a3245;
  --text: #e8ecf4;
  --muted: #8b94a7;
  --accent: #6c5ce7;
  --accent2: #8e7cf3;
  --bubble-me: #4d3fd6;
  --bubble-them: #232b3d;
  --danger: #ff6b6b;
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }
input { font-family: inherit; }

/* ---------- Auth ---------- */
.auth-screen {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at top, #1b1440 0%, var(--bg) 60%);
}
.auth-card {
  width: 340px; padding: 36px 32px; background: var(--bg2);
  border: 1px solid var(--border); border-radius: 20px; text-align: center;
}
.logo {
  font-size: 34px; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent2), #52d0ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.logo.big { font-size: 56px; }
.tagline { color: var(--muted); margin: 6px 0 22px; font-size: 14px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tabs button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 14px;
}
.auth-tabs button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
#auth-form, #phone-form { display: flex; flex-direction: column; gap: 10px; }
#auth-form input, #phone-form input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 14px; outline: none;
}
#auth-form input:focus, #phone-form input:focus { border-color: var(--accent); }
#auth-form button[type=submit], #phone-form button[type=submit] {
  padding: 12px; border: none; border-radius: 10px; margin-top: 4px;
  background: linear-gradient(135deg, var(--accent), #5a4bd1);
  color: #fff; font-size: 15px; font-weight: 600;
}
.error { color: var(--danger); font-size: 13px; min-height: 16px; }

/* ---------- Layout ---------- */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 320px; min-width: 260px; background: var(--bg2);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Sidebar ---------- */
.sidebar-header {
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.me { display: flex; align-items: center; gap: 10px; }
.me-name { font-weight: 600; font-size: 14px; }
.me-username { color: var(--muted); font-size: 12px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #52d0ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; position: relative;
}
.avatar .dot {
  position: absolute; bottom: 0; right: 0; width: 11px; height: 11px;
  border-radius: 50%; background: #4cd964; border: 2px solid var(--bg2);
}
.icon-btn {
  background: transparent; border: none; color: var(--muted); font-size: 14px;
  padding: 7px 9px; border-radius: 9px;
  display: inline-flex; align-items: center; gap: 6px; vertical-align: middle;
}
.icon-btn:hover { background: var(--bg3); color: var(--text); }
.icon-btn.send { color: var(--accent2); }
.icon-btn.active { color: var(--accent2); }
.icon-btn.danger { color: var(--danger); }
.ic { width: 19px; height: 19px; display: block; flex-shrink: 0; }
.ic.xs { width: 12px; height: 12px; display: inline-block; vertical-align: -2px; }
.ic.sm { width: 15px; height: 15px; display: inline-block; vertical-align: -3px; }
.search-row { display: flex; gap: 6px; padding: 10px 12px; }
.search-row input {
  flex: 1; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 13px; outline: none;
}
.search-results { border-bottom: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.search-results .item, .chat-list .item {
  display: flex; gap: 11px; align-items: center; padding: 11px 14px; cursor: pointer;
}
.search-results .item:hover, .chat-list .item:hover { background: var(--bg3); }
.chat-list { flex: 1; overflow-y: auto; }
.chat-list .item.active { background: var(--bg3); }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; }
.item-title .time { color: var(--muted); font-weight: 400; font-size: 11px; }
.item-sub {
  color: var(--muted); font-size: 12.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; margin-top: 2px;
  display: flex; justify-content: space-between; gap: 8px;
}
.unread {
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; padding: 1px 7px; flex-shrink: 0;
}

/* ---------- Chat view ---------- */
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; color: var(--muted);
}
.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header {
  display: flex; align-items: center; gap: 12px; padding: 11px 18px;
  border-bottom: 1px solid var(--border); background: var(--bg2);
}
.chat-header-info { flex: 1; min-width: 0; }
#chat-title, #chat-subtitle { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-title { font-weight: 700; font-size: 15px; }
#chat-subtitle { color: var(--muted); font-size: 12px; }
.banner {
  padding: 10px 18px; background: var(--bg3); border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text); white-space: pre-wrap; max-height: 200px; overflow-y: auto;
}
.messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 4px; }

.msg { display: flex; margin-top: 8px; max-width: 72%; }
.msg.me { align-self: flex-end; }
.msg .bubble {
  background: var(--bubble-them); border-radius: 16px 16px 16px 5px;
  padding: 8px 12px; font-size: 14px; line-height: 1.45; position: relative;
  word-break: break-word;
}
.msg.me .bubble { background: var(--bubble-me); border-radius: 16px 16px 5px 16px; }
.msg .sender { font-size: 12px; font-weight: 700; color: var(--accent2); margin-bottom: 2px; }
.msg .meta { font-size: 10.5px; color: rgba(255,255,255,.45); margin-top: 3px; text-align: right; }
.msg .reply-quote {
  border-left: 3px solid var(--accent2); background: rgba(0,0,0,.22);
  border-radius: 7px; padding: 5px 9px; font-size: 12.5px; margin-bottom: 5px;
  color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; max-width: 320px;
}
.msg .reply-quote b { color: var(--accent2); display: block; font-size: 11.5px; }
.msg .reactions { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.msg .reactions span {
  background: rgba(0,0,0,.3); border-radius: 10px; padding: 2px 7px;
  font-size: 12px; cursor: pointer;
}
.msg .actions {
  display: none; position: absolute; top: -14px; right: 6px; gap: 2px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 9px; padding: 2px;
}
.msg .bubble:hover .actions { display: flex; }
.msg .actions button {
  background: none; border: none; color: var(--muted);
  padding: 4px 6px; border-radius: 6px; display: inline-flex;
}
.msg .actions button .ic { width: 14px; height: 14px; }
.msg .actions button:hover { background: var(--bg2); color: var(--text); }
.msg.deleted .bubble { font-style: italic; color: var(--muted); background: transparent; border: 1px dashed var(--border); }
.msg img.media { max-width: 300px; border-radius: 10px; display: block; margin-bottom: 4px; }
.msg a.doc { color: #7fd0ff; }
.pin-flag { font-size: 11px; }

/* ---------- Header dropdown menu ---------- */
.menu-wrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
  padding: 6px; min-width: 210px; box-shadow: 0 12px 30px rgba(0,0,0,.45);
  display: flex; flex-direction: column; gap: 1px;
}
.dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: var(--text); font-size: 13.5px;
  padding: 9px 10px; border-radius: 8px;
}
.dropdown button:hover { background: var(--bg3); }
.dropdown button.active { color: var(--accent2); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 2px; }

/* ---------- Rich-share popup ---------- */
.share-menu {
  position: fixed; z-index: 40; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 1px;
  box-shadow: 0 12px 30px rgba(0,0,0,.45); min-width: 170px;
}
.share-menu button {
  display: flex; align-items: center; gap: 10px; background: none; border: none;
  color: var(--text); font-size: 13.5px; padding: 9px 10px; border-radius: 8px; text-align: left;
}
.share-menu button:hover { background: var(--bg3); }

/* ---------- Sticker / GIF picker ---------- */
.modal.picker { width: 320px; }
.picker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 240px; overflow-y: auto; }
.picker-grid button {
  font-size: 30px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 10px; padding: 6px; cursor: pointer; line-height: 1;
}
.picker-grid button:hover { border-color: var(--accent2); }
#gif-url { width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 14px; outline: none; }

/* ---------- Location / contact / sticker message bubbles ---------- */
.loc-card {
  display: block; border-radius: 10px; overflow: hidden; max-width: 260px;
  border: 1px solid var(--border); text-decoration: none; color: inherit;
}
.loc-card .loc-map { height: 120px; background: #1b2436 center/cover; display: flex;
  align-items: center; justify-content: center; color: var(--accent2); }
.loc-card .loc-label { padding: 8px 10px; font-size: 13px; }
.contact-card {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--border); min-width: 200px;
}
.contact-card .c-info { flex: 1; min-width: 0; }
.contact-card .c-name { font-weight: 600; font-size: 13.5px; }
.contact-card .c-user { color: var(--muted); font-size: 12px; }
.contact-card button {
  background: var(--accent); border: none; color: #fff; border-radius: 8px;
  padding: 5px 10px; font-size: 12px;
}
.msg .sticker-media { font-size: 64px; line-height: 1; }
.msg img.gif-media { max-width: 240px; border-radius: 10px; display: block; }

/* ---------- Status / Stories ---------- */
.status-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55;
  display: flex; justify-content: flex-end;
}
.status-panel {
  width: 360px; max-width: 90vw; background: var(--bg2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; height: 100%;
}
.status-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.status-panel-head h3 { font-size: 17px; }
.status-add {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; width: 100%;
  background: none; border: none; border-bottom: 1px solid var(--border); color: var(--text);
  font-size: 14px; cursor: pointer;
}
.status-add:hover { background: var(--bg3); }
.status-add-ring {
  width: 46px; height: 46px; border-radius: 50%; border: 2px dashed var(--accent2);
  display: flex; align-items: center; justify-content: center; color: var(--accent2);
}
.status-list { flex: 1; overflow-y: auto; }
.status-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; cursor: pointer;
}
.status-row:hover { background: var(--bg3); }
.status-ring {
  width: 46px; height: 46px; border-radius: 50%; padding: 2px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent2), #52d0ff);
}
.status-ring.seen { background: var(--border); }
.status-ring .avatar { width: 100%; height: 100%; border: 2px solid var(--bg2); }
.status-row-info { flex: 1; min-width: 0; }
.status-row-name { font-weight: 600; font-size: 14px; }
.status-row-sub { color: var(--muted); font-size: 12px; }
.status-row-views { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 4px; }

.status-view {
  position: fixed; inset: 0; background: #05070c; z-index: 60;
  display: flex; flex-direction: column;
}
.status-view-bar { height: 3px; background: rgba(255,255,255,.2); margin: 10px 14px 0; border-radius: 2px; overflow: hidden; }
#status-view-progress { height: 100%; width: 0; background: #fff; }
.status-view-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
#status-view-name { font-weight: 600; font-size: 14px; }
.status-view-time { color: var(--muted); font-size: 12px; }
.status-view-head button { margin-left: auto; }
.status-view-body {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px;
  text-align: center; font-size: 24px; overflow: hidden;
}
.status-view-body img, .status-view-body video { max-width: 100%; max-height: 100%; border-radius: 10px; }
.status-view-footer { padding: 14px 18px; color: var(--muted); font-size: 13px; text-align: center; }

/* Full-screen status composer (WhatsApp/Instagram-style) */
.status-compose {
  position: fixed; inset: 0; background: #05070c; z-index: 70;
  display: flex; flex-direction: column;
}
.status-compose.hidden { display: none; }
.status-compose-head {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; color: #fff;
}
.status-compose-head > span { font-weight: 600; font-size: 15px; }
.status-compose-head .icon-btn { color: #fff; }
.scomp-post {
  margin-left: auto; background: var(--accent2); color: #fff; border: none;
  padding: 8px 20px; border-radius: 20px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.scomp-post:disabled { opacity: .6; cursor: default; }
.status-preview {
  flex: 1; position: relative; display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin: 0 12px; border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #1b2233, #0b0f17);
}
.status-preview-empty { display: flex; gap: 40px; }
.scomp-src {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: none; border: none; color: #fff; font-size: 13px; cursor: pointer;
}
.scomp-ring {
  width: 74px; height: 74px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent2), #52d0ff);
  display: flex; align-items: center; justify-content: center;
}
.scomp-ring .ic { width: 30px; height: 30px; color: #fff; }
.scomp-src:hover .scomp-ring { filter: brightness(1.1); }
.status-preview-media { max-width: 100%; max-height: 100%; object-fit: contain; }
.status-preview-change {
  position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0,0,0,.55); border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.status-preview.text-only { background: linear-gradient(135deg, #12b886, #0ca678); }
.status-text-card {
  color: #fff; font-size: 26px; font-weight: 600; text-align: center; padding: 24px;
  word-break: break-word; white-space: pre-wrap; max-height: 100%; overflow-y: auto;
}
.status-compose-foot { padding: 14px 16px 20px; }
#status-text {
  width: 100%; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
  color: #fff; padding: 13px 16px; border-radius: 24px; font-size: 15px; outline: none;
}
#status-text::placeholder { color: rgba(255,255,255,.5); }
#status-compose-error { color: #ff6b6b; font-size: 13px; text-align: center; padding: 0 16px 8px; }
.settings-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-tools button {
  flex: 1; min-width: 130px; padding: 9px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 12.5px;
}
.settings-tools button:hover { border-color: var(--accent2); }
textarea#status-text {
  padding: 11px 13px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 14px; outline: none; resize: vertical;
  font-family: inherit;
}

/* status strip in sidebar */
.status-strip {
  display: flex; gap: 12px; padding: 12px 14px; overflow-x: auto; border-bottom: 1px solid var(--border);
}
.status-strip::-webkit-scrollbar { height: 0; }
.status-strip-item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; flex-shrink: 0; width: 56px; }
.status-strip-item .status-ring { width: 50px; height: 50px; }
.status-strip-item span { font-size: 11px; color: var(--muted); max-width: 56px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Avatars, chat item actions, archived, forwarded ---------- */
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.item { position: relative; }
.item-actions {
  display: none; position: absolute; right: 8px; top: 8px; gap: 2px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px; padding: 2px;
}
.item:hover .item-actions { display: flex; }
.item-actions button {
  background: none; border: none; color: var(--muted); padding: 4px 6px; border-radius: 6px;
  display: inline-flex;
}
.item-actions button:hover { background: var(--bg3); color: var(--text); }
.archived-header {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  color: var(--muted); font-size: 13px; cursor: pointer; border-top: 1px solid var(--border);
}
.archived-header:hover { color: var(--text); }
.fwd-label {
  display: flex; align-items: center; gap: 4px; font-size: 11.5px; font-style: italic;
  color: rgba(255,255,255,.55); margin-bottom: 3px;
}

/* ---------- Read ticks & blocked chips ---------- */
.ticks { color: rgba(255,255,255,.5); }
.ticks.read { color: #6fd3ff; }
.blocked-list { display: flex; flex-wrap: wrap; gap: 6px; }
.block-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 14px;
  color: var(--text); padding: 4px 10px; font-size: 12.5px;
}
.block-chip:hover { border-color: var(--danger); color: var(--danger); }

/* ---------- Polls ---------- */
.poll { min-width: 240px; }
.poll-q { font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.poll-opt {
  position: relative; display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; margin: 4px 0; border-radius: 9px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.14); overflow: hidden;
}
.poll-opt:hover { border-color: var(--accent2); }
.poll-opt.mine { border-color: var(--accent2); }
.poll-opt.mine .poll-label::after { content: ' ✓'; color: var(--accent2); }
.poll-bar {
  position: absolute; inset: 0 auto 0 0; background: rgba(255,255,255,.12);
  border-radius: 8px; transition: width .3s;
}
.poll-label, .poll-count { position: relative; z-index: 1; font-size: 13.5px; }
.poll-count { color: rgba(255,255,255,.6); font-size: 12px; margin-left: 10px; }
.poll-total { color: rgba(255,255,255,.5); font-size: 11.5px; margin-top: 5px; }

/* ---------- Link previews ---------- */
.preview-card {
  display: block; margin-top: 6px; border-radius: 10px; overflow: hidden;
  background: rgba(0,0,0,.25); border-left: 3px solid var(--accent2);
  text-decoration: none; color: inherit; max-width: 320px;
}
.preview-card img { width: 100%; max-height: 150px; object-fit: cover; display: block; }
.preview-body { padding: 8px 10px; }
.preview-title { font-weight: 600; font-size: 13px; }
.preview-desc { color: rgba(255,255,255,.65); font-size: 12px; margin-top: 2px; }
.preview-site { color: var(--accent2); font-size: 11px; margin-top: 4px; }

.typing { min-height: 20px; padding: 0 20px 2px; color: var(--muted); font-size: 12.5px; font-style: italic; }
.reply-bar {
  display: flex; align-items: center; padding: 7px 16px; gap: 10px;
  background: var(--bg3); border-top: 1px solid var(--border); font-size: 13px; color: var(--muted);
}
#reply-preview { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.composer {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  border-top: 1px solid var(--border); background: var(--bg2);
}
.composer input#msg-input {
  flex: 1; padding: 12px 16px; border-radius: 22px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 14px; outline: none;
}
.composer input#msg-input:focus { border-color: var(--accent); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  width: 360px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 14px;
}
.modal h3 { font-size: 17px; }
.modal label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; }
.modal label input:not([type=checkbox]) {
  padding: 10px 12px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 14px; outline: none;
}
.modal label.toggle { flex-direction: row; align-items: center; gap: 9px; color: var(--text); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.modal-actions button {
  padding: 9px 18px; border-radius: 9px; border: 1px solid var(--border);
  background: transparent; color: var(--text); font-size: 14px;
}
.modal-actions button.primary { background: var(--accent); border-color: var(--accent); }

/* ---------- Voice recording ---------- */
#btn-mic.recording { color: #ff5c5c; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* ---------- Calls ---------- */
.call-overlay {
  position: fixed; inset: 0; background: #0a0d13; z-index: 60;
  display: flex; flex-direction: column;
}
.call-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
}
.call-header #btn-hangup { color: #ff5c5c; font-size: 14px; }
.call-grid {
  flex: 1; display: grid; gap: 10px; padding: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-content: center;
}
.call-tile {
  background: var(--bg3); border-radius: 14px; overflow: hidden; position: relative;
  aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center;
}
.call-tile video { width: 100%; height: 100%; object-fit: cover; }
.call-tile .name {
  position: absolute; bottom: 8px; left: 10px; font-size: 13px;
  background: rgba(0,0,0,.55); padding: 2px 9px; border-radius: 8px;
}
.call-controls {
  display: flex; gap: 10px; justify-content: center; padding: 16px;
  border-top: 1px solid var(--border);
}
.call-btn {
  padding: 11px 18px; border-radius: 24px; border: 1px solid var(--border);
  background: var(--bg3); color: var(--text); font-size: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.call-btn .ic { width: 17px; height: 17px; }
.call-btn.off { background: #4a2733; border-color: #6b3345; color: #ffb3c0; }

/* Back button only appears on mobile */
.mobile-back { display: none; }

@media (max-width: 720px) {
  /* Single-pane: the chat list fills the screen; opening a chat swaps to it. */
  .sidebar { width: 100%; min-width: 0; border-right: none; }
  .main { display: none; }
  .app.chat-open .sidebar { display: none; }
  .app.chat-open .main { display: flex; }
  .mobile-back { display: inline-flex; margin-right: 2px; }

  .msg { max-width: 85%; }
  .chat-header { padding: 10px 12px; gap: 8px; }
  #chat-title { font-size: 15px; }
  .dropdown { min-width: 200px; }
  /* Roomier tap targets */
  .chat-list .item, .search-results .item { padding: 13px 14px; }
  .composer { padding: 9px 10px; gap: 4px; }
  .composer .icon-btn { padding: 8px; }
  .status-panel { width: 100%; max-width: 100%; }
  .modal { width: 92vw; max-width: 360px; }
}
