:root {
  color-scheme: light;
  --bg: #ffffff;
  --card: #ffffff;
  --text: #1a1916;
  --muted: #5c574e;
  --accent: #c4a574;
  --line: #e4dfd4;
  --danger: #a33d3d;
  --me: #f3eee4;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(16px + env(safe-area-inset-bottom));
}

#app {
  max-width: 40rem;
  margin: 0 auto;
}

.top {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.who {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card,
.composer,
.msg {
  background: var(--card);
  border-radius: 14px;
}

.composer,
.msg {
  border: 1px solid var(--line);
}

.card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

label {
  font-size: 0.9rem;
}

input,
textarea,
button {
  font: inherit;
  color: var(--text);
}

input,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}

textarea {
  resize: vertical;
  min-height: 3.2rem;
}

button {
  background: var(--accent);
  color: #1a1916;
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 600;
  min-height: 44px;
}

button:disabled {
  opacity: 0.55;
}

#logout {
  margin-left: auto;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.error {
  color: var(--danger);
}

#chat {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 6rem);
}

.messages {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 10px;
  flex: 1;
}

.msg {
  padding: 12px 14px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.msg.me {
  justify-self: end;
  background: var(--me);
  max-width: 92%;
}

.msg.bot {
  justify-self: start;
  max-width: 92%;
}

.pending-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.pending-prompt {
  margin-top: 10px;
  font-weight: 600;
}

.pending-actions button {
  min-height: 36px;
  padding: 8px 12px;
}

.pending-actions button:last-child {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px;
  position: sticky;
  bottom: env(safe-area-inset-bottom);
}

code {
  color: var(--text);
}
