:root{
  --bg0:#06070a;
  --bg1:#0b0d12;
  --panel:rgba(255,255,255,.06);
  --panel2:rgba(255,255,255,.08);
  --stroke:rgba(255,255,255,.10);
  --text:#e8eefc;
  --muted:rgba(232,238,252,.72);
  --muted2:rgba(232,238,252,.55);
  --neon1:#67d6ff;
  --neon2:#7a5cff;
  --good:#4ef0a1;
  --bad:#ff5d75;
  --warn:#ffd166;
  --shadow:0 18px 60px rgba(0,0,0,.50);
  --r:18px;
  --r2:26px;
  --pad:14px;
  --font:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,Helvetica,Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  color:var(--text) !important;
  background:radial-gradient(1200px 600px at 20% 10%, rgba(122,92,255,.25), transparent 60%),
             radial-gradient(900px 500px at 70% 20%, rgba(103,214,255,.18), transparent 60%),
             linear-gradient(180deg,var(--bg0),var(--bg1));
  overflow:hidden;
}

a{color:var(--neon1); text-decoration:none}
a:hover{opacity:.9}

#bg{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  z-index:0;
  pointer-events:none;
}

.app{
  position:relative;
  z-index:1;
  height:100%;
  display:flex;
  flex-direction:column;
}

.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:12px 14px;
  backdrop-filter: blur(10px);
  background:linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.03));
  border-bottom:1px solid var(--stroke);
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:160px;
}

.logo{
  width:36px;
  height:36px;
  border-radius:12px;
  background:radial-gradient(circle at 30% 30%, rgba(103,214,255,.9), rgba(122,92,255,.6));
  box-shadow:0 0 0 1px rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.4);
}

.logoImg{
  width:36px;
  height:36px;
  border-radius:12px;
  object-fit:cover;
  box-shadow:0 0 0 1px rgba(255,255,255,.12), 0 10px 30px rgba(0,0,0,.4);
}
.sendWrap{
  display:flex;
  flex-direction:column;
  justify-content:flex-end;
}


.brand h1{
  margin:0;
  font-size:16px;
  letter-spacing:.18em;
  text-transform:uppercase;
}

.status{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--muted);
  font-size:12px;
  user-select:none;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:7px 10px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  border:1px solid var(--stroke);
}

.dot{
  width:8px;
  height:8px;
  border-radius:50%;
  background:var(--warn);
  box-shadow:0 0 18px rgba(255,209,102,.35);
}

.dot.ok{background:var(--good); box-shadow:0 0 18px rgba(78,240,161,.35)}
.dot.bad{background:var(--bad); box-shadow:0 0 18px rgba(255,93,117,.35)}

.actions{
  display:flex;
  gap:10px;
  align-items:center;
}

.btn{
  appearance:none;
  border:none;
  cursor:pointer;
  color:var(--text) !important;
  padding:10px 12px;
  border-radius:14px;
  background:rgba(255,255,255,.06);
  border:1px solid var(--stroke);
  transition:transform .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-weight:600;
  font-size:12px;
}

.btn:hover{
  background:rgba(255,255,255,.09);
  border-color:rgba(255,255,255,.18);
  transform:translateY(-1px);
  box-shadow:0 10px 26px rgba(0,0,0,.22);
}

.btn:active{transform:translateY(0)}
.btn.primary{
  background:linear-gradient(135deg, rgba(103,214,255,.22), rgba(122,92,255,.20));
  border-color:rgba(103,214,255,.28);
}
.btn.danger{
  background:rgba(255,93,117,.12);
  border-color:rgba(255,93,117,.22);
}
.btn.ghost{
  background:transparent;
}

.main{
  flex:1;
  display:flex;
  min-height:0;
}

.sidebar{
  width:320px;
  border-right:1px solid var(--stroke);
  background:rgba(255,255,255,.03);
  backdrop-filter: blur(12px);
  display:flex;
  flex-direction:column;
  min-height:0;
}

.sidebar .head{
  padding:14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.sidebar .head .title{
  font-weight:800;
  letter-spacing:.10em;
  text-transform:uppercase;
  font-size:12px;
  color:var(--muted);
}

.search{
  padding:0 14px 12px 14px;
}
.search input{
  width:100%;
  padding:10px 12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.25);
  color:var(--text) !important;
  outline:none;
}
.search input:focus{border-color:rgba(103,214,255,.32); box-shadow:0 0 0 4px rgba(103,214,255,.08)}
.sessions{
  overflow:auto;
  padding:6px 10px 14px 10px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.session{
  padding:10px 12px;
  border-radius:16px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  cursor:pointer;
  transition:transform .14s ease, background .14s ease, border-color .14s ease;
}
.session:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.07);
  border-color:rgba(255,255,255,.16);
}
.session.active{
  background:linear-gradient(135deg, rgba(103,214,255,.15), rgba(122,92,255,.12));
  border-color:rgba(103,214,255,.26);
}
.session .t{
  font-weight:800;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.session .m{
  margin-top:4px;
  font-size:12px;
  color:var(--muted2);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.chat{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.chathead{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px;
  border-bottom:1px solid var(--stroke);
  background:rgba(255,255,255,.02);
}

.chathead .meta{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.chathead .meta .h{
  font-weight:900;
  letter-spacing:.08em;
  text-transform:uppercase;
  font-size:12px;
  color:var(--muted);
}
.chathead .meta .sub{
  font-size:12px;
  color:var(--muted2);
}

.chatlog{
  flex:1;
  overflow:auto;
  padding:18px 18px 12px 18px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.msg{
  max-width:860px;
  padding:12px 14px;
  border-radius:18px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  box-shadow:0 10px 32px rgba(0,0,0,.18);
  line-height:1.45;
  font-size:14px;
  white-space:pre-wrap;
  word-break:break-word;
}
.msg.user{
  margin-left:auto;
  background:linear-gradient(135deg, rgba(103,214,255,.14), rgba(122,92,255,.12));
  border-color:rgba(103,214,255,.22);
}
.msg.assistant{
  margin-right:auto;
}
.msg .meta{
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:6px;
  color:var(--muted2);
  font-size:11px;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.composer{
  border-top:1px solid var(--stroke);
  background:rgba(255,255,255,.03);
  backdrop-filter: blur(10px);
  padding:14px 14px;
  position:sticky;
  bottom:0;
  width:100%;
}

.composer .row{
  display:flex;
  gap:10px;
  align-items:center;
}

.composer form.row{margin:0}

.composer textarea,
.composer input#msg{
  flex:1;
  width:100%;
  min-height:48px;
  height:48px;
  max-height:180px;
  resize:none;
  padding:12px 12px;
  border-radius:16px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.32) !important;
  color:var(--text) !important;
  outline:none;
  font-size:14px;
  line-height:1.45;
}

.composer textarea:focus{border-color:rgba(103,214,255,.30); box-shadow:0 0 0 4px rgba(103,214,255,.08)}

#sendBtn{
  height:48px;
  align-self:flex-end;
}

.kpiLine{
  margin-top:8px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  font-size:12px;
  color:var(--muted2);
}

.badge{
  padding:6px 10px;
  border-radius:999px;
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.06);
}

.drawerToggle{
  display:none;
}

.modal{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  padding:18px;
  background:rgba(0,0,0,.55);
  z-index:20;
}
.modal.show{display:flex}

.card{
  width:min(720px, 100%);
  border-radius:var(--r2);
  border:1px solid var(--stroke);
  background:rgba(20,22,30,.78);
  backdrop-filter: blur(14px);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.card .cardHead{
  padding:16px 16px 12px 16px;
  border-bottom:1px solid var(--stroke);
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}
.card .cardHead .title{
  font-weight:900;
  letter-spacing:.10em;
  text-transform:uppercase;
  font-size:12px;
  color:var(--muted);
}
.card .cardBody{padding:16px}
.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
@media (max-width: 760px){
  body{overflow:auto}
  .topbar{flex-wrap:wrap; gap:10px}
  .brand{min-width:auto}
  .actions{flex-wrap:wrap; justify-content:flex-end}
  .main{flex-direction:column}
  .sidebar{
    position:fixed;
    left:0;
    top:56px;
    bottom:0;
    width:min(92vw, 360px);
    transform:translateX(-105%);
    transition:transform .18s ease;
    z-index:12;
    box-shadow:var(--shadow);
  }
  .sidebar.open{transform:translateX(0)}
  .drawerToggle{display:inline-flex}
  .chat{min-height:calc(100vh - 56px)}
}
.field{
  display:flex;
  flex-direction:column;
  gap:7px;
}
.field label{
  font-size:12px;
  color:var(--muted);
  letter-spacing:.08em;
  text-transform:uppercase;
}
.field input, .field textarea, .field select{
  width:100%;
  padding:11px 12px;
  border-radius:14px;
  border:1px solid var(--stroke);
  background:rgba(0,0,0,.25);
  color:var(--text) !important;
  outline:none;
  font-size:14px;
}
.field textarea{min-height:110px; resize:vertical}

.hr{height:1px; background:var(--stroke); margin:14px 0}

.notice{
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  border-radius:16px;
  padding:12px 12px;
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
}
.notice b{color:var(--text)}
.small{font-size:12px; color:var(--muted2)}
.row2{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
}