:root {
  color-scheme: light;
  font-family: "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172026;
  background: #eef1f1;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #eef1f1; }
button, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 840px);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: #f8f9f9;
  border-inline: 1px solid #dce2e2;
}

.topbar {
  min-height: 64px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-bottom: 1px solid #dce2e2;
  background: #ffffff;
}

.identity { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #176b58;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
}
.identity h1 { margin: 0; font-size: 17px; line-height: 1.3; }
.identity p { margin: 2px 0 0; color: #728079; font-size: 11px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #2e8b63; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon-button, .send-button {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid #d6dddd;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #26343a;
  font-size: 23px;
}
.icon-button:hover { background: #edf2f1; }
.icon-button.small { width: 30px; height: 30px; flex-basis: 30px; font-size: 18px; }

.drawer-scrim {
  position: fixed;
  z-index: 10;
  inset: 0;
  background: rgba(19, 29, 31, 0.24);
}
.session-drawer {
  position: fixed;
  z-index: 11;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 82vw);
  padding: max(18px, env(safe-area-inset-top)) 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: translateX(-102%);
  transition: transform 160ms ease-out;
  border-right: 1px solid #dce2e2;
  background: #f8f9f9;
  box-shadow: 8px 0 24px rgba(24, 37, 37, 0.12);
}
.session-drawer.open { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.drawer-header strong { font-size: 16px; }
.session-list { display: grid; gap: 6px; overflow-y: auto; padding: 2px; }
.session-entry {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #26343a;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-entry:hover { background: #edf2f1; }
.session-entry.active { border-color: #cfe1d8; background: #e6f1ec; color: #155c4b; }

.conversation {
  min-height: 0;
  overflow-y: auto;
  padding: 26px 24px 128px;
  scroll-behavior: smooth;
}

.message { width: min(88%, 660px); margin: 0 0 22px; }
.message.user { margin-left: auto; }
.speaker { margin: 0 0 6px; color: #6a777c; font-size: 12px; }
.message.user .speaker { text-align: right; }
.message p {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.user p {
  display: inline-block;
  padding: 11px 14px;
  border-radius: 16px 16px 4px 16px;
  background: #e4f1ec;
  color: #20342e;
  line-height: 1.55;
}
.message.error p {
  padding: 10px 12px;
  border-left: 3px solid #d98673;
  background: #fff4f1;
  color: #7c2e21;
}
.message-body { display: grid; gap: 10px; }
.message-body p + p { padding-top: 10px; border-top: 1px solid #edf1ef; }
.message.user .message-body { display: block; }
.message.user .message-body p + p { margin-top: 8px; padding-top: 8px; border-top-color: rgba(32, 52, 46, 0.12); }

.quick-prompts, .choices { display: flex; flex-wrap: wrap; gap: 8px; margin: -6px 0 28px; }
.quick-prompts button, .choices button, .action-row button, .action-row a {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #cfd8d7;
  border-radius: 18px;
  background: #f8faf9;
  color: #26343a;
  text-decoration: none;
}
.quick-prompts button:hover, .choices button:hover, .action-row button:hover, .action-row a:hover { border-color: #176b58; color: #176b58; }

.plan-band {
  margin: 8px 0 24px;
  padding: 14px 0 16px;
  border-top: 1px solid #d9e4df;
  border-bottom: 1px solid #d9e4df;
  background: transparent;
}
.plan-band strong { display: block; margin-bottom: 10px; color: #176b58; font-size: 15px; }
.plan-band dl { display: grid; grid-template-columns: 90px 1fr; gap: 6px 10px; margin: 0; font-size: 14px; }
.plan-band dt { color: #607077; }
.plan-band dd { margin: 0; overflow-wrap: anywhere; }
.alternatives-title { margin-top: 12px; color: #607077; font-size: 13px; }
.alternatives { margin: 6px 0 0; padding-left: 22px; font-size: 13px; line-height: 1.65; }
.confirmation-band { margin: -6px 0 24px; }
.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.action-row .primary { background: #176b58; border-color: #176b58; color: #ffffff; }

.attachment-bar {
  margin: 0 18px 8px;
  padding: 8px 10px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #d6dddd;
  border-radius: 12px;
  background: #f5f8f7;
  color: #53656d;
  font-size: 13px;
}
.attachment-bar:not([hidden]) { display: flex; }

.composer {
  position: sticky;
  bottom: 0;
  padding: 10px 16px max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  border-top: 1px solid #e1e8e5;
  background: rgba(248, 250, 249, 0.98);
}
.composer-tools { display: flex; gap: 8px; }
.composer textarea {
  width: 100%;
  min-height: 42px;
  max-height: 140px;
  resize: none;
  padding: 11px 14px;
  border: 1px solid #ccd5d4;
  border-radius: 20px;
  outline: none;
  color: #172026;
  background: #ffffff;
  line-height: 1.45;
}
.composer textarea:focus { border-color: #176b58; box-shadow: 0 0 0 2px rgba(23, 107, 88, 0.12); }
.send-button { background: #176b58; border-color: #176b58; color: #ffffff; font-weight: 700; }
.send-button:disabled { cursor: default; background: #a8b7b3; border-color: #a8b7b3; }

@media (max-width: 620px) {
  .app-shell { border: 0; }
  .topbar { padding-inline: 14px; }
  .conversation { padding: 20px 16px 128px; }
  .composer { padding-inline: 10px; gap: 7px; }
  .composer-tools { gap: 6px; }
  .icon-button, .send-button { width: 40px; height: 40px; flex-basis: 40px; }
  .message { width: 94%; }
  .plan-band dl { grid-template-columns: 78px 1fr; }
}
