body {
  font-family: system-ui, sans-serif;
  max-width: 56rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
  color: #18181b;
}

.site-nav {
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.site-nav a {
  margin-right: 1rem;
  color: #18181b;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

.site-nav a.active {
  font-weight: 700;
  text-decoration: underline;
}

.site-nav .hidden,
.hidden {
  display: none;
}

.prompt-panel {
  border: 1px solid #e4e4e7;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #fafafa;
  margin-bottom: 1rem;
}

.prompt-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.prompt-grid {
  display: grid;
  gap: 0.75rem;
}

.prompt-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #e4e4e7;
}

.prompt-tab {
  border: none;
  background: transparent;
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: #71717a;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.prompt-tab:hover {
  color: #18181b;
}

.prompt-tab.active {
  color: #18181b;
  font-weight: 600;
  border-bottom-color: #3b82f6;
}

.prompt-tab-panel.hidden {
  display: none;
}

.prompt-field label {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #52525b;
}

.prompt-field textarea {
  width: 100%;
  min-height: 8rem;
  padding: 0.5rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  resize: vertical;
  box-sizing: border-box;
}

.prompt-field input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.35rem;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.prompt-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.prompt-btn {
  border: 1px solid #e4e4e7;
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.prompt-btn.primary {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

.prompt-status {
  font-size: 0.8rem;
  color: #71717a;
  min-height: 1.2rem;
  margin-top: 0.35rem;
}

/* Chat page */
body.chat-page {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.chat-page .site-nav {
  flex-shrink: 0;
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e4e4e7;
}

.chat-shell {
  flex: 1;
  display: grid;
  grid-template-columns: 16rem 1fr;
  min-height: 0;
}

@media (max-width: 768px) {
  .chat-shell {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    max-height: 12rem;
    border-right: none;
    border-bottom: 1px solid #e4e4e7;
  }
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  border-right: 1px solid #e4e4e7;
  background: #fafafa;
  overflow: auto;
}

.chat-new-btn {
  width: 100%;
  border: 1px solid #e4e4e7;
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
}

.chat-new-btn:hover {
  border-color: #a1a1aa;
}

.chat-sidebar-section {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.chat-sidebar-section h2 {
  margin: 0.5rem 0 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #71717a;
}

.recent-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  border-radius: 0.35rem;
  padding: 0.45rem 0.5rem;
  font-size: 0.85rem;
  color: #3f3f46;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item:hover {
  background: #f4f4f5;
}

.recent-item.selected {
  background: #e4e4e7;
  font-weight: 600;
}

.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  padding: 1rem;
}

.chat-toolbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.chat-field-inline {
  display: grid;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: #52525b;
}

.chat-field-inline select {
  padding: 0.4rem 0.5rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.35rem;
  font-size: 0.9rem;
  min-width: 14rem;
}

.chat-prompt-details {
  flex: 1;
  min-width: 12rem;
}

.chat-prompt-details summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: #52525b;
  user-select: none;
}

.chat-thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid #e4e4e7;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: #fff;
  font-size: 0.9rem;
}

.chat-thread .latency {
  color: #888;
  font-size: 0.8rem;
}

.chat-composer {
  flex-shrink: 0;
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  margin-top: 0.75rem;
}

.chat-composer textarea {
  flex: 1;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e4e4e7;
  border-radius: 0.4rem;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
  min-height: 2.5rem;
}

.chat-status {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: #71717a;
  min-height: 1.2rem;
  margin: 0.35rem 0 0;
}

.load-more {
  margin-top: 0.35rem;
  width: 100%;
  border: 1px solid #e4e4e7;
  background: #fff;
  border-radius: 0.4rem;
  padding: 0.45rem;
  cursor: pointer;
  font-size: 0.8rem;
}

.empty {
  color: #71717a;
  font-size: 0.9rem;
}
