﻿:root {
  color-scheme: light;
  --bg: #f5f7f7;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --ink: #182126;
  --text: #2f3a40;
  --muted: #66747d;
  --line: #dce3e1;
  --line-strong: #c8d3d0;
  --primary: #0f6b5f;
  --primary-strong: #0a574e;
  --primary-soft: #edf6f3;
  --blue: #315f8c;
  --amber: #9a6416;
  --red: #b42318;
  --shadow: 0 18px 48px rgba(18, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

button:hover:not(:disabled) {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.09);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: var(--blue);
}

.app-header {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.brand-copy {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.status-pill {
  min-width: 112px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #ead7b4;
  border-radius: 6px;
  background: #fffaf0;
  color: var(--amber);
  font-size: 13px;
  white-space: nowrap;
}

.status-pill[data-ok="true"] {
  border-color: #c6ded7;
  background: var(--primary-soft);
  color: var(--primary);
}

.status-pill[data-ok="false"] {
  border-color: #f0c2bd;
  background: #fff5f4;
  color: var(--red);
}

.prompt-toggle {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.prompt-toggle[aria-expanded="true"] {
  border-color: #b8d5cd;
  background: var(--primary-soft);
  color: var(--primary);
}

.shell {
  width: min(1060px, calc(100% - 36px));
  height: calc(100vh - 92px);
  margin: 10px auto;
  min-height: 0;
}

.assistant-workspace {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.workspace-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.workspace-topline div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.workspace-topline strong {
  font-size: 15px;
}

.workspace-topline span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-button {
  min-height: 32px;
  padding: 0 10px;
  background: #fff;
  color: var(--muted);
}

.chat-window {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 18px;
}

.main-chat {
  min-height: 0;
  background: var(--surface-soft);
}

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.chat-row.user {
  justify-content: flex-end;
}

.chat-row.assistant {
  justify-content: flex-start;
}

.avatar {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-top: 2px;
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.chat-row.user .avatar {
  display: none;
}

.chat-bubble {
  width: fit-content;
  max-width: min(760px, 88%);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  line-height: 1.62;
}

.chat-row.user .chat-bubble {
  border-color: #c8ded7;
  background: #f1f7f5;
}

.chat-bubble strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.chat-bubble p {
  margin: 0;
}

.chat-bubble p + p {
  margin-top: 6px;
}

.product-understanding {
  display: grid;
  gap: 9px;
  margin: 10px 0 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.product-understanding > div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
}

.product-understanding span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.product-understanding strong,
.product-understanding p {
  margin: 0;
}

.consultant-note {
  padding: 9px 10px;
  border-left: 3px solid var(--amber);
  background: #fffaf0;
  color: #6f4a12;
}

.consultant-prompt {
  margin-top: 12px;
  font-weight: 800;
}

.typing {
  color: var(--muted);
}

.analysis-grid {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px 12px;
  margin: 10px 0 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.analysis-grid dt {
  color: var(--muted);
}

.analysis-grid dd {
  margin: 0;
  word-break: break-word;
}

.quick-section {
  margin-top: 10px;
}

.consultant-questions {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.consultant-question {
  display: grid;
  gap: 7px;
}

.step-question {
  display: grid;
  gap: 10px;
}

.step-question-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.step-question-head span {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f7faf9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.step-question-head strong {
  color: var(--ink);
}

.quick-section-title {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.option-list,
.inline-samples,
.bubble-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-list button,
.inline-samples button,
.bubble-actions button {
  min-height: 32px;
  padding: 0 10px;
  background: #fff;
}

.option-list button.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.inline-samples {
  margin-top: 12px;
}

.clarify-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.clarify-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.clarify-inputs label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.clarify-inputs input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 13px;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  outline: 3px solid rgba(15, 107, 95, 0.12);
}

.consultant-free-text {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.consultant-free-text input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}

.composer {
  display: grid;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.composer-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
}

.composer-status[data-type="success"] {
  color: var(--primary);
}

.composer-status[data-type="error"] {
  color: var(--red);
}

.composer-status[data-type="warn"] {
  color: var(--amber);
}

.composer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 10px;
}

.composer-row input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 13px;
  background: #fff;
}

.composer-row button,
.panel-head button,
.primary-action {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.bubble-actions .primary-action,
.report-actions .primary-action,
.basis-actions .primary-action {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.composer-row button:hover:not(:disabled),
.panel-head button:hover:not(:disabled),
.primary-action:hover:not(:disabled),
.bubble-actions .primary-action:hover:not(:disabled),
.report-actions .primary-action:hover:not(:disabled),
.basis-actions .primary-action:hover:not(:disabled) {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #fff;
}

.prompt-drawer {
  position: fixed;
  inset: 92px clamp(18px, 4vw, 48px) 24px;
  z-index: 18;
}

.prompt-drawer.is-hidden,
.reason-modal.is-hidden,
.evidence-modal.is-hidden {
  display: none;
}

.tool-panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-panel {
  height: 100%;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.panel-head,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.card-head {
  justify-content: flex-start;
}

.panel-head h2,
.card-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.prompt-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 16px 0;
}

.prompt-tabs button {
  min-height: 34px;
  padding: 0 12px;
  background: var(--surface-soft);
}

.prompt-tabs button.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

textarea {
  width: calc(100% - 32px);
  min-height: 260px;
  margin: 14px 16px 16px;
  padding: 12px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.6;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.result-card {
  min-height: 280px;
  overflow: hidden;
  box-shadow: none;
}

.result-card-strong {
  border-color: #b8d8d0;
}

.source-mark,
.assistant-dot {
  display: grid;
  place-items: center;
  border-radius: 5px;
  font-weight: 800;
}

.source-mark {
  width: 28px;
  height: 28px;
  background: var(--primary-soft);
  color: var(--primary);
}

.source-mark.alt {
  background: #eef4fa;
  color: var(--blue);
}

.source-mark.final {
  background: #fff7e8;
  color: var(--amber);
}

.result-body {
  padding: 14px;
}

.result-body.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
}

.match-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.match-item:first-child {
  padding-top: 0;
}

.match-item:last-child {
  border-bottom: 0;
}

.match-title,
.recommend-main {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.match-title span,
.recommend-main span {
  color: var(--primary);
  font-weight: 800;
}

dl {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

dl div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
}

dt {
  color: var(--muted);
}

dd {
  margin: 0;
  word-break: break-word;
}

.reason,
.hint {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.error-box,
.empty-state {
  padding: 12px;
  border-radius: 6px;
  background: #fff5f4;
  color: var(--red);
}

.empty-state {
  background: var(--surface-soft);
  color: var(--muted);
}

.recommendation {
  display: grid;
  gap: 12px;
}

.classification-report {
  width: min(760px, 100%);
  display: grid;
  gap: 16px;
}

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.report-kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.confidence-badge.high {
  border-color: #b8d8d0;
  background: var(--primary-soft);
  color: var(--primary);
}

.confidence-badge.medium {
  border-color: #ead7b4;
  background: #fff7e8;
  color: var(--amber);
}

.confidence-badge.low {
  border-color: #f0c2bd;
  background: #fff5f4;
  color: var(--red);
}

.report-section {
  display: grid;
  gap: 8px;
}

.report-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.report-title {
  color: var(--ink);
  font-size: 22px;
  line-height: 1.35;
  font-weight: 800;
}

.path-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.path-list li {
  position: relative;
  min-height: 30px;
  display: flex;
  align-items: center;
  padding-left: 22px;
  color: var(--text);
}

.path-list li::before {
  content: "";
  position: absolute;
  left: 0;
  width: 8px;
  height: 8px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  background: #fff;
}

.path-arrow {
  width: 16px;
  margin-left: -22px;
  margin-right: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.evidence-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.evidence-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.evidence-list div:first-child {
  border-top: 0;
}

.evidence-list dt {
  color: var(--muted);
  font-weight: 800;
}

.evidence-list dd {
  margin: 0;
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.keyword-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 13px;
}

.report-empty {
  color: var(--muted);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 2px;
}

.report-actions button {
  min-height: 34px;
  padding: 0 12px;
}

.report-actions button:first-child {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.review-section p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
}

.basis-content {
  min-height: 0;
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 16px;
}

.basis-content section {
  display: grid;
  gap: 7px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.basis-content section:last-of-type {
  border-bottom: 0;
}

.basis-content h3 {
  margin: 0;
  font-size: 15px;
}

.basis-content p {
  margin: 0;
  color: var(--text);
  line-height: 1.65;
}

.basis-list {
  margin: 0;
  display: grid;
  gap: 8px;
}

.basis-list div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
}

.basis-list dt {
  color: var(--muted);
  font-weight: 800;
}

.basis-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.basis-actions button {
  padding: 0 12px;
}

.status-line span {
  display: inline-block;
  padding: 5px 9px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.status-line[data-status="needs_review"] span,
.status-line[data-status="conflict"] span,
.status-line[data-status="nearest_match"] span {
  background: #fff7e8;
  color: var(--amber);
}

.status-line[data-status="no_match"] span {
  background: #fff5f4;
  color: var(--red);
}

.copy-button {
  justify-self: start;
  padding: 0 12px;
}

.reason-modal,
.evidence-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 32, 38, 0.32);
}

.reason-dialog,
.evidence-dialog {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(17, 32, 38, 0.22);
}

.evidence-dialog {
  width: min(1180px, calc(100vw - 48px));
}

.evidence-dialog .result-grid {
  min-height: 0;
  overflow: auto;
}

.evidence-dialog .result-body {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.reason-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.reason-dialog-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.reason-dialog-head h2 {
  margin: 0;
  font-size: 16px;
}

.assistant-dot {
  width: 30px;
  height: 30px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.icon-close {
  width: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 6px;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 860px) {
  .brand p {
    display: none;
  }

  .shell {
    width: min(100% - 20px, 1120px);
    height: calc(100vh - 88px);
    margin: 8px auto;
  }

  .workspace-topline span {
    white-space: normal;
  }

  .chat-bubble {
    max-width: calc(100vw - 80px);
  }

  .clarify-inputs,
  .result-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-header {
    height: 76px;
    padding-inline: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .header-actions {
    gap: 6px;
  }

  #serviceStatus {
    display: none;
  }

  .status-pill {
    min-width: 0;
    padding-inline: 8px;
  }

  .workspace-topline {
    align-items: flex-start;
    padding: 12px;
  }

  .chat-window {
    padding: 12px;
  }

  .composer {
    padding: 10px 12px 12px;
  }

  .composer-row {
    grid-template-columns: 1fr;
  }

  dl div,
  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .report-head,
  .report-actions {
    align-items: flex-start;
  }

  .report-head {
    flex-direction: column;
  }

  .report-title {
    font-size: 19px;
  }

  .evidence-list div,
  .product-understanding > div,
  .basis-list div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .reason-modal,
  .evidence-modal {
    padding: 12px;
  }

  .reason-dialog,
  .evidence-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }
}

