:root {
  --bg: #0b0e14;
  --panel: #12161f;
  --panel-2: #171c28;
  --line: #232938;
  --text: #e5e7eb;
  --muted: #7a8699;
  --accent: #e8a33d;
  --accent-dim: #6b5327;
  --error: #e5484d;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
}

body {
  -webkit-font-smoothing: antialiased;
}

.cursor {
  display: inline-block;
  animation: blink 1.1s steps(1) infinite;
  color: var(--accent);
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
}

/* ---------- Login page ---------- */

.login-wrap {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 32px 28px;
}

.login-title {
  font-family: var(--mono);
  font-size: 15px;
  color: var(--muted);
  margin: 0 0 4px;
}

.login-title strong {
  color: var(--text);
}

.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 24px;
}

label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: 16px 0 6px;
}

input[type='text'],
input[type='password'] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

input[type='text']:focus,
input[type='password']:focus {
  border-color: var(--accent);
}

button {
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  border: none;
  border-radius: 6px;
}

.btn-primary {
  width: 100%;
  margin-top: 24px;
  padding: 11px 0;
  background: var(--accent);
  color: #17130a;
  font-weight: 600;
  transition: opacity 0.15s ease;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.error-msg {
  margin-top: 14px;
  font-size: 13px;
  color: var(--error);
  min-height: 16px;
}

/* ---------- Chat page ---------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.app-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
}

.app-title {
  font-size: 14px;
  color: var(--text);
}

.app-title .muted {
  color: var(--muted);
}

.logout-link {
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 0;
}

.logout-link:hover {
  color: var(--text);
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px 12px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.msg {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
}

.msg-prompt {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
}

.msg.user .msg-prompt {
  color: var(--accent);
}

.msg-body {
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.assistant .msg-body {
  color: var(--text);
}

.msg.user .msg-body {
  color: #f2d8ab;
}

.empty-state {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  padding-top: 40px;
  text-align: center;
}

.composer {
  border-top: 1px solid var(--line);
  padding: 14px 20px 20px;
}

.composer-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 6px 6px 14px;
}

.composer-inner:focus-within {
  border-color: var(--accent);
}

#composer-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  padding: 10px 0;
  resize: none;
  outline: none;
  max-height: 140px;
}

#composer-input::placeholder {
  color: var(--muted);
}

.send-btn {
  align-self: flex-end;
  background: var(--accent);
  color: #17130a;
  font-weight: 600;
  padding: 9px 16px;
  margin: 3px 0;
}

.send-btn:disabled {
  background: var(--accent-dim);
  color: var(--muted);
  cursor: default;
}
