:root {
  color-scheme: light;
  --ink: #17231d;
  --muted: #6d776f;
  --line: #dfe5df;
  --surface: #ffffff;
  --canvas: #f3f5f1;
  --primary: #155d43;
  --primary-dark: #0d4531;
  --accent: #ddf3e7;
  --warm: #f5eee4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 5%, rgba(203, 225, 211, .7), transparent 27rem),
    radial-gradient(circle at 94% 86%, rgba(231, 217, 195, .65), transparent 30rem),
    var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

button, textarea { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(1440px, 100%);
  height: 100%;
  margin: 0 auto;
  padding: 0 32px 32px;
  overflow: hidden;
}

.topbar {
  height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand, .top-actions, .feature-list, .quick-actions {
  display: flex;
  align-items: center;
}

.brand { gap: 13px; }
.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--primary);
  border-radius: 14px 5px 14px 5px;
  font-size: 22px;
  font-weight: 800;
  box-shadow: 0 9px 22px rgba(21, 93, 67, .2);
}

.brand h1 { margin: 0; font-size: 20px; letter-spacing: .02em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { gap: 18px; }

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.status i {
  width: 8px;
  height: 8px;
  background: #a9b1ac;
  border-radius: 50%;
}
.status.online i {
  background: #27a06e;
  box-shadow: 0 0 0 4px rgba(39, 160, 110, .12);
}

.ghost-button {
  padding: 9px 15px;
  border: 1px solid #cbd4cc;
  color: var(--ink);
  background: rgba(255, 255, 255, .55);
  border-radius: 10px;
}
.ghost-button:hover { background: white; border-color: #9eaaa1; }

.workspace {
  height: calc(100% - 94px);
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, 390px) minmax(0, 1fr);
  gap: 24px;
}

.intro-card, .chat-panel {
  border: 1px solid rgba(201, 211, 203, .8);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 18px 55px rgba(46, 67, 54, .08);
  backdrop-filter: blur(16px);
}

.intro-card {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 4vw, 52px);
  border-radius: 24px;
}
.intro-card::after {
  content: "¥";
  position: absolute;
  right: -22px;
  bottom: -68px;
  color: rgba(21, 93, 67, .055);
  font-family: Georgia, serif;
  font-size: 250px;
  font-weight: bold;
}

.eyebrow {
  display: inline-block;
  padding: 6px 10px;
  color: var(--primary);
  background: var(--accent);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}
.intro-card h2 {
  max-width: 260px;
  margin: 26px 0 14px;
  font-family: "Microsoft YaHei", sans-serif;
  font-size: clamp(31px, 3vw, 46px);
  line-height: 1.16;
  letter-spacing: -.04em;
}
.intro-card > p { color: var(--muted); line-height: 1.8; }

.example {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  padding: 18px;
  border: 1px solid #e6dfd4;
  background: var(--warm);
  border-radius: 16px;
}
.example span { display: block; color: #8b7456; font-size: 12px; font-weight: 700; }
.example button {
  padding: 9px 0 0;
  border: 0;
  color: #4f4335;
  background: transparent;
  text-align: left;
  line-height: 1.6;
}
.feature-list {
  position: absolute;
  z-index: 1;
  left: 52px;
  right: 52px;
  bottom: 38px;
  flex-wrap: wrap;
  gap: 8px;
}
.feature-list span {
  padding: 7px 10px;
  color: #536057;
  background: #edf1ed;
  border-radius: 99px;
  font-size: 11px;
}

.chat-panel {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
}
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 34px clamp(20px, 4vw, 48px);
  scroll-behavior: smooth;
}

.scroll-latest {
  position: absolute;
  z-index: 4;
  right: 28px;
  bottom: 142px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid #ccd8d0;
  color: var(--primary);
  background: rgba(255, 255, 255, .96);
  border-radius: 99px;
  box-shadow: 0 7px 22px rgba(31, 63, 43, .12);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .18s ease;
}
.scroll-latest.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.scroll-latest svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.message {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 24px;
}
.message.user { flex-direction: row-reverse; }
.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: var(--accent);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 800;
}
.user .avatar { color: white; background: var(--primary); }
.message-content { max-width: min(720px, 78%); }
.bubble {
  padding: 13px 16px;
  border: 1px solid var(--line);
  background: white;
  border-radius: 4px 16px 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  box-shadow: 0 7px 18px rgba(35, 54, 42, .04);
}
.user .bubble {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
  border-radius: 16px 4px 16px 16px;
}
.message time {
  display: block;
  margin: 6px 3px 0;
  color: #9aa39d;
  font-size: 10px;
}
.user time { text-align: right; }
.bubble.loading::after {
  content: "...";
  display: inline-block;
  width: 18px;
  overflow: hidden;
  vertical-align: bottom;
  animation: typing 1.1s steps(4, end) infinite;
}

.quote-card {
  width: min(760px, calc(100% - 45px));
  margin: -6px 0 28px 45px;
  overflow: hidden;
  border: 1px solid #cfdad2;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 16px 38px rgba(35, 67, 48, .1);
}
.quote-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 24px 18px;
  color: white;
  background: var(--primary);
}
.quote-header span {
  display: block;
  margin-bottom: 5px;
  color: #aee0c8;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
}
.quote-header h3 { margin: 0; font-size: 20px; }
.quote-header strong {
  padding: 6px 10px;
  color: #d9f5e7;
  background: rgba(255, 255, 255, .12);
  border-radius: 99px;
  font-size: 11px;
}
.quote-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 15px 24px;
  border-bottom: 1px solid #e6ebe7;
  background: #f7faf8;
}
.quote-meta div { display: flex; gap: 8px; font-size: 12px; }
.quote-meta span { color: var(--muted); }
.quote-meta b { font-weight: 700; }
.quote-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  padding: 8px 24px 16px;
}
.quote-details div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px dashed #e2e8e3;
}
.quote-details dt { color: var(--muted); font-size: 12px; }
.quote-details dd { margin: 0; font-size: 13px; font-weight: 700; }
.quote-total {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 24px;
  padding: 18px 0;
  border-top: 2px solid var(--ink);
}
.quote-total span { color: var(--muted); font-size: 13px; }
.quote-total strong { color: var(--primary); font-family: Georgia, serif; font-size: 32px; }
.quote-note, .quote-contact {
  margin: 0;
  padding: 0 24px 10px;
  color: #79847c;
  font-size: 11px;
  line-height: 1.65;
}
.quote-contact { color: #4f5e54; font-weight: 700; }
.quote-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 24px 20px;
}
.quote-actions button {
  padding: 9px 13px;
  border: 1px solid #cdd7cf;
  color: var(--ink);
  background: white;
  border-radius: 9px;
  font-size: 12px;
}
.quote-actions button.primary { color: white; border-color: var(--primary); background: var(--primary); }

.quick-actions {
  gap: 8px;
  overflow-x: auto;
  padding: 12px clamp(20px, 4vw, 48px);
  border-top: 1px solid #edf0ed;
  scrollbar-width: none;
}
.quick-actions::-webkit-scrollbar { display: none; }
.quick-actions button {
  flex: none;
  padding: 7px 12px;
  border: 1px solid #d8dfd9;
  color: #536057;
  background: #f7f9f7;
  border-radius: 99px;
  font-size: 12px;
}
.quick-actions button:hover { color: var(--primary); border-color: #a9c8b8; background: #f0f8f4; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 0 clamp(16px, 3vw, 36px);
  padding: 10px 10px 10px 18px;
  border: 1px solid #ccd5ce;
  background: white;
  border-radius: 17px;
  box-shadow: 0 8px 28px rgba(40, 64, 49, .08);
}
.composer:focus-within { border-color: #73a78f; box-shadow: 0 0 0 3px rgba(21, 93, 67, .08); }
.composer textarea {
  width: 100%;
  min-height: 40px;
  max-height: 132px;
  padding: 9px 0;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  line-height: 1.5;
}
.composer textarea::placeholder { color: #9aa39d; }
.send-button {
  height: 42px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  border: 0;
  color: white;
  background: var(--primary);
  border-radius: 11px;
  font-weight: 700;
}
.send-button:hover { background: var(--primary-dark); }
.send-button:disabled { cursor: wait; opacity: .65; }
.send-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}
.privacy-note {
  margin: 9px 0 14px;
  color: #929b95;
  font-size: 10px;
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes typing {
  from { width: 0; }
  to { width: 18px; }
}

@media (max-width: 860px) {
  .shell { height: 100%; padding: 0 14px 14px; }
  .topbar { height: 76px; }
  .brand p, .status { display: none; }
  .workspace { height: calc(100% - 76px); min-height: 0; grid-template-columns: 1fr; }
  .intro-card { display: none; }
  .chat-panel { height: 100%; min-height: 0; border-radius: 18px; }
  .messages { padding: 24px 16px; }
  .message-content { max-width: 86%; }
  .quote-card { width: calc(100% - 45px); }
}

@media (max-width: 480px) {
  .brand h1 { font-size: 17px; }
  .brand-mark { width: 39px; height: 39px; font-size: 18px; }
  .ghost-button { padding: 8px 11px; font-size: 12px; }
  .send-button span { display: none; }
  .send-button { width: 42px; justify-content: center; padding: 0; }
  .quote-card { width: 100%; margin-left: 0; border-radius: 14px; }
  .quote-meta, .quote-details { grid-template-columns: 1fr; }
  .quote-actions { justify-content: stretch; }
  .quote-actions button { flex: 1; }
}

@media print {
  body { background: white; }
  .shell > * { display: none !important; }
  .shell, .workspace, .chat-panel, .messages {
    display: block !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: white !important;
  }
  .messages > * { display: none !important; }
  .messages > .quote-card.print-target {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    border: 1px solid #bbb !important;
    box-shadow: none !important;
  }
  .quote-actions { display: none !important; }
}
  min-height: 0;
