:root{
  --bg:#f0f2f5;
  --card:#ffffff;
  --accent:#25d366;
  --accent-dark:#1fa855;
  --muted:#6b7280;
  --glass:rgba(0,0,0,0.04);
  --sidebar:#f8fafb;
  --border:rgba(15,23,36,0.08);
}
*{box-sizing:border-box;font-family:Inter,Segoe UI,Roboto,Arial,sans-serif}
html,body,#app{height:100%}
body{margin:0;background:var(--bg);color:#0f1724}
.app{max-width:1200px;margin:20px auto;padding:16px;border-radius:14px;background:var(--card);box-shadow:0 6px 20px rgba(15,23,36,0.08)}
header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}
header h1{margin:0;font-weight:600}
.controls{display:flex;gap:8px;align-items:center}
select,input,button{padding:8px 10px;border-radius:8px;border:1px solid rgba(15,23,36,0.06);background:transparent;color:inherit}
.topbar{background:#f6f7f8;border:1px solid var(--border);border-radius:12px;padding:10px 12px;margin-bottom:12px}
.presence-status{min-width:200px;text-align:right;color:var(--muted);font-size:12px;display:flex;align-items:center;justify-content:flex-end;gap:8px}
.presence-dot{width:10px;height:10px;border-radius:50%;background:#e2e8f0;border:1px solid rgba(15,23,36,0.1)}
.presence-dot.online{background:#22c55e;border-color:#16a34a}
.presence-typing{color:#0b6ef3}
.layout{display:flex;gap:0;border:1px solid var(--border);border-radius:14px;overflow:hidden;min-height:620px}
.sidebar{width:320px;background:var(--sidebar);border-right:1px solid var(--border);display:flex;flex-direction:column}
.sidebar-header{padding:14px 16px;border-bottom:1px solid var(--border);background:#ffffff}
.sidebar-list{overflow:auto;flex:1}
.chat{flex:1;display:flex;flex-direction:column;position:relative;background:#efeae2}
.messages{flex:1;padding:18px;background:#efeae2;overflow:auto}
.empty-state{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:14px;background:#efeae2}
.msg{padding:8px 10px;margin-bottom:8px;border-radius:10px;max-width:75%;box-shadow:0 1px 2px rgba(0,0,0,0.04)}
.msg.me{background:#d9fdd3;margin-left:auto;border:1px solid rgba(31,168,85,0.12)}
.msg.other{background:#ffffff;border:1px solid rgba(15,23,36,0.06)}
.meta{width:360px}
/* message internals */
.msg .who{font-size:12px;color:var(--muted);margin-bottom:6px}
.msg .txt{font-size:15px;line-height:1.4}
.msg .t{font-size:11px;color:var(--muted);margin-top:6px;text-align:right}
.attachment{margin-top:8px}
.attachment a{color:var(--accent);text-decoration:none}
.attachment img.thumb{width:100px;height:70px;object-fit:cover;border-radius:8px;margin-right:8px;border:1px solid rgba(15,23,36,0.06)}

/* Attachment strip in composer */
.attachment-strip{display:flex;flex-direction:column;gap:8px;padding:6px;overflow-y:auto;width:68px;flex:0 0 68px;border-radius:8px}
.attachment-strip .att{position:relative;display:flex;align-items:center;justify-content:center}
.attachment-strip .att img{width:56px;height:56px;border-radius:8px;object-fit:cover;border:1px solid rgba(15,23,36,0.06)}
.attachment-strip .att .rm{position:absolute;top:-6px;right:-6px;background:#fff;border-radius:50%;width:18px;height:18px;display:flex;align-items:center;justify-content:center;border:1px solid rgba(15,23,36,0.06);cursor:pointer;font-size:12px}

.composer{display:flex;align-items:flex-end;gap:12px;background:#f0f2f5;padding:10px;border-top:1px solid var(--border)}
.composer-row{display:flex;align-items:center;gap:8px;padding:8px;border-radius:12px;background:#ffffff;flex:1;border:1px solid var(--border)}
.composer-row input[type="text"], .composer-row input[type="search"], .composer-row input{flex:1;padding:12px 14px;border-radius:20px;border:1px solid #e5e7eb;background:#f9fafb}
.attach-btn{width:44px;height:44px;border-radius:10px;background:transparent;border:1px dashed rgba(15,23,36,0.12);font-size:22px;color:var(--accent);cursor:pointer}
.attach-btn{display:none}
.send-btn{width:44px;height:44px;border-radius:10px;background:var(--accent);border:0;color:#fff;font-weight:700;cursor:pointer}
.send-btn:hover{background:var(--accent-dark)}
pre{background:#f1f5f9;padding:12px;border-radius:8px;overflow:auto;max-height:480px}
.composer{display:flex;gap:8px;margin-top:8px}
footer{margin-top:10px;text-align:center;color:var(--muted)}

/* Login overlay */
.login-overlay{position:fixed;inset:0;background:rgba(255,255,255,0.6);display:flex;align-items:center;justify-content:center;z-index:40}
.login-topbar{position:absolute;top:16px;right:16px;z-index:41}
.login-card{width:420px;padding:22px;border-radius:12px;background:var(--card);box-shadow:0 8px 40px rgba(15,23,36,0.06);text-align:center}
.login-card .logo{font-weight:700;font-size:20px;margin-bottom:8px}
.login-card h2{margin:6px 0 12px}
.login-form input{width:100%;margin:8px 0;padding:10px;border-radius:8px;border:1px solid rgba(15,23,36,0.06);background:transparent;color:inherit}
.login-actions{display:flex;gap:8px;justify-content:center;margin-top:10px}
.login-actions button{padding:8px 12px;border-radius:8px;border:0;background:var(--accent);color:#ffffff;cursor:pointer}
.feedback{margin-top:8px;color:var(--muted);font-size:13px}

/* Admin list items */
.admin-item{gap:12px;cursor:pointer;background:#ffffff;border-bottom:1px solid var(--border);transition:background 0.2s ease}
.admin-item:hover{background:#f6f7f8}
.admin-item .avatar{width:44px;height:44px;border-radius:50%;object-fit:cover;border:1px solid var(--border)}
.admin-item .badge{border-radius:999px}
.admin-item .typing-indicator{color:#0b6ef3;font-size:12px}
.status-col{min-width:54px;display:flex;align-items:center;justify-content:flex-end;gap:8px}
.status-dot{width:10px;height:10px;border-radius:50%;background:#e2e8f0;border:1px solid rgba(15,23,36,0.1)}
.status-dot.online{background:#22c55e;border-color:#16a34a}
