:root {
  --bg: #0b1020;
  --bg-2: #121a31;
  --panel: rgba(14, 22, 45, 0.72);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --text: #eef3ff;
  --muted: #a9b5d4;
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --danger: #ff7a7a;
  --success: #9ef7b0;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius: 24px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(34, 211, 238, 0.16), transparent 22%),
    linear-gradient(180deg, #0a0f1d 0%, #10172b 100%);
}

.page-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black 55%, transparent 100%);
}

.app {
  width: min(1400px, calc(100% - 32px));
  margin: 24px auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
}

.glass {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(22px);
  box-shadow: var(--shadow);
}

.sidebar,
.chat-panel {
  border-radius: var(--radius);
}

.sidebar {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 12px 30px rgba(139, 92, 246, 0.35);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1, h2, p { margin: 0; }
h1 { font-size: 34px; line-height: 1; }
h2 { font-size: 18px; line-height: 1.2; }

.tagline {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.card {
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: 20px;
  padding: 18px;
}

.notice-card ul {
  margin: 14px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pill {
  margin-bottom: 10px;
  background: rgba(158, 247, 176, 0.12);
  color: var(--success);
  border: 1px solid rgba(158, 247, 176, 0.25);
}

.quick-prompts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-chip,
.ghost-button,
.send-button {
  font: inherit;
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.prompt-chip {
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.09);
}

.prompt-chip:hover,
.ghost-button:hover,
.send-button:hover { transform: translateY(-1px); }

.mini-info p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.chat-panel {
  min-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 24px 24px 20px;
  border-bottom: 1px solid var(--line);
}

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

.status-badge {
  background: rgba(255,255,255,0.05);
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.1);
}

.status-badge.is-busy {
  color: white;
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.3);
}

.ghost-button {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
}

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

.message {
  max-width: min(820px, 92%);
  padding: 18px 18px 16px;
  border-radius: 22px;
  line-height: 1.7;
  position: relative;
}

.message .meta {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.message.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
}

.message.assistant .meta { color: var(--accent-2); }

.message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(139,92,246,0.25), rgba(34,211,238,0.16));
  border: 1px solid rgba(139,92,246,0.25);
}

.message.user .meta { color: white; }

.message p:first-child { margin-top: 0; }
.message p:last-child { margin-bottom: 0; }
.message ul, .message ol { padding-left: 22px; }
.message code {
  background: rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 8px;
}

.typing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  animation: bounce 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-4px); opacity: 1; }
}

.chat-form {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--line);
}

#messageInput {
  width: 100%;
  min-height: 64px;
  max-height: 200px;
  resize: vertical;
  padding: 18px 18px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(6, 12, 24, 0.68);
  color: var(--text);
  font: inherit;
  outline: none;
}

#messageInput:focus {
  border-color: rgba(34,211,238,0.45);
  box-shadow: 0 0 0 4px rgba(34,211,238,0.08);
}

.form-actions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tiny-note {
  color: var(--muted);
  font-size: 13px;
}

.send-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 16px 40px rgba(34, 211, 238, 0.18);
}

.send-button svg {
  width: 18px;
  height: 18px;
}

.send-button:disabled,
.ghost-button:disabled,
.prompt-chip:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 980px) {
  .app {
    grid-template-columns: 1fr;
  }
  .chat-panel {
    min-height: 72vh;
  }
}

@media (max-width: 640px) {
  .app {
    width: min(100% - 18px, 100%);
    margin: 9px auto;
    gap: 12px;
  }
  .sidebar,
  .chat-header,
  .chat-messages,
  .chat-form {
    padding-left: 16px;
    padding-right: 16px;
  }
  .chat-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .send-button {
    justify-content: center;
  }
  .message {
    max-width: 100%;
  }
}
