:root{
  --bg:#050816;
  --panel:rgba(12,18,35,.68);
  --panel-strong:rgba(8,12,24,.86);
  --border:rgba(130,170,255,.20);
  --text:#eef4ff;
  --muted:#9fb0d6;
  --accent:#7ca7ff;
  --accent-2:#8ef0ff;
  --danger:#ff6f93;
  --good:#63e3a0;
  --shadow:0 32px 90px rgba(0,0,0,.42);
  --radius:24px;
}

*{box-sizing:border-box}
html,body{min-height:100%}
body{
  margin:0;
  min-height:100vh;
  color:var(--text);
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(124,167,255,.20), transparent 22%),
    radial-gradient(circle at 88% 12%, rgba(142,240,255,.14), transparent 20%),
    radial-gradient(circle at 50% 100%, rgba(99,227,160,.08), transparent 24%),
    linear-gradient(180deg,#050816 0%,#071021 100%);
  overflow-x:hidden;
}
.bg-grid{
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.22;
  background-image:
    linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size:52px 52px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.9), rgba(0,0,0,.2));
}
.bg-glow{
  position:fixed;
  width:42vw;
  height:42vw;
  border-radius:50%;
  filter:blur(90px);
  opacity:.12;
  pointer-events:none;
}
.glow-a{ top:-10vw; left:-12vw; background:radial-gradient(circle, rgba(124,167,255,.9), transparent 60%); }
.glow-b{ right:-14vw; top:-6vw; background:radial-gradient(circle, rgba(142,240,255,.85), transparent 60%); }
.noise{
  position:fixed;
  inset:0;
  pointer-events:none;
  opacity:.035;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
.app-shell{
  position:relative;
  width:min(1440px,100%);
  margin:0 auto;
  min-height:100vh;
  display:grid;
  grid-template-columns: 340px 1fr;
  gap:18px;
  padding:18px;
}
.glass{
  background:linear-gradient(180deg, rgba(12,18,35,.92), rgba(8,12,24,.80));
  border:1px solid var(--border);
  box-shadow:var(--shadow);
  border-radius:var(--radius);
  backdrop-filter: blur(16px);
  overflow:hidden;
}
.sidebar{
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.brand-card{
  padding:20px;
  border-radius:22px;
  background:linear-gradient(135deg, rgba(124,167,255,.16), rgba(142,240,255,.08));
  border:1px solid rgba(142,240,255,.16);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.brand-top{ display:flex; justify-content:space-between; gap:10px; align-items:center; margin-bottom:12px; }
.brand-kicker{ font-size:12px; letter-spacing:.22em; color:var(--accent-2); text-transform:uppercase; }
.status-pill{
  font-size:12px;
  color:#d8e4ff;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  padding:6px 10px;
  border-radius:999px;
  white-space:nowrap;
}
.brand-card h1{ margin:0; font-size:28px; letter-spacing:.3px; }
.brand-sub{ margin:10px 0 0; color:var(--muted); line-height:1.6; font-size:14px; }
.stats-grid{ display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
.stat{
  padding:14px;
  border-radius:18px;
  background:rgba(255,255,255,.03);
  border:1px solid rgba(255,255,255,.07);
}
.stat span{ display:block; color:var(--muted); font-size:12px; margin-bottom:8px; letter-spacing:.04em; }
.stat strong{ font-size:16px; letter-spacing:.2px; }
.panel{ padding:16px; border-radius:20px; background:rgba(255,255,255,.03); border:1px solid rgba(255,255,255,.07); }
.panel-title{ color:#dfe9ff; font-size:13px; letter-spacing:.14em; text-transform:uppercase; margin-bottom:12px; }
.memory-box{ color:var(--muted); font-size:14px; line-height:1.7; min-height:86px; white-space:pre-wrap; word-break:break-word; }
.shortcut-list{ margin:0; padding-left:18px; color:var(--muted); line-height:1.8; font-size:14px; }
.small-note p{ margin:0; color:var(--muted); font-size:13px; line-height:1.7; }
.small-note code{ color:#fff; background:rgba(255,255,255,.08); padding:2px 6px; border-radius:6px; }
.main{ display:flex; flex-direction:column; min-height:0; }
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  padding:20px;
  border-bottom:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.title-block .eyebrow{ display:inline-flex; font-size:12px; letter-spacing:.20em; color:var(--accent-2); text-transform:uppercase; margin-bottom:10px; }
.title-block h2{ margin:0; font-size:24px; letter-spacing:.2px; }
.title-block p{ margin:8px 0 0; color:var(--muted); line-height:1.6; font-size:14px; }
.top-actions{ display:flex; flex-wrap:wrap; gap:10px; justify-content:flex-end; }
.btn{
  appearance:none;
  border:none;
  cursor:pointer;
  color:var(--text);
  font-weight:650;
  border-radius:16px;
  padding:12px 15px;
  transition:transform .15s ease, opacity .15s ease, box-shadow .15s ease, background .15s ease;
  box-shadow:0 8px 24px rgba(0,0,0,.18);
}
.btn:hover{transform:translateY(-1px)}
.btn:disabled{opacity:.55;cursor:not-allowed;transform:none}
.primary{ background:linear-gradient(135deg, rgba(124,167,255,.28), rgba(142,240,255,.16)); border:1px solid rgba(124,167,255,.30); }
.ghost{ background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08); }
.danger{ background:rgba(255,111,147,.12); border:1px solid rgba(255,111,147,.22); }
.chat{
  flex:1;
  min-height:0;
  overflow:auto;
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:14px;
  scroll-behavior:smooth;
}
.chat::-webkit-scrollbar, textarea::-webkit-scrollbar{ width:10px; }
.chat::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb{ background:rgba(124,167,255,.22); border-radius:999px; }
.msg{
  max-width:min(780px, 92%);
  border-radius:22px;
  padding:16px 17px;
  border:1px solid rgba(255,255,255,.08);
  box-shadow:0 14px 30px rgba(0,0,0,.18);
  line-height:1.68;
  white-space:pre-wrap;
  word-wrap:break-word;
  overflow-wrap:anywhere;
}
.msg.user{ align-self:flex-end; background:linear-gradient(135deg, rgba(124,167,255,.18), rgba(124,167,255,.08)); border-color:rgba(124,167,255,.20); }
.msg.assistant{ align-self:flex-start; background:linear-gradient(135deg, rgba(255,255,255,.05), rgba(255,255,255,.03)); border-color:rgba(255,255,255,.08); }
.meta{ display:flex; justify-content:space-between; gap:12px; margin-bottom:9px; color:var(--muted); font-size:12px; }
.msg .bubble{ font-size:15px; }
.thinking{ opacity:.88; font-style:italic; }
.thinking::after{ content:''; display:inline-block; width:1.2em; text-align:left; animation: dots 1.2s infinite; }
@keyframes dots{ 0%{content:''} 25%{content:'.'} 50%{content:'..'} 75%{content:'...'} 100%{content:''} }
.composer{
  padding:18px 20px 20px;
  border-top:1px solid rgba(255,255,255,.08);
  background:linear-gradient(180deg, transparent, rgba(255,255,255,.02));
}
.composer-top{ display:flex; gap:12px; align-items:flex-end; }
textarea{
  flex:1;
  min-height:62px;
  max-height:180px;
  resize:none;
  padding:16px 16px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.04);
  color:var(--text);
  outline:none;
  font:inherit;
  line-height:1.55;
}
textarea::placeholder{color:#8e9bbb}
.composer-bottom{ margin-top:10px; display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap; color:var(--muted); font-size:12px; line-height:1.5; }
@media (max-width: 1024px){ .app-shell{ grid-template-columns:1fr; } .sidebar{order:2} .main{order:1; min-height:72vh} }
@media (max-width: 680px){ .app-shell{padding:10px; gap:10px} .topbar{ flex-direction:column; align-items:stretch; } .top-actions{ justify-content:flex-start; } .composer-top{ flex-direction:column; align-items:stretch; } .btn{ width:100%; } .msg{ max-width:100%; } }
