:root {
  --bg-body: #050816;
  --bg-elevated: rgba(15, 23, 42, 0.9);
  --bg-elevated-soft: rgba(15, 23, 42, 0.75);
  --bg-accent: #2563eb;
  --bg-accent-soft: rgba(37, 99, 235, 0.12);
  --border-subtle: rgba(148, 163, 184, 0.25);
  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-soft: #6b7280;
  --text-strong: #f9fafb;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-soft: 0 18px 60px rgba(15, 23, 42, 0.6);
  --blur: 18px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--text-main);
  background: radial-gradient(circle at top left, #0f172a, #020617 55%);
}

/* Top nav */

.top-nav {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  backdrop-filter: blur(18px);
  background: linear-gradient(
    to right,
    rgba(15, 23, 42, 0.95),
    rgba(15, 23, 42, 0.4)
  );
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 20%, #60a5fa, #1d4ed8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.7);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-soft);
}

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

.pill {
  border-radius: 999px;
  padding: 8px 16px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: radial-gradient(circle at top left, #1d4ed8, #0f172a);
  color: var(--text-main);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease,
    background 0.12s ease;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.8);
}

.pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 1);
}

.pill-ghost {
  background: rgba(15, 23, 42, 0.7);
  box-shadow: none;
}

.pill-ghost:hover {
  background: rgba(15, 23, 42, 0.9);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.9);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #4ade80;
  box-shadow: 0 0 12px rgba(74, 222, 128, 0.8);
}

/* Layout */

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 64px);
  padding: 16px 16px 20px 16px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Cards */

.card {
  background: var(--bg-elevated-soft);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  padding: 16px 16px 14px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(var(--blur));
}

.card h2,
.card h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.card-footer-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

/* Fields */

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.field-label {
  font-size: 0.75rem;
  color: var(--text-soft);
}

.input {
  border-radius: var(--radius-md);
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: radial-gradient(circle at top left, #020617, #020617);
  padding: 8px 10px;
  font-size: 0.82rem;
  color: var(--text-main);
  outline: none;
  resize: none;
}

.input:focus {
  border-color: rgba(37, 99, 235, 0.7);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.4);
}

.input-multiline {
  min-height: 72px;
}

/* Chips */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chip {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.7);
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 6px 10px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease,
    transform 0.1s ease;
}

.chip:hover {
  background: var(--bg-accent-soft);
  border-color: rgba(37, 99, 235, 0.7);
  color: var(--text-main);
  transform: translateY(-1px);
}

/* Buttons */

.btn {
  border-radius: 999px;
  border: none;
  padding: 8px 16px;
  font-size: 0.82rem;
  font-weight: 500;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.6);
  transition: transform 0.1s ease, box-shadow 0.1s ease,
    opacity 0.1s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(37, 99, 235, 0.85);
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-main);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.8);
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 1);
  box-shadow: 0 16px 32px rgba(15, 23, 42, 1);
}

.btn-ghost {
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: transparent;
  color: var(--text-muted);
  box-shadow: none;
}

/* Info list */

.info-list {
  margin: 0 0 10px;
  padding-left: 18px;
  list-style: disc;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.info-list li + li {
  margin-top: 4px;
}

/* Chat area */

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 10px;
}

.chat-header h1 {
  margin: 0;
  font-size: 1.1rem;
}

.chat-subtitle {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.8);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.status-ready {
  background: #4ade80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
}

.status-busy {
  background: #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.8);
}

.chat-window {
  flex: 1;
  min-height: 0;
  border-radius: 22px;
  background: radial-gradient(circle at top left, #020617, #020617);
  border: 1px solid rgba(31, 41, 55, 0.8);
  padding: 14px 14px 10px;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.9);
}

.chat-window-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  font-size: 0.85rem;
}

/* Messages */

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

.message-row.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 80%;
  padding: 10px 12px;
  border-radius: 16px;
  font-size: 0.82rem;
  line-height: 1.4;
  position: relative;
  border: 1px solid transparent;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.7rem;
}

.message-role {
  font-weight: 500;
}

.message-time {
  color: var(--text-soft);
}

.message-bubble.user {
  background: radial-gradient(circle at top left, #1d4ed8, #1e293b);
  color: #e5edff;
  border-color: rgba(147, 197, 253, 0.4);
}

.message-bubble.assistant {
  background: rgba(15, 23, 42, 0.95);
  border-color: rgba(148, 163, 184, 0.35);
}

/* Composer */

.composer {
  margin-top: 10px;
}

.composer-inner {
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(31, 41, 55, 0.9);
  padding: 8px 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.composer-input {
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 0.84rem;
  resize: none;
  outline: none;
  max-height: 140px;
}

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

.composer-hint {
  font-size: 0.72rem;
  color: var(--text-soft);
}

/* Responsive */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
  }

  .sidebar {
    order: 2;
  }

  .chat-panel {
    order: 1;
    height: calc(100vh - 64px - 16px - 16px);
  }
}
