:root{
  --bg: #0b141a;
  --panel: #111b21;
  --panel2:#202c33;
  --line:#2a3942;
  --text:#e9edef;
  --muted:#8696a0;
  --accent:#00a884;
  --danger:#ff4d4f;
  --chip:#1f2c34;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Arial, "Assistant", sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background:#0c1317;
  color:var(--text);
  overflow:hidden;
}

a{color:inherit}
button,input,select,textarea{font-family:inherit}

#app{height:100%}

/* Layout */
.shell{
  height:100%;
  display:grid;
  grid-template-columns: 360px 1fr 320px;
  gap:0;
}
@media (max-width: 1100px){
  .shell{grid-template-columns: 360px 1fr}
  .right{display:none}
}
@media (max-width: 820px){
  .shell{grid-template-columns: 1fr}
  .left{display:none}
  .right{display:none}
}

/* Panels */
.left, .mid, .right{
  height:100%;
  min-height:0;
  background:var(--panel);
  border-left:1px solid var(--line);
}
.left{border-left:none}
.mid{background:linear-gradient(180deg, #111b21 0%, #0b141a 100%)}
.right{background:var(--panel)}

/* Top bars */
.topbar{
  height:56px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:0 12px;
  background:var(--panel2);
  border-bottom:1px solid var(--line);
}
.topbar .title{
  font-weight:650;
  letter-spacing:.2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.topbar .spacer{flex:1}
.iconbtn{
  height:36px;
  min-width:36px;
  padding:0 10px;
  border-radius:10px;
  border:1px solid transparent;
  background:transparent;
  color:var(--text);
  cursor:pointer;
}
.iconbtn:hover{background:#1a2a33;border-color:#20323c}
.pill{
  padding:6px 10px;
  border-radius:999px;
  background:var(--chip);
  color:var(--muted);
  font-size:12px;
  border:1px solid #25343e;
}

/* Left list */
.search{
  padding:10px 12px;
  border-bottom:1px solid var(--line);
}
.search input{
  width:100%;
  height:38px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid #26343d;
  background:#0c1317;
  color:var(--text);
  outline:none;
}
.search input::placeholder{color:#6f828e}
.list{
  height:calc(100% - 56px - 59px);
  overflow:auto;
}
.item{
  display:flex;
  gap:10px;
  padding:10px 12px;
  border-bottom:1px solid rgba(42,57,66,.55);
  cursor:pointer;
}
.item:hover{background:#0f1a20}
.item.active{background:#0f1f25}
.avatar{
  width:44px;height:44px;border-radius:999px;
  background:#17303a;
  border:1px solid #21404b;
  display:flex;align-items:center;justify-content:center;
  color:#b8c7cf;font-weight:700;
}
.item .meta{min-width:0;flex:1}
.item .row1{display:flex;gap:8px;align-items:center}
.item .name{font-weight:650;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item .time{margin-right:auto;color:var(--muted);font-size:12px;white-space:nowrap}
.item .row2{display:flex;gap:8px;align-items:center;margin-top:4px}
.item .snippet{color:var(--muted);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.badge{
  margin-right:auto;
  min-width:20px;height:20px;border-radius:999px;
  background:var(--accent);
  color:#062b22;
  display:flex;align-items:center;justify-content:center;
  font-weight:800;font-size:12px;
}

/* Mid chat */
.chat{
  height:calc(100% - 56px - 72px);
  overflow:auto;
  padding:14px 16px 18px;
}
.msg{
  max-width:72%;
  padding:10px 12px;
  border-radius:14px;
  margin:6px 0;
  border:1px solid rgba(255,255,255,.06);
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  word-wrap:break-word;
  white-space:pre-wrap;
  line-height:1.35;
}
.msg.in{
  background:#1f2c34;
  margin-left:auto;
  border-top-right-radius:6px;
}
.msg.out{
  background:#005c4b;
  margin-right:auto;
  border-top-left-radius:6px;
}
.msg .sub{
  margin-top:6px;
  display:flex;
  justify-content:flex-start;
  gap:8px;
  color:rgba(255,255,255,.72);
  font-size:11px;
}

/* Composer */
.composer{
  height:72px;
  display:flex;
  gap:10px;
  align-items:center;
  padding:10px 12px;
  background:var(--panel2);
  border-top:1px solid var(--line);
}
.composer textarea{
  flex:1;
  height:44px;
  resize:none;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #26343d;
  background:#0c1317;
  color:var(--text);
  outline:none;
}
.composer textarea::placeholder{color:#6f828e}
.primary{
  height:44px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid #0a6f58;
  background:var(--accent);
  color:#062b22;
  font-weight:800;
  cursor:pointer;
}
.primary:hover{filter:brightness(1.03)}
.primary:disabled{opacity:.55;cursor:not-allowed}

/* Right panel */
.right .body{
  height:calc(100% - 56px);
  overflow:auto;
  padding:14px 12px;
}
.card{
  background:#0f1a20;
  border:1px solid #22333d;
  border-radius:var(--radius);
  padding:12px;
  box-shadow: var(--shadow);
  margin-bottom:12px;
}
.card h3{margin:0 0 8px;font-size:14px}
.kv{display:flex;gap:8px;margin:6px 0;color:var(--muted);font-size:13px}
.kv b{color:var(--text);font-weight:650}

/* Modal */
.modal-backdrop{
  position:fixed;inset:0;
  background:rgba(0,0,0,.55);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px;
}
.modal{
  width:min(520px, 100%);
  background:var(--panel);
  border:1px solid #22333d;
  border-radius:16px;
  box-shadow:var(--shadow);
  overflow:hidden;
}
.modal .mhead{
  padding:14px 14px;
  background:var(--panel2);
  border-bottom:1px solid var(--line);
  display:flex;align-items:center;gap:10px;
}
.modal .mhead .mtitle{font-weight:800}
.modal .mbody{padding:14px}
.field{display:flex;flex-direction:column;gap:6px;margin:10px 0}
.field label{color:var(--muted);font-size:12px}
.field input{
  height:42px;
  padding:0 12px;
  border-radius:12px;
  border:1px solid #26343d;
  background:#0c1317;
  color:var(--text);
  outline:none;
}
.row{display:flex;gap:10px;align-items:center;justify-content:flex-end;margin-top:12px}
.danger{
  height:42px;
  padding:0 14px;
  border-radius:12px;
  border:1px solid #5a1f21;
  background:#2a1213;
  color:#ffb4b6;
  font-weight:800;
  cursor:pointer;
}
.small{
  color:var(--muted);
  font-size:12px;
  line-height:1.4;
}
.err{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #4a1f23;
  background:#240f11;
  color:#ffb4b6;
  font-size:13px;
}
.ok{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid #134a3b;
  background:#0b221c;
  color:#a7f3d0;
  font-size:13px;
}
