:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --ink: #17211b;
  --muted: #657166;
  --line: #dbe3da;
  --accent: #1f7a52;
  --accent-dark: #14543b;
  --shadow: 0 16px 40px rgba(31, 50, 38, .10);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  min-height: 100vh;
}

button,
textarea {
  font: inherit;
}

.agent-shell {
  width: min(820px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 14px 0;
}

.agent-header {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  background: rgba(247, 248, 245, .94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(219, 227, 218, .72);
}

.agent-logo {
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: 34px;
  object-fit: contain;
  background: transparent;
}

.brand {
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
}

.quick-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 0;
  scrollbar-width: none;
}

.quick-panel::-webkit-scrollbar {
  display: none;
}

.quick-panel button {
  flex: 0 0 auto;
  height: 36px;
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(31, 50, 38, .05);
}

.quick-panel button:active {
  transform: translateY(1px);
}

.messages {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 0 112px;
}

.message {
  width: fit-content;
  max-width: min(88%, 640px);
  border-radius: 8px;
  padding: 12px 13px;
  line-height: 1.65;
  font-size: 15px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: var(--shadow);
}

.message.agent {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}

.message.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 30px rgba(31, 122, 82, .18);
}

.message.pending {
  color: var(--muted);
}

.composer {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(792px, calc(100% - 28px));
  transform: translateX(-50%);
  z-index: 5;
  display: grid;
  grid-template-columns: 62px 1fr 58px;
  gap: 8px;
  align-items: end;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 118px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 10px 4px;
  color: var(--ink);
  background: transparent;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #8b968c;
}

.voice-btn,
.send-btn {
  height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
}

.voice-btn {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--muted);
}

.voice-btn.listening {
  border-color: #d97706;
  background: #fff7ed;
  color: #8a4b09;
}

.send-btn {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.send-btn:disabled {
  background: #9fb9aa;
  cursor: progress;
}

@media (min-width: 720px) {
  .agent-shell {
    padding-left: 24px;
    padding-right: 24px;
  }

  .messages {
    padding-right: 2px;
  }
}

@media (max-width: 380px) {
  .agent-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  h1 {
    font-size: 26px;
  }

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

  .voice-btn,
  .send-btn {
    font-size: 14px;
  }
}
