:root {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --border: #e4e2dc;
  --border-strong: #d0cec7;
  --text: #2c2c2a;
  --text-muted: #6b6a64;
  --text-hint: #9a988f;
  --teal: #0f6e56;
  --teal-bg: #e1f5ee;
  --blue: #185fa5;
  --blue-bg: #e6f1fb;
  --amber: #854f0b;
  --amber-bg: #faeeda;
  --red: #a32d2d;
  --red-bg: #fcebeb;
  --green: #3b6d11;
  --green-bg: #eaf3de;
  --purple: #534ab7;
  --purple-bg: #eeedfe;
  --gray-bg: #f1efe8;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-brand { font-weight: 600; font-size: 15px; color: var(--text); text-decoration: none; }
.nav-version { font-size: 11px; color: var(--text-hint); background: var(--gray-bg); padding: 2px 8px; border-radius: 10px; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-btn {
  padding: 4px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}
.nav-btn:hover { background: var(--gray-bg); }
.nav-create {
  padding: 5px 14px;
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  background: var(--teal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.nav-create:hover { background: #0d5f49; }

.container { max-width: 1200px; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; font-weight: 600; margin-bottom: 4px; }
h2 { font-size: 16px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
h4 { font-size: 13px; font-weight: 600; margin-bottom: 8px; color: var(--text-muted); }

/* Stats */
.stats-row { display: flex; gap: 12px; margin-bottom: 32px; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.stat-value { font-size: 32px; font-weight: 600; }
.stat-processing { color: var(--blue); }
.stat-blocked { color: var(--amber); }
.stat-completed { color: var(--green); }

.section-header { margin: 24px 0 12px; display: flex; justify-content: space-between; align-items: center; }

/* Forms */
.create-form { margin-bottom: 24px; }
.form-row { display: flex; gap: 8px; }
.form-row input, .form-row select {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  transition: border-color 0.2s;
}
.form-row input:focus, .form-row select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}
.form-row select { flex: 0 0 140px; }

/* Table */
.project-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.project-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--gray-bg);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.project-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.project-table tr:last-child td { border-bottom: none; }
.project-table tr:hover { background: var(--bg); }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-blue { background: var(--blue-bg); color: var(--blue); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-gray { background: var(--gray-bg); color: var(--text-muted); }

.tag { padding: 2px 8px; border-radius: 4px; font-size: 12px; }
.tag-theme { background: var(--purple-bg); color: var(--purple); }

/* Buttons */
.btn-primary, .btn-danger, .btn-sm {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-primary:hover { background: #0d5f49; }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { background: #8f2525; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-sm.btn-primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-sm.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }

.link { color: var(--blue); text-decoration: none; }
.link:hover { text-decoration: underline; }
.back-link { font-size: 13px; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--text); }

/* Project detail */
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.project-meta { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; }

/* Pipeline */
.pipeline-container { margin-top: 24px; }
.pipeline-flow {
  display: flex;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 0 16px;
}
.stage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 180px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: all 0.2s;
}
.stage-card.completed { border-color: var(--green); border-left: 3px solid var(--green); }
.stage-card.running { border-color: var(--blue); border-left: 3px solid var(--blue); box-shadow: var(--shadow-lg); }
.stage-card.failed { border-color: var(--red); border-left: 3px solid var(--red); }
.stage-card.gate-pending { border-color: var(--amber); border-left: 3px solid var(--amber); }

.stage-header { display: flex; align-items: center; gap: 8px; }
.stage-order {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gray-bg);
  font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  color: var(--text-muted);
}
.stage-card.completed .stage-order { background: var(--green-bg); color: var(--green); }
.stage-card.running .stage-order { background: var(--blue-bg); color: var(--blue); }
.stage-card.failed .stage-order { background: var(--red-bg); color: var(--red); }
.stage-card.gate-pending .stage-order { background: var(--amber-bg); color: var(--amber); }
.stage-label { font-size: 13px; font-weight: 600; }

.stage-body { display: flex; flex-direction: column; gap: 8px; }

/* Progress bar */
.progress-container {
  width: 100%;
  height: 4px;
  background: var(--gray-bg);
  border-radius: 2px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), #2a7fd4);
  border-radius: 2px;
  transition: width 0.5s ease;
  width: 0%;
}
.stage-card.completed .progress-bar { background: var(--green); width: 100%; }
.progress-text { font-size: 11px; color: var(--text-muted); }

.stage-output {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  font-family: "SF Mono", "JetBrains Mono", monospace;
  display: none;
}
.stage-error { font-size: 12px; color: var(--red); display: none; }

.gate-info { display: flex; align-items: center; gap: 4px; font-size: 12px; flex-wrap: wrap; }
.gate-icon { color: var(--amber); }

.stage-actions { margin-top: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.stage-arrow { display: flex; align-items: center; color: var(--text-hint); font-size: 18px; padding: 0 2px; }

.action-bar {
  margin-top: 24px;
  padding: 16px;
  background: var(--amber-bg);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  text-align: center;
}

.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-hint);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
}

/* Review page */
.review-container { max-width: 640px; }
.review-meta { display: flex; gap: 24px; margin: 12px 0 24px; font-size: 14px; color: var(--text-muted); }
.review-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}
.review-output { margin-bottom: 20px; }
.review-output code {
  background: var(--gray-bg);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  display: block;
  word-break: break-all;
}
.dimension-list { display: flex; flex-direction: column; gap: 10px; }
.dimension-item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.dimension-item span { flex: 1; }
.dim-verdict {
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 12px;
}
.review-comment textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}
.review-comment textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}
.review-actions { display: flex; gap: 12px; margin-top: 20px; }

/* Toast */
.toast {
  position: fixed;
  top: 70px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s;
  box-shadow: var(--shadow-lg);
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateX(0); }
.toast-info { background: var(--blue-bg); color: var(--blue); }
.toast-success { background: var(--green-bg); color: var(--green); }
.toast-warn { background: var(--amber-bg); color: var(--amber); }
.toast-error { background: var(--red-bg); color: var(--red); }

/* Config panel */
.config-panel {
  position: fixed;
  top: 52px;
  right: -400px;
  width: 380px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  z-index: 200;
  transition: right 0.3s;
  overflow-y: auto;
  max-height: calc(100vh - 52px);
}
.config-panel.open { right: 0; }
.config-section { margin-bottom: 20px; }
.config-select {
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  width: 100%;
}
.tool-list { display: flex; flex-direction: column; gap: 6px; }
.tool-status {
  font-size: 13px;
  padding: 4px 0;
}
.tool-status.ok { color: var(--green); }
.tool-status.missing { color: var(--red); }

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stage-card.running .stage-label::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 6px;
  border: 2px solid var(--blue-bg);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
}

.mono { font-family: "SF Mono", "JetBrains Mono", monospace; }
.small { font-size: 12px; }

/* Responsive */
@media (max-width: 768px) {
  .container { padding: 16px; }
  .stats-row { flex-wrap: wrap; }
  .stat-card { min-width: calc(50% - 6px); }
  .form-row { flex-direction: column; }
  .form-row select { flex: 1; }
}

/* Nav link */
.nav-link {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 12px;
  border-radius: var(--radius);
  transition: all 0.15s;
}
.nav-link:hover { background: var(--gray-bg); color: var(--text); }

/* Toolbox */
.toolbox h1 { margin-bottom: 4px; }
.text-muted { color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

.tab-nav {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}
.tab-btn {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--teal); border-bottom-color: var(--teal); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header { margin-bottom: 20px; }
.panel-header h2 { margin-bottom: 4px; }

.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.search-select {
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  flex-shrink: 0;
  width: 120px;
}
.search-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
}
.search-input:focus, .search-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}

.results-container { margin-top: 20px; }

/* Hot search results */
.hot-platform {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
}
.hot-platform-header {
  padding: 10px 16px;
  background: var(--gray-bg);
  font-weight: 600;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.hot-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  transition: background 0.1s;
}
.hot-item:hover { background: var(--bg); }
.hot-item:last-child { border-bottom: none; }
.hot-rank {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--gray-bg);
  color: var(--text-muted);
  flex-shrink: 0;
}
.hot-rank.top1 { background: var(--red); color: #fff; }
.hot-rank.top2 { background: var(--amber); color: #fff; }
.hot-rank.top3 { background: var(--teal); color: #fff; }
.hot-title { flex: 1; }
.hot-count { font-size: 12px; color: var(--text-hint); }

/* Search results grid */
.search-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.search-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.search-card:hover { box-shadow: var(--shadow-lg); }
.search-card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--gray-bg);
  overflow: hidden;
}
.search-card-cover img { width: 100%; height: 100%; object-fit: cover; }
.search-card-body { padding: 12px 16px; }
.search-card-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-card-author { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.search-card-stats { display: flex; gap: 12px; font-size: 11px; color: var(--text-hint); }
.search-card-stat { display: flex; align-items: center; gap: 2px; }

/* Compliance check */
.compliance-input { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.compliance-textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  line-height: 1.8;
  min-height: 200px;
}
.compliance-textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-bg);
}

.compliance-result {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  border: 1px solid var(--border);
}
.compliance-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.compliance-badge {
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
}
.compliance-badge.safe { background: var(--green-bg); color: var(--green); }
.compliance-badge.low { background: var(--blue-bg); color: var(--blue); }
.compliance-badge.medium { background: var(--amber-bg); color: var(--amber); }
.compliance-badge.high { background: var(--red-bg); color: var(--red); }

.violation-list { display: flex; flex-direction: column; gap: 8px; }
.violation-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 14px;
  background: var(--red-bg);
  border-radius: var(--radius);
  font-size: 13px;
}
.violation-word { font-weight: 600; color: var(--red); }
.violation-context { color: var(--text-muted); font-size: 12px; margin-top: 4px; font-family: "SF Mono", monospace; }

.loading-state { text-align: center; padding: 40px; color: var(--text-hint); }
.loading-state .spinner { width: 24px; height: 24px; }

.empty-results { text-align: center; padding: 40px; color: var(--text-hint); }

/* ===== 公司工作台 v3 ===== */
.nav-link-active { background: var(--teal-bg); color: var(--teal); font-weight: 600; }

.wb-hero {
  background: linear-gradient(135deg, #0f6e56 0%, #185fa5 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  box-shadow: var(--shadow-lg);
}
.wb-hero-title { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.wb-hero-sub { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.wb-hero-date { font-size: 13px; opacity: 0.9; background: rgba(255,255,255,0.15); padding: 6px 14px; border-radius: 20px; }

.wb-section { margin-bottom: 28px; }
.wb-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.wb-section-hint { font-size: 12px; color: var(--text-hint); font-weight: 400; }

.wb-strategy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.wb-strategy-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  position: relative;
  transition: box-shadow 0.2s;
}
.wb-strategy-card:hover { box-shadow: var(--shadow-lg); }
.wb-strategy-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 10px;
}
.wb-strategy-badge.phase-1 { background: var(--teal-bg); color: var(--teal); }
.wb-strategy-badge.phase-2 { background: var(--purple-bg); color: var(--purple); }
.wb-strategy-name { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.wb-strategy-desc { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 12px; }
.wb-strategy-meta { font-size: 12px; color: var(--text-hint); border-top: 1px dashed var(--border); padding-top: 10px; }
.wb-strategy-meta span { color: var(--text-muted); font-weight: 600; margin-right: 6px; }

.wb-tools-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.wb-tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wb-tool-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--teal); }
.wb-tool-icon { font-size: 22px; }
.wb-tool-name { font-size: 14px; font-weight: 600; }
.wb-tool-desc { font-size: 12px; color: var(--text-hint); }

@media (max-width: 768px) {
  .wb-strategy-grid, .wb-tools-grid { grid-template-columns: 1fr; }
  .wb-hero { flex-direction: column; align-items: flex-start; gap: 10px; }
}

