:root {
  --blue:#0084ff;
  --blue2:#35a8ff;
  --green:#25d366;
  --bg:#eef2f7;
  --dark:#111827;
  --muted:#6b7280;
  --white:#ffffff;
  --other:#f1f3f5;
  --danger:#ef4444;
}

*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;width:100%;height:100%;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;background:radial-gradient(circle at top left,rgba(0,132,255,.2),transparent 30%),radial-gradient(circle at bottom right,rgba(37,211,102,.15),transparent 30%),var(--bg);color:var(--dark)}
button,input{font-family:inherit}
.auth-page{min-height:100dvh;display:grid;place-items:center;padding:20px}
.auth-card{width:100%;max-width:410px;padding:34px;border-radius:32px;background:rgba(255,255,255,.92);backdrop-filter:blur(20px);box-shadow:0 30px 90px rgba(15,23,42,.22);border:1px solid rgba(255,255,255,.72)}
.brand{width:76px;height:76px;border-radius:24px;background:linear-gradient(135deg,var(--blue),#7bc6ff);display:grid;place-items:center;font-size:34px;box-shadow:0 16px 30px rgba(0,132,255,.3);margin-bottom:18px}
.auth-card h1{margin:0;font-size:31px;letter-spacing:-.7px}.auth-card p{margin:8px 0 24px;color:var(--muted);font-size:14px}.auth-card label,.modal-card label{display:block;font-size:13px;font-weight:800;color:#374151;margin:12px 0 7px}.auth-card input,.modal-card input{width:100%;padding:15px 16px;border:1px solid #dbe2ea;border-radius:17px;outline:0;background:#f8fafc;font-size:15px;transition:.18s}.auth-card input:focus,.modal-card input:focus{border-color:var(--blue);background:#fff;box-shadow:0 0 0 4px rgba(0,132,255,.12)}.auth-card button,.modal-actions button{width:100%;padding:15px;border:0;border-radius:17px;background:linear-gradient(135deg,var(--blue),var(--blue2));color:white;font-weight:900;font-size:15px;cursor:pointer;margin-top:16px;box-shadow:0 14px 28px rgba(0,132,255,.25)}.error{color:var(--danger);font-size:14px;margin-top:12px;min-height:18px}
.chat-app{display:none;width:min(100%,540px);height:100dvh;margin:auto;background:#fff;flex-direction:column;box-shadow:0 0 60px rgba(15,23,42,.16);overflow:hidden}.topbar{height:76px;flex:0 0 76px;padding:12px 15px;border-bottom:1px solid #e5e7eb;background:rgba(255,255,255,.94);backdrop-filter:blur(18px);display:flex;align-items:center;justify-content:space-between;z-index:4}.profile{display:flex;align-items:center;gap:12px;min-width:0}.profile-text{min-width:0}.avatar-wrap{position:relative;flex:0 0 auto}.avatar-img{width:50px;height:50px;border-radius:18px;object-fit:cover;background:#dbeafe;display:block;box-shadow:0 10px 22px rgba(0,132,255,.15)}.dot{position:absolute;right:-2px;bottom:0;width:13px;height:13px;border-radius:50%;background:#9ca3af;border:2px solid #fff}.dot.online{background:var(--green)}.profile h3{margin:0;font-size:17px;font-weight:900;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.profile small{display:block;margin-top:2px;color:var(--muted);font-size:12px}.profile small.online{color:#16a34a;font-weight:800}.actions{display:flex;gap:7px}.actions button{width:38px;height:38px;border:0;border-radius:14px;background:#f3f4f6;cursor:pointer;font-size:15px;transition:.15s}.actions button:hover{background:#e5e7eb;transform:translateY(-1px)}
.messages{flex:1;overflow-y:auto;padding:16px 12px;background:linear-gradient(rgba(255,255,255,.88),rgba(255,255,255,.88)),radial-gradient(circle at top left,rgba(0,132,255,.1),transparent 34%),radial-gradient(circle at bottom right,rgba(37,211,102,.1),transparent 34%);scroll-behavior:smooth}.message-row{display:flex;margin:8px 0;animation:pop .16s ease}.message-row.me{justify-content:flex-end}.message-row.other{justify-content:flex-start;align-items:flex-end;gap:7px}@keyframes pop{from{opacity:0;transform:translateY(4px) scale(.98)}to{opacity:1;transform:none}}.stack{max-width:78%}.mini-pp{width:29px;height:29px;border-radius:50%;object-fit:cover;align-self:flex-end;box-shadow:0 2px 8px rgba(0,0,0,.08)}.bubble{padding:10px 13px 7px;border-radius:22px;box-shadow:0 2px 8px rgba(15,23,42,.06);word-break:break-word;font-size:15px;line-height:1.42}.me .bubble{background:linear-gradient(135deg,var(--blue),#006fe0);color:#fff;border-bottom-right-radius:7px}.other .bubble{background:var(--other);color:#111827;border-bottom-left-radius:7px}.chat-image{max-width:245px;width:100%;border-radius:16px;display:block;margin-bottom:6px;background:#e5e7eb}.footer{display:flex;align-items:center;justify-content:flex-end;gap:5px;font-size:10.5px;opacity:.85;margin-top:5px;white-space:nowrap}.status{font-size:12px;letter-spacing:-1px}.status.seen{color:#bfe7ff;font-weight:900}.seen-label{text-align:right;font-size:11px;color:var(--muted);margin:4px 8px 0 0}.empty{text-align:center;color:var(--muted);margin-top:45%;font-size:14px}.date-pill{width:fit-content;margin:14px auto;padding:6px 12px;font-size:11px;background:rgba(255,255,255,.86);border:1px solid #e5e7eb;border-radius:999px;color:var(--muted)}
.typing-indicator{display:none;align-items:flex-end;gap:8px;padding:0 17px 7px;background:#fff}.typing-avatar{width:27px;height:27px;border-radius:50%;object-fit:cover}.typing-bubble{display:flex;gap:4px;background:#f1f3f5;border-radius:16px;padding:10px 12px}.typing-bubble span{width:7px;height:7px;background:#9ca3af;border-radius:50%;animation:typingBounce 1s infinite ease-in-out}.typing-bubble span:nth-child(2){animation-delay:.15s}.typing-bubble span:nth-child(3){animation-delay:.3s}@keyframes typingBounce{0%,80%,100%{transform:scale(.8);opacity:.5}40%{transform:scale(1.2);opacity:1}}
.composer{flex:0 0 auto;display:flex;gap:8px;padding:10px 12px calc(10px + env(safe-area-inset-bottom));border-top:1px solid #e5e7eb;background:rgba(255,255,255,.96)}.composer input{flex:1;border:0;outline:0;background:#f1f5f9;padding:14px 17px;border-radius:999px;font-size:15px}.composer input:focus{background:#eef6ff;box-shadow:inset 0 0 0 1px rgba(0,132,255,.25)}.composer button{width:48px;height:48px;border:0;border-radius:50%;cursor:pointer}.attach{background:#eef2f7;font-size:24px;color:#374151}.send{background:linear-gradient(135deg,var(--blue),var(--blue2));color:#fff;font-size:18px;box-shadow:0 10px 20px rgba(0,132,255,.25)}
.modal{position:fixed;inset:0;background:rgba(15,23,42,.55);display:none;place-items:center;padding:20px;z-index:99}.modal-card{width:100%;max-width:430px;background:#fff;border-radius:28px;padding:24px;box-shadow:0 30px 90px rgba(0,0,0,.28)}.modal-head{display:flex;align-items:center;justify-content:space-between}.modal-head h2{margin:0 0 10px;font-size:24px}.modal-head button{width:36px;height:36px;border:0;border-radius:12px;background:#f3f4f6;font-size:24px;cursor:pointer}.modal-actions{display:flex;gap:10px}.modal-actions .cancel{background:#6b7280;box-shadow:none}
@media(max-width:640px){body{background:#fff}.chat-app{width:100%;box-shadow:none}.auth-card{padding:28px 22px;border-radius:28px}.stack{max-width:84%}.chat-image{max-width:220px}.topbar{height:72px;flex-basis:72px}.avatar-img{width:46px;height:46px;border-radius:16px}.actions button{width:36px;height:36px}.modal-card{border-radius:24px}}
