/* 素源鲜行AI智能体 Agent 控制台 */

:root {
  --bg: #f5f6f8;
  --bg-card: #ffffff;
  --border: #e2e5ea;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --text-hint: #9ca3af;
  --accent: #1d9e75;
  --accent-light: #e1f5ee;
  --accent-dark: #0f6e56;
  --purple: #534ab7;
  --purple-light: #eeedfe;
  --amber: #ba7517;
  --amber-light: #faeeda;
  --red: #a32d2d;
  --red-light: #fcebeb;
  --radius: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  height: 100vh;
  overflow: hidden;
}

/* Layout */
.app {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  gap: 0;
}

/* Header */
.header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 56px;
}

.header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-dark);
  letter-spacing: -0.3px;
}

.header .badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 500;
}

/* Chat area */
.chat-panel {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.message.user {
  align-self: flex-end;
  background: var(--accent-light);
  color: var(--accent-dark);
  border-bottom-right-radius: 2px;
}

.message.agent {
  align-self: flex-start;
  background: #f3f4f6;
  color: var(--text);
  border-bottom-left-radius: 2px;
}

.message.system {
  align-self: center;
  background: var(--amber-light);
  color: var(--amber);
  font-size: 12.5px;
  max-width: 90%;
  text-align: center;
}

.chat-input-area {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

.quick-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.quick-btn {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: var(--accent-light);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s;
}

.input-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.input-row button {
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.input-row button:hover { background: var(--accent-dark); }
.input-row button:disabled { opacity: 0.5; cursor: default; }

/* Right panel */
.info-panel {
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.card .label {
  font-size: 11px;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.card .value {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.active { background: var(--accent); }
.status-dot.idle { background: var(--text-hint); }
.status-dot.error { background: var(--red); }

.field-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #f9fafb;
}

.field-item .icon { width: 16px; text-align: center; }
.field-item .icon.done { color: var(--accent); }
.field-item .icon.pending { color: var(--text-hint); }

.field-item .val {
  flex: 1;
  color: var(--text);
  font-weight: 500;
}

.field-item .lbl {
  color: var(--text-hint);
  font-size: 11px;
}

.confidence-bar {
  height: 4px;
  border-radius: 2px;
  background: #e5e7eb;
  margin-top: 4px;
  overflow: hidden;
}

.confidence-bar .fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.confidence-bar .fill.high { background: var(--accent); }
.confidence-bar .fill.med { background: var(--amber); }
.confidence-bar .fill.low { background: var(--red); }

.history-list {
  font-size: 12px;
  color: var(--text-muted);
  max-height: 200px;
  overflow-y: auto;
}

.history-item {
  padding: 3px 0;
  border-bottom: 1px solid #f3f4f6;
}

.history-item .role {
  font-weight: 500;
  color: var(--accent-dark);
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: var(--text-hint);
  text-align: center;
  gap: 8px;
}

.empty-state .icon-lg { font-size: 36px; }
.empty-state .title { font-size: 16px; font-weight: 500; color: var(--text-muted); }
.empty-state .desc { font-size: 13px; max-width: 280px; }

/* ===== Form card (missing fields) ===== */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  margin: 0 0 12px 0;
}

.form-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

.form-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.form-field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-field input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(29, 158, 117, 0.15);
}

.form-field .hint {
  font-size: 11px;
  color: var(--text-hint);
}

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

.form-submit-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.form-submit-btn:hover { opacity: 0.9; }

.form-cancel-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
}

.form-cancel-btn:hover { background: var(--bg); }
