:root {
  --bg: #0f1115;
  --panel: #141821;
  --panel-2: #0b0d12;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #19c37d;
  --accent-2: #0ea5a6;
  --border: #1f2430;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: 'Sora', sans-serif;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2130 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #0d1a22 0%, transparent 55%),
              var(--bg);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #111622 0%, #0b0f18 100%);
  border-right: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 40px; height: 40px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #1ad7a4 0%, #0ea5a6 100%);
  font-weight: 700; color: #00120f;
}
.brand-text .title { font-weight: 700; }
.brand-text .subtitle { font-size: 12px; color: var(--muted); }

.primary {
  background: #1f2635;
  border: 1px solid #2a3246;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.primary:hover { border-color: #3a4560; }

.section-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.history { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  padding: 8px 10px; border-radius: 8px; background: #121724;
  border: 1px solid #1d2332; color: #cfd6e4; font-size: 13px;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.history-item.active {
  border-color: #2d8f72;
  background: #12211d;
  color: #d5f6eb;
}

.sidebar-footer { margin-top: auto; display: flex; gap: 8px; }
.pill {
  font-size: 11px; color: #b5c0d4; border: 1px solid #263149; padding: 4px 8px; border-radius: 999px;
}

.main {
  display: grid; grid-template-rows: auto 1fr auto auto; height: 100%;
}

.topbar {
  padding: 16px 24px; display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); background: rgba(10,12,16,0.6);
  backdrop-filter: blur(6px);
}
.model { color: var(--muted); font-size: 13px; }
.status { font-size: 12px; color: #7dd3fc; }

.chat {
  padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
}

.msg { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: start; }
.avatar {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: #1f2635; border: 1px solid #2a3246; font-weight: 700; color: #8ab4f8;
}
.avatar.user { background: #142a24; color: #33e3a1; border-color: #1d3a31; }

.bubble {
  background: #121724; border: 1px solid #1d2332; border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow); line-height: 1.5;
}
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble pre {
  background: #0d121d;
  border: 1px solid #222a3a;
  border-radius: 10px;
  padding: 10px;
  overflow-x: auto;
  margin: 8px 0;
}
.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
}
.bubble :not(pre) > code {
  background: #1a2231;
  border: 1px solid #2a344a;
  border-radius: 6px;
  padding: 2px 6px;
}
.bubble ul, .bubble ol {
  margin: 8px 0 8px 20px;
  padding: 0;
}
.bubble li { margin: 3px 0; }
.bubble a { color: #8bd3ff; }
.bubble h1, .bubble h2, .bubble h3, .bubble h4 {
  margin: 10px 0 8px;
  line-height: 1.25;
}
.bubble blockquote {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 3px solid #2a344a;
  color: #b5c0d4;
}

.composer {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  padding: 16px 24px; border-top: 1px solid var(--border);
  background: rgba(10,12,16,0.8);
}

textarea {
  resize: none; border-radius: 12px; border: 1px solid #222a3a;
  background: #0f141f; color: var(--text); padding: 12px;
  font-family: inherit; font-size: 14px; min-height: 44px;
}

.send {
  background: linear-gradient(135deg, #1ad7a4 0%, #0ea5a6 100%);
  border: none; color: #00120f; padding: 0 18px; border-radius: 12px; font-weight: 700;
  cursor: pointer;
}

.hint { padding: 0 24px 16px; color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
