/* Digital Messenger — design tokens */
:root {
  --space: #070A14;        /* Deep Space */
  --panel: #0D1222;        /* Graphite Night */
  --panel-2: #121A2E;
  --line: #1E2842;
  --line-2: #2A3658;
  --ice: #E8F1FF;          /* Ice */
  --mist: #8E9BBF;         /* Mist */
  --mist-2: #5E6B90;
  --cyan: #00E5FF;         /* Pulse Cyan */
  --indigo: #5B6CFF;       /* Volt Indigo */
  --violet: #B14DFF;       /* Neon Violet */
  --mint: #00F5A0;         /* Signal Mint */
  --danger: #FF4D6D;
  --grad: linear-gradient(135deg, var(--cyan) 0%, var(--indigo) 50%, var(--violet) 100%);
  --grad-soft: linear-gradient(135deg, rgba(0,229,255,.16), rgba(91,108,255,.16) 50%, rgba(177,77,255,.16));
  --r: 14px; --r-lg: 20px;
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --display: 'Space Grotesk', 'Manrope', var(--font);
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--space); color: var(--ice); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--cyan); }
::selection { background: rgba(91,108,255,.5); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.muted { color: var(--mist); }
i[data-i] { display: inline-flex; width: 20px; height: 20px; flex: none; }
i[data-i] svg { width: 100%; height: 100%; }

/* wordmark */
.wordmark { font-family: var(--display); font-size: 19px; letter-spacing: -.02em; line-height: 1; display: inline-flex; gap: 1px; }
.wordmark span { font-weight: 500; color: var(--mist); }
.wordmark b { font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark.big { font-size: clamp(34px, 5vw, 56px); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 12px; font-weight: 600; transition: transform .15s, box-shadow .2s, background .2s; }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 28px -8px rgba(91,108,255,.7); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px -8px rgba(91,108,255,.9); }
.btn.ghost { background: var(--panel-2); border: 1px solid var(--line-2); }
.btn.ghost:hover { border-color: var(--indigo); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .6; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center; color: var(--mist); transition: background .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--panel-2); color: var(--ice); }
.icon-btn.accent { color: var(--cyan); }
.link-btn { color: var(--mist); font-size: 13px; text-decoration: underline; }

/* fields */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--mist); }
.field input, .field textarea { width: 100%; background: var(--space); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; outline: none; resize: none; transition: border-color .15s, box-shadow .15s; }
.field input:focus, .field textarea:focus { border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(91,108,255,.18); }

/* ================= AUTH ================= */
.auth { position: fixed; inset: 0; display: grid; grid-template-columns: 1.1fr minmax(320px, 420px); align-items: center; gap: 48px; padding: 48px clamp(20px, 6vw, 96px); overflow: auto; }
.auth-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.auth-bg .grid { position: absolute; inset: -50%; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 48px 48px; transform: perspective(600px) rotateX(55deg) translateY(-10%); mask-image: radial-gradient(ellipse at 50% 60%, #000 10%, transparent 60%); opacity: .55; animation: gridmove 12s linear infinite; }
@keyframes gridmove { to { background-position: 0 48px, 0 0; } }
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5; }
.orb.o1 { width: 480px; height: 480px; background: var(--indigo); top: -120px; left: -80px; }
.orb.o2 { width: 420px; height: 420px; background: var(--violet); bottom: -140px; right: 10%; opacity: .35; }
.auth-logo { display: block; width: 96px; height: 96px; filter: drop-shadow(0 16px 40px rgba(91,108,255,.6)); margin-bottom: 24px; animation: float 5s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px); } }
.tagline { font-family: var(--display); font-size: clamp(20px, 2.4vw, 28px); color: var(--ice); margin: 14px 0 28px; }
.features { list-style: none; padding: 0; margin: 0 0 32px; display: grid; gap: 12px; }
.features li { display: flex; align-items: center; gap: 12px; color: var(--mist); }
.features i { width: 36px; height: 36px; padding: 8px; border-radius: 10px; background: var(--grad-soft); border: 1px solid var(--line-2); color: var(--cyan); }
.byline { font-family: var(--mono); font-size: 13px; color: var(--mist-2); }
.byline b { color: var(--mist); font-weight: 500; }
.auth-card { background: rgba(13,18,34,.82); backdrop-filter: blur(20px); border: 1px solid var(--line-2); border-radius: 24px; padding: 28px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.6); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--space); border-radius: 12px; padding: 4px; margin-bottom: 22px; border: 1px solid var(--line); }
.tab { height: 38px; border-radius: 9px; color: var(--mist); font-weight: 600; }
.tab.active { background: var(--panel-2); color: var(--ice); box-shadow: inset 0 0 0 1px var(--line-2); }
.auth-card:not(.register) .reg-only { display: none; }
.form-error { color: var(--danger); font-size: 14px; min-height: 20px; margin: 0 0 8px; }
.fine { font-size: 12px; color: var(--mist-2); text-align: center; margin: 14px 0 0; }

/* ================= APP LAYOUT ================= */
.app { position: fixed; inset: 0; display: grid; grid-template-columns: 72px 340px 1fr auto; }
.rail { background: var(--space); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 8px; }
.rail-logo { width: 40px; height: 40px; margin-bottom: 14px; filter: drop-shadow(0 6px 16px rgba(91,108,255,.5)); }
.rail-btn { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--mist-2); transition: .15s; }
.rail-btn:hover { color: var(--ice); background: var(--panel-2); }
.rail-btn.active { color: var(--cyan); background: var(--grad-soft); box-shadow: inset 0 0 0 1px var(--line-2); }
.rail-spacer { flex: 1; }
.rail-me { border-radius: 50%; padding: 0; margin-top: 6px; }

.sidebar { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.sb-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 14px; min-height: 68px; }
.search { margin: 0 14px 10px; display: flex; align-items: center; gap: 10px; background: var(--space); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; color: var(--mist-2); }
.search:focus-within { border-color: var(--indigo); }
.search input { flex: 1; height: 42px; background: none; border: 0; outline: none; min-width: 0; }
.sb-label { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mist-2); padding: 8px 20px; }
.chat-list { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; cursor: pointer; transition: background .12s; position: relative; }
.chat-item:hover { background: var(--panel-2); }
.chat-item.active { background: var(--grad-soft); box-shadow: inset 0 0 0 1px var(--line-2); }
.ci-main { flex: 1; min-width: 0; }
.ci-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ci-top b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-top time { font: 500 11px var(--mono); color: var(--mist-2); flex: none; }
.ci-bottom { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-top: 2px; }
.ci-bottom p { margin: 0; color: var(--mist); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-bottom p.typing { color: var(--cyan); }
.badge { background: var(--grad); color: #fff; font: 600 11px var(--mono); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.sb-foot { padding: 12px 20px; font: 500 11px var(--mono); color: var(--mist-2); border-top: 1px solid var(--line); letter-spacing: .04em; }
.sb-empty { color: var(--mist-2); text-align: center; padding: 30px 20px; font-size: 14px; }

/* avatar */
.avatar { position: relative; width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; font: 600 16px var(--display); color: #fff; background-size: cover; background-position: center; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.xl { width: 96px; height: 96px; font-size: 34px; }
.avatar.xxl { width: 132px; height: 132px; font-size: 46px; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 10px; min-height: 10px; border-radius: 50%; background: var(--mint); border: 2.5px solid var(--panel); box-shadow: 0 0 10px var(--mint); }
.avatar-slot { display: inline-flex; }

/* ================= CHAT ================= */
.chat { position: relative; min-width: 0; display: flex; flex-direction: column; background: radial-gradient(circle at 70% 0%, rgba(91,108,255,.08), transparent 50%), var(--space); }
.empty { margin: auto; text-align: center; max-width: 360px; padding: 20px; }
.empty-logo { width: 88px; opacity: .9; filter: drop-shadow(0 18px 40px rgba(91,108,255,.45)); }
.empty h2 { font: 600 24px var(--display); margin: 20px 0 8px; }
.empty p { color: var(--mist); margin: 0; }
.conv { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.conv-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: rgba(13,18,34,.7); backdrop-filter: blur(14px); min-height: 68px; }
.peer { display: flex; align-items: center; gap: 12px; text-align: left; min-width: 0; flex: 1; border-radius: 12px; padding: 4px; }
.peer-meta { display: grid; min-width: 0; }
.peer-meta b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-meta small { color: var(--mist); font-size: 12.5px; }
.peer-meta small.on { color: var(--mint); }
.peer-meta small.typing { color: var(--cyan); }
.conv-actions { display: flex; gap: 4px; }

.messages { flex: 1; overflow-y: auto; padding: 20px clamp(12px, 4vw, 48px) 10px; display: flex; flex-direction: column; gap: 3px; }
.day { align-self: center; font: 500 11px var(--mono); color: var(--mist); background: var(--panel); border: 1px solid var(--line); padding: 4px 12px; border-radius: 20px; margin: 14px 0 10px; letter-spacing: .05em; }
.msg { max-width: min(560px, 78%); align-self: flex-start; display: flex; flex-direction: column; animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.msg.me { align-self: flex-end; align-items: flex-end; }
.bubble { background: var(--panel-2); border: 1px solid var(--line); padding: 8px 12px 6px; border-radius: 18px 18px 18px 6px; position: relative; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.me .bubble { background: linear-gradient(135deg, #2B4BFF 0%, #5B6CFF 55%, #8F4DFF 100%); border-color: transparent; border-radius: 18px 18px 6px 18px; box-shadow: 0 6px 20px -10px rgba(91,108,255,.8); }
.msg.cont .bubble { border-top-left-radius: 6px; }
.msg.me.cont .bubble { border-top-right-radius: 6px; border-top-left-radius: 18px; }
.msg:not(.cont) { margin-top: 8px; }
.bubble .text { white-space: pre-wrap; }
.bubble .text a { color: inherit; text-decoration: underline; }
.meta { display: inline-flex; gap: 4px; align-items: center; float: right; margin: 6px 0 -2px 10px; font: 500 10.5px var(--mono); color: rgba(232,241,255,.55); }
.msg.me .meta { color: rgba(255,255,255,.75); }
.ticks { width: 16px; height: 12px; }
.ticks.read { color: var(--cyan); filter: drop-shadow(0 0 4px rgba(0,229,255,.7)); }
.bubble.media { padding: 4px; }
.bubble.media .text { padding: 6px 8px 0; }
.bubble.media .meta { margin-right: 6px; }
.media-img, .media-vid { display: block; border-radius: 14px; max-width: 100%; max-height: 360px; min-width: 120px; min-height: 80px; object-fit: cover; cursor: zoom-in; background: var(--space); }
.media-vid { cursor: default; }
.file-card { display: flex; gap: 12px; align-items: center; padding: 8px 6px; text-decoration: none; color: inherit; min-width: 220px; }
.file-card .fi { width: 42px; height: 42px; border-radius: 12px; background: rgba(255,255,255,.12); display: grid; place-items: center; flex: none; }
.file-card b { display: block; font-weight: 600; font-size: 14px; word-break: break-all; }
.file-card small { font: 500 11px var(--mono); opacity: .7; }
.call-pill { align-self: center; display: inline-flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line-2); padding: 8px 14px; border-radius: 14px; margin: 10px 0; font-size: 13.5px; }
.call-pill i { color: var(--mint); }
.call-pill.missed i { color: var(--danger); }
.call-pill small { font: 500 11px var(--mono); color: var(--mist); }
.call-pill button { color: var(--cyan); font-weight: 600; font-size: 13px; }
.msg.pending { opacity: .6; }

.drop-hint { position: absolute; inset: 68px 0 0; background: rgba(7,10,20,.85); border: 2px dashed var(--indigo); border-radius: 20px; margin: 12px; display: none; place-items: center; align-content: center; gap: 12px; font: 600 18px var(--display); color: var(--cyan); z-index: 5; }
.drop-hint i { width: 48px; height: 48px; }
.conv.dragging .drop-hint { display: grid; }
.uploads { padding: 0 16px; display: grid; gap: 6px; }
.up-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mist); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.up-item .bar { flex: 1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.up-item .bar > div { height: 100%; width: 0; background: var(--grad); transition: width .15s; }
.up-item span { max-width: 40%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(13,18,34,.7); backdrop-filter: blur(14px); }
.input-wrap { flex: 1; position: relative; display: flex; align-items: flex-end; background: var(--space); border: 1px solid var(--line-2); border-radius: 16px; transition: border-color .15s, box-shadow .15s; }
.input-wrap:focus-within { border-color: var(--indigo); box-shadow: 0 0 0 4px rgba(91,108,255,.15); }
.input-wrap textarea { flex: 1; background: none; border: 0; outline: none; resize: none; padding: 11px 14px; max-height: 160px; line-height: 1.4; min-width: 0; }
.emoji-btn { width: 40px; height: 42px; font-size: 19px; filter: grayscale(.3); flex: none; }
.emoji-btn:hover { filter: none; }
.emoji-pop { position: absolute; bottom: 52px; right: 0; width: 300px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; box-shadow: 0 20px 50px -10px rgba(0,0,0,.6); z-index: 10; }
.emoji-pop button { font-size: 21px; height: 34px; border-radius: 8px; }
.emoji-pop button:hover { background: var(--panel-2); }
.send-btn { width: 44px; height: 44px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 8px 22px -8px rgba(91,108,255,.9); transition: transform .12s; }
.send-btn:hover { transform: scale(1.05); }
.send-btn:active { transform: scale(.95); }

/* drawer */
.drawer { width: 320px; background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.drawer > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 14px 20px; border-bottom: 1px solid var(--line); min-height: 68px; }
.drawer-body { overflow-y: auto; padding: 24px 20px; }
.dr-hero { text-align: center; }
.dr-hero .avatar { margin: 0 auto 14px; }
.dr-hero h3 { font: 600 22px var(--display); margin: 0; }
.dr-hero .mono { color: var(--mist); font-size: 12.5px; margin-top: 4px; }
.dr-bio { background: var(--space); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin: 18px 0; color: var(--mist); white-space: pre-wrap; }
.dr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0; }
.dr-title { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--mist-2); margin: 20px 0 10px; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.gallery > * { aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--space) center/cover; cursor: pointer; position: relative; }
.gallery video { width: 100%; height: 100%; object-fit: cover; }
.gallery .play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(0,0,0,.25); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(4,6,12,.7); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 24px; padding: 20px 24px 24px; max-height: 100%; overflow-y: auto; }
.modal-card > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font: 600 18px var(--display); }
.pf-avatar { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 18px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.1); }
.swatches button.on { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ice); }
.row { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(4,6,12,.94); z-index: 60; display: grid; place-items: center; padding: 24px; }
.lb-body img, .lb-body video { max-width: 92vw; max-height: 88vh; border-radius: 12px; }
.lb-close { position: absolute; top: 16px; right: 16px; background: var(--panel-2); color: var(--ice); }

/* ================= CALL ================= */
.call { position: fixed; inset: 0; z-index: 80; background: radial-gradient(circle at 50% 30%, #18204A 0%, var(--space) 70%); overflow: hidden; }
.call #remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .3s; }
.call.has-remote-video #remoteVideo { opacity: 1; }
.call.has-remote-video .call-veil { opacity: 0; pointer-events: none; }
.call-veil { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; transition: opacity .3s; padding: 20px; text-align: center; }
.call-veil h2 { font: 600 30px var(--display); margin: 22px 0 0; }
.call-veil p { color: var(--mist); margin: 0; font-size: 14px; }
.call-ring { position: relative; border-radius: 50%; }
.call-ring::before, .call-ring::after { content: ''; position: absolute; inset: -14px; border-radius: 50%; border: 2px solid var(--indigo); opacity: 0; }
.call.ringing .call-ring::before, .call.ringing .call-ring::after { animation: ring 2s ease-out infinite; }
.call.ringing .call-ring::after { animation-delay: 1s; border-color: var(--cyan); }
@keyframes ring { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
.call-ring .avatar { box-shadow: 0 0 0 4px rgba(255,255,255,.06), 0 20px 60px -10px rgba(91,108,255,.8); }
.call-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: calc(16px + env(safe-area-inset-top)) 20px 16px; background: linear-gradient(rgba(0,0,0,.45), transparent); }
.call-top img { width: 28px; }
.call-top .mono { font-size: 14px; }
.call-badge { margin-left: auto; font: 500 11px var(--mono); color: var(--mint); border: 1px solid rgba(0,245,160,.35); background: rgba(0,245,160,.08); padding: 4px 10px; border-radius: 20px; }
.pip { position: absolute; right: 20px; bottom: 120px; width: min(240px, 32vw); aspect-ratio: 3/4; object-fit: cover; border-radius: 18px; border: 2px solid rgba(255,255,255,.15); box-shadow: 0 20px 50px -10px rgba(0,0,0,.7); transform: scaleX(-1); background: #000; }
.pip.screen { transform: none; aspect-ratio: 16/10; }
.call-controls { position: absolute; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 14px; padding: 12px; border-radius: 28px; background: rgba(13,18,34,.7); backdrop-filter: blur(16px); border: 1px solid var(--line-2); }
.cc { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); color: var(--ice); transition: .15s; }
.cc i { width: 24px; height: 24px; }
.cc:hover { background: var(--line-2); }
.cc.off { background: var(--ice); color: var(--space); }
.cc.on { background: var(--grad); color: #fff; }
.cc.end { background: var(--danger); color: #fff; box-shadow: 0 10px 30px -8px rgba(255,77,109,.8); }
.cc.ok { background: var(--mint); color: #04261A; box-shadow: 0 10px 30px -8px rgba(0,245,160,.7); animation: bob 1.2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* toasts */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 12px 16px; box-shadow: 0 20px 40px -10px rgba(0,0,0,.6); animation: pop .2s; font-size: 14px; display: flex; gap: 10px; align-items: center; cursor: pointer; }
.toast .avatar { width: 32px; height: 32px; font-size: 12px; }
.toast b { display: block; }
.toast p { margin: 0; color: var(--mist); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }

.mobile-only { display: none; }

/* ================= RESPONSIVE ================= */
@media (max-width: 1180px) {
  .app { grid-template-columns: 72px 300px 1fr; }
  .drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: -20px 0 60px rgba(0,0,0,.5); max-width: 100vw; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; gap: 28px; padding: 32px 16px; align-content: start; }
  .auth-hero { text-align: center; }
  .auth-logo { width: 72px; height: 72px; margin: 0 auto 16px; }
  .features { display: none; }
  .tagline { margin-bottom: 8px; }
  .auth-card { padding: 22px 18px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .mobile-only { display: inline-grid; }
  .sidebar, .chat { grid-column: 1; grid-row: 1; }
  .app.in-chat .sidebar { display: none; }
  .app:not(.in-chat) .chat { display: none; }
  .sb-head { padding-top: calc(16px + env(safe-area-inset-top)); }
  .conv-head { padding: calc(8px + env(safe-area-inset-top)) 8px 8px; }
  .msg { max-width: 86%; }
  .drawer { width: 100%; }
  .pip { width: 110px; right: 12px; bottom: 116px; top: auto; }
  .call-controls { gap: 10px; padding: 10px; }
  .cc { width: 52px; height: 52px; }
  #ccScreen { display: none; }
}
