:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d6dee6;
  --panel: #ffffff;
  --bg: #eef3f7;
  --accent: #176b87;
  --accent-2: #2f8f6f;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

.workspace {
  width: min(1080px, 100%);
  height: min(820px, calc(100vh - 40px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(31, 41, 51, 0.12);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

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

.status {
  min-width: 82px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.conversation {
  overflow: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  max-width: 820px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  line-height: 1.6;
}

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

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

.message.error {
  border-color: #fecdca;
  color: var(--danger);
  background: #fff4f2;
}

.role {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
}

.composer {
  display: grid;
  grid-template-columns: 160px 1fr 96px;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}

select,
textarea,
button {
  font: inherit;
  border-radius: 6px;
}

select,
textarea {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

select {
  height: 48px;
  padding: 0 10px;
}

textarea {
  min-height: 48px;
  max-height: 160px;
  resize: vertical;
  padding: 12px;
}

button {
  height: 48px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  background: #98a2b3;
  cursor: wait;
}

@media (max-width: 720px) {
  .shell {
    padding: 0;
  }

  .workspace {
    height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .topbar {
    align-items: flex-start;
    padding: 14px;
  }

  h1 {
    font-size: 20px;
  }

  .conversation {
    padding: 14px;
  }

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

  .composer select {
    grid-column: 1 / -1;
  }
}
