:root {
    --primary: #2563eb;
    --bg: #f1f5f9;
    --sidebar: #0f172a;
    --text: #1e293b;
    --border: #e2e8f0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }

a { color: var(--primary); text-decoration: none; }

/* 登录页 */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%); }
.login-box { background: #fff; padding: 40px; border-radius: 12px; width: 360px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-box h1 { font-size: 20px; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #94a3b8; font-size: 12px; margin-bottom: 24px; }
.login-box label { display: block; margin: 12px 0 4px; font-size: 13px; color: #475569; }
.login-box input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 6px; }
.login-box input:focus { outline: none; border-color: var(--primary); }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 220px; background: var(--sidebar); color: #cbd5e1; flex-shrink: 0; display: flex; flex-direction: column; }
.brand { padding: 20px; font-size: 16px; font-weight: 700; color: #fff; border-bottom: 1px solid #1e293b; }
.sidebar nav { flex: 1; padding: 12px 0; }
.sidebar nav a { display: block; padding: 12px 20px; color: #cbd5e1; }
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid #1e293b; font-size: 13px; }
.sidebar-footer .role { color: #64748b; margin: 4px 0 8px; }
.sidebar-footer a { color: #94a3b8; }

.content { flex: 1; padding: 24px; }
h2 { margin-bottom: 20px; }
h2 small { color: #94a3b8; font-weight: normal; }
h3 { margin-bottom: 12px; }

/* 卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; padding: 20px; border-radius: 10px; border: 1px solid var(--border); text-align: center; }
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .label { color: #64748b; margin-top: 4px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.panel-head h3 { margin: 0; }

/* 表单 */
label { display: block; margin: 12px 0 4px; font-size: 13px; color: #475569; }
input, select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
input:focus, select:focus { outline: none; border-color: var(--primary); }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.inline-form input, .inline-form select { flex: 0 0 auto; }

/* 按钮 */
.btn { display: inline-block; padding: 9px 16px; background: #fff; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text); }
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: #1d4ed8; color: #fff; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-danger { color: #dc2626; border-color: #fecaca; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; font-weight: 600; color: #475569; }
tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: #94a3b8; padding: 30px; }
.td-actions { white-space: nowrap; }
.td-actions .btn { margin-right: 6px; }
.td-actions .btn:last-child { margin-right: 0; }

/* 徽章/状态 */
.badge { background: #eff6ff; color: var(--primary); padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.status { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; }
.status-pending { background: #fef3c7; color: #b45309; }
.status-running { background: #dbeafe; color: #1d4ed8; }
.status-done { background: #dcfce7; color: #15803d; }
.status-review, .status-paused { background: #fae8ff; color: #a21caf; }
.status-failed { background: #fee2e2; color: #dc2626; }

/* 提示 */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #dc2626; }

/* 步骤流 */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.step-head { display: flex; align-items: center; gap: 10px; }
.step-name { font-weight: 600; }
.step-key { color: #94a3b8; font-size: 12px; }
.step-action { margin-top: 12px; }
.step-error { margin-top: 8px; color: #dc2626; font-size: 13px; }
.step-output { margin-top: 8px; background: #f8fafc; padding: 10px; border-radius: 6px; font-size: 12px; max-height: 150px; overflow: auto; white-space: pre-wrap; }
.step-body { margin-top: 12px; }

/* 键值列表（调研报告等结构化展示） */
.kv-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.kv-row { display: flex; border-bottom: 1px solid var(--border); }
.kv-row:last-child { border-bottom: none; }
.kv-key { width: 110px; flex-shrink: 0; padding: 10px 12px; background: #f8fafc; font-weight: 600; color: #475569; font-size: 13px; }
.kv-val { flex: 1; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.bullet-list { margin: 0; padding-left: 20px; }
.bullet-list li { margin: 4px 0; }

/* 风险表格 */
.risk-table { margin-top: 12px; font-size: 13px; }
.risk { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; }
.risk-high { background: #fee2e2; color: #dc2626; }
.risk-medium { background: #fef3c7; color: #b45309; }
.risk-low { background: #dcfce7; color: #15803d; }

/* 提示词列表 */
.prompt-list { margin-top: 12px; }
.prompt-item { padding: 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; }
.prompt-text { margin-top: 6px; color: #475569; font-size: 12px; line-height: 1.5; }
.prompt-more { color: #94a3b8; font-size: 12px; margin-top: 6px; }

/* 场景模板表单 */
.hint { color: #64748b; font-size: 13px; margin-bottom: 16px; }
.scene-form .form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.scene-form .form-grid input, .scene-form .form-grid select { width: 100%; }
.scene-form .form-actions { margin-top: 16px; display: flex; gap: 10px; }
