:root {
  color-scheme: dark;
  --bg: #0b1020;
  --bg-accent: #11182d;
  --sidebar: rgba(18, 24, 44, 0.92);
  --chat: rgba(11, 16, 32, 0.94);
  --panel: rgba(18, 25, 42, 0.78);
  --panel-strong: rgba(24, 34, 56, 0.96);
  --panel-soft: rgba(38, 50, 77, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef2ff;
  --muted: #96a0bd;
  --accent: #8ab4ff;
  --accent-soft: rgba(138, 180, 255, 0.16);
  --mine: linear-gradient(180deg, #234b8d, #1e3d73);
  --theirs: rgba(255,255,255,0.05);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(92, 123, 255, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(77, 208, 255, 0.10), transparent 24%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
  color: var(--text);
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  padding: 18px;
}

.sidebar,
.chat-shell {
  min-height: calc(100vh - 36px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar {
  background: var(--sidebar);
  border-radius: 28px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top {
  padding: 24px 22px 18px;
  border-bottom: 1px solid var(--border);
}

.agent-list {
  overflow: auto;
  padding: 8px;
}

.agent-row {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  padding: 14px;
  border-radius: 20px;
  cursor: pointer;
  margin-bottom: 6px;
  transition: background 0.18s ease, transform 0.18s ease;
}

.agent-row.active,
.agent-row:hover {
  background: rgba(255,255,255,0.05);
  transform: translateY(-1px);
}

.agent-row-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.agent-name-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.agent-badge {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  flex: 0 0 auto;
  border: 1px solid rgba(138, 180, 255, 0.22);
}

.agent-name {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.agent-preview,
.agent-meta,
.muted {
  color: var(--muted);
}

.agent-preview {
  font-size: 0.92rem;
  line-height: 1.35;
}

.agent-meta {
  font-size: 0.78rem;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--chat);
  border-radius: 28px;
  overflow: hidden;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid rgba(138, 180, 255, 0.22);
}

.chat-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  min-height: 0;
}

.card {
  background: transparent;
}

.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
}

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

.message {
  max-width: 72%;
  padding: 14px 15px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-wrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.16);
  border: 1px solid rgba(255,255,255,0.05);
}

.message.user {
  align-self: flex-end;
  background: var(--mine);
}

.message.assistant {
  align-self: flex-start;
  background: var(--theirs);
}

.message-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.62);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.message-time {
  margin-top: 8px;
  font-size: 0.72rem;
  color: rgba(233,237,239,0.58);
  text-align: right;
}

.composer {
  display: flex;
  gap: 12px;
  padding: 18px 20px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}

.composer input {
  flex: 1;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

.send-btn,
.ghost-btn {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-weight: 700;
}

.inspector {
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow: auto;
  background: rgba(255,255,255,0.02);
}

.panel-header {
  margin-bottom: 16px;
}

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

.thought-panel > div {
  padding: 12px 13px;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.04);
}

.thought-panel.empty,
.empty-state {
  color: var(--muted);
}

.thought-label,
.eyebrow {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.version-badge {
  position: fixed;
  right: 14px;
  bottom: 12px;
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(7, 10, 20, 0.7);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 999px;
  padding: 6px 10px;
  z-index: 20;
  backdrop-filter: blur(14px);
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 12px;
  }

  .sidebar,
  .chat-shell {
    min-height: auto;
    border-radius: 22px;
  }

  .sidebar {
    max-height: 320px;
  }

  .chat-main {
    grid-template-columns: 1fr;
  }

  .inspector {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  .message {
    max-width: 88%;
  }
}
