* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: #17211c;
  background: #eef2ee;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px 24px;
  background: #f8faf7;
  border-right: 1px solid #d7ded6;
}

.brand {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  align-items: center;
}

.brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #dbe2dc;
  padding: 6px;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand p {
  margin: 4px 0 0;
  color: #607268;
  font-size: 14px;
}

.model {
  margin: 12px 0 0;
  padding: 8px 10px;
  color: #496051;
  background: #e8efe8;
  border: 1px solid #d3dfd5;
  border-radius: 8px;
  font-size: 13px;
  word-break: break-all;
}

.controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.access-box {
  display: grid;
  gap: 8px;
}

.access-box label {
  color: #405648;
  font-size: 14px;
}

.access-box input {
  width: 100%;
  border: 1px solid #cad6cc;
  border-radius: 8px;
  padding: 10px 11px;
  outline: none;
  background: #ffffff;
  color: #17211c;
}

.access-box input:focus {
  border-color: #246b4f;
  box-shadow: 0 0 0 3px rgba(36, 107, 79, 0.12);
}

.controls label {
  grid-column: 1 / -1;
  color: #405648;
  font-size: 14px;
}

.controls input {
  width: 100%;
}

.quick-prompts {
  display: grid;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  color: #ffffff;
  background: #246b4f;
}

button:hover {
  background: #1f5d45;
}

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

.quick-prompts button,
.secondary {
  color: #244232;
  background: #e5ece5;
  border: 1px solid #cfdacf;
  text-align: left;
}

.quick-prompts button:hover,
.secondary:hover {
  background: #dce6dc;
}

.boundary {
  margin-top: auto;
  color: #6a766e;
  line-height: 1.6;
  font-size: 13px;
}

.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-width: 0;
}

.messages {
  overflow-y: auto;
  padding: 30px;
  min-height: 0;
}

.message {
  display: flex;
  margin-bottom: 18px;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(780px, 88%);
  padding: 15px 17px;
  border-radius: 8px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(20, 35, 25, 0.06);
}

.feedback {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.feedback button {
  padding: 7px 10px;
  color: #405648;
  background: #eef3ee;
  border: 1px solid #d4dfd6;
  font-size: 13px;
}

.feedback button:hover {
  background: #e2ebe2;
}

.assistant .bubble {
  background: #ffffff;
  border: 1px solid #dbe2dc;
}

.user .bubble {
  color: #ffffff;
  background: #246b4f;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 12px;
  padding: 18px 22px;
  background: #f8faf7;
  border-top: 1px solid #d7ded6;
}

textarea {
  width: 100%;
  min-height: 72px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid #cad6cc;
  border-radius: 8px;
  padding: 12px 13px;
  outline: none;
  background: #ffffff;
  color: #17211c;
  line-height: 1.55;
}

textarea:focus {
  border-color: #246b4f;
  box-shadow: 0 0 0 3px rgba(36, 107, 79, 0.12);
}

@media (max-width: 820px) {
  body {
    min-height: 100svh;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 100svh;
  }

  .sidebar {
    gap: 14px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid #d7ded6;
  }

  .brand {
    grid-template-columns: 44px 1fr;
  }

  .brand img {
    width: 44px;
    height: 44px;
    padding: 5px;
  }

  h1 {
    font-size: 22px;
  }

  .model {
    font-size: 12px;
    padding: 6px 8px;
  }

  .access-box,
  .controls {
    max-width: none;
  }

  .quick-prompts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .quick-prompts button,
  .secondary {
    min-height: 42px;
    padding: 9px 10px;
    text-align: center;
    font-size: 14px;
  }

  .boundary {
    margin-top: 0;
    font-size: 12px;
    line-height: 1.5;
  }

  .chat-panel {
    min-height: 0;
  }

  .messages {
    padding: 16px;
  }

  .message {
    margin-bottom: 14px;
  }

  .bubble {
    max-width: 94%;
    padding: 12px 13px;
    line-height: 1.65;
  }

  .feedback {
    flex-wrap: wrap;
  }

  .composer {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 10px;
  }

  textarea {
    min-height: 88px;
  }

  #sendBtn {
    width: 100%;
    min-height: 46px;
  }
}

@media (max-width: 460px) {
  .quick-prompts {
    grid-template-columns: 1fr;
  }
}
