﻿:root {
  --bg: #f6f2ec;
  --ink: #1d1b18;
  --muted: #6f685f;
  --line: #ddd4c7;
  --paper: #fffdf9;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 32px;
  box-shadow: 0 18px 45px rgba(38, 30, 20, .08);
}

.brand {
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0;
}
.brand.small { font-size: 20px; }
.sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

h1 { margin: 0 0 20px; font-size: 24px; }
h2 { margin: 0 0 8px; font-size: 18px; }

.login-form, .composer form, .followup-box form { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
input, textarea, button {
  font: inherit;
  border-radius: 6px;
}
input, textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}
input { padding: 12px; }
textarea {
  min-height: 180px;
  resize: vertical;
  padding: 14px;
  line-height: 1.7;
}
button {
  border: 0;
  background: var(--accent);
  color: white;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
}
button:hover { background: var(--accent-dark); }

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-actions { display: flex; gap: 16px; align-items: center; }
.top-actions a { color: var(--accent-dark); font-weight: 700; text-decoration: none; }

.app-shell {
  width: min(940px, 100%);
  margin: 0 auto;
  padding: 28px;
}
.chat-mode {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 16px;
}

.start-mode {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: start center;
}

.composer, .conversation, .followup-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.composer {
  width: min(760px, 100%);
  padding: 22px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.conversation {
  padding: 22px;
  display: grid;
  align-content: end;
  gap: 16px;
  min-height: 45vh;
}
.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  animation: messageIn .22s ease-out both;
}
.message.user { background: #f9fbfa; }
.role {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}
pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  font-family: inherit;
}

.followup-box {
  position: sticky;
  bottom: 0;
  padding: 16px;
  box-shadow: 0 -10px 24px rgba(38, 30, 20, .06);
}
.followup-box textarea {
  min-height: 92px;
}
.followup-box button {
  justify-self: end;
  min-width: 110px;
}

.error {
  margin: 12px 0 0;
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 860px) {
  .topbar { padding: 14px 18px; }
  .app-shell { padding: 18px; }
  .form-row { grid-template-columns: 1fr; }
  .followup-box button { width: 100%; }
}


.thinking {
  color: var(--muted);
  font-size: 14px;
  display: none;
  align-items: center;
  gap: 8px;
}
.thinking.active { display: flex; }
.thinking::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulse 1s ease-in-out infinite;
}

.is-submitting button[type="submit"] {
  opacity: .72;
  pointer-events: none;
}

@keyframes messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: .35; transform: scale(.85); }
  50% { opacity: 1; transform: scale(1); }
}


.message-actions {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.copy-button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}
.copy-button {
  background: #fff;
  color: var(--accent-dark);
}
.copy-button:hover,
.download-button:hover {
  border-color: var(--accent);
}

.download-form {
  margin: 0;
}
.download-form button {
  cursor: pointer;
}

