:root {
  --bg: #0b141a;
  --panel: #111b21;
  --panel-2: #202c33;
  --panel-3: #2a3942;
  --accent: #00a884;
  --accent-dark: #008f6f;
  --text: #e9edef;
  --text-dim: #8696a0;
  --bubble-out: #005c4b;
  --bubble-in: #202c33;
  --divider: #222d34;
  --danger: #f15c6d;
  --chat-bg: #0b141a;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: 15px; }

/* ---------- AUTH ---------- */
.auth-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(1200px 600px at 50% -10%, #11352c 0%, var(--bg) 55%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-logo { width: 64px; height: 64px; }
.auth-brand h1 { font-size: 28px; margin-top: 8px; letter-spacing: .5px; }
.auth-tagline { color: var(--text-dim); font-size: 14px; margin-top: 4px; }
.auth-tabs {
  display: flex;
  background: var(--panel-2);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 18px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 8px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
}
.auth-tab.active { background: var(--accent); color: #04130e; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form input {
  background: var(--panel-2);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--text);
  outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.btn-primary {
  background: var(--accent);
  color: #04130e;
  font-weight: 700;
  padding: 13px;
  border-radius: 10px;
  margin-top: 4px;
}
.btn-primary:hover { background: var(--accent-dark); }
.auth-sep { display: flex; align-items: center; gap: 10px; color: var(--text-dim); margin: 18px 0 14px; font-size: 13px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--divider); }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f1f1f; font-weight: 600;
  padding: 12px; border-radius: 10px; text-decoration: none;
}
.btn-google:hover { background: #f3f3f3; }
.auth-hint { color: var(--text-dim); font-size: 13px; text-align: center; margin-top: 10px; }
.btn-link-device { width: 100%; margin-top: 12px; background: transparent; color: var(--text-dim);
  border: 1px solid var(--divider); border-radius: 10px; padding: 11px; font-size: 14px; }
.btn-link-device:hover { color: var(--text); border-color: var(--accent); }
.link-qr { width: 200px; margin: 0 auto 14px; background: #fff; padding: 10px; border-radius: 12px; }
.link-qr svg { display: block; width: 100%; height: auto; }
.link-code { font-size: 34px; font-weight: 700; letter-spacing: 8px; color: var(--accent);
  background: var(--panel-2); border-radius: 12px; padding: 18px; margin: 8px 0 14px; font-family: monospace; }
.auth-error { color: var(--danger); font-size: 13px; text-align: center; min-height: 18px; margin-top: 10px; }
.auth-foot { color: var(--text-dim); font-size: 12px; margin-top: 18px; text-align: center; }

/* ---------- APP LAYOUT ---------- */
.app { display: flex; height: 100%; height: 100dvh; max-width: 1600px; margin: 0 auto; }
.sidebar {
  width: 30%;
  min-width: 300px;
  max-width: 460px;
  background: var(--panel);
  border-right: 1px solid var(--divider);
  display: flex;
  flex-direction: column;
  position: relative;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--panel-2);
}
.sidebar-title { font-weight: 700; font-size: 17px; flex: 1; }
.sidebar-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; color: var(--text-dim);
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--panel-3); color: var(--text); }
.icon-btn svg { width: 22px; height: 22px; }

/* Floating action button — prominent "new conversation" entry point. */
.fab {
  position: absolute; right: 20px; bottom: 20px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: #04130e;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
  z-index: 20; transition: transform .12s ease, background .12s;
}
.fab:hover { background: var(--accent-dark); transform: translateY(-2px); }
.fab:active { transform: translateY(0); }
.fab svg { width: 26px; height: 26px; }
.avatar-btn {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent) center/cover no-repeat;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: #04130e;
}
.net-indicator { font-size: 12px; color: var(--accent); }
.net-indicator.offline { color: var(--danger); }
.net-indicator.mesh { color: #f0b232; }

.search-bar { padding: 8px 12px; background: var(--panel); }
.search-bar input {
  width: 100%; background: var(--panel-2); border: none;
  border-radius: 10px; padding: 10px 14px; color: var(--text); outline: none;
}

.chat-list { list-style: none; overflow-y: auto; flex: 1; }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; cursor: pointer; border-bottom: 1px solid var(--divider);
  position: relative;
}
.chat-item:hover { background: var(--panel-2); }
.chat-item-menu { position: absolute; top: 8px; right: 8px; opacity: 0;
  width: 26px; height: 26px; border-radius: 50%; color: var(--text-dim); font-size: 16px; }
.chat-item:hover .chat-item-menu { opacity: 1; }
.chat-item-menu:hover { background: var(--panel-3); color: var(--text); }
.badge.muted { background: var(--text-dim); color: var(--panel); }
.archived-toggle { padding: 12px 16px; color: var(--text-dim); cursor: pointer;
  font-size: 14px; border-bottom: 1px solid var(--divider); }
.archived-toggle:hover { background: var(--panel-2); }
.search-section-head { padding: 12px 16px 6px; color: var(--accent); font-size: 13px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.popup-menu { position: fixed; z-index: 120; background: var(--panel-2);
  border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.5); padding: 6px; min-width: 160px; }
.popup-item { padding: 10px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.popup-item:hover { background: var(--panel-3); }
.chat-item.active { background: var(--panel-3); }
.avatar {
  width: 49px; height: 49px; border-radius: 50%; flex-shrink: 0;
  background: var(--panel-3) center/cover no-repeat;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--text); font-size: 18px;
}
.avatar.sm { width: 40px; height: 40px; font-size: 15px; }
.chat-item-body { flex: 1; min-width: 0; }
.chat-item-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-item-name { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-time { font-size: 12px; color: var(--text-dim); flex-shrink: 0; }
.chat-item-preview { display: flex; justify-content: space-between; gap: 8px; margin-top: 3px; }
.chat-item-last { font-size: 14px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  background: var(--accent); color: #04130e; font-size: 12px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ---------- CONVERSATION ---------- */
.conversation { flex: 1; display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px; color: var(--text-dim);
  border-bottom: 4px solid var(--accent);
}
.empty-logo { width: 120px; opacity: .5; margin-bottom: 20px; }
.empty-state h2 { color: var(--text); font-weight: 500; margin-bottom: 10px; }
.empty-state p { max-width: 420px; font-size: 14px; line-height: 1.5; }

.chat-view { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.pinned-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--panel-2); border-bottom: 1px solid var(--divider); border-left: 4px solid var(--accent); }
.pinned-icon { font-size: 16px; }
.pinned-body { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: pointer; }
.pinned-label { font-size: 12px; color: var(--accent); font-weight: 600; }
.pinned-text { font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mention { color: var(--accent); font-weight: 600; }
.star-label { color: #f0b232; font-size: 11px; }
.msg.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 100% { background: var(--bubble-in); } 30% { background: #3a4a52; } }
.msg.out.flash { animation: flashOut 1.2s ease; }
@keyframes flashOut { 0%, 100% { background: var(--bubble-out); } 30% { background: #0a7d68; } }
.mention-suggest { position: absolute; bottom: 64px; left: 14px; right: 14px; max-width: 360px;
  background: var(--panel-2); border-radius: 10px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  overflow: hidden; z-index: 20; }
.mention-opt { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer; }
.mention-opt:hover { background: var(--panel-3); }
.mention-user { color: var(--text-dim); font-size: 13px; margin-left: auto; }
.chat-header {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: var(--panel-2); border-left: 1px solid var(--divider);
}
.back-btn { display: none; font-size: 26px; }
.chat-header-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; }
.chat-header-title, .chat-header-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-actions { flex-shrink: 0; }
.chat-header-text { display: flex; flex-direction: column; }
.chat-header-title { font-weight: 600; font-size: 16px; }
.chat-header-sub { font-size: 12px; color: var(--text-dim); }
.chat-header-sub.typing { color: var(--accent); }

.messages {
  flex: 1; overflow-y: auto; padding: 16px 6%;
  display: flex; flex-direction: column; gap: 2px;
  background-image: linear-gradient(rgba(11,20,26,.94), rgba(11,20,26,.94));
}
.day-divider { align-self: center; background: var(--panel-2); color: var(--text-dim);
  font-size: 12px; padding: 5px 12px; border-radius: 8px; margin: 12px 0; }
.system-msg { align-self: center; background: var(--panel-2); color: var(--text-dim);
  font-size: 13px; padding: 6px 14px; border-radius: 8px; margin: 8px 0; text-align: center; }

.call-log { align-self: center; display: flex; align-items: center; gap: 10px;
  background: var(--panel-2); border-radius: 10px; padding: 8px 14px; margin: 6px 0;
  font-size: 14px; max-width: 80%; }
.call-log-icon { font-size: 18px; }
.call-log.missed .call-log-icon, .call-log.missed .call-log-text { color: var(--danger); }
.call-log-text { flex: 1; }
.call-log-time { color: var(--text-dim); font-size: 12px; }
.call-log-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--accent);
  color: #04130e; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.call-log-btn:hover { background: var(--accent-dark); }

.msg { max-width: 75%; padding: 6px 9px 8px; border-radius: 8px; position: relative;
  font-size: 14.5px; line-height: 1.4; word-wrap: break-word; }
.msg.in { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 2px; }
.msg.out { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 2px; }
.msg + .msg { margin-top: 2px; }
.msg-sender { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.msg-reply {
  border-left: 3px solid var(--accent); background: rgba(0,0,0,.18);
  padding: 4px 8px; border-radius: 4px; margin-bottom: 4px; font-size: 13px;
}
.msg-reply .rname { color: var(--accent); font-weight: 600; display: block; }
.msg-reply .rtext { color: var(--text-dim); }
.msg-body { white-space: pre-wrap; }
.msg-media img { max-width: 260px; border-radius: 6px; display: block; margin-bottom: 4px; cursor: pointer; }
.msg-file { display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.2);
  padding: 10px; border-radius: 6px; margin-bottom: 4px; text-decoration: none; color: var(--text); }
.msg-file .file-ic { font-size: 24px; }
.msg-deleted { font-style: italic; color: var(--text-dim); }
.msg-encrypted { font-style: italic; color: var(--text-dim); }
.msg-forwarded { font-size: 12.5px; color: var(--text-dim); font-style: italic; margin-bottom: 2px; }
.edited-label { font-style: italic; opacity: .8; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px;
  font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.msg.out .msg-meta { color: rgba(233,237,239,.6); }
.tick { font-size: 13px; }
.tick.read { color: #53bdeb; }
.tick.failed { color: var(--danger); cursor: pointer; }
.msg-reactions { display: flex; gap: 3px; position: absolute; bottom: -10px;
  right: 6px; background: var(--panel-3); border-radius: 10px; padding: 1px 6px; font-size: 12px;
  cursor: pointer; border: 1px solid var(--panel); }
.msg-reactions.mine { background: var(--bubble-out); }
.emoji-popup { position: fixed; z-index: 140; background: var(--panel-2); border-radius: 24px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5); padding: 6px 8px; display: flex; flex-wrap: wrap;
  gap: 2px; max-width: 280px; }
.emoji-opt { font-size: 22px; width: 38px; height: 38px; border-radius: 50%; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; }
.emoji-opt:hover { background: var(--panel-3); transform: scale(1.15); }
.msg-actions { position: absolute; top: 2px; right: 4px; opacity: 0; display: flex; gap: 2px; }
.msg:hover .msg-actions { opacity: 1; }
.msg-actions button { font-size: 13px; width: 24px; height: 22px; border-radius: 5px;
  background: rgba(0,0,0,.35); }
.msg-actions button:hover { background: rgba(0,0,0,.6); }

/* reply preview + composer */
.reply-preview { display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--panel-2); border-left: 3px solid var(--accent); }
.reply-preview-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.reply-preview-name { color: var(--accent); font-weight: 600; font-size: 13px; }
.reply-preview-text { color: var(--text-dim); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.block-banner { display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px; background: var(--panel-2); color: var(--text-dim); font-size: 14px; }
.block-banner button { color: var(--accent); font-weight: 600; }
.block-banner button:hover { text-decoration: underline; }
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; background: var(--panel-2);
  flex-wrap: nowrap; }
.composer textarea {
  flex: 1 1 auto; min-width: 0; resize: none; max-height: 120px; background: var(--panel-3);
  border: none; border-radius: 10px; padding: 11px 14px; color: var(--text);
  outline: none; line-height: 1.4;
}
.send-btn { background: var(--accent); color: #04130e; font-size: 18px; }
.send-btn:hover { background: var(--accent-dark); color: #04130e; }

/* ---------- MODALS ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border-radius: 14px; width: 100%; max-width: 420px;
  max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-header { padding: 16px 20px; background: var(--panel-2); display: flex;
  align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 17px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-body input[type=text], .modal-body input[type=search] {
  width: 100%; background: var(--panel-2); border: none; border-radius: 10px;
  padding: 12px 14px; color: var(--text); outline: none; margin-bottom: 12px;
}
.user-result { display: flex; align-items: center; gap: 12px; padding: 10px 6px;
  border-radius: 8px; cursor: pointer; }
.user-result:hover { background: var(--panel-2); }
.user-result-body { flex: 1; min-width: 0; }
.user-result-name { font-weight: 600; }
.user-result-sub { font-size: 13px; color: var(--text-dim); }
.user-result .check { color: var(--accent); font-size: 18px; }
.modal-footer { padding: 14px 20px; background: var(--panel); display: flex; gap: 10px; justify-content: flex-end; }
.modal-footer .btn-primary { margin: 0; padding: 10px 20px; }
.profile-avatar-big { width: 110px; height: 110px; border-radius: 50%; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 700;
  background: var(--accent) center/cover no-repeat; color: #04130e; }
.field-label { font-size: 13px; color: var(--accent); margin-bottom: 4px; }
.select-input { width: 100%; background: var(--panel-2); border: none; border-radius: 10px;
  padding: 11px 14px; color: var(--text); outline: none; }
.field-row { margin-bottom: 16px; }

/* ---------- HEADER ACTIONS / VOICE ---------- */
.chat-header-actions { display: flex; gap: 2px; }
.composer.recording textarea { display: none; }
.rec-indicator { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--danger);
  font-size: 14px; padding: 0 8px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
  animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
#mic-btn.recording { background: var(--danger); color: #fff; }
.msg-audio audio { height: 40px; max-width: 240px; }

/* ---------- CALL OVERLAY ---------- */
.call-overlay { position: fixed; inset: 0; z-index: 200; background: #04130e;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  background: #04130e; display: none; }
.call-overlay.video-call .call-remote { display: block; }
.call-local { position: absolute; bottom: 110px; right: 18px; width: 110px; height: 150px;
  object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.25);
  background: #000; display: none; z-index: 2; }
.call-overlay.video-call .call-local { display: block; }
.call-info { position: relative; z-index: 1; text-align: center; color: #fff; }
.call-overlay.video-call .call-info { position: absolute; top: 40px; }
.call-avatar { width: 130px; height: 130px; border-radius: 50%; margin: 0 auto 18px;
  background: var(--accent) center/cover no-repeat; display: flex; align-items: center;
  justify-content: center; font-size: 48px; font-weight: 700; color: #04130e; }
.call-overlay.video-call .call-avatar { display: none; }
.call-name { font-size: 24px; font-weight: 600; }
.call-status { font-size: 15px; color: var(--text-dim); margin-top: 6px; min-height: 20px; }
.call-controls { position: absolute; bottom: 36px; z-index: 3; display: flex; gap: 18px; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; font-size: 24px;
  background: rgba(255,255,255,.18); color: #fff; display: flex; align-items: center; justify-content: center; }
.call-btn:hover { background: rgba(255,255,255,.3); }
.call-btn.off { background: #fff; color: #04130e; }
.call-btn.accept { background: var(--accent); }
.call-btn.hangup { background: var(--danger); }

/* ---------- GROUP CALLS ---------- */
.gcall-overlay { position: fixed; inset: 0; z-index: 200; background: #04130e;
  display: flex; flex-direction: column; }
.gcall-grid { flex: 1; display: grid; gap: 6px; padding: 10px; align-content: center; }
.gcall-tile { position: relative; background: #000; border-radius: 12px; overflow: hidden;
  aspect-ratio: 3/4; max-height: 100%; }
.gcall-tile video { width: 100%; height: 100%; object-fit: cover; }
.gcall-name { position: absolute; bottom: 6px; left: 8px; color: #fff; font-size: 13px;
  background: rgba(0,0,0,.4); padding: 2px 8px; border-radius: 8px; }
.gcall-controls { display: flex; justify-content: center; gap: 18px; padding: 18px; }
.gcall-incoming { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 210; background: var(--panel-3); color: var(--text); padding: 14px 18px;
  border-radius: 14px; display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.5);
  flex-wrap: wrap; max-width: 92vw; }
.gcall-incoming .btn-primary { margin: 0; padding: 8px 18px; }
.gcall-dismiss { color: var(--text-dim); padding: 8px 14px; }

/* ---------- STATUS / STORIES ---------- */
.net-indicator.has-status, #status-btn.has-status { color: var(--accent); }
#status-btn.has-status { position: relative; }
.status-ring { display: inline-flex; border-radius: 50%; padding: 2px;
  background: var(--accent); }
.status-ring.seen { background: var(--panel-3); }
.status-ring .avatar { border: 2px solid var(--panel); }

.status-compose-preview { min-height: 200px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; padding: 16px; color: #fff; }
.status-compose-text { background: transparent; border: none; outline: none; color: #fff;
  text-align: center; font-size: 22px; width: 100%; resize: none; }
.status-compose-text::placeholder { color: rgba(255,255,255,.7); }
.status-swatches { display: flex; gap: 6px; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); }

.status-viewer { position: fixed; inset: 0; z-index: 200; background: #000;
  display: flex; flex-direction: column; }
.status-bars { display: flex; gap: 4px; padding: 10px 12px 4px; }
.status-bar { flex: 1; height: 3px; background: rgba(255,255,255,.3); border-radius: 2px; overflow: hidden; }
.status-bar-fill { display: block; height: 100%; width: 0; background: #fff; }
.status-viewer-head { display: flex; align-items: center; gap: 10px; padding: 6px 14px; color: #fff; }
.status-time { font-size: 12px; color: rgba(255,255,255,.7); }
.status-viewer-content { flex: 1; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; cursor: pointer; }
.status-text { color: #fff; font-size: 26px; text-align: center; padding: 24px; white-space: pre-wrap; }
.status-img { max-width: 100%; max-height: 100%; object-fit: contain; }
.status-caption { position: absolute; bottom: 24px; left: 0; right: 0; text-align: center;
  color: #fff; padding: 0 20px; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.status-viewer-foot { display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px; }
.status-viewers-btn, .status-del-btn { color: #fff; background: rgba(255,255,255,.18);
  padding: 8px 18px; border-radius: 20px; font-size: 15px; }
.status-viewers-btn:hover, .status-del-btn:hover { background: rgba(255,255,255,.3); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--panel-3); color: var(--text); padding: 12px 20px; border-radius: 24px;
  font-size: 14px; z-index: 100; box-shadow: 0 6px 24px rgba(0,0,0,.4); }

/* ---------- MEDIA DOWNLOAD PLACEHOLDER ---------- */
.media-download-btn {
  background: rgba(0,0,0,.25); color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  padding: 22px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  width: 220px; max-width: 60vw; display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .12s ease;
}
.media-download-btn:hover { background: rgba(0,0,0,.42); }

/* ---------- FOLDER TABS (Telegram-style chat filters) ---------- */
.folder-tabs { display: flex; gap: 6px; padding: 2px 12px 8px; overflow-x: auto; background: var(--panel); }
.folder-tab { padding: 6px 14px; border-radius: 16px; font-size: 13px; font-weight: 600;
  color: var(--text-dim); background: var(--panel-2); white-space: nowrap; flex-shrink: 0;
  transition: background .12s, color .12s; }
.folder-tab.active { background: var(--accent); color: #04130e; }

/* ---------- POLLS ---------- */
.poll { min-width: 220px; max-width: 320px; }
.poll-q { font-weight: 600; margin-bottom: 8px; }
.poll-opt { position: relative; padding: 9px 34px 9px 12px; border-radius: 8px; margin-bottom: 6px;
  background: rgba(0,0,0,.18); cursor: pointer; overflow: hidden; }
.poll-opt.voted { outline: 1px solid var(--accent); }
.poll-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(0,168,132,.28);
  transition: width .3s ease; }
.poll-opt-label { position: relative; z-index: 1; font-size: 14px; }
.poll-opt-count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 1;
  font-size: 12px; color: var(--text-dim); }
.poll-total { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

/* ---------- PREMIUM POLISH ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a52; }
::-webkit-scrollbar-track { background: transparent; }

.msg { box-shadow: 0 1px 1.5px rgba(0,0,0,.2); }
.chat-item { transition: background .12s ease; }
.send-btn, .btn-primary, .auth-tab, .call-btn, .fab { transition: background .12s ease, transform .1s ease, color .12s; }
.send-btn:active, .fab:active { transform: scale(.93); }
.modal { box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.sidebar-header { box-shadow: 0 1px 0 rgba(0,0,0,.25); position: relative; z-index: 2; }
.avatar-btn { transition: box-shadow .15s ease; }
.avatar-btn:hover { box-shadow: 0 0 0 2px rgba(0,168,132,.55); }
.auth-card { border: 1px solid rgba(255,255,255,.04); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  .sidebar { width: 100%; max-width: none; min-width: 0; }
  .app.in-chat .sidebar { display: none; }
  .app:not(.in-chat) .conversation { display: none; }
  .back-btn { display: inline-flex; }
  .msg { max-width: 85%; }
}
