:root{
  --bg:#081126;
  --bg2:#0d1730;
  --card:#141d35;
  --card2:#1b2542;
  --stroke:rgba(255,255,255,.08);
  --text:#f4f7ff;
  --muted:#9ca8c7;
  --gold:#f5d36b;
  --teal:#46f3c2;
  --blue:#6eb6ff;
  --shadow:0 18px 40px rgba(0,0,0,.28);
  --shadowSoft:0 10px 22px rgba(0,0,0,.18);
  --r:22px;
  --r2:16px;
}

*{box-sizing:border-box;}

html, body{
  margin:0;
  height:100%;
}

body{
  background:radial-gradient(circle at top, var(--bg2), var(--bg) 78%);
  font-family:'Poppins','Inter',ui-sans-serif,system-ui,sans-serif;
  color:var(--text);
  overflow:hidden;
}

.app{
  height:100vh;
  padding:18px;
}

.layout{
  height:calc(100vh - 72px);
  display:grid;
  grid-template-columns:50fr 31fr;
  gap:14px;
}

.panel{
  background:rgba(255,255,255,.04);
  border:1px solid var(--stroke);
  border-radius:var(--r);
  box-shadow:var(--shadow);
  overflow:hidden;
}

.left{
  padding:22px;
  display:flex;
  flex-direction:column;
  gap:14px;
  min-height:0;
}

.brand-row{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
}

h2{
  margin:0 0 8px;
  font-size:28px;
  font-weight:700;
  background:linear-gradient(90deg,var(--gold),var(--teal));
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
}

.meta{
  font-size:13px;
  color:var(--muted);
}

button{
  padding:12px 22px;
  border-radius:999px;
  border:none;
  background:linear-gradient(90deg,var(--teal),var(--blue));
  color:#07101f;
  font-weight:700;
  cursor:pointer;
}

button:hover{
  transform:translateY(-1px);
}

.card{
  border-radius:var(--r2);
  border:1px solid var(--stroke);
  background:rgba(255,255,255,.05);
  box-shadow:var(--shadowSoft);
  padding:16px;
}

.err{
  color:#ff6b8c;
  font-weight:700;
}

.conversation-wrap{
  min-height:0;
  flex:1;
  overflow:auto;
  padding-right:2px;
}

.messages{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.role{
  font-size:12px;
  font-weight:700;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--teal);
  margin-bottom:8px;
}

.bubble{
  padding:14px 18px;
  border-radius:16px;
  line-height:1.6;
  font-size:15px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.bubble.user{
  background:rgba(70,243,194,.16);
  border-left:3px solid var(--teal);
}

.bubble.assistant{
  background:rgba(245,211,107,.12);
  border-left:3px solid var(--gold);
}

.composer-card{
  padding:18px;
}

form.chat{
  display:flex;
  gap:12px;
  align-items:center;
}

input[type="text"]{
  flex:1;
  min-width:0;
  padding:14px 16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(255,255,255,.06);
  color:var(--text);
  font-size:15px;
  outline:none;
}

input[type="text"]::placeholder{
  color:var(--muted);
}

.right{
  display:grid;
  grid-template-rows:31fr 19fr;
  gap:14px;
  min-height:0;
}

.side-panel{
  padding:18px;
  display:flex;
  flex-direction:column;
  min-height:0;
}

.section-title{
  font-size:12px;
  color:var(--muted);
  letter-spacing:.12em;
  text-transform:uppercase;
  margin-bottom:12px;
}

.side-scroll{
  min-height:0;
  flex:1;
  overflow:auto;
}

.side-card{
  min-height:100%;
}

.side-text{
  font-size:14px;
  line-height:1.65;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.muted-block{
  color:var(--muted);
}

.phi-image-wrap{
  margin-top:16px;
}

.phi-image{
  display:block;
  width:100%;
  max-width:420px;
  margin:0 auto 10px;
  border-radius:14px;
  object-fit:cover;
  border:1px solid var(--stroke);
}

.phi-image-caption{
  text-align:center;
  font-size:13px;
  color:var(--muted);
}

.hidden{
  display:none;
}

footer{
  height:54px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:13px;
  color:var(--muted);
  border-top:1px solid rgba(255,255,255,.06);
}

@media (max-width: 980px){
  body{
    overflow:auto;
  }

  .app{
    height:auto;
  }

  .layout{
    height:auto;
    grid-template-columns:1fr;
  }

  .right{
    grid-template-rows:auto auto;
  }

  .conversation-wrap{
    max-height:none;
  }
}