:root{
  --bg:#0b1220;
  --panel:#0f1a33;
  --panel-2:#101a30;
  --border:rgba(255,255,255,.10);
  --text:#e7eefc;
  --muted:rgba(231,238,252,.72);
  --accent:#6aa6ff;
  --danger:#ffb3b3;
  --ok:#7dffb3;
  --warn:#ffd27d;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui,Segoe UI,Arial,sans-serif;
  background:var(--bg);
  color:var(--text);
}
a{color:var(--accent);text-decoration:none}
.wrap{display:grid;grid-template-columns:340px 1fr;height:100vh}
.left{border-right:1px solid var(--border);padding:12px;overflow:auto}
.right{display:grid;grid-template-rows:auto 1fr auto;min-width:0}
.top{
  padding:12px;
  border-bottom:1px solid var(--border);
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.title{font-weight:900}
.list .item{
  padding:10px;
  border:1px solid var(--border);
  border-radius:14px;
  margin-bottom:10px;
  cursor:pointer;
  background:rgba(255,255,255,.03);
}
.list .item.active{
  border-color:var(--accent);
  box-shadow:0 0 0 2px rgba(106,166,255,.18);
}
.row{display:flex;gap:10px;align-items:center}
.badge{
  font-size:12px;
  opacity:.85;
  border:1px solid var(--border);
  padding:2px 8px;
  border-radius:999px;
}
.small{font-size:12px;color:var(--muted)}
.chat{
  padding:12px;
  overflow:auto;
  min-width:0;
}
.msg{
  max-width:78%;
  padding:10px 12px;
  border-radius:14px;
  margin:10px 0;
  border:1px solid var(--border);
  background:rgba(255,255,255,.03);
  word-break:break-word;
}
.out{
  margin-left:auto;
  background:rgba(106,166,255,.12);
  border-color:rgba(106,166,255,.25);
}
.meta{
  font-size:12px;
  color:var(--muted);
  margin-top:6px;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.divider{
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed rgba(255,255,255,.18);
}
.tr,.delivered{font-size:13px;opacity:.95}

.send-wrap{
  border-top:1px solid var(--border);
  background:rgba(255,255,255,.02);
}

.send{
  display:flex;
  gap:10px;
  padding:12px;
  align-items:flex-end;
}

textarea, input, select{
  background:var(--panel);
  color:var(--text);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  outline:none;
}
textarea{
  flex:1;
  resize:none;
  height:56px;
  min-height:56px;
}
button{
  background:var(--accent);
  border:0;
  color:#071022;
  padding:10px 14px;
  border-radius:12px;
  font-weight:900;
  cursor:pointer;
}
button.ghost{
  background:transparent;
  color:var(--text);
  border:1px solid var(--border);
}
.login{
  max-width:420px;
  margin:10vh auto;
  padding:18px;
  border:1px solid var(--border);
  border-radius:18px;
  background:rgba(255,255,255,.03);
}
.login h2{margin:0 0 8px}
.err{color:var(--danger);margin-top:10px}
.pill{
  display:flex;
  gap:10px;
  align-items:center;
  border:1px solid var(--border);
  padding:6px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.02);
}
.k{color:var(--muted)}
.grow{flex:1}
.ws-ok #wsState{color:var(--ok)}
.ws-bad #wsState{color:var(--danger)}

.dropzone{
  margin:12px 12px 0;
  padding:14px;
  border:1px dashed rgba(255,255,255,.22);
  border-radius:14px;
  text-align:center;
  color:var(--muted);
  transition:.15s ease;
}
.dropzone.dragover{
  border-color:var(--accent);
  background:rgba(106,166,255,.08);
  color:var(--text);
}

.picked-files{
  padding:8px 12px 0;
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.picked-file{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.04);
  font-size:13px;
}
.picked-file button{
  padding:2px 8px;
  border-radius:8px;
  font-size:12px;
}

.attachment-card{
  margin-top:8px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.03);
  overflow:hidden;
}
.attachment-preview{
  display:block;
  max-width:100%;
  max-height:280px;
  object-fit:cover;
}
.attachment-body{
  padding:10px;
}
.attachment-title{
  font-weight:700;
  font-size:14px;
}
.attachment-sub{
  margin-top:4px;
  font-size:12px;
  color:var(--muted);
}
.audio-box, .video-box, .sticker-box{
  margin-top:8px;
}
audio, video{
  max-width:100%;
}
.list-last-attachment{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
  opacity:.95;
}
.file-block{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.file-generic{
  flex-direction:row;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.03);
}

.file-icon{
  width:42px;
  height:42px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(106,166,255,.12);
  font-size:22px;
}

.file-info{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.file-info a,
.file-caption a{
  word-break:break-word;
}

.msg-image{
  display:block;
  max-width:320px;
  max-height:320px;
  width:auto;
  height:auto;
  border-radius:12px;
  border:1px solid var(--border);
}

.file-caption{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.msg-text{
  margin-top:8px;
  word-break:break-word;
}
.msg-video{
  display:block;
  max-width:320px;
  max-height:320px;
  width:auto;
  height:auto;
  border-radius:12px;
  border:1px solid var(--border);
}

.msg-audio{
  width:320px;
  max-width:100%;
}