* {
  box-sizing: border-box;
}

html,
body,
#root {
  height: 100%;
}

body {
  margin: 0;
  min-width: 1080px;
  color: #20242a;
  background: #f4f6f8;
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
textarea,
select {
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(39, 108, 92, 0.22);
  outline-offset: 2px;
}

.error-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100vh;
  padding: 32px;
  text-align: center;
  background: #f4f6f8;
}

.error-screen img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 10px;
}

.error-screen h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.error-screen p {
  max-width: 560px;
  margin: 0;
  color: #607080;
  line-height: 1.7;
}

.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  height: 100vh;
  min-height: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 0;
  padding: 22px 16px;
  color: #eef2f7;
  background: #23272f;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #aeb7c3;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #c7d0dd;
  background: transparent;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  color: #ffffff;
  background: #343b46;
}

.nav-button.active::before {
  position: absolute;
  left: -16px;
  width: 3px;
  height: 22px;
  border-radius: 999px;
  background: #78c5ae;
  content: "";
}

.session-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  margin-top: auto;
  padding: 12px;
  border: 1px solid #3a414c;
  border-radius: 8px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.session-box:hover {
  background: #343b46;
  border-color: #4d5664;
  transform: translateY(-1px);
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  padding: 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
}

.topbar p,
.panel-title p,
.task-card small,
.blueprint-item span {
  color: #687282;
}

.icon-button,
.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.icon-button {
  width: 36px;
  color: #364150;
  background: #ffffff;
  border-color: #d9dee6;
}

.icon-button:hover,
.secondary-button:hover {
  border-color: #bac5d1;
  background: #f8fafb;
  transform: translateY(-1px);
}

.primary-button {
  padding: 0 14px;
  color: #ffffff;
  background: #276c5c;
}

.primary-button:hover:not(:disabled) {
  background: #1f5f50;
  box-shadow: 0 8px 18px rgba(39, 108, 92, 0.18);
  transform: translateY(-1px);
}

.primary-button:disabled {
  cursor: default;
  opacity: 0.6;
}

.secondary-button {
  padding: 0 14px;
  color: #344054;
  background: #ffffff;
  border-color: #d9dee6;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric,
.panel {
  background: #ffffff;
  border: 1px solid #e0e4ea;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(29, 42, 56, 0.04);
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 118px;
  padding: 16px;
}

.metric svg {
  color: #276c5c;
}

.metric span {
  color: #687282;
}

.metric strong {
  font-size: 18px;
  overflow-wrap: anywhere;
}

.panel {
  padding: 16px;
}

.assistant-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.conversation-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 14px;
  min-height: 0;
  height: 100%;
  padding: 18px;
}

.conversation {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 2px 6px 4px 0;
  scroll-behavior: smooth;
}

.message {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  animation: message-in 0.18s ease both;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) 34px;
}

.message.user .avatar {
  grid-column: 2;
  grid-row: 1;
}

.message.user .bubble {
  grid-column: 1;
  justify-self: end;
  background: #e9f5ef;
  border-color: #d6eadf;
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #24302b;
  background: #dfeee8;
  box-shadow: 0 6px 14px rgba(26, 64, 52, 0.08);
}

.avatar img {
  width: 26px;
  height: 26px;
  object-fit: contain;
}

.bubble {
  display: grid;
  gap: 12px;
  max-width: 760px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f2f4f7;
  border: 1px solid #eef1f5;
  box-shadow: 0 8px 22px rgba(30, 41, 59, 0.05);
}

.bubble p {
  line-height: 1.7;
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-actions .secondary-button {
  height: 34px;
  background: #fbfcfd;
}

.thinking-bubble {
  width: fit-content;
  min-width: 124px;
}

.thinking-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #51606f;
  font-size: 13px;
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.thinking-dots i {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #276c5c;
  opacity: 0.35;
  animation: thinking-pulse 1s ease-in-out infinite;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

.attachment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid #d9e7df;
  border-radius: 8px;
  background: #ffffff;
}

.attachment-main,
.attachment-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.attachment-main svg {
  flex: 0 0 auto;
  color: #276c5c;
}

.attachment-main div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-main strong,
.attachment-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-main span {
  color: #687282;
  font-size: 12px;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dde5ed;
  border-radius: 8px;
  background: #fbfcfd;
}

.composer-input {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.composer textarea {
  min-height: 72px;
  max-height: 150px;
  border-color: transparent;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #ccd4df;
}

.composer textarea:focus {
  box-shadow: inset 0 0 0 1px #276c5c, 0 0 0 3px rgba(39, 108, 92, 0.08);
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  color: #7a8493;
  font-size: 12px;
}

.send-button {
  height: 44px;
  min-width: 104px;
}

.send-button span {
  line-height: 1;
  white-space: nowrap;
}

.context-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.metric-stack,
.quick-actions {
  display: grid;
  gap: 10px;
}

.context-metric {
  display: grid;
  grid-template-columns: 24px 64px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 4px;
  border-radius: 8px;
}

.context-metric svg {
  color: #276c5c;
}

.context-metric span {
  color: #687282;
}

.context-metric strong {
  overflow-wrap: anywhere;
}

.quick-action {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid #e1e6ec;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.quick-action:hover {
  border-color: #c8d6df;
  background: #fbfcfd;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(30, 41, 59, 0.06);
}

.quick-action small {
  color: #7a8493;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.panel.wide {
  grid-column: span 4;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.blueprint {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.blueprint-item {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 12px;
  border: 1px solid #e4e8ee;
  border-radius: 8px;
  background: #fbfcfd;
}

.plain-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li,
.endpoint-row {
  padding: 10px;
  border-radius: 8px;
  background: #f4f7f6;
  overflow-wrap: anywhere;
}

.task-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
}

.task-list {
  display: grid;
  align-content: start;
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 7px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
}

.task-card.selected {
  border-color: #276c5c;
  box-shadow: inset 3px 0 0 #276c5c;
}

.task-detail {
  min-height: 520px;
}

.danger,
.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
}

.danger.safe,
.pill.ok {
  color: #126044;
  background: #e0f6ed;
}

.danger.review {
  color: #8a5200;
  background: #fff1cc;
}

.danger.danger {
  color: #9b1c1c;
  background: #ffe2e2;
}

.pill.muted {
  color: #687282;
  background: #edf0f4;
}

.endpoint-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

code {
  color: #5b3bc4;
  font-weight: 700;
}

.param-grid,
.form-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.toggle span {
  color: #445061;
  font-size: 13px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: #20242a;
  border: 1px solid #ccd4df;
  border-radius: 8px;
  background: #ffffff;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #276c5c;
  box-shadow: 0 0 0 3px rgba(39, 108, 92, 0.08);
  outline: none;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding-top: 21px;
}

.toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
}

.compact-toggle {
  padding-top: 0;
}

.subsection-title {
  padding-top: 6px;
  color: #20242a;
  font-weight: 700;
}

.scope-note {
  color: #687282;
  font-size: 13px;
  line-height: 1.6;
}

.mcp-status-card {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #fbfcfd;
}

.mcp-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mcp-status-header strong {
  color: #20242a;
}

.mcp-summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mcp-summary-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e6ebf1;
  border-radius: 8px;
  background: #ffffff;
}

.mcp-summary-item.wide {
  grid-column: 1 / -1;
}

.mcp-summary-item span,
.mcp-empty {
  color: #687282;
  font-size: 12px;
}

.mcp-summary-item strong {
  color: #20242a;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.mcp-summary-item strong.ok {
  color: #126044;
}

.mcp-summary-item strong.warn {
  color: #8a5200;
}

.action-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.feedback {
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.5;
}

.feedback.success {
  color: #126044;
  background: #e0f6ed;
}

.feedback.error {
  color: #9b1c1c;
  background: #ffe2e2;
}

.feedback.info {
  color: #315f83;
  background: #e8f2ff;
}

.captcha-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 10px;
}

.captcha-button {
  display: grid;
  place-items: center;
  height: 38px;
  padding: 0;
  border: 1px solid #ccd4df;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.captcha-button img {
  width: 120px;
  height: 40px;
  object-fit: cover;
}

.logged-in-actions {
  display: flex;
  justify-content: flex-start;
  padding-top: 4px;
}

.result {
  max-height: 260px;
  margin: 16px 0 0;
  padding: 12px;
  border-radius: 8px;
  overflow: auto;
  white-space: pre-wrap;
}

.result.success {
  color: #123f31;
  background: #eef9f3;
}

.result.error {
  color: #7b1d1d;
  background: #fff0f0;
}

.comparison-wrap {
  margin-top: 16px;
  max-width: 100%;
  overflow: auto;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #ffffff;
}

.order-stats-wrap,
.markdown-table-wrap {
  margin-top: 12px;
  max-width: 100%;
  overflow: auto;
  border: 1px solid #dfe5ec;
  border-radius: 8px;
  background: #ffffff;
}

.table-caption {
  padding: 10px 12px;
  border-bottom: 1px solid #e6ebf1;
  color: #344054;
  background: #fbfcfd;
  font-size: 13px;
  font-weight: 700;
}

.comparison-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  min-width: 1120px;
  background: #ffffff;
}

.order-stats-table,
.markdown-table {
  width: 100%;
  min-width: 640px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #ffffff;
}

.comparison-table th,
.comparison-table td,
.order-stats-table th,
.order-stats-table td,
.markdown-table th,
.markdown-table td {
  padding: 11px 10px;
  border-bottom: 1px solid #e6ebf1;
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.comparison-table th,
.order-stats-table th,
.markdown-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #445061;
  background: #f6f8fa;
  font-size: 13px;
  font-weight: 700;
}

.comparison-table tbody tr:nth-child(even) td,
.order-stats-table tbody tr:nth-child(even) td,
.markdown-table tbody tr:nth-child(even) td {
  background: #fbfcfd;
}

.comparison-table tbody tr:hover td,
.order-stats-table tbody tr:hover td,
.markdown-table tbody tr:hover td {
  background: #f4f8f6;
}

.comparison-table tr:last-child td,
.order-stats-table tr:last-child td,
.markdown-table tr:last-child td {
  border-bottom: 0;
}

.order-stats-table th:nth-child(1),
.order-stats-table td:nth-child(1) {
  width: 150px;
}

.order-stats-table th:nth-child(2),
.order-stats-table td:nth-child(2) {
  width: 110px;
}

.order-stats-table th:nth-child(3),
.order-stats-table td:nth-child(3) {
  width: 240px;
}

.order-stats-table th:nth-child(4),
.order-stats-table td:nth-child(4) {
  width: 320px;
}

.stat-value {
  color: #123f31;
  font-weight: 800;
}

.comparison-table th:nth-child(1),
.comparison-table td:nth-child(1) {
  width: 124px;
}

.comparison-table th:nth-child(2),
.comparison-table td:nth-child(2) {
  width: 240px;
}

.comparison-table th:nth-child(3),
.comparison-table td:nth-child(3) {
  width: 94px;
}

.comparison-table th:nth-child(4),
.comparison-table td:nth-child(4) {
  width: 100px;
}

.comparison-table th:nth-child(5),
.comparison-table td:nth-child(5) {
  width: 96px;
}

.comparison-table th:nth-child(6),
.comparison-table td:nth-child(6) {
  width: 142px;
}

.comparison-table th:nth-child(7),
.comparison-table td:nth-child(7) {
  width: 250px;
}

.comparison-table th:nth-child(8),
.comparison-table td:nth-child(8) {
  width: 260px;
}

.price-cell,
.unit-price-cell {
  color: #123f31;
  font-weight: 700;
}

.table-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.table-status.ok {
  color: #126044;
  background: #e0f6ed;
}

.table-status.warn {
  color: #8a5200;
  background: #fff1cc;
}

.table-status.muted {
  color: #687282;
  background: #edf0f4;
}

.evidence-cell {
  display: grid;
  gap: 8px;
  min-width: 0;
  word-break: normal;
}

.evidence-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.evidence-link {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid #cfe0f7;
  border-radius: 999px;
  color: #1f6feb;
  background: #f4f8ff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.evidence-cell a {
  color: #1f6feb;
  text-decoration: none;
}

.evidence-cell a:hover {
  text-decoration: underline;
}

.evidence-detail {
  color: #5d6878;
  font-size: 12px;
}

.evidence-detail summary {
  cursor: pointer;
  width: fit-content;
}

.evidence-detail code {
  display: block;
  max-height: 84px;
  margin-top: 4px;
  padding: 6px;
  overflow: auto;
  border-radius: 6px;
  color: #334155;
  background: #f6f8fa;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-all;
}

.evidence-text {
  color: #334155;
}

.bubble .comparison-wrap {
  margin-top: 0;
}

.bubble .comparison-table {
  min-width: 1040px;
}

.result-details {
  margin-top: 12px;
}

.result-details summary {
  color: #445061;
  cursor: pointer;
  font-weight: 600;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  align-items: start;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.settings-grid .panel {
  align-self: start;
}

.logs-panel {
  min-height: 590px;
}

.logs-list,
.compact-logs {
  display: grid;
  gap: 8px;
}

.log-line {
  display: grid;
  grid-template-columns: 180px 70px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f7f8fa;
}

.log-line time,
.log-line span {
  color: #687282;
  font-size: 12px;
}

.log-line.success {
  background: #eef9f3;
}

.log-line.error {
  background: #fff0f0;
}

.log-line.warn {
  background: #fff7dd;
}

.empty {
  color: #7a8493;
}

.conversation::-webkit-scrollbar,
.context-panel::-webkit-scrollbar,
.settings-grid::-webkit-scrollbar,
.comparison-wrap::-webkit-scrollbar,
.result::-webkit-scrollbar,
.evidence-detail code::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.conversation::-webkit-scrollbar-thumb,
.context-panel::-webkit-scrollbar-thumb,
.settings-grid::-webkit-scrollbar-thumb,
.comparison-wrap::-webkit-scrollbar-thumb,
.result::-webkit-scrollbar-thumb,
.evidence-detail code::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: #b8c1cc;
  background-clip: content-box;
}

.conversation::-webkit-scrollbar-track,
.context-panel::-webkit-scrollbar-track,
.settings-grid::-webkit-scrollbar-track,
.comparison-wrap::-webkit-scrollbar-track,
.result::-webkit-scrollbar-track,
.evidence-detail code::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes thinking-pulse {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }
  40% {
    opacity: 0.85;
    transform: translateY(-2px);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
