@import url("https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;600&family=IBM+Plex+Mono:wght@400;600&display=swap");

:root {
  --bg: #0b0f1a;
  --surface: #141a2a;
  --panel: #1b2337;
  --accent: #ffb347;
  --accent-2: #6dd3ce;
  --text: #f4f2ee;
  --muted: #a7b0c2;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 20%, #1f2a44 0%, transparent 45%),
    radial-gradient(circle at 80% 10%, #3a2a1f 0%, transparent 35%),
    var(--bg);
  min-height: 100vh;
}

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

.sidebar {
  background: rgba(14, 18, 30, 0.9);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar h1 {
  font-size: 22px;
  margin: 0 0 8px;
}

.tagline {
  color: var(--muted);
  margin: 0;
  font-size: 13px;
}

.thread-actions {
  margin: 8px 0;
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.thread-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

.thread-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 179, 71, 0.4);
}

.thread-card small {
  color: var(--muted);
}

.main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  padding: 24px;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.status-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  width: fit-content;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(109, 211, 206, 0);
}

.status-dot.busy {
  background: var(--accent-2);
  box-shadow: 0 0 0 6px rgba(109, 211, 206, 0.1);
  animation: pulse 1.4s ease-in-out infinite;
}

.status-dot.error {
  background: #ff6f59;
  box-shadow: 0 0 0 6px rgba(255, 111, 89, 0.12);
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(109, 211, 206, 0.25);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(109, 211, 206, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(109, 211, 206, 0);
  }
}

.mode-pill {
  background: rgba(255, 179, 71, 0.18);
  color: var(--accent);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border-radius: 16px;
  min-height: 360px;
  box-shadow: 0 12px 30px var(--shadow);
}

.message {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.message.user {
  background: rgba(255, 179, 71, 0.15);
  align-self: flex-end;
  max-width: 80%;
}

.message.assistant {
  background: rgba(109, 211, 206, 0.15);
  align-self: flex-start;
  max-width: 80%;
}

.message pre {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  white-space: pre-wrap;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

textarea {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px;
  resize: vertical;
  min-height: 120px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-note {
  font-size: 12px;
  color: var(--muted);
}

.primary {
  background: linear-gradient(120deg, var(--accent), #ff6f59);
  border: none;
  color: #1a1a1a;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.sidecar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 20px var(--shadow);
}

.runbook-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.runbook-item:last-child {
  border-bottom: none;
}

.runbook-item label {
  font-size: 13px;
  color: var(--text);
}

.runbook-item small {
  display: block;
  color: var(--muted);
}

.debug-entry {
  display: flex;
  justify-content: space-between;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 4px 0;
  color: var(--muted);
}

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

@media (max-width: 960px) {
  .page {
    grid-template-columns: 1fr;
  }
  .main {
    grid-template-columns: 1fr;
  }
}
