:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }

/* Login */
#login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1419 0%, #1a2744 50%, #0f1a2e 100%);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
  width: 380px;
}

.login-card h1 { font-size: 24px; margin-bottom: 8px; }
.subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }

.login-card label {
  display: block;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.login-card input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
}

.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  cursor: pointer;
  margin-top: 8px;
}

.login-card button:hover { background: var(--primary-hover); }
.error { color: var(--danger); font-size: 13px; margin-top: 12px; }

/* Layout */
#main-page { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.brand {
  padding: 0 20px 20px;
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.nav-item {
  display: block;
  padding: 10px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-item:hover, .nav-item.active {
  color: var(--text);
  background: var(--surface2);
  border-left: 3px solid var(--primary);
}

.logout {
  margin-top: auto;
  margin: auto 16px 16px;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
}

.content { flex: 1; padding: 24px 32px; overflow-y: auto; }

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

.topbar h2 { font-size: 20px; }
#user-info { color: var(--text-muted); font-size: 13px; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.stat-card .label { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; }
.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }

/* Forms */
.config-form { display: grid; gap: 16px; }

.config-form .field label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.required-mark {
  color: var(--danger);
  font-weight: 700;
  line-height: 1;
}

.required-legend {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.field-required label {
  color: var(--text);
}

.config-form .field input, .config-form .field textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: monospace;
}

.config-form .field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-actions { margin-top: 20px; }

.btn-primary, .btn-secondary {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); margin-left: 8px; }

.message { margin-top: 12px; font-size: 13px; padding: 10px; border-radius: var(--radius); }
.message.success { background: rgba(34,197,94,0.15); color: var(--success); }
.message.error { background: rgba(239,68,68,0.15); color: var(--danger); }

.info-card { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.info-card h4 { color: var(--text); margin-bottom: 8px; }
.info-card code { background: var(--surface2); padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* Tables */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { color: var(--text-muted); font-weight: 500; }
.data-table td { color: var(--text); }
.table-toolbar { margin-bottom: 16px; display: flex; gap: 12px; }
.table-toolbar select { padding: 8px 12px; background: var(--surface2); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
}
.status-success { background: rgba(34,197,94,0.2); color: var(--success); }
.status-handoff { background: rgba(245,158,11,0.2); color: var(--warning); }
.status-failed { background: rgba(239,68,68,0.2); color: var(--danger); }
.status-ignored { background: rgba(139,156,179,0.2); color: var(--text-muted); }

.doc-links { margin: 16px 0; }
.doc-preview { background: var(--surface2); padding: 16px; border-radius: var(--radius); font-size: 13px; line-height: 1.8; overflow-x: auto; }
.doc-preview pre { white-space: pre-wrap; word-break: break-all; }

.ticket-action {
  padding: 4px 10px;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
}

.muted { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }

.setup-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.progress-bar { flex: 1; height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
#setup-progress-fill { height: 100%; background: var(--primary); width: 0; transition: width 0.3s; }

.setup-steps { display: flex; flex-direction: column; gap: 12px; }
.setup-step { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--surface2); }
.setup-step.step-done { border-color: var(--success); }
.setup-step.step-pending { border-color: var(--warning); }
.setup-step.step-blocked { opacity: 0.6; }
.step-header { display: flex; align-items: center; gap: 12px; }
.step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.step-status { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.step-desc { font-size: 13px; color: var(--text-muted); margin: 8px 0 0 40px; }
.step-missing { font-size: 12px; color: var(--danger); margin: 4px 0 0 40px; }
.step-actions { margin-left: auto; display: flex; gap: 8px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.migrate-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0; }
.file-btn { cursor: pointer; display: inline-block; }
.checkbox-label { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.migrate-output { background: var(--surface2); padding: 12px; border-radius: var(--radius); font-size: 12px; min-height: 60px; white-space: pre-wrap; }

.config-form textarea { width: 100%; padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); font-size: 14px; font-family: inherit; resize: vertical; }
.config-form code { font-size: 11px; color: var(--text-muted); }

.config-tabs, .ops-tabs { display: flex; gap: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 8px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); cursor: pointer; font-size: 13px; }
.tab.active { background: var(--primary); color: white; border-color: var(--primary); }
.tab-req { color: var(--danger); margin-left: 2px; font-weight: 700; }
.tab.active .tab-req { color: #fecaca; }

.arch-hint { display: flex; align-items: center; gap: 12px; font-size: 14px; padding: 12px 20px; }
.arch-hint code { background: var(--surface2); padding: 2px 8px; border-radius: 4px; }
.arch-hint .muted { margin-left: auto; font-size: 12px; color: var(--text-muted); }

/* Login enterprise layout */
.login-layout { display: flex; gap: 48px; align-items: center; max-width: 960px; padding: 24px; }
.login-hero { flex: 1; max-width: 480px; }
.login-hero h1 { font-size: 32px; margin-bottom: 12px; line-height: 1.3; }
.hero-desc { color: var(--text-muted); margin-bottom: 20px; font-size: 15px; }
.hero-features { list-style: none; margin-bottom: 24px; }
.hero-features li { padding: 8px 0 8px 20px; position: relative; color: var(--text-muted); font-size: 14px; }
.hero-features li::before { content: '✓'; position: absolute; left: 0; color: var(--success); }
.product-badge { display: inline-block; padding: 4px 12px; background: rgba(59,130,246,0.15); color: var(--primary); border-radius: 20px; font-size: 12px; margin-bottom: 16px; }
.hero-spec { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.login-card h2 { font-size: 20px; margin-bottom: 4px; }

.brand-title { display: block; font-weight: 700; }
.brand-ver { font-size: 11px; color: var(--text-muted); font-weight: 400; }
.sidebar-footer { margin-top: auto; padding: 16px; border-top: 1px solid var(--border); }
.sidebar-status { font-size: 11px; margin-bottom: 12px; }
.status-line.muted { color: var(--text-muted); margin-top: 4px; }

.view-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.system-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }
.pill-ok { background: rgba(34,197,94,0.15); color: var(--success); }
.pill-warn { background: rgba(245,158,11,0.15); color: var(--warning); }
.pill-danger { background: rgba(239,68,68,0.15); color: var(--danger); }

.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.half-card h3 { font-size: 15px; margin-bottom: 16px; color: var(--text-muted); }
@media (max-width: 900px) { .dashboard-row { grid-template-columns: 1fr; } .login-layout { flex-direction: column; } }

.slo-panel { display: flex; flex-direction: column; gap: 10px; }
.slo-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--surface2); font-size: 13px; }
.slo-row.slo-ok { border-left: 3px solid var(--success); }
.slo-row.slo-fail { border-left: 3px solid var(--warning); }
.slo-val { font-weight: 700; }
.slo-target { font-size: 11px; color: var(--text-muted); }

.integration-panel { display: flex; flex-direction: column; gap: 10px; }
.integration-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.integration-row:last-child { border-bottom: none; }
.integration-row code { font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; }

.intent-panel { display: flex; flex-direction: column; gap: 12px; }
.intent-bar { display: grid; grid-template-columns: 100px 1fr 80px; gap: 12px; align-items: center; font-size: 13px; }
.intent-track { height: 8px; background: var(--surface2); border-radius: 4px; overflow: hidden; }
.intent-fill { height: 100%; background: var(--primary); border-radius: 4px; }
.intent-count { text-align: right; color: var(--text-muted); font-size: 12px; }

.doc-tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.toolbar-meta { margin-left: auto; font-size: 12px; color: var(--text-muted); }
.empty-cell { text-align: center; color: var(--text-muted); padding: 24px !important; }
.clickable-table tbody tr { cursor: pointer; }
.clickable-table tbody tr:hover { background: var(--surface2); }

.status-timeout { background: rgba(245,158,11,0.2); color: var(--warning); }
.status-ticket-open { background: rgba(59,130,246,0.2); color: var(--primary); }
.status-ticket-processing { background: rgba(245,158,11,0.2); color: var(--warning); }
.status-ticket-closed { background: rgba(139,156,179,0.2); color: var(--text-muted); }

.ticket-action.danger { color: var(--danger); border-color: rgba(239,68,68,0.4); }
.doc-md { white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.7; max-height: 60vh; overflow: auto; }
.markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 16px 0 8px; }
.markdown-body ul { margin: 8px 0 8px 20px; }

.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.modal-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; width: min(560px, 92vw); max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; color: var(--text-muted); font-size: 24px; cursor: pointer; line-height: 1; }
.modal-body { padding: 20px; overflow-y: auto; }
.detail-dl { display: grid; grid-template-columns: 100px 1fr; gap: 8px 16px; font-size: 13px; }
.detail-dl dt { color: var(--text-muted); }
.msg-block { background: var(--surface2); padding: 10px; border-radius: var(--radius); white-space: pre-wrap; word-break: break-word; }
.error-text { color: var(--danger); }

/* 首页流程图 */
.flowchart-card { padding: 28px 32px; }
.flowchart-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 28px; }
.flowchart-header h3 { font-size: 16px; font-weight: 600; }

.flowchart { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 8px 0 16px; }

.flow-row { display: flex; align-items: center; justify-content: center; gap: 16px; width: 100%; }
.flow-row-branches { gap: 24px; flex-wrap: wrap; }

.flow-node {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  min-width: 140px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.flow-node:hover { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(59,130,246,0.2); }
.flow-icon { font-size: 22px; margin-bottom: 6px; line-height: 1; }
.flow-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.flow-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; }

.flow-node-gateway { border-color: var(--primary); background: rgba(59,130,246,0.08); min-width: 180px; }
.flow-node-coze { border-top: 3px solid #8b5cf6; }
.flow-node-dms { border-top: 3px solid var(--success); }
.flow-node-handoff { border-top: 3px solid var(--warning); }
.flow-node-channel { border-top: 3px solid #06b6d4; }
.flow-node-reply { border-top: 3px solid var(--primary); }
.flow-node-log { border-top: 3px solid var(--text-muted); }

.flow-branch { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.flow-tag { font-size: 10px; color: var(--text-muted); font-family: monospace; background: var(--bg); padding: 2px 8px; border-radius: 4px; }

.flow-arrow-h { width: 48px; height: 2px; background: var(--border); position: relative; flex-shrink: 0; }
.flow-arrow-h span { position: absolute; right: -1px; top: -4px; border: 5px solid transparent; border-left-color: var(--border); }
.flow-arrow-h.flow-arrow-light { width: 32px; }

.flow-arrow-v { width: 2px; height: 28px; background: var(--border); position: relative; margin: 4px 0; }
.flow-arrow-v span { position: absolute; bottom: -1px; left: -4px; border: 5px solid transparent; border-top-color: var(--border); }
.flow-arrow-merge::before,
.flow-arrow-merge::after {
  content: '';
  position: absolute;
  top: 0;
  width: 80px;
  height: 2px;
  background: var(--border);
}
.flow-arrow-merge::before { left: -80px; transform: rotate(25deg); transform-origin: right top; }
.flow-arrow-merge::after { right: -80px; transform: rotate(-25deg); transform-origin: left top; }

.flow-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  padding-top: 20px;
  margin-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.flow-legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-wecom { background: #06b6d4; }
.dot-http { background: var(--success); }
.dot-async { background: var(--warning); }

@media (max-width: 768px) {
  .flow-row-branches { flex-direction: column; }
  .flow-arrow-h { width: 24px; }
  .flow-arrow-merge::before, .flow-arrow-merge::after { display: none; }
}

/* 新手向首页 */
.welcome-card h3 { margin-bottom: 20px; font-size: 17px; }
.overview-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.overview-step { display: flex; gap: 16px; align-items: flex-start; padding: 14px 16px; background: var(--surface2); border-radius: var(--radius); }
.overview-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.overview-step p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.welcome-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.prep-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.prep-list li { padding: 10px 14px 10px 32px; background: var(--surface2); border-radius: var(--radius); font-size: 14px; position: relative; }
.prep-list li::before { content: '•'; position: absolute; left: 14px; color: var(--primary); }
.quick-links { display: flex; flex-direction: column; gap: 8px; }
.quick-link-btn { text-align: left; padding: 12px 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); cursor: pointer; font-size: 14px; transition: border-color 0.15s; }
.quick-link-btn:hover { border-color: var(--primary); color: var(--primary); }

/* 简化流程图 */
.flow-simple { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 16px 0; }
.flow-simple-item { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; text-align: center; font-size: 14px; line-height: 1.5; min-width: 120px; }
.flow-simple-item small { display: block; color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.flow-simple-item.highlight { border-color: var(--primary); background: rgba(59,130,246,0.1); }
.flow-simple-item.small { min-width: 100px; padding: 12px 14px; font-size: 13px; }
.flow-simple-arrow { color: var(--text-muted); font-size: 20px; }
.flow-simple-items { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.tip-card { font-size: 14px; line-height: 1.7; color: var(--text-muted); padding: 16px 20px !important; background: rgba(59,130,246,0.06) !important; border-color: rgba(59,130,246,0.25) !important; }
.tip-card strong { color: var(--text); }
.progress-label { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.step-title-wrap { flex: 1; min-width: 0; }

/* 使用手册 */
.handbook-layout { display: grid; grid-template-columns: 200px 1fr; gap: 20px; }
.handbook-nav { display: flex; flex-direction: column; gap: 4px; }
.handbook-nav-item { text-align: left; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-muted); cursor: pointer; font-size: 13px; }
.handbook-nav-item:hover, .handbook-nav-item.active { color: var(--text); border-color: var(--primary); background: var(--surface2); }
.handbook-content h3 { font-size: 20px; margin-bottom: 12px; }
.guide-intro { color: var(--text-muted); line-height: 1.8; margin-bottom: 24px; font-size: 14px; }
.guide-step-block { margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.guide-step-block:last-of-type { border-bottom: none; }
.guide-step-block h4 { font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.guide-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: white; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.guide-step-list { margin-left: 34px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.7; color: var(--text-muted); }
.guide-step-list a { color: var(--primary); }
.guide-step-list strong { color: var(--text); }
.guide-checklist ul { margin: 12px 0 0 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; }
.guide-faq { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.guide-faq h4 { margin-bottom: 16px; font-size: 15px; }
.faq-item { margin-bottom: 16px; padding: 14px 16px; background: var(--surface2); border-radius: var(--radius); }
.faq-q { font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.faq-a { font-size: 13px; color: var(--text-muted); line-height: 1.7; }
.guide-actions { margin-top: 24px; }
.guide-card { padding: 16px 20px !important; }
.category-guide-inner h4 { font-size: 14px; margin-bottom: 8px; }
.category-guide-body { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.category-guide-body a { color: var(--primary); }
.guide-inline-list { margin: 8px 0 8px 18px; display: flex; flex-direction: column; gap: 6px; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; font-size: 13px; margin-top: 10px; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.link-btn { width: 100%; margin-bottom: 8px; padding: 8px; background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; text-align: left; border-radius: var(--radius); }
.link-btn:hover { background: var(--surface2); color: var(--text); }
.hero-hint { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

@media (max-width: 768px) {
  .handbook-layout { grid-template-columns: 1fr; }
  .handbook-nav { flex-direction: row; flex-wrap: wrap; }
  .flow-simple { flex-direction: column; }
  .flow-simple-arrow { transform: rotate(90deg); }
  .role-cards { grid-template-columns: 1fr; }
}

/* 角色分工 */
.role-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 8px; }
.role-card {
  padding: 18px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.role-card:hover { border-color: rgba(59,130,246,0.5); }
.role-card.active { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(59,130,246,0.25); }
.role-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 15px; }
.role-card-icon { font-size: 22px; }
.role-card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 12px; }
.role-card-tasks { list-style: none; margin-bottom: 14px; }
.role-card-tasks li { font-size: 12px; color: var(--text-muted); padding: 4px 0 4px 14px; position: relative; }
.role-card-tasks li::before { content: '·'; position: absolute; left: 0; color: var(--primary); }
.role-card-btn { width: 100%; margin-left: 0 !important; }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
  white-space: nowrap;
}
.role-digital { background: rgba(59,130,246,0.15); color: #93c5fd; }
.role-training { background: rgba(34,197,94,0.15); color: #86efac; }
.role-both { background: rgba(168,85,247,0.15); color: #d8b4fe; }
.role-all { background: rgba(139,156,179,0.15); color: var(--text-muted); }

.overview-step strong { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.step-title-wrap strong { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.step-status { display: block; margin-top: 4px; }

.category-guide-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.category-guide-head h4 { margin-bottom: 0; }

.role-matrix-wrap { overflow-x: auto; margin: 16px 0 24px; }
.role-matrix { width: 100%; border-collapse: collapse; font-size: 13px; }
.role-matrix th, .role-matrix td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.role-matrix th { color: var(--text-muted); font-weight: 500; background: var(--surface2); }
.role-matrix .matrix-note { color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.role-matrix .role-badge { margin-left: 0; }

.ops-advice-card { border-color: rgba(245,158,11,0.35) !important; background: rgba(245,158,11,0.06) !important; }
.ops-advice-card h3 { font-size: 15px; margin-bottom: 14px; }
.ops-advice-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.ops-advice-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.6; padding: 12px 14px; background: var(--surface2); border-radius: var(--radius); }
.ops-advice-list .role-badge { margin-left: 0; flex-shrink: 0; }
