:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f4;
  color: #1f2523;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid #1f2523;
  background: #1f2523;
  color: #fff;
  border-radius: 6px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary,
.actions button {
  background: #fff;
  color: #1f2523;
  border-color: #c8cec8;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.shell {
  min-height: 100vh;
}

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

.login-panel {
  width: min(380px, 100%);
  border: 1px solid #d7ddd7;
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  display: grid;
  gap: 16px;
  box-shadow: 0 18px 50px rgb(31 37 35 / 8%);
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

p,
label span,
#statusText {
  color: #66706a;
}

label {
  display: grid;
  gap: 6px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c8cec8;
  border-radius: 6px;
  background: #fff;
  color: #1f2523;
  padding: 10px 12px;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #22765f;
  box-shadow: 0 0 0 3px rgb(34 118 95 / 14%);
}

.error {
  min-height: 20px;
  color: #a12b2b;
}

.chat {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #d7ddd7;
  background: #fff;
  padding: 14px clamp(16px, 4vw, 32px);
}

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

.messages {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.message {
  max-width: 78%;
  white-space: pre-wrap;
  line-height: 1.55;
  border: 1px solid #d7ddd7;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.message.user {
  align-self: flex-end;
  background: #e6f4ef;
  border-color: #b7d8ca;
}

.message.model {
  align-self: flex-start;
}

.message.system {
  align-self: center;
  max-width: 100%;
  color: #66706a;
  background: transparent;
  border-style: dashed;
}

.composer {
  border-top: 1px solid #d7ddd7;
  background: #fff;
  padding: 14px clamp(16px, 4vw, 32px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

textarea {
  min-height: 46px;
  max-height: 180px;
  resize: vertical;
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .message {
    max-width: 92%;
  }

  .composer {
    grid-template-columns: 1fr;
  }
}
