:root {
  --ink: #1b1f23;
  --paper: #f6f4ef;
  --panel: #ffffff;
  --line: #e4e0d6;
  --accent: #2f5d50;
  --accent-soft: #dfe9e4;
  --bubble-me: #2f5d50;
  --bubble-them: #ffffff;
  --muted: #7a7568;
  --danger: #b3492f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }

.hidden { display: none !important; }

/* ---------- Auth ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 40px; width: 360px; box-shadow: 0 20px 40px rgba(27,31,35,0.06); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 22px; font-weight: 700; }
.brand-mark { color: var(--accent); font-size: 22px; }
.brand-tag { color: var(--muted); font-size: 13px; margin: 8px 0 24px; }
.tabs { display: flex; gap: 4px; background: var(--accent-soft); border-radius: 10px; padding: 4px; margin-bottom: 20px; }
.tab { flex: 1; border: none; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--muted); }
.tab.active { background: var(--panel); color: var(--ink); }
.auth-form label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.auth-form input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; background: var(--paper); }
.primary-btn { margin-top: 20px; width: 100%; background: var(--accent); color: white; border: none; padding: 11px; border-radius: 8px; font-weight: 600; cursor: pointer; }
.primary-btn:hover { opacity: 0.92; }
.ghost-btn { background: transparent; border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; cursor: pointer; }
.auth-error { color: var(--danger); font-size: 13px; margin-top: 14px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; height: 100vh; }
.sidebar { width: 320px; border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); font-size: 16px; }
.sidebar-actions button, .sidebar-actions .icon-link { border: none; background: var(--accent-soft); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; margin-left: 6px; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--ink); }
.conversation-list { overflow-y: auto; flex: 1; }
.conv-item { display: flex; gap: 10px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--line); }
.conv-item:hover, .conv-item.active { background: var(--accent-soft); }
.conv-meta { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; font-size: 14px; }
.conv-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chat-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 12px; }
.empty-state .brand-mark { font-size: 40px; }

.chat-view { display: flex; flex-direction: column; height: 100%; }
.chat-header { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.chat-header-meta { flex: 1; min-width: 0; }
.peer-name { font-weight: 700; }
.peer-status { font-size: 12px; color: var(--muted); }
.peer-status.online { color: var(--accent); font-weight: 600; }
.header-btn { width: 32px; height: 32px; border-radius: 8px; font-size: 15px; padding: 0; }

.messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 8px; background: repeating-linear-gradient(135deg, var(--paper), var(--paper) 24px, #f1eee6 24px, #f1eee6 48px); }
.bubble { max-width: 60%; padding: 9px 12px; border-radius: 14px; font-size: 14px; line-height: 1.4; position: relative; }
.bubble.me { align-self: flex-end; background: var(--bubble-me); color: white; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: var(--bubble-them); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble .time { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; opacity: 0.75; margin-top: 4px; }
.bubble img, .bubble video { max-width: 220px; border-radius: 8px; display: block; margin-bottom: 4px; }
.bubble.deleted { font-style: italic; opacity: 0.65; }
.bubble.deleted.them { background: var(--bubble-them); }
.bubble { cursor: pointer; }
.delete-actions { flex-direction: column; align-items: stretch; gap: 8px; }
.delete-actions button { width: 100%; text-align: center; }
.ticks { letter-spacing: -2px; font-size: 12px; }
.ticks.read { color: #6fc7ff; opacity: 1; }

.modal-card.wide { width: 400px; max-height: 80vh; display: flex; flex-direction: column; }
.rename-row { display: flex; gap: 8px; margin-top: 12px; }
.rename-row input { flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.member-list { margin-top: 16px; overflow-y: auto; flex: 1; border-top: 1px solid var(--line); }
.member-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-info { flex: 1; min-width: 0; }
.member-name { font-weight: 600; font-size: 14px; }
.member-phone { font-size: 12px; color: var(--muted); }
.admin-badge { font-size: 10px; background: var(--accent-soft); color: var(--accent); padding: 2px 7px; border-radius: 10px; font-weight: 700; margin-left: 6px; }
.member-actions { display: flex; gap: 6px; }
.member-actions button { border: none; background: var(--accent-soft); border-radius: 6px; padding: 5px 8px; font-size: 11px; cursor: pointer; }
.ghost-btn.danger { border-color: var(--danger); color: var(--danger); }

/* ---------- Status / Stories ---------- */
.status-bar { display: flex; gap: 14px; padding: 12px 16px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.status-item { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; flex-shrink: 0; width: 56px; }
.status-ring { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2.5px solid var(--accent-soft); position: relative; }
.status-ring.unseen { border-color: var(--accent); }
.status-ring.subscribed { border-color: #d9b64a; }
.status-ring .avatar { width: 42px; height: 42px; font-size: 18px; }
.status-ring .plus-badge { position: absolute; bottom: -2px; right: -2px; width: 16px; height: 16px; background: var(--accent); color: white; border-radius: 50%; font-size: 11px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--panel); }
.status-item-label { font-size: 10px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56px; }

.status-textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); font-size: 15px; resize: none; margin-top: 8px; font-family: inherit; }
.status-swatches { display: flex; gap: 8px; margin-top: 10px; }
.status-swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; }
.status-swatch.selected { border-color: var(--ink); }
#statusImageArea label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
#statusImageArea input[type=text] { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }

.status-viewer { position: fixed; inset: 0; background: #111; z-index: 100; display: flex; flex-direction: column; }
.status-bars { display: flex; gap: 4px; padding: 8px 10px 0; }
.status-bar-track { flex: 1; height: 3px; background: rgba(255,255,255,0.3); border-radius: 2px; overflow: hidden; }
.status-bar-fill { height: 100%; width: 0%; background: white; }
.status-bar-fill.filled { width: 100%; }
.status-viewer-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: white; }
.status-viewer-meta { flex: 1; }
.status-viewer-meta .peer-name { color: white; }
.status-viewer-meta .peer-status { color: rgba(255,255,255,0.7); }
.status-viewer-header .header-btn { background: rgba(255,255,255,0.15); color: white; }
.status-viewer-content { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; color: white; text-align: center; font-size: 22px; font-weight: 600; padding: 30px; word-break: break-word; }
.status-viewer-content img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.status-nav-zone { position: absolute; top: 60px; bottom: 60px; width: 35%; }
.status-nav-zone.left { left: 0; }
.status-nav-zone.right { right: 0; }
.status-viewers-footer { padding: 14px 16px; color: white; max-height: 30vh; overflow-y: auto; }
.status-viewers-footer .viewer-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }

.connection-banner { padding: 8px 16px; font-size: 12px; text-align: center; background: #fdf1e7; color: var(--danger); border-top: 1px solid var(--line); }
.connection-banner.connecting { background: var(--accent-soft); color: var(--muted); }

.upload-progress { position: fixed; bottom: 0; left: 0; right: 0; z-index: 200; height: 42px; background: var(--panel); border-top: 2px solid var(--accent); overflow: hidden; display: flex; align-items: center; box-shadow: 0 -4px 16px rgba(0,0,0,0.12); }
.upload-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); opacity: 0.18; transition: width 0.2s ease; width: 0%; }
.upload-progress-label { position: relative; font-size: 13px; padding: 0 16px; color: var(--accent); font-weight: 700; letter-spacing: 0.01em; }

.attach-preview { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.attach-preview-thumb { width: 42px; height: 42px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.attach-preview-thumb img, .attach-preview-thumb video { width: 100%; height: 100%; object-fit: cover; }
.attach-preview-name { flex: 1; font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-preview-cancel { border: none; background: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 6px; line-height: 1; }
.attach-preview-cancel:hover { color: var(--danger); }

.typing-indicator { padding: 4px 14px; font-size: 12px; color: var(--muted); font-style: italic; }

.install-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 300; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--accent); color: #fff; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,0.15); }
.install-banner span { flex: 1; }
.install-banner .primary-btn { background: #fff; color: var(--accent); padding: 6px 16px; font-size: 13px; width: auto; }
.install-dismiss { border: none; background: none; color: #fff; opacity: 0.8; font-size: 16px; cursor: pointer; padding: 4px 6px; line-height: 1; }
.install-dismiss:hover { opacity: 1; }

.call-overlay { position: fixed; inset: 0; z-index: 500; background: #1a1a1a; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.call-overlay.hidden { display: none; }
.remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #111; }
.remote-video.hidden { display: none; }
.local-video { position: absolute; bottom: 120px; right: 16px; width: 100px; height: 140px; border-radius: 12px; object-fit: cover; background: #333; border: 2px solid rgba(255,255,255,0.3); z-index: 2; }
.local-video.hidden { display: none; }
.call-info { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 0 20px; }
.call-avatar { width: 96px; height: 96px; font-size: 44px; background: var(--accent-soft); }
.call-peer-name { font-size: 22px; font-weight: 700; }
.call-status { font-size: 14px; opacity: 0.8; }
.call-controls { position: absolute; bottom: 40px; left: 0; right: 0; display: flex; justify-content: center; gap: 24px; z-index: 2; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: none; font-size: 24px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.call-btn.hidden { display: none; }
.call-btn-red { background: #e0453f; color: #fff; }
.call-btn-green { background: #34a853; color: #fff; }
.call-btn-grey { background: rgba(255,255,255,0.2); color: #fff; }
.call-btn-grey.active { background: rgba(255,255,255,0.5); }

.file-attachment { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; background: rgba(0,0,0,0.07); border-radius: 8px; }
.file-attachment-name { font-size: 13px; word-break: break-all; }
.file-attachment-actions { display: flex; gap: 8px; }
.file-action-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; background: rgba(0,0,0,0.12); border-radius: 14px; text-decoration: none; color: inherit; font-size: 12px; font-weight: 600; }
.file-action-btn:hover { background: rgba(0,0,0,0.2); }
.attachment-preview { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 13px; background: var(--accent-soft); border-top: 1px solid var(--line); }
.attachment-preview button { border: none; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted); }

.ad-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fbf6e8; border-bottom: 1px solid var(--line); font-size: 13px; }
.ad-banner .ad-badge { font-size: 9px; font-weight: 800; letter-spacing: 0.5px; color: #8c6b00; background: #f1e0a3; padding: 2px 6px; border-radius: 4px; flex-shrink: 0; }
.ad-banner .ad-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-banner a { color: var(--accent); font-weight: 600; text-decoration: none; flex-shrink: 0; }
.ad-banner .ad-dismiss { cursor: pointer; color: var(--muted); flex-shrink: 0; font-size: 15px; }
.status-ring.sponsored { border-color: #d9b64a; border-style: dashed; }
.biz-status { font-size: 13px; color: var(--danger); margin: 12px 0 0; }
.biz-status.active { color: var(--accent); font-weight: 600; }

/* ---------- Mobile: single-pane navigation (tap a chat = full screen) ---------- */
.back-btn { display: none; border: none; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; padding: 4px 10px 4px 0; color: var(--ink); }

@media (max-width: 768px) {
  .app-shell { position: relative; overflow: hidden; }
  .sidebar { width: 100%; }
  .chat-panel { display: none; width: 100%; max-width: 100vw; overflow: hidden; }
  .app-shell.chat-active .sidebar { display: none; }
  .app-shell.chat-active .chat-panel { display: flex; width: 100%; }
  .back-btn { display: inline-flex; }
  .modal-card, .modal-card.wide { width: 88vw; max-width: 400px; }
  .bubble { max-width: 78%; }
  .messages { padding: 12px 10px; }
}

.message-form { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--panel); box-sizing: border-box; width: 100%; min-width: 0; overflow: hidden; }
.attach-btn { cursor: pointer; font-size: 18px; }
.message-form input[type=text] { flex: 1; min-width: 0; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper); font-size: 14px; }
.send-btn { flex-shrink: 0; border: none; background: var(--accent); color: white; width: 38px; height: 38px; border-radius: 50%; cursor: pointer; font-size: 15px; }

/* ---------- Modals ---------- */
.modal { position: fixed; inset: 0; background: rgba(27,31,35,0.4); display: flex; align-items: center; justify-content: center; }
.modal-card { background: var(--panel); border-radius: 14px; padding: 28px; width: 340px; }
.modal-card h3 { margin: 0 0 12px; }
.modal-card label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.modal-card input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------- Search bar ---------- */
.search-bar { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.search-bar input { flex: 1; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--line); background: var(--paper); font-size: 14px; }
.search-bar button { border: none; background: transparent; font-size: 16px; cursor: pointer; }
.search-results { padding: 10px 16px; font-size: 13px; color: var(--muted); }

/* ---------- Pinned bar ---------- */
.pinned-bar { display: flex; align-items: center; gap: 8px; padding: 8px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.pinned-bar .pin-icon { color: var(--accent); }

/* ---------- Poll bubble ---------- */
.poll-bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 200px; max-width: 280px; }
.poll-question { font-weight: 700; margin-bottom: 10px; font-size: 15px; }
.poll-option { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; cursor: pointer; }
.poll-bar-wrap { flex: 1; background: var(--accent-soft); border-radius: 6px; height: 8px; overflow: hidden; }
.poll-bar-fill { height: 100%; background: var(--accent); border-radius: 6px; transition: width 0.3s; }
.poll-option-label { font-size: 13px; min-width: 100px; }
.poll-votes { font-size: 11px; color: var(--muted); margin-left: 4px; }
.poll-option.voted .poll-option-label { font-weight: 700; color: var(--accent); }

/* ---------- Reaction bar ---------- */
.reaction-bar { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction-chip { font-size: 13px; background: var(--accent-soft); border-radius: 10px; padding: 2px 7px; cursor: pointer; border: 1px solid transparent; }
.reaction-chip.mine { border-color: var(--accent); }
.reaction-picker { display: flex; gap: 6px; padding: 6px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; position: absolute; z-index: 50; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.reaction-picker span { font-size: 20px; cursor: pointer; padding: 2px; border-radius: 6px; }
.reaction-picker span:hover { background: var(--accent-soft); }

/* ---------- Voice message ---------- */
.voice-bubble { display: flex; align-items: center; gap: 8px; min-width: 180px; max-width: 260px; }
.voice-play { flex-shrink: 0; border: none; background: var(--accent); color: white; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; }
.bubble.me .voice-play { background: rgba(255,255,255,0.25); }
.voice-progress { flex: 1; height: 4px; background: rgba(0,0,0,0.15); border-radius: 2px; overflow: hidden; }
.bubble.me .voice-progress { background: rgba(255,255,255,0.3); }
.voice-progress-fill { height: 100%; width: 0%; background: white; border-radius: 2px; transition: width 0.1s linear; }
.bubble.them .voice-progress-fill { background: var(--accent); }
.voice-duration { font-size: 11px; opacity: 0.75; white-space: nowrap; flex-shrink: 0; }
.voice-recording { display: flex; align-items: center; gap: 8px; padding: 10px 16px; background: var(--accent-soft); border-top: 1px solid var(--line); }
.voice-recording .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0;} }

/* ---------- Dropdown menu ---------- */
.dropdown-menu { position: absolute; right: 16px; top: 60px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,0.12); z-index: 60; min-width: 180px; }
.dropdown-menu button { display: block; width: 100%; text-align: left; padding: 12px 16px; border: none; background: transparent; cursor: pointer; font-size: 14px; }
.dropdown-menu button:hover { background: var(--accent-soft); }

/* =====================================================================
   PIGEON — professional restyle layer (overrides the rules above)
   ===================================================================== */
:root{
  --ink:#12201b; --paper:#f4f6f5; --panel:#fff; --line:#e4eae7;
  --accent:#1f6b53; --accent-soft:#e3f0eb; --bubble-me:#1f6b53; --bubble-them:#fff;
  --muted:#6b7a74; --danger:#c0392b; --bg:#f4f6f5; --shadow:0 1px 2px rgba(18,32,27,.06),0 4px 14px rgba(18,32,27,.05);
  font-family:"Plus Jakarta Sans",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}
@media (prefers-color-scheme:dark){:root{
  --ink:#e9f1ed; --paper:#0d1411; --panel:#141d19; --line:#233029; --accent:#2fb88b;
  --accent-soft:#1b2b25; --bubble-me:#1f8a68; --bubble-them:#1c2823; --muted:#8da098; --bg:#0d1411;
  --shadow:0 1px 2px rgba(0,0,0,.4);}
  .ad-banner{background:#2a2614!important} .connection-banner{background:#2d1f1a!important}
  .primary-btn,.send-btn,.install-banner .primary-btn{color:#06150f}
}
.ic{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
html,body{height:100%} body{-webkit-font-smoothing:antialiased;letter-spacing:-.005em}
button,input,textarea{font-family:inherit}
:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.app-shell{height:100vh;height:100dvh}

/* Buttons */
.primary-btn{border-radius:12px;padding:12px 16px;font-size:14px}
.ghost-btn{border-radius:12px;padding:11px 16px;font-size:14px;font-weight:600;color:var(--ink);background:var(--panel)}
.ghost-btn:hover{background:var(--accent-soft)}
.ghost-btn.header-btn{border:0;background:transparent;width:38px;height:38px;border-radius:12px;display:inline-flex;align-items:center;justify-content:center;color:var(--ink)}
.ghost-btn.header-btn:hover{background:var(--accent-soft)}
.ghost-btn.header-btn.hidden{display:none!important}

/* Sidebar */
.sidebar{position:relative;width:340px;box-shadow:var(--shadow);z-index:1}
.sidebar-header{flex-direction:column;align-items:stretch;gap:12px;padding:16px 0 4px;border-bottom:0}
.me{padding:0 16px;font-size:18px;font-weight:700}
.avatar{width:44px;height:44px;font-size:20px;background:var(--accent-soft);flex:none}
.sidebar-actions{display:flex;gap:8px;overflow-x:auto;padding:2px 16px 12px;scrollbar-width:none}
.sidebar-actions::-webkit-scrollbar{display:none}
.sidebar-actions button,.sidebar-actions .icon-link{flex:none;width:auto;height:36px;margin:0;padding:0 14px 0 11px;gap:7px;border-radius:999px;font-size:13px;font-weight:600;background:var(--accent-soft);color:var(--ink);white-space:nowrap}
.sidebar-actions #newChatBtn{background:var(--accent);color:#fff}
.sidebar-actions button:hover,.sidebar-actions .icon-link:hover{filter:brightness(.96)}
.sidebar-actions .ic{width:17px;height:17px}
.search-bar{padding:4px 16px 12px;border:0}
.search-bar input{padding:11px 16px;border-radius:14px;background:var(--paper)}
.status-bar{padding:6px 16px 14px;gap:16px;border-bottom:1px solid var(--line)}
.status-item{width:60px}
.status-ring{width:56px;height:56px;border-width:2px}
.status-ring .avatar{width:48px;height:48px}
.status-item-label{font-size:11px;max-width:60px}
.status-ring.unseen{border-color:var(--accent)}
.conversation-list{padding-bottom:88px}
.conv-item{align-items:center;gap:14px;padding:12px 16px;border-bottom:0;position:relative;transition:background .15s}
.conv-item:hover{background:var(--paper)}
.conv-item.active{background:var(--accent-soft)}
.conv-item.active::before{content:"";position:absolute;left:0;top:10px;bottom:10px;width:3px;border-radius:0 3px 3px 0;background:var(--accent)}
.conv-item .avatar{width:50px;height:50px;font-size:22px}
.conv-name{font-size:15.5px;font-weight:600;margin-bottom:2px}
.conv-preview{font-size:13.5px}
.fab{position:absolute;right:18px;bottom:20px;width:56px;height:56px;border:0;border-radius:18px;background:var(--accent);color:#fff;display:grid;place-items:center;cursor:pointer;box-shadow:0 10px 24px rgba(31,107,83,.35);z-index:5}
.fab .ic{width:24px;height:24px}

/* Chat panel */
.empty-state{background:var(--paper);font-size:15px}
.empty-state .brand-mark{display:grid;place-items:center;width:84px;height:84px;border-radius:26px;background:var(--accent-soft);font-size:34px}
.chat-header{padding:10px 14px;gap:10px;box-shadow:var(--shadow);position:relative;z-index:2}
.chat-header .avatar{width:42px;height:42px}
.peer-name{font-size:16px}
.back-btn{display:none;width:38px;height:38px;padding:0;border-radius:12px;align-items:center;justify-content:center;margin-right:-4px}
.back-btn:hover{background:var(--accent-soft)}
.messages{background:var(--paper);padding:18px 16px;gap:6px}
.bubble{max-width:68%;padding:9px 13px;border-radius:18px;font-size:14.5px;line-height:1.45;box-shadow:var(--shadow)}
.bubble.me{border-bottom-right-radius:5px}
.bubble.them{border:0;border-bottom-left-radius:5px}
.bubble img,.bubble video{border-radius:12px}
.poll-bubble{border-radius:16px}
.pinned-bar,.attachment-preview,.voice-recording{background:var(--accent-soft)}
.message-form{gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px))}
.message-form input[type=text]{padding:12px 16px;border-radius:24px;font-size:15px;background:var(--paper)}
.attach-btn{width:40px;height:40px;border:0;border-radius:50%;background:transparent;color:var(--muted);display:inline-flex;align-items:center;justify-content:center;flex:none;font-size:18px;padding:0}
.attach-btn:hover{background:var(--accent-soft);color:var(--accent)}
.send-btn{width:44px;height:44px;display:inline-flex;align-items:center;justify-content:center;box-shadow:0 4px 12px rgba(31,107,83,.3)}
.send-btn .ic{width:19px;height:19px;stroke-width:2}

/* Modals */
.modal{background:rgba(10,18,15,.5);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}
.modal-card{border-radius:22px;padding:24px;box-shadow:0 24px 60px rgba(0,0,0,.25)}
.modal-card h3{font-size:18px;font-weight:700;margin-bottom:6px}
.modal-card input,.status-textarea{border-radius:12px;padding:12px 14px;font-size:15px}
.modal-actions{gap:10px}
.modal-actions>button{flex:1;margin-top:0;width:auto}
.dropdown-menu{border-radius:16px;padding:6px;top:64px;box-shadow:0 12px 36px rgba(0,0,0,.18)}
.dropdown-menu button{border-radius:10px;padding:11px 14px}
.tabs{border-radius:14px}.tab{border-radius:10px}
.member-row .avatar{width:38px;height:38px;font-size:17px}
.call-btn{box-shadow:0 6px 18px rgba(0,0,0,.3)}
.meeting-tile{border-radius:16px}

@media (max-width:768px){
  .sidebar{width:100%}
  .back-btn{display:inline-flex}
  .modal{align-items:flex-end}
  .modal-card,.modal-card.wide{width:100%;max-width:none;border-radius:24px 24px 0 0;padding:22px 20px calc(22px + env(safe-area-inset-bottom,0px))}
  .bubble{max-width:82%}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

/* Fix: pop-ups must sit above the sidebar and chat header (they were covered, so their buttons couldn't be tapped) */
.modal{z-index:120}
.dropdown-menu{z-index:130}

/* ===== WhatsApp-style extras (chat list, tabs, calls, contacts) ===== */
.hidden{display:none!important}
.conv-row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.conv-row .conv-name{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conv-time{font-size:12px;color:var(--muted);flex:none}
.conv-item.unread .conv-time{color:var(--accent);font-weight:600}
.conv-item.unread .conv-name,.conv-item.unread .conv-preview{font-weight:700;color:var(--ink)}
.conv-preview{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.unread-badge,.nav-badge{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--accent);color:#fff;font-size:11.5px;font-weight:700;display:inline-grid;place-items:center;flex:none}
.sidebar{display:flex;flex-direction:column}
.conversation-list,.calls-panel,.updates-extra{flex:1;overflow-y:auto;min-height:0}
.updates-extra{flex:none}
.panel-title{font-size:20px;font-weight:700;padding:8px 16px 6px}
.panel-empty{padding:48px 24px;text-align:center;color:var(--muted);font-size:14px;line-height:1.6}
.call-row,.panel-row,.pc-row{display:flex;align-items:center;gap:14px;padding:12px 16px;width:100%;border:0;background:none;color:inherit;text-align:left;cursor:pointer;font:inherit}
.call-row .conv-meta,.pc-row .conv-meta{flex:1;min-width:0;display:flex;flex-direction:column}
.call-row .avatar,.pc-row .avatar{width:46px;height:46px}
.conv-name.missed{color:var(--danger)}
.arr{font-weight:700}.arr.out,.arr.in{color:#25a56a}.arr.miss{color:var(--danger)}
.icon-only{width:40px;height:40px;border:0;border-radius:50%;background:transparent;color:var(--ink);display:inline-grid;place-items:center;cursor:pointer;flex:none}
.icon-only:hover{background:var(--accent-soft)}
.hdr-search{margin-left:auto}
.bottom-nav{display:flex;flex:none;border-top:1px solid var(--line);background:var(--panel);padding:6px 6px calc(6px + env(safe-area-inset-bottom,0px))}
.nav-tab{flex:1;border:0;background:none;color:var(--muted);font:inherit;font-size:11.5px;font-weight:600;display:flex;flex-direction:column;align-items:center;gap:3px;padding:4px 0;cursor:pointer}
.nav-tab .pill{position:relative;padding:4px 20px;border-radius:999px;display:inline-flex}
.nav-tab.on{color:var(--ink)}.nav-tab.on .pill{background:var(--accent-soft);color:var(--accent)}
.nav-tab .nav-badge{position:absolute;top:-4px;right:6px;min-width:18px;height:18px;font-size:10.5px}
.fab{bottom:86px}
/* which section shows on which tab */
.calls-panel,.updates-extra{display:none}
.sidebar[data-tab="chats"] .status-bar,.sidebar[data-tab="chats"] .sidebar-actions,
.sidebar[data-tab="calls"] .status-bar,.sidebar[data-tab="calls"] .sidebar-actions,.sidebar[data-tab="calls"] .conversation-list,.sidebar[data-tab="calls"] .fab,.sidebar[data-tab="calls"] .search-bar,
.sidebar[data-tab="updates"] .sidebar-actions,.sidebar[data-tab="updates"] .conversation-list,.sidebar[data-tab="updates"] .fab,.sidebar[data-tab="updates"] .search-bar,
.sidebar[data-tab="tools"] .status-bar,.sidebar[data-tab="tools"] .conversation-list,.sidebar[data-tab="tools"] .fab,.sidebar[data-tab="tools"] .search-bar{display:none!important}
.sidebar[data-tab="calls"] .calls-panel{display:block}
.sidebar[data-tab="updates"] .updates-extra{display:block}
.sidebar[data-tab="updates"] .status-bar{flex:none}
.sidebar[data-tab="tools"] .sidebar-actions{flex-direction:column;overflow:visible;padding:8px 16px;gap:6px}
.sidebar[data-tab="tools"] .sidebar-actions button,.sidebar[data-tab="tools"] .sidebar-actions .icon-link{width:100%;height:50px;border-radius:14px;justify-content:flex-start;padding:0 16px;font-size:15px;background:var(--paper)}
/* contacts inside New chat */
.pc-box{margin:10px 0 14px}.pc-head{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:8px}
.pc-count,.pc-msg{font-size:12.5px;color:var(--muted)}.pc-msg{margin:6px 0}
.pc-actions{display:flex;gap:8px}.pc-actions .ghost-btn{flex:1;text-align:center;cursor:pointer;font-size:13px;padding:10px 8px}
.pc-list{max-height:220px;overflow-y:auto;margin:4px -16px 0}
.pc-row{padding:8px 16px}.pc-row:hover{background:var(--paper)}

/* ===== filters, pinned, drafts, sheets, wallpaper ===== */
.list-chips{display:flex;gap:8px;padding:6px 16px 10px;flex:none;overflow-x:auto;scrollbar-width:none}
.sidebar:not([data-tab="chats"]) .list-chips{display:none}
.lchip{flex:none;border:1px solid var(--line);background:transparent;color:var(--muted);font:inherit;font-size:13px;font-weight:600;padding:7px 14px;border-radius:999px;cursor:pointer}
.lchip.on{background:var(--accent-soft);color:var(--accent);border-color:transparent}
.draft{color:#25a56a;font-weight:600}
.sheet{position:fixed;inset:0;z-index:140;background:rgba(10,18,15,.5);display:flex;align-items:flex-end;justify-content:center}
.sheet.hidden{display:none}
.sheet-card{width:100%;max-width:480px;background:var(--panel);border-radius:24px 24px 0 0;padding:18px 16px calc(18px + env(safe-area-inset-bottom,0px));display:flex;flex-direction:column;gap:6px}
.sheet-title{font-weight:700;font-size:16px;padding:0 8px 8px}
.sheet-card>button{border:0;background:var(--paper);color:var(--ink);font:inherit;font-size:15px;font-weight:600;text-align:left;padding:14px 16px;border-radius:14px;cursor:pointer}
.sheet-card>.sheet-cancel{background:transparent;color:var(--muted);text-align:center}
.wall-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;padding:4px 4px 8px}
.wall{height:72px;border:2px solid var(--line);border-radius:14px;cursor:pointer;display:flex;align-items:flex-end;padding:6px;font:inherit;font-size:11px;font-weight:700;color:#12201b}
.wall span{background:rgba(255,255,255,.75);border-radius:6px;padding:1px 5px}

/* ===== search bar, menus, media sheet, mic/send swap ===== */
.list-search{display:flex;align-items:center;gap:10px;margin:2px 16px 8px;padding:0 14px;height:44px;border-radius:22px;background:var(--paper);color:var(--muted);flex:none}
.list-search input{flex:1;min-width:0;border:0;background:transparent;font:inherit;font-size:15px;color:var(--ink);outline:none}
.sidebar:not([data-tab="chats"]) .list-search{display:none}
.pick-body{display:flex;flex-direction:column;gap:6px;max-height:60vh;overflow-y:auto}
.pick-body>button{border:0;background:var(--paper);color:var(--ink);font:inherit;font-size:15px;font-weight:600;text-align:left;padding:14px 16px;border-radius:14px;cursor:pointer}
.pc-sub{font-size:12.5px;font-weight:700;color:var(--muted);padding:10px 16px 4px;text-transform:uppercase;letter-spacing:.04em}
.pick-body .pc-sub{padding-left:4px}
.media-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.media-grid a{aspect-ratio:1;border-radius:10px;overflow:hidden;background:var(--paper);display:grid;place-items:center;font-size:28px;text-decoration:none}
.media-grid img{width:100%;height:100%;object-fit:cover}
.link-row{display:block;padding:10px 4px;font-size:14px;color:var(--accent);text-decoration:none;overflow-wrap:anywhere;border-bottom:1px solid var(--line)}
.invite{color:var(--accent);font-weight:700;font-size:14px;text-decoration:none;padding:6px 8px}
.message-form.has-text #voiceBtn{display:none}
.message-form.no-send .send-btn{display:none}
#voiceBtn{width:44px;height:44px;background:var(--accent);color:#fff;border-radius:50%;box-shadow:0 4px 12px rgba(31,107,83,.3)}

/* ===== invite sheet ===== */
.invite{border:0;background:transparent;font:inherit;font-size:14px;font-weight:700;cursor:pointer}
.inv-card{align-items:stretch;padding-top:10px}
.grab{width:44px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 10px}
.inv-title{text-align:center;font-size:20px;padding:6px 8px 4px}
.inv-sub{text-align:center;color:var(--muted);font-size:14px;margin:0 8px 8px;line-height:1.45}
.inv-who{display:flex;flex-direction:column;align-items:center;gap:6px;font-size:13.5px;font-weight:600;margin-bottom:10px}
.inv-who .avatar{width:64px;height:64px;font-size:30px}
.inv-msg{position:relative;display:block;margin:6px 4px 12px}
.inv-msg>span{position:absolute;top:-9px;left:14px;background:var(--panel);padding:0 6px;font-size:12px;color:var(--muted)}
.inv-msg textarea{width:100%;border:1.5px solid var(--line);border-radius:16px;background:transparent;color:var(--ink);font:inherit;font-size:15px;line-height:1.5;padding:16px;resize:none;outline:none}
.inv-msg textarea:focus{border-color:var(--accent)}
.inv-send{display:block;text-align:center;text-decoration:none;background:var(--accent);color:#fff;font-weight:700;font-size:15px;padding:15px;border-radius:999px;margin:0 4px}

/* ===== download button on received files ===== */
.bubble{position:relative}
.dl-btn{position:absolute;top:8px;right:8px;width:32px;height:32px;border:0;border-radius:50%;background:rgba(0,0,0,.45);color:#fff;display:grid;place-items:center;cursor:pointer;padding:0}
.dl-btn .ic{width:16px;height:16px}
.dl-btn.done{background:var(--accent)}

/* ===== no sideways sliding: keep everything inside the screen width ===== */
html,body{overflow-x:hidden;max-width:100vw;overscroll-behavior-x:none}
.app-shell{overflow:hidden;max-width:100vw;touch-action:pan-y}
main,.chat-panel,.sidebar{min-width:0}
main{overflow:hidden}
.messages{overflow-x:hidden!important;overflow-y:auto;overscroll-behavior-x:none}
.bubble{min-width:0;max-width:82%;overflow-wrap:anywhere}
.bubble img,.bubble video,.bubble canvas{display:block;width:auto!important;height:auto!important;max-width:min(100%,280px)!important;max-height:60vh;object-fit:contain}
.bubble audio{max-width:100%}
.bubble iframe,.bubble table{max-width:100%}
.message-form,.chat-header,.pinned-bar{max-width:100%;overflow:hidden}
.message-form input[type=text]{min-width:0;flex:1}

/* ===== full-screen Select contact page ===== */
.pc-box{display:none}
.cpage{position:fixed;inset:0;z-index:110;background:var(--panel);display:flex;flex-direction:column;padding-top:env(safe-area-inset-top,0px)}
.cpage.hidden{display:none}
.cp-head{display:flex;align-items:center;gap:4px;padding:8px 8px;border-bottom:1px solid var(--line);flex:none}
.cp-title{flex:1;min-width:0;display:flex;flex-direction:column;padding-left:6px}
.cp-title b{font-size:18px;font-weight:700}.cp-title small{font-size:12.5px;color:var(--muted)}
.cp-search{padding:8px 12px;flex:none}
.cp-search input{width:100%;border:0;background:var(--paper);color:var(--ink);font:inherit;font-size:15px;padding:12px 16px;border-radius:22px;outline:none}
.cp-msg{font-size:12.5px;color:var(--muted);padding:0 16px;flex:none}.cp-msg:not(:empty){padding:8px 16px}
.cp-body{flex:1;overflow-y:auto;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px))}
.cp-row{display:flex;align-items:center;gap:14px;width:100%;padding:10px 16px;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer}
.cp-row:hover{background:var(--paper)}
.cp-av{width:46px;height:46px;font-size:20px;font-weight:700;flex:none}
.cp-ic{width:46px;height:46px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:grid;place-items:center;flex:none}
.cp-meta{flex:1;min-width:0;display:flex;flex-direction:column}
.cp-meta b{font-size:16px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cp-meta small{font-size:13.5px;color:var(--muted)}
.cp-dot{width:10px;height:10px;border-radius:50%;background:#25a56a;flex:none}

.cp-empty{display:flex;flex-direction:column;align-items:center;gap:12px}
.cp-empty b{font-size:17px;color:var(--ink)}
.cp-empty p{margin:0;max-width:300px}
.cp-empty .ghost-btn{width:100%;max-width:300px}
.cp-hint{font-size:13px;line-height:1.55}

/* ===== explicit theme choice, font size, settings & tools ===== */
:root[data-theme="dark"]{--ink:#e9f1ed;--paper:#0d1411;--panel:#141d19;--line:#233029;--accent:#2fb88b;--accent-soft:#1b2b25;--bubble-me:#1f8a68;--bubble-them:#1c2823;--muted:#8da098;--bg:#0d1411;--shadow:0 1px 2px rgba(0,0,0,.4)}
:root[data-theme="light"]{--ink:#12201b;--paper:#f4f6f5;--panel:#fff;--line:#e4eae7;--accent:#1f6b53;--accent-soft:#e3f0eb;--bubble-me:#1f6b53;--bubble-them:#fff;--muted:#6b7a74;--bg:#f4f6f5;--shadow:0 1px 2px rgba(18,32,27,.06),0 4px 14px rgba(18,32,27,.05)}
.bubble{font-size:calc(14.5px * var(--fs,1))}
.tools-page{display:none;flex:1;overflow-y:auto;min-height:0;padding-bottom:12px}
.sidebar[data-tab="tools"] .tools-page{display:block}
.sidebar[data-tab="tools"] .sidebar-actions{display:none!important}
.st-row{align-items:center;padding:12px 16px}
.st-ic{width:40px;height:40px;display:grid;place-items:center;color:var(--muted);flex:none}
.st-me{display:flex;align-items:center;gap:14px;padding:16px;border-bottom:1px solid var(--line);margin-bottom:6px}
.st-av{width:64px;height:64px;font-size:32px}
.st-text{margin:0;padding:12px 8px;font-size:14px;line-height:1.55;color:var(--muted)}
.st-switch{display:flex;align-items:center;gap:12px;width:100%;border:0;background:var(--paper)!important;border-radius:14px;padding:12px 16px!important;color:var(--ink);font:inherit;cursor:pointer;text-align:left}
.st-switch .cp-meta{flex:1}.st-switch small{font-weight:400}
.tg{width:46px;height:26px;border-radius:13px;background:var(--line);position:relative;flex:none;transition:background .15s}
.tg::after{content:"";position:absolute;top:3px;left:3px;width:20px;height:20px;border-radius:50%;background:#fff;transition:transform .15s}
.tg.on{background:var(--accent)}.tg.on::after{transform:translateX(20px)}
.st-opt{border:0;background:var(--paper);color:var(--ink);font:inherit;font-size:15px;font-weight:600;text-align:left;padding:13px 16px;border-radius:14px;cursor:pointer;display:block;width:100%;margin-top:6px}
.st-opt.on{background:var(--accent-soft);color:var(--accent)}

/* ===== message bar: rounded card, text on top, tools underneath ===== */
div:has(> #messageForm){background:var(--paper)}
.message-form{display:flex;flex-direction:column;align-items:stretch;gap:6px;margin:6px 10px calc(8px + env(safe-area-inset-bottom,0px));padding:14px 14px 8px;border:1px solid var(--line);border-radius:28px;background:var(--panel);box-shadow:var(--shadow)}
.message-form textarea{width:100%;min-height:30px;max-height:140px;border:0;background:transparent;color:var(--ink);font:inherit;font-size:16px;line-height:1.4;padding:2px 4px;resize:none;outline:none;overflow-y:auto}
.message-form textarea::placeholder{color:var(--muted)}
.mb-row{display:flex;align-items:center;gap:2px}
.mb-spacer{flex:1}
.mb-chip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:transparent;color:var(--muted);font:inherit;font-size:13.5px;font-weight:600;padding:7px 12px;border-radius:999px;cursor:pointer;white-space:nowrap}
.mb-chip .ic{width:15px;height:15px}
.mb-chip:hover{background:var(--accent-soft);color:var(--accent)}
.message-form.rec .send-btn{display:none}
.message-form .send-btn,.message-form #voiceBtn{margin-left:6px;flex:none}
.emoji-grid{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;max-height:50vh;overflow-y:auto;padding:4px}
.emoji-grid button{border:0;background:transparent;font-size:26px;padding:6px 0;border-radius:10px;cursor:pointer}
.emoji-grid button:hover{background:var(--accent-soft)}
@media(max-width:420px){.mb-chip{padding:7px 10px;font-size:13px}.attach-btn{width:36px;height:36px}}

/* ===== message bar: match the reference (white round send button, roomy icons) ===== */
:root{--send-bg:var(--accent);--send-ink:#fff}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--send-bg:#f4f6f5;--send-ink:#0d1411}}
:root[data-theme="dark"]{--send-bg:#f4f6f5;--send-ink:#0d1411}
.message-form{margin:6px 12px calc(10px + env(safe-area-inset-bottom,0px));padding:16px 14px 10px 18px;border-radius:30px}
.message-form textarea{font-size:16px;padding:0 2px 6px}
.mb-row{gap:0}
.mb-chip{padding:8px 14px;font-size:14px;font-weight:500;color:var(--muted);margin-right:2px}
.mb-row .attach-btn{width:46px;height:46px;color:var(--muted)}
.mb-row .attach-btn .ic{width:25px;height:25px}
.mb-row .poll-mini{width:40px;height:40px}
.mb-row .poll-mini .ic{width:21px;height:21px}
.message-form .send-btn,.message-form #voiceBtn{width:56px;height:56px;margin-left:8px;border-radius:50%;background:var(--send-bg)!important;color:var(--send-ink)!important;box-shadow:0 2px 8px rgba(0,0,0,.25);font-size:22px}
.message-form .send-btn .ic{width:24px;height:24px;stroke-width:2.2}
@media(max-width:420px){.mb-row .attach-btn{width:42px;height:42px}.mb-row .poll-mini{width:36px;height:36px}.message-form .send-btn,.message-form #voiceBtn{width:52px;height:52px}}

/* ===== show line breaks typed with Shift+Enter ===== */
.bubble{white-space:pre-wrap}
.bubble .file-attachment,.bubble .poll-bubble,.bubble .voice-bubble,.bubble .time,.bubble [class*="poll"],.bubble [class*="reaction"]{white-space:normal}

/* ===== fixes: time stamp stays on one line, header names don't wrap letter by letter ===== */
.bubble .time{white-space:nowrap!important}
.chat-header-meta{flex:1;min-width:0}
.chat-header .peer-name,.chat-header .peer-status{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chat-header .peer-status{font-size:12.5px}
.ghost-btn.header-btn{width:36px;height:36px;flex:none}
.chat-header{gap:6px}

/* ===== animated wallpapers (also used as live previews in the picker) ===== */
@keyframes wpShift{0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}}
@keyframes wpDrift{from{background-position:0 0,0 0,0 0}to{background-position:-220px 180px,-140px 110px,0 0}}
@keyframes wpRise{from{background-position:0 0,0 0,0 0}to{background-position:0 -240px,0 -400px,0 0}}
.wall-aurora{background:linear-gradient(120deg,#0b3d2e,#145a64,#3a2a7a,#0f6b53,#0b3d2e);background-size:400% 400%;animation:wpShift 16s ease infinite}
.wall-sunset{background:linear-gradient(135deg,#3b1d4a,#a8325e,#f08a4b,#a8325e,#3b1d4a);background-size:400% 400%;animation:wpShift 18s ease infinite}
.wall-ocean{background:linear-gradient(160deg,#04293a,#064663,#0b7285,#064663,#04293a);background-size:300% 300%;animation:wpShift 20s ease infinite}
.wall-stars{background:radial-gradient(1.6px 1.6px at 30px 40px,#fff,transparent),radial-gradient(1.2px 1.2px at 90px 70px,#cfe3ff,transparent),linear-gradient(#050b1a,#0c1838);background-size:220px 180px,140px 110px,100% 100%;animation:wpDrift 40s linear infinite}
.wall-bubbles{background:radial-gradient(circle at 30px 40px,rgba(255,255,255,.2) 0 7px,transparent 8px),radial-gradient(circle at 90px 120px,rgba(255,255,255,.14) 0 12px,transparent 13px),linear-gradient(#063a46,#0b6b6b);background-size:120px 120px,200px 200px,100% 100%;animation:wpRise 22s linear infinite}
.wall-gal{background:var(--paper);cursor:pointer;justify-content:center;align-items:center;text-align:center}

/* ===== greeting / away message sheets ===== */
.st-ta{width:100%;border:1.5px solid var(--line);border-radius:16px;background:transparent;color:var(--ink);font:inherit;font-size:15px;line-height:1.5;padding:14px;resize:vertical;outline:none;min-height:110px}
.st-ta:focus{border-color:var(--accent)}
.st-hours{display:flex;gap:10px;margin-top:8px}
.st-hours label{flex:1;display:flex;flex-direction:column;gap:4px;font-size:12px;font-weight:600;color:var(--muted)}
.st-hours input{font:inherit;font-size:16px;padding:10px;border-radius:12px;border:1px solid var(--line);background:transparent;color:var(--ink)}
.st-save{border:0;background:var(--accent);color:#fff;font:inherit;font-size:16px;font-weight:700;padding:15px;border-radius:999px;cursor:pointer;margin-top:4px}
.st-save:disabled{opacity:.6}

/* ===== app lock ===== */
.applock{position:fixed;inset:0;z-index:300;background:var(--panel);display:flex;align-items:center;justify-content:center;padding:24px}
.applock.hidden{display:none}
.al-card{width:100%;max-width:320px;display:flex;flex-direction:column;gap:14px;text-align:center}
.al-title{font-size:22px;font-weight:700}
.al-card input{font:inherit;font-size:24px;letter-spacing:.4em;text-align:center;padding:14px;border-radius:16px;border:1.5px solid var(--line);background:transparent;color:var(--ink)}

/* ===== love wallpapers: drawn in code (animated hearts + heart/rose designs) ===== */
@keyframes wpHeartsUp{from{background-position:0 0,0 0,0 0}to{background-position:0 -440px,0 -320px,0 0}}
@keyframes wpHeartsDown{from{background-position:0 0,0 0,0 0}to{background-position:0 440px,0 320px,0 0}}
@keyframes wpPulse{from{background-size:60% 60%,180px 180px,100% 100%}to{background-size:150% 150%,180px 180px,100% 100%}}
.wall-hearts{background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27160%27%20height%3D%27220%27%3E%3Cpath%20transform%3D%27translate%2820%2030%29%20scale%280.9166666666666666%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff8fb8%27%20fill-opacity%3D%270.3%27%2F%3E%3Cpath%20transform%3D%27translate%28100%20120%29%20scale%281.4166666666666667%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff5c9a%27%20fill-opacity%3D%270.22%27%2F%3E%3Cpath%20transform%3D%27translate%2860%20170%29%20scale%280.6666666666666666%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffd1e3%27%20fill-opacity%3D%270.35%27%2F%3E%3C%2Fsvg%3E") 0 0/160px 220px,url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27110%27%20height%3D%27160%27%3E%3Cpath%20transform%3D%27translate%2815%2020%29%20scale%280.5833333333333334%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffd1e3%27%20fill-opacity%3D%270.3%27%2F%3E%3Cpath%20transform%3D%27translate%2870%2095%29%20scale%281.0833333333333333%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff7aa8%27%20fill-opacity%3D%270.18%27%2F%3E%3C%2Fsvg%3E") 0 0/110px 160px,linear-gradient(160deg,#3a0a24,#7a1245 55%,#b01c5e);animation:wpHeartsUp 26s linear infinite}
.wall-heartrain{background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27160%27%20height%3D%27220%27%3E%3Cpath%20transform%3D%27translate%2820%2030%29%20scale%280.9166666666666666%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff6b6b%27%20fill-opacity%3D%270.28%27%2F%3E%3Cpath%20transform%3D%27translate%28100%20120%29%20scale%281.4166666666666667%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff3d5a%27%20fill-opacity%3D%270.22%27%2F%3E%3Cpath%20transform%3D%27translate%2860%20170%29%20scale%280.6666666666666666%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffc2c2%27%20fill-opacity%3D%270.3%27%2F%3E%3C%2Fsvg%3E") 0 0/160px 220px,url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27110%27%20height%3D%27160%27%3E%3Cpath%20transform%3D%27translate%2815%2020%29%20scale%280.5833333333333334%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffc2c2%27%20fill-opacity%3D%270.28%27%2F%3E%3Cpath%20transform%3D%27translate%2870%2095%29%20scale%281.0833333333333333%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff5470%27%20fill-opacity%3D%270.18%27%2F%3E%3C%2Fsvg%3E") 0 0/110px 160px,linear-gradient(170deg,#2b0614,#6d0f2f 60%,#a3142f);animation:wpHeartsDown 30s linear infinite}
.wall-lovepulse{background:radial-gradient(circle at 50% 45%,rgba(255,77,141,.55),transparent 55%) center/60% 60% no-repeat,url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27180%27%20height%3D%27180%27%3E%3Cpath%20transform%3D%27translate%2814%2020%29%20scale%280.5%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffb3cf%27%20fill-opacity%3D%270.35%27%2F%3E%3Cpath%20transform%3D%27translate%28110%2040%29%20scale%280.75%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff7aa8%27%20fill-opacity%3D%270.25%27%2F%3E%3Cpath%20transform%3D%27translate%2860%20120%29%20scale%280.9166666666666666%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff5c9a%27%20fill-opacity%3D%270.2%27%2F%3E%3Cpath%20transform%3D%27translate%28140%20140%29%20scale%280.4166666666666667%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffd1e3%27%20fill-opacity%3D%270.4%27%2F%3E%3C%2Fsvg%3E") 0 0/180px 180px,linear-gradient(#2a0618,#5e0d33);animation:wpPulse 4.5s ease-in-out infinite alternate}
.wall-romance{background:linear-gradient(120deg,#5b0f3b,#c2185b,#ff8a65,#c2185b,#5b0f3b);background-size:400% 400%;animation:wpShift 16s ease infinite}
.wall-pinkhearts{background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%2790%27%20height%3D%2790%27%3E%3Cpath%20transform%3D%27translate%2810%2012%29%20scale%280.75%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff9ec4%27%20fill-opacity%3D%270.5%27%2F%3E%3Cpath%20transform%3D%27translate%2852%2048%29%20scale%281.0833333333333333%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff7fb2%27%20fill-opacity%3D%270.38%27%2F%3E%3Cpath%20transform%3D%27translate%2818%2060%29%20scale%280.5%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ffc2da%27%20fill-opacity%3D%270.7%27%2F%3E%3C%2Fsvg%3E") 0 0/90px 90px,#ffe7f0}
.wall-redgold{background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27100%27%20height%3D%27100%27%3E%3Cpath%20transform%3D%27translate%2814%2014%29%20scale%280.75%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23f5c76a%27%20fill-opacity%3D%270.55%27%2F%3E%3Cpath%20transform%3D%27translate%2858%2052%29%20scale%281.0833333333333333%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23f5c76a%27%20fill-opacity%3D%270.4%27%2F%3E%3Cpath%20transform%3D%27translate%2822%2066%29%20scale%280.5%29%27%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23f5c76a%27%20fill-opacity%3D%270.65%27%2F%3E%3C%2Fsvg%3E") 0 0/100px 100px,#5a0a1a}
.wall-roses{background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20width%3D%27140%27%20height%3D%27140%27%3E%3Crect%20width%3D%27140%27%20height%3D%27140%27%20fill%3D%27%232a0f1a%27%2F%3E%3Cg%3E%3Ccircle%20cx%3D%2745%27%20cy%3D%2745%27%20r%3D%2717%27%20fill%3D%27%23b3124f%27%2F%3E%3Ccircle%20cx%3D%2745%27%20cy%3D%2745%27%20r%3D%2711%27%20fill%3D%27%23d81b6a%27%2F%3E%3Cpath%20d%3D%27M45%2045m-3%200a3%203%200%201%201%203%203a6%206%200%201%201-6-6a9%209%200%201%201%209%209%27%20fill%3D%27none%27%20stroke%3D%27%23ff9ec4%27%20stroke-width%3D%271.6%27%20stroke-linecap%3D%27round%27%2F%3E%3Cellipse%20cx%3D%2727%27%20cy%3D%2764%27%20rx%3D%2710%27%20ry%3D%274%27%20transform%3D%27rotate%28-30%2027%2064%29%27%20fill%3D%27%232e7d4f%27%2F%3E%3Cellipse%20cx%3D%2763%27%20cy%3D%2764%27%20rx%3D%2710%27%20ry%3D%274%27%20transform%3D%27rotate%2830%2063%2064%29%27%20fill%3D%27%232e7d4f%27%2F%3E%3C%2Fg%3E%3Cg%20transform%3D%27translate%2868%2062%29%20scale%28.7%29%27%3E%3Cg%3E%3Ccircle%20cx%3D%2745%27%20cy%3D%2745%27%20r%3D%2717%27%20fill%3D%27%23b3124f%27%2F%3E%3Ccircle%20cx%3D%2745%27%20cy%3D%2745%27%20r%3D%2711%27%20fill%3D%27%23d81b6a%27%2F%3E%3Cpath%20d%3D%27M45%2045m-3%200a3%203%200%201%201%203%203a6%206%200%201%201-6-6a9%209%200%201%201%209%209%27%20fill%3D%27none%27%20stroke%3D%27%23ff9ec4%27%20stroke-width%3D%271.6%27%20stroke-linecap%3D%27round%27%2F%3E%3Cellipse%20cx%3D%2727%27%20cy%3D%2764%27%20rx%3D%2710%27%20ry%3D%274%27%20transform%3D%27rotate%28-30%2027%2064%29%27%20fill%3D%27%232e7d4f%27%2F%3E%3Cellipse%20cx%3D%2763%27%20cy%3D%2764%27%20rx%3D%2710%27%20ry%3D%274%27%20transform%3D%27rotate%2830%2063%2064%29%27%20fill%3D%27%232e7d4f%27%2F%3E%3C%2Fg%3E%3C%2Fg%3E%3C%2Fsvg%3E") 0 0/140px 140px,#2a0f1a}
.wall-bigheart{background:url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%27%20viewBox%3D%270%200%20400%20600%27%20preserveAspectRatio%3D%27xMidYMid%20slice%27%3E%3Cdefs%3E%3CradialGradient%20id%3D%27g%27%20cx%3D%2750%25%27%20cy%3D%2745%25%27%20r%3D%2760%25%27%3E%3Cstop%20offset%3D%270%27%20stop-color%3D%27%23ff4d8d%27%20stop-opacity%3D%27.55%27%2F%3E%3Cstop%20offset%3D%271%27%20stop-color%3D%27%232a0618%27%20stop-opacity%3D%270%27%2F%3E%3C%2FradialGradient%3E%3C%2Fdefs%3E%3Crect%20width%3D%27400%27%20height%3D%27600%27%20fill%3D%27%232a0618%27%2F%3E%3Crect%20width%3D%27400%27%20height%3D%27600%27%20fill%3D%27url%28%23g%29%27%2F%3E%3Cg%20transform%3D%27translate%2872%20150%29%20scale%2811.4%29%27%3E%3Cpath%20d%3D%27M12%2021.35l-1.45-1.32C5.4%2015.36%202%2012.28%202%208.5%202%205.42%204.42%203%207.5%203c1.74%200%203.41.81%204.5%202.09C13.09%203.81%2014.76%203%2016.5%203%2019.58%203%2022%205.42%2022%208.5c0%203.78-3.4%206.86-8.55%2011.54L12%2021.35z%27%20fill%3D%27%23ff3d7f%27%20fill-opacity%3D%27.88%27%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") center/cover no-repeat}
.sheet-card{max-height:85vh;overflow-y:auto}

/* ===== emoji / GIF panel ===== */
.ep-tabs{display:flex;gap:8px;padding:0 4px 10px}
.ep-tab{flex:1;border:0;background:var(--paper);color:var(--muted);font:inherit;font-size:14px;font-weight:700;padding:10px;border-radius:999px;cursor:pointer}
.ep-tab.on{background:var(--accent-soft);color:var(--accent)}
.gif-q{width:100%;border:0;background:var(--paper);color:var(--ink);font:inherit;font-size:15px;padding:12px 16px;border-radius:22px;outline:none;margin-bottom:8px}
.gif-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;max-height:48vh;overflow-y:auto}
.gif-item{border:0;padding:0;border-radius:12px;overflow:hidden;background:var(--paper);cursor:pointer;aspect-ratio:1/1}
.gif-item img{width:100%;height:100%;object-fit:cover;display:block}
.gif-msg{font-size:13.5px;color:var(--muted);text-align:center;padding:8px 6px;line-height:1.5}.gif-msg:empty{display:none}
.gif-credit{font-size:11px;color:var(--muted);text-align:center;padding:6px 0 0}

/* ===== stickers: no bubble around them ===== */
.gif-grid.stk img{object-fit:contain;padding:6px}
.bubble:has(img[src$="#sticker"]){background:transparent!important;box-shadow:none!important;border:0!important;padding:2px 4px}
.bubble img[src$="#sticker"]{max-width:170px!important;max-height:170px;object-fit:contain}

/* ===== emoji picker: sections, recents, category bar, backspace ===== */
.emoji-grid{display:block!important;position:relative;max-height:44vh;overflow-y:auto;padding:0 2px}
.emoji-grid.hidden,.emoji-cats.hidden{display:none!important}
.emoji-h{font-size:12.5px;font-weight:700;color:var(--muted);padding:10px 6px 4px}
.emoji-sg{display:grid;grid-template-columns:repeat(8,1fr);gap:0}
.emoji-sg button{border:0;background:transparent;font-size:25px;padding:7px 0;border-radius:10px;cursor:pointer;line-height:1.2}
.emoji-sg button:active,.emoji-sg button:hover{background:var(--accent-soft)}
.emoji-cats{display:flex;justify-content:space-between;gap:2px;padding:8px 2px 2px;border-top:1px solid var(--line);margin-top:6px}
.emoji-cats button{flex:1;border:0;background:transparent;font-size:20px;padding:8px 0;border-radius:12px;cursor:pointer;filter:grayscale(.6)}
.emoji-cats button:active{background:var(--accent-soft);filter:none}
.ep-bs{flex:none;width:46px;border:0;background:var(--paper);color:var(--muted);border-radius:999px;cursor:pointer;display:grid;place-items:center}

/* ===== emoji panel docked under the message bar (the text box stays visible) ===== */
.ep-dock{background:var(--panel);border-top:1px solid var(--line);padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px));flex:none}
.ep-dock .sheet-card{max-width:none;width:100%;border-radius:0;padding:0;background:transparent;max-height:none;overflow:visible;gap:0}
.ep-dock #emojiDone{display:none}
.ep-dock .emoji-grid{max-height:32vh}
.ep-dock .gif-grid{max-height:30vh}
.ep-dock .ep-tabs{padding:0 0 8px}

/* ===== swipe to reply ===== */
.reply-preview{display:flex;gap:10px;align-items:stretch;background:var(--paper);border-radius:14px;padding:8px 8px 8px 10px;margin-bottom:6px}
.reply-preview.hidden{display:none!important}
.rp-bar{width:4px;border-radius:2px;background:var(--accent);flex:none}
.rp-body{flex:1;min-width:0}
.rp-name{font-size:13px;font-weight:700;color:var(--accent)}
.rp-text{font-size:13px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;white-space:normal;overflow-wrap:anywhere}
.rp-x{flex:none;align-self:flex-start;width:28px;height:28px;border:0;background:transparent;color:var(--muted);font-size:14px;cursor:pointer;border-radius:50%}
.reply-quote{display:block;border-left:4px solid var(--accent);background:rgba(0,0,0,.16);border-radius:8px;padding:6px 10px;margin:0 0 6px;cursor:pointer;white-space:normal}
.bubble.me .reply-quote{border-left-color:#bff3df}
.rq-name{font-size:12.5px;font-weight:700;color:var(--accent)}
.bubble.me .rq-name{color:#bff3df}
.rq-text{font-size:13px;opacity:.85;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.reply-ic{position:fixed;left:14px;top:0;width:36px;height:36px;border-radius:50%;background:rgba(127,127,127,.4);color:var(--ink);display:grid;place-items:center;pointer-events:none;opacity:0;transform:scale(.4);z-index:20}
.bubble.flash{animation:rqFlash 1.3s ease}
@keyframes rqFlash{0%,65%{box-shadow:0 0 0 3px var(--accent)}100%{box-shadow:0 0 0 0 transparent}}
.bubble{touch-action:pan-y}

/* ===== long-press selection toolbar + reaction bar ===== */
.bubble{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
.bubble.selected::after{content:"";position:absolute;left:-100vw;right:-100vw;top:-5px;bottom:-5px;background:rgba(90,150,255,.22);pointer-events:none;z-index:2}
.sel-bar{position:absolute;inset:0;background:var(--panel);display:flex;align-items:center;gap:2px;padding:0 6px;z-index:5}
.sel-bar.hidden{display:none!important}
.sel-bar .icon-only{width:42px;height:42px;flex:none}
.sel-count{font-size:19px;font-weight:700;margin-left:4px}
.sel-sp{flex:1}
.rx-bar{position:fixed;z-index:60;display:flex;gap:0;background:var(--panel);border:1px solid var(--line);border-radius:999px;padding:5px 8px;box-shadow:0 8px 24px rgba(0,0,0,.35)}
.rx-bar.hidden{display:none!important}
.rx-bar button{border:0;background:transparent;font-size:26px;line-height:1;padding:4px 6px;cursor:pointer;border-radius:50%}
.rx-bar button:active{transform:scale(1.25)}

/* ===== photos and videos: no green / dark bubble behind them ===== */
.bubble.media-only{background:transparent!important;box-shadow:none!important;border:0!important;padding:0!important;overflow:visible}
.bubble.media-only img,.bubble.media-only video{display:block;border-radius:16px}
.bubble.media-only .time{position:absolute;right:8px;bottom:8px;background:rgba(0,0,0,.5);color:#fff!important;border-radius:10px;padding:2px 8px;font-size:11px;line-height:1.4}

/* ===== reply quote: always ON TOP of the message text, with a thumbnail for files ===== */
.bubble[data-q="1"]{display:flex;flex-direction:column;align-items:flex-start}
.bubble[data-q="1"] .time{align-self:flex-end}
.bubble[data-q="1"] > .reply-quote{align-self:stretch;width:100%;box-sizing:border-box;display:flex;gap:8px;align-items:stretch;min-width:180px}
.rq-main{flex:1;min-width:0}
.bubble .reply-quote .rq-thumb{width:46px!important;height:46px!important;max-width:46px!important;max-height:46px!important;object-fit:cover;border-radius:6px;flex:none;margin:0;display:block}
.rp-thumb{width:44px;height:44px;object-fit:cover;border-radius:8px;flex:none;align-self:center}
.rp-thumb.hidden{display:none!important}

.rx-bar{z-index:130!important}
.sel-bar{z-index:6}

/* ===== reaction bar like WhatsApp: big emojis, highlighted current one, + button ===== */
.rx-bar{align-items:center;gap:2px;padding:8px 10px;background:var(--panel)}
.rx-bar button{font-size:33px;padding:5px 7px;line-height:1.1}
.rx-bar button.on{background:rgba(127,127,127,.32)}
.rx-bar .rx-plus{width:42px;height:42px;border-radius:50%;background:rgba(127,127,127,.38);display:grid;place-items:center;font-size:0;color:var(--ink);padding:0;margin-left:2px}
.rx-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:2px}
.rx-grid button{border:0;background:transparent;font-size:28px;padding:8px 0;border-radius:12px;cursor:pointer}
.rx-grid button:active{background:var(--accent-soft)}

/* ===== photo / video albums ===== */
.bubble.album{padding:4px 4px 6px!important}
.bubble.album .time{padding-right:6px}
.album-grid{display:grid;grid-template-columns:1fr 1fr;gap:4px;width:min(264px,68vw);margin:0 0 4px}
.album-grid.n3 .album-tile:nth-child(3){grid-column:1/3;aspect-ratio:2/1}
.album-tile{position:relative;border:0;padding:0;border-radius:12px;overflow:hidden;aspect-ratio:1/1;background:#000;cursor:pointer;display:block}
.bubble .album-tile img,.bubble .album-tile video{width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:cover;border-radius:0;display:block}
.album-more{position:absolute;inset:0;display:grid;place-items:center;background:rgba(0,0,0,.5);color:#fff;font-size:30px;font-weight:600}
.album-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:38px;height:38px;border-radius:50%;background:rgba(0,0,0,.5);color:#fff;display:grid;place-items:center;font-size:16px}

/* ===== full-screen picture / video viewer ===== */
.mv{position:fixed;inset:0;z-index:250;background:#000;display:flex;flex-direction:column}
.mv.hidden{display:none!important}
.mv-top{display:flex;align-items:center;gap:6px;padding:calc(8px + env(safe-area-inset-top,0px)) 8px 8px;color:#fff;flex:none;background:linear-gradient(rgba(0,0,0,.65),transparent);position:relative;z-index:2}
.mv-top .icon-only{color:#fff;text-decoration:none}
.mv-count{flex:1;text-align:center;font-weight:600;font-size:15px}
.mv-stage{flex:1;display:flex;align-items:center;justify-content:center;min-height:0;overflow:hidden;margin-top:-56px}
.mv-stage img,.mv-stage video{max-width:100%!important;max-height:100%!important;width:auto!important;height:auto!important;object-fit:contain;border-radius:0!important;box-shadow:none!important}
.mv-nav{position:absolute;top:50%;transform:translateY(-50%);border:0;background:rgba(255,255,255,.18);color:#fff;font-size:34px;line-height:1;width:44px;height:64px;cursor:pointer;border-radius:12px;z-index:2}
.mv-prev{left:8px}.mv-next{right:8px}
@media (pointer:coarse){.mv-nav{display:none}}

/* ===== album page (list of all pictures / videos in an album) ===== */
.alb{position:fixed;inset:0;z-index:240;background:var(--paper);display:flex;flex-direction:column;padding-top:env(safe-area-inset-top,0px)}
.alb.hidden{display:none!important}
.alb-top{display:flex;align-items:center;gap:6px;padding:8px 8px;background:var(--panel);border-bottom:1px solid var(--line);flex:none}
.alb-title{display:flex;flex-direction:column;min-width:0}
.alb-title b{font-size:18px;font-weight:700}.alb-title small{font-size:12.5px;color:var(--muted)}
.alb-body{flex:1;overflow-y:auto;padding:10px 12px calc(16px + env(safe-area-inset-bottom,0px))}
.alb-item{position:relative;display:block;width:100%;max-width:440px;margin:0 auto 8px;border:0;padding:0;background:#000;border-radius:10px;overflow:hidden;cursor:pointer}
.alb-item img,.alb-item video{width:100%;max-height:70vh;min-height:120px;object-fit:cover;display:block}
.alb-play{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:52px;height:52px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;display:grid;place-items:center}
.alb-play .ic{width:24px;height:24px}
.alb-dur{position:absolute;left:8px;bottom:8px;display:flex;align-items:center;gap:5px;color:#fff;font-size:12px;text-shadow:0 1px 3px rgba(0,0,0,.7)}
.alb-dur .ic{width:15px;height:15px}.alb-dur i{font-style:normal}
.alb-time{position:absolute;right:8px;bottom:8px;color:#fff;font-size:11px;text-shadow:0 1px 3px rgba(0,0,0,.7);display:inline-flex;align-items:center;gap:3px}
