* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #020617 0, #020617 40%, #020617 100%);
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100vh;
}

/* Sidebar */
.sidebar {
  background: #020617;
  border-right: 1px solid #1f2937;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.logo-circle {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #22c55e, #16a34a, #15803d);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #020617;
  font-size: 18px;
}

.logo-text .title {
  font-size: 15px;
  font-weight: 600;
}

.logo-text .subtitle {
  font-size: 11px;
  color: #9ca3af;
}

.sidebar-section {
  margin-top: 4px;
}

.sidebar-section.small {
  margin-top: auto;
  font-size: 12px;
}

.sidebar-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b7280;
  margin-bottom: 6px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill, .pill-current {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  border: 1px solid #1f2937;
  background: #020617;
  color: #e5e7eb;
  cursor: pointer;
}

.pill-current {
  cursor: default;
  background: #111827;
}

.pill:hover {
  background: #111827;
}

.pill.active {
  border-color: #22c55e;
  background: #14532d;
}

.status-text {
  min-height: 18px;
  color: #9ca3af;
}

/* Chat pane */
.chat-pane {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  padding-bottom: 8px;
}

.message-row {
  margin-bottom: 10px;
}

.message-meta {
  font-size: 11px;
  color: #9ca3af;
  margin-bottom: 3px;
}

.bubble {
  max-width: 80%;
  padding: 8px 10px;
  border-radius: 10px;
  line-height: 1.4;
  font-size: 14px;
  white-space: pre-wrap;
}

.bubble.user {
  background: #2563eb;
  margin-left: auto;
}

.bubble.assistant {
  background: #020617;
  border: 1px solid #1f2937;
  margin-right: auto;
}

/* Input */
.input-bar {
  border-top: 1px solid #1f2937;
  padding: 10px 14px;
  display: flex;
  gap: 8px;
}

#message-input {
  flex: 1;
  resize: vertical;
  min-height: 40px;
  max-height: 120px;
  background: #020617;
  color: #e5e7eb;
  border-radius: 10px;
  border: 1px solid #1f2937;
  padding: 8px 10px;
  font-size: 14px;
}

#message-input:focus {
  outline: none;
  border-color: #22c55e;
}

#send-btn {
  padding: 0 18px;
  border-radius: 999px;
  border: none;
  background: #22c55e;
  color: #020617;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

#send-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Responsive */
@media (max-width: 800px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}
.sidebar * {
  max-width: 100%;
}

.sidebar p,
.sidebar .title,
.sidebar .subtitle,
.sidebar span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar .row,
.sidebar button,
.sidebar a {
  box-sizing: border-box;
}

.sidebar-scroll-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.sidebar-scroll-btn {
  height: 32px;
  width: 32px;
  border-radius: 999px;
  border: 1px solid #1f2937;
  background: #2563eb;
  color: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.sidebar-scroll-btn:hover {
  background: #1d4ed8;
}
