
:root{
  --bg-0:#0f1117;
  --bg-1:#1e1f22;
  --bg-2:#2b2d31;
  --bg-3:#313338;
  --bg-4:#1e1f22;
  --bg-5:#232428;
  --text:#dbdee1;
  --muted:#949ba4;
  --muted-2:#80848e;
  --accent:#5865f2;
  --good:#23a55a;
  --warn:#f0b232;
  --bad:#f23f43;
  --line:#3f4147;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  --radius: 12px;
  --radius-s: 10px;
  --radius-xs: 8px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:var(--font);
  color:var(--text);
  background: radial-gradient(1200px 600px at 20% 0%, rgba(88,101,242,.12), transparent 60%),
              radial-gradient(800px 500px at 80% 100%, rgba(35,165,90,.10), transparent 55%),
              var(--bg-1);
  overflow:hidden;
}

.hidden{ display:none !important; }

.app{
  height:100%;
  display:grid;
  grid-template-columns: 72px 260px 1fr 280px;
  grid-template-rows: 48px 1fr 56px;
  grid-template-areas:
    "servers channels top members"
    "servers channels chat members"
    "servers channels composer members";
}

.servers{
  grid-area:servers;
  background: var(--bg-5);
  border-right:1px solid rgba(255,255,255,.04);
  padding:10px 10px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.pill{
  width:52px;height:52px;
  border-radius: 26px;
  background: var(--bg-2);
  display:grid;
  place-items:center;
  color:var(--text);
  cursor:pointer;
  user-select:none;
  position:relative;
  transition: border-radius .15s ease, background .15s ease, transform .08s ease;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.pill:hover{ border-radius: 18px; background: #2f3136; }
.pill:active{ transform: translateY(1px); }
.pill .badge{
  position:absolute;
  right:-4px; bottom:-4px;
  background: var(--bad);
  color:white;
  font-weight:700;
  font-size:11px;
  min-width:18px;
  height:18px;
  padding:0 6px;
  border-radius: 9px;
  display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow);
  border:3px solid var(--bg-5);
}
.pill.active{
  background: var(--accent);
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(88,101,242,.25), inset 0 0 0 1px rgba(255,255,255,.12);
}
.pill.active::before{
  content:"";
  position:absolute;
  left:-10px;
  width:4px;
  height:28px;
  border-radius: 999px;
  background:#fff;
  opacity:.85;
}
.pill.home{
  background: linear-gradient(180deg, rgba(88,101,242,.25), rgba(88,101,242,.08));
  box-shadow: inset 0 0 0 1px rgba(88,101,242,.25);
}
.pill.add{
  background: rgba(35,165,90,.10);
  color: #a8ffcc;
  box-shadow: inset 0 0 0 1px rgba(35,165,90,.25);
}

.channels{
  grid-area:channels;
  background: var(--bg-3);
  border-right:1px solid rgba(255,255,255,.04);
  display:flex;
  flex-direction:column;
  min-width:0;
}
.guildHeader{
  height:48px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 12px;
  border-bottom:1px solid rgba(255,255,255,.04);
  box-shadow: 0 2px 0 rgba(0,0,0,.12);
}
.guildTitle{
  font-weight:700;
  font-size:14px;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.guildHeader .chev{
  opacity:.85;
  width:18px;height:18px;
  display:grid;place-items:center;
  border-radius:6px;
}
.guildHeader .chev:hover{
  background: rgba(255,255,255,.06);
}

.channelScroll{
  padding: 10px 8px 8px;
  overflow:auto;
  height:100%;
}

.section{
  margin:10px 0 6px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  color: var(--muted);
  font-size:12px;
  font-weight:700;
  letter-spacing:.4px;
  text-transform:uppercase;
  padding: 6px 8px;
}

.chan{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor:pointer;
  color: var(--muted);
  user-select:none;
}
.chan:hover{
  background: rgba(255,255,255,.06);
  color: var(--text);
}
.chan.active{
  background: rgba(255,255,255,.10);
  color: var(--text);
}
.chan .hash{
  width:18px;height:18px;
  opacity:.9;
  display:grid;place-items:center;
  color: var(--muted);
}
.chan.active .hash{ color: var(--text); }

.channelFooter{
  height:56px;
  border-top:1px solid rgba(255,255,255,.04);
  background: rgba(0,0,0,.12);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 8px 10px;
  gap:10px;
}
.me{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.avatar{
  width:32px;height:32px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(88,101,242,.9), rgba(35,165,90,.65));
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.22);
  position:relative;
}
.statusDot{
  position:absolute;
  right:-2px; bottom:-2px;
  width:12px;height:12px;
  border-radius: 6px;
  background: var(--bad);
  border: 3px solid rgba(0,0,0,.35);
}
.statusDot.online{ background: var(--good); }
.meText{ min-width:0; }
.meName{
  font-weight:700;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.meTag{
  font-size:11px;
  color: var(--muted);
  margin-top:2px;
}
.meBtns{
  display:flex; gap:6px;
}
.iconBtn{
  width:32px;height:32px;
  border-radius: 8px;
  display:grid; place-items:center;
  cursor:pointer;
  color: var(--muted);
}
.iconBtn:hover{ background: rgba(255,255,255,.06); color: var(--text); }

.top{
  grid-area:top;
  background: var(--bg-4);
  border-bottom:1px solid rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 14px;
  gap:12px;
  min-width:0;
}
.topLeft{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.chTitle{
  display:flex;
  align-items:center;
  gap:8px;
  font-weight:800;
  font-size:15px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.divider{
  width:1px; height:22px;
  background: rgba(255,255,255,.06);
  margin:0 6px;
}
.topic{
  color: var(--muted);
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 46vw;
}
.topRight{
  display:flex;
  align-items:center;
  gap:8px;
}
.search{
  height:30px;
  width:240px;
  border-radius: 8px;
  background: rgba(0,0,0,.25);
  display:flex;
  align-items:center;
  padding: 0 10px;
  gap:8px;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.search input{
  width:100%;
  background:transparent;
  border:0;
  outline:0;
  color: var(--text);
  font-size:13px;
}

.actionBtn{
  height:30px;
  padding: 0 12px;
  border-radius: 8px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(88,101,242,.15);
  color: var(--text);
  font-weight:600;
  font-size:12px;
  cursor:pointer;
  transition: background .15s ease, border .15s ease;
}
.actionBtn:hover{ background: rgba(88,101,242,.25); border-color: rgba(255,255,255,.3); }
.actionBtn.ghost{ background: rgba(0,0,0,.25); }
.actionBtn.danger{ background: rgba(242,63,67,.18); border-color: rgba(242,63,67,.4); }

.chat{
  grid-area:chat;
  background: var(--bg-4);
  overflow:hidden;
  padding: 16px 14px;
  min-width:0;
  display:flex;
  flex-direction:column;
}

.meetingWrap{
  background: rgba(0,0,0,.25);
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.06);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  flex: 0 0 auto;
}
.meetingHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 14px;
  background: rgba(0,0,0,.35);
  border-bottom:1px solid rgba(255,255,255,.06);
}
.meetingTitle{
  font-weight:800;
  font-size:14px;
}
.meetingMeta{
  font-size:12px;
  color: var(--muted);
  margin-top:4px;
}
.meetingActions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.meetingFrame{
  width:100%;
  height: clamp(320px, 55vh, 640px);
  min-height: 320px;
  background: #0f1117;
}

#chatMessages{
  flex: 1 1 auto;
  overflow:auto;
  padding-right: 4px;
}

.dayMarker{
  margin: 14px 0;
  display:flex;
  align-items:center;
  gap:12px;
  color: var(--muted);
  font-size:12px;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.5px;
}
.dayMarker::before, .dayMarker::after{
  content:"";
  height:1px;
  background: rgba(255,255,255,.06);
  flex:1;
}

.msg{
  display:grid;
  grid-template-columns: 44px 1fr;
  gap:10px;
  padding: 6px 8px;
  border-radius: 10px;
  align-items:start;
}
.msg:hover{
  background: rgba(255,255,255,.03);
}
.msgAv{
  width:40px;height:40px;border-radius:20px;
  background: linear-gradient(135deg, rgba(255,255,255,.12), rgba(255,255,255,.03));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  display:grid; place-items:center;
  color: rgba(255,255,255,.75);
  font-weight:800;
}
.msgHead{
  display:flex;
  align-items:baseline;
  gap:8px;
  flex-wrap:wrap;
}
.msgName{
  font-weight:800;
  font-size:14px;
}
.roleTag{
  font-size:11px;
  font-weight:800;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(88,101,242,.18);
  color: #c7ccff;
  box-shadow: inset 0 0 0 1px rgba(88,101,242,.22);
}
.msgTime{
  color: var(--muted);
  font-size:12px;
}
.msgBody{
  color: var(--text);
  font-size:14px;
  line-height:1.45;
  margin-top:2px;
  white-space:pre-wrap;
  word-break:break-word;
}
.mention{
  background: rgba(88,101,242,.20);
  color: #cfd3ff;
  padding: 0 4px;
  border-radius: 6px;
  font-weight:700;
}
.link{
  color:#6ea8fe;
  text-decoration:none;
}
.link:hover{ text-decoration:underline; }

.composer{
  grid-area:composer;
  background: var(--bg-4);
  padding: 10px 14px;
  border-top:1px solid rgba(255,255,255,.04);
  min-width:0;
}
.composeBox{
  display:flex;
  align-items:flex-end;
  gap:10px;
  background: rgba(0,0,0,.20);
  border-radius: 12px;
  padding: 10px 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
}
.composeIcons{
  display:flex; gap:6px;
  padding-bottom:2px;
}
.composeArea{
  flex:1;
  min-width:0;
}
textarea{
  width:100%;
  resize:none;
  border:0;
  outline:0;
  background:transparent;
  color: var(--text);
  font-size:14px;
  line-height:1.4;
  max-height: 160px;
  min-height: 20px;
  padding: 2px 0 0;
}
.hint{
  color: var(--muted);
  font-size:12px;
  margin-top:6px;
  display:flex;
  justify-content:space-between;
  gap:10px;
}
.kbd{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: rgba(255,255,255,.08);
  padding: 1px 6px;
  border-radius: 6px;
  border:1px solid rgba(255,255,255,.08);
  color: var(--text);
  font-size:11px;
}

.members{
  grid-area:members;
  background: var(--bg-2);
  border-left:1px solid rgba(255,255,255,.04);
  display:flex;
  flex-direction:column;
  min-width:0;
}
.membersHeader{
  height:48px;
  border-bottom:1px solid rgba(255,255,255,.04);
  display:flex;align-items:center;
  padding: 0 12px;
  color: var(--muted);
  font-weight:800;
  letter-spacing:.2px;
  font-size:13px;
}
.membersList{
  overflow:auto;
  padding: 10px 8px;
  height:100%;
}
.roleHeader{
  color: var(--muted);
  font-size:12px;
  font-weight:900;
  letter-spacing:.4px;
  text-transform:uppercase;
  padding: 10px 8px 6px;
}
.member{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor:pointer;
  color: var(--muted);
}
.member:hover{
  background: rgba(255,255,255,.05);
  color: var(--text);
}
.mAv{
  width:30px;height:30px;border-radius:15px;
  background: linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.04));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
  display:grid;place-items:center;
  font-weight:900;
  color: rgba(255,255,255,.78);
  position:relative;
}
.mDot{
  position:absolute;
  right:-2px; bottom:-2px;
  width:10px; height:10px;
  border-radius: 5px;
  background: var(--good);
  border: 3px solid var(--bg-2);
}
.memberName{
  font-weight:800;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chat::-webkit-scrollbar,
.channelScroll::-webkit-scrollbar,
.membersList::-webkit-scrollbar{
  width:10px;
}
.chat::-webkit-scrollbar-thumb,
.channelScroll::-webkit-scrollbar-thumb,
.membersList::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
.chat::-webkit-scrollbar-thumb:hover,
.channelScroll::-webkit-scrollbar-thumb:hover,
.membersList::-webkit-scrollbar-thumb:hover{
  background: rgba(255,255,255,.14);
  background-clip: content-box;
}

@media (max-width: 1100px){
  .app{ grid-template-columns: 72px 260px 1fr; grid-template-areas:
    "servers channels top"
    "servers channels chat"
    "servers channels composer";
  }
  .members{ display:none; }
  .search{ width:160px; }
  .topic{ max-width: 38vw; }
}
@media (max-width: 860px){
  .app{ grid-template-columns: 72px 1fr; grid-template-areas:
    "servers top"
    "servers chat"
    "servers composer";
  }
  .channels{ display:none; }
  .topic{ display:none; }
  .search{ width: 44vw; }
}

@media (max-width: 720px){
  .topRight{ flex-wrap:wrap; justify-content:flex-end; }
  .meetingFrame{ min-height: 300px; }
}