* {
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --panel: #111827;
  --panel-2: #1f2937;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #f59e0b;
  --accent-2: #fbbf24;
  --user: #2563eb;
  --bot: #1f2937;
  --border: #1e293b;
  --ok: #22c55e;
  --bad: #ef4444;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: linear-gradient(160deg, #0b1220 0%, #0f172a 100%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

.app {
  max-width: 820px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
}

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

.logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1f2937;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.5px;
}

h1 {
  font-size: 16px;
  margin: 0;
  font-weight: 700;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.ghost:hover {
  color: var(--text);
  border-color: var(--accent);
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
  transition: background 0.2s;
}

.dot.ok {
  background: var(--ok);
}
.dot.bad {
  background: var(--bad);
}

.chat {
  flex: 1;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user {
  align-self: flex-end;
  background: var(--user);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.bot {
  align-self: flex-start;
  background: var(--bot);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg.error {
  align-self: flex-start;
  background: #3b1f24;
  border: 1px solid #6b2730;
  color: #fecaca;
  border-bottom-left-radius: 4px;
}

.typing {
  display: inline-flex;
  gap: 4px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite ease-in-out;
}

.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.2;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.composer {
  display: flex;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
}

#input {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  max-height: 160px;
}

#send {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #1f2937;
  font-weight: 700;
  padding: 0 18px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.05s ease, opacity 0.2s;
}

#send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#send:not(:disabled):active {
  transform: scale(0.98);
}

.footer {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

.footer code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 4px;
}
