:root {
  color-scheme: dark;
  --bg: #0f1220;
  --panel: #171b2f;
  --panel-2: #1f2540;
  --text: #e8ebff;
  --muted: #aab2d5;
  --accent: #7c9cff;
  --danger: #ff6b81;
  --border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: linear-gradient(180deg, #0b0e1a 0%, var(--bg) 100%);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 0.8rem 1rem;
  background: var(--accent);
  color: white;
  font-weight: 600;
}

button.danger {
  background: var(--danger);
}

input,
textarea {
  width: 100%;
  background: #0e1325;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem;
}

textarea {
  resize: vertical;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 1.25rem;
  background: rgba(6, 9, 18, 0.8);
  backdrop-filter: blur(8px);
}

.main-panel {
  padding: 1.25rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.hero p,
.muted,
.status,
.stats,
.message p {
  color: var(--muted);
}

.sidebar h1,
.sidebar h2,
.main-panel h2 {
  margin-top: 0;
}

.sidebar h1 {
  font-size: 1.75rem;
  margin-block: 0 0.75rem;
  line-height: 1.2;
}

.sidebar .panel {
  display: grid;
  gap: 0.75rem;
}

.panel-note {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.startup-notice {
  margin: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid rgba(124, 156, 255, 0.35);
  border-radius: 8px;
  background: rgba(124, 156, 255, 0.12);
  color: #d6e0ff;
  font-size: 0.88rem;
  line-height: 1.4;
}

.section-label {
  margin: 0;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #c8d1ff;
  font-weight: 700;
}

.stack-actions {
  display: grid;
  gap: 0.6rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 0.2rem 0;
}

.status {
  min-height: 2rem;
}

.connection-status {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

.service-status-list {
  display: grid;
  gap: 0.45rem;
}

.service-indicator {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
}

.service-indicator.online {
  background: rgba(66, 186, 112, 0.16);
  color: #9be8b4;
}

.service-indicator.offline {
  background: rgba(255, 107, 129, 0.12);
  color: #ff9aa9;
}

.stats {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.35rem;
}

.chat-log {
  min-height: 340px;
  max-height: 52vh;
  overflow: auto;
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.message {
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}

.message.user {
  margin-left: 10%;
}

.message.ai {
  margin-right: 10%;
}

.message strong {
  display: block;
  margin-bottom: 0.4rem;
}

.chat-form {
  display: grid;
  gap: 0.75rem;
}

.memory-preview {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 35vh;
  overflow: auto;
  background: #0e1325;
  border-radius: 12px;
  padding: 1rem;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}
