:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --line: #d9dee7;
  --text: #1f2933;
  --muted: #657080;
  --accent: #176b87;
  --accent-2: #2f8f6f;
  --danger: #b42318;
  --warning: #9a6700;
  --soft: #edf2f7;
  --shadow: 0 10px 28px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
textarea,
input {
  font: inherit;
}

.shell {
  min-height: 100vh;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fbfcfd;
  padding: 20px;
}

.brand {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 16px;
  line-height: 1.35;
}

p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.status,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--soft);
  color: var(--muted);
}

.status.ok,
.badge.auto {
    background: #e7f6ef;
    color: var(--accent-2);
  }

  .badge.assist {
    background: #eef4ff;
    color: #2563eb;
  }

.badge.handoff {
  background: #fff0ed;
  color: var(--danger);
}

.badge.ignore {
  background: #edf2f7;
  color: var(--muted);
}

.badge.medium {
  background: #fff7e6;
  color: var(--warning);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel.compact {
  padding: 14px;
  margin-top: 14px;
}

.metric-list,
.intent-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.metric,
.intent-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 6px;
  background: #f7f9fb;
  font-size: 13px;
}

.metric strong,
.intent-item strong {
  font-size: 13px;
}

.main-panel {
  padding: 22px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  min-height: 36px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 12px;
  margin-bottom: 12px;
}

.logistics-panel {
  padding: 14px 16px;
  margin-bottom: 14px;
}

.logistics-controls {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.logistics-controls label {
  display: grid;
  grid-template-columns: 88px minmax(180px, 320px);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.image-paste-row {
  display: grid;
  grid-template-columns: 88px minmax(220px, 520px);
  align-items: start;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.image-paste-zone {
  min-height: 128px;
  border: 1px dashed #aeb8c6;
  border-radius: 8px;
  background: #fbfcfd;
  padding: 10px;
  outline: none;
}

.image-paste-zone:focus,
.image-paste-zone.dragging {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
}

.image-paste-hint {
  color: var(--muted);
  line-height: 1.5;
}

.image-preview {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-top: 8px;
}

.image-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.ghost-btn.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.image-status {
  min-height: 18px;
  margin-top: 6px;
  color: var(--accent-2);
  font-size: 12px;
  word-break: break-all;
}

.image-status.error {
  color: var(--danger);
}

select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
}

input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 10px;
  min-width: 0;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 112px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  outline: none;
  background: var(--surface);
  color: var(--text);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.12);
}

#sendBtn {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  min-height: 112px;
}

.quick-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.sample-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  min-height: 34px;
  padding: 0 10px;
  cursor: pointer;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) 1.15fr;
  gap: 16px;
  margin-bottom: 16px;
}

.decision-panel,
.reply-panel,
.main-panel > .panel {
  padding: 16px;
}

.decision-empty,
.reply-empty {
  color: var(--muted);
  margin-top: 12px;
}

.decision-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.decision-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  font-size: 14px;
}

.decision-row span:first-child {
  color: var(--muted);
}

.reply-text {
  margin-top: 12px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.evidence-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.tool-card {
  padding: 12px;
  border: 1px solid #b7d7c5;
  border-radius: 8px;
  background: #f1fbf5;
}

.tool-card.warning {
  border-color: #f4d48a;
  background: #fff9ea;
}

.tool-card.danger {
  border-color: #f4b6ad;
  background: #fff4f2;
}

.tool-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.tool-card p {
  margin: 4px 0 0;
  line-height: 1.6;
}

.evidence-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.evidence-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 700;
}

.evidence-body {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

@media (max-width: 900px) {
  .workspace,
  .result-grid,
  .input-row {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #sendBtn {
    min-height: 44px;
  }
}
