/* ============================================
   中介魔方 - 数据生成工坊 (Web 版)
   Responsive CSS - 完整样式文件
   ============================================ */

/* 基础重置与变量 */
:root {
  --primary: #1e3a8a;
  --primary-light: #3b82f6;
  --primary-dark: #1e40af;
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #2563eb;
  --badge-blue: #eff6ff;
  --badge-green: #f0fdf4;
  --badge-purple: #f5f3ff;
  --badge-orange: #fff7ed;
  --badge-teal: #f0fdfa;
  --badge-indigo: #eef2ff;
  --badge-red: #fef2f2;
  --badge-pink: #fdf2f8;
  --badge-cyan: #ecfeff;
  --badge-rose: #fff1f2;
  --badge-amber: #fffbeb;
  --badge-violet: #f5f3ff;
  --badge-gray: #f1f5f9;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   布局容器
   ============================================ */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100vh;
}

.page {
  padding: 16px;
  min-height: 100vh;
  background: #f8fafc;
}

/* ============================================
   导航栏
   ============================================ */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.nav-back {
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: background var(--transition);
}
.nav-back:hover {
  background: rgba(255, 255, 255, 0.15);
}

.nav-title {
  font-size: 17px;
  font-weight: 600;
}

/* ============================================
   首页头部
   ============================================ */
.header {
  padding: 24px 12px 12px;
  text-align: center;
}
.header-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}
.header-sub {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ============================================
   区域标题
   ============================================ */
.section {
  margin-top: 20px;
}
.section-title {
  font-size: 17px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 12px;
  padding-left: 6px;
}

/* ============================================
   卡片
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin: 14px 0;
  padding: 18px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 14px;
}

/* ============================================
   模型卡片网格
   ============================================ */
.card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.model-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 2px solid transparent;
}
.model-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-light);
}
.model-card:active {
  transform: scale(0.97);
}

.card-badge {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
  margin-bottom: 10px;
}
.badge-blue {
  background: var(--badge-blue);
  color: var(--info);
}
.badge-green {
  background: var(--badge-green);
  color: var(--success);
}
.badge-purple {
  background: var(--badge-purple);
  color: #7c3aed;
}
.badge-orange {
  background: var(--badge-orange);
  color: #ea580c;
}
.badge-teal {
  background: var(--badge-teal);
  color: #0d9488;
}
.badge-indigo {
  background: var(--badge-indigo);
  color: #4f46e5;
}
.badge-red {
  background: var(--badge-red);
  color: var(--danger);
}
.badge-pink {
  background: var(--badge-pink);
  color: #db2777;
}
.badge-cyan {
  background: var(--badge-cyan);
  color: #0891b2;
}
.badge-violet {
  background: var(--badge-violet);
  color: #7c3aed;
}
.card-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============================================
   表单元素
   ============================================ */
.form-item {
  margin-bottom: 16px;
  flex: 1;
  min-width: 0;
}
.form-label {
  font-size: 14px;
  color: #475569;
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.form-input {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
  background: #f8fafc;
  text-align: center;
  transition: border-color var(--transition);
}
.form-input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* 滑动条样式 */
.range-input {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
  margin: 10px 0;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

.slider-item {
  margin-bottom: 16px;
}
.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.slider-label {
  font-size: 14px;
  color: #475569;
}
.slider-value {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.slider-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  display: block;
}

/* 选择器样式 */
.picker-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color var(--transition);
}
.picker-box:hover {
  border-color: var(--primary-light);
}
.picker-value {
  font-weight: 500;
}
.picker-arrow {
  color: var(--text-muted);
  font-size: 11px;
}
select.form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  background: #f8fafc;
  cursor: pointer;
}

/* 步进器 */
.stepper {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #f8fafc;
}
.stepper-btn {
  width: 36px;
  height: 38px;
  line-height: 38px;
  text-align: center;
  font-size: 18px;
  color: var(--primary-light);
  background: #fff;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  border: none;
}
.stepper-btn:hover {
  background: #eff6ff;
}
.stepper-input {
  flex: 1;
  text-align: center;
  font-size: 15px;
  height: 38px;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  min-width: 40px;
}

/* ============================================
   按钮
   ============================================ */
.btn {
  display: inline-block;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
}
.btn-primary {
  background: var(--primary-light);
  color: #fff;
  flex: 1;
  width: 100%;
  padding: 14px;
  font-size: 16px;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}
.btn-secondary {
  background: #f1f5f9;
  color: #475569;
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.action-bar {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  flex-wrap: wrap;
}
.action-btn {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: all var(--transition);
  border: none;
}
.action-regenerate {
  background: #eff6ff;
  color: var(--info);
}
.action-regenerate:hover {
  background: #dbeafe;
}
.action-params {
  background: #f1f5f9;
  color: #475569;
}
.action-params:hover {
  background: #e2e8f0;
}

/* 重新生成/返回按钮 */
.top-action-bar {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.action-hint {
  font-size: 13px;
  opacity: 0.85;
  margin-bottom: 8px;
}
.regen-btn, .back-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
}
.regen-btn {
  background: #fff;
  color: var(--primary);
}
.regen-btn:hover {
  background: #eff6ff;
}
.back-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   模型选项卡
   ============================================ */
.model-selector-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0;
  margin-bottom: 10px;
}
.model-tab {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: #f1f5f9;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}
.model-tab:hover {
  background: #dbeafe;
  color: var(--primary);
}
.model-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ============================================
   验证面板
   ============================================ */
.validation-panel {
  margin-bottom: 14px;
}
.validation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f0fdf4;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.validation-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--success);
}
.status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.status-icon-fail {
  background: var(--danger);
}
.status-fail {
  color: var(--danger);
}
.quality-score {
  text-align: right;
}
.score-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}
.score-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/* 验证摘要 */
.validation-summary {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.summary-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}
.summary-pass {
  background: #f0fdf4;
  color: var(--success);
}
.summary-fail {
  background: #fef2f2;
  color: var(--danger);
}
.summary-icon {
  font-size: 14px;
}

/* 指标网格 */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 10px;
}
.metric-card {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 14px;
  border: 1px solid var(--border);
}
.metric-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* 信度列表 */
.alpha-list, .ave-cr-list, .corr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.alpha-item, .ave-cr-item, .corr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.alpha-name, .ave-cr-label, .corr-label {
  color: var(--text-secondary);
}
.alpha-value, .ave-cr-value, .corr-value {
  font-weight: 600;
  color: var(--primary);
  margin: 0 8px;
}
.alpha-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.tag-excellent {
  background: #dcfce7;
  color: var(--success);
}
.tag-good {
  background: #fef3c7;
  color: #b45309;
}
.tag-acceptable {
  background: #ffedd5;
  color: #c2410c;
}
.tag-poor {
  background: #fef2f2;
  color: var(--danger);
}
.tag-pass {
  background: #dcfce7;
  color: var(--success);
}
.tag-fail {
  background: #fef2f2;
  color: var(--danger);
}

/* 进度条 */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin: 10px 0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success), var(--primary-light));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.metric-note {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-top: 6px;
}

.validity-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
  background: #f8fafc;
  color: #475569;
}

/* ============================================
   表格
   ============================================ */
.table-wrapper {
  overflow-x: auto;
  margin: 8px 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead th {
  background: #f8fafc;
  padding: 10px 8px;
  text-align: center;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody tr:hover {
  background: #f8fafc;
}

.validity-table-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  background: #f8fafc;
  padding: 10px 8px;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 2px solid var(--border);
  text-align: center;
  gap: 4px;
}
.validity-table-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  padding: 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  gap: 4px;
}
.validity-table-row:hover {
  background: #f8fafc;
}
.vtcol-name {
  font-weight: 600;
  text-align: left;
}
.vtcol-ave, .vtcol-cr, .vtcol-status {
  text-align: center;
}
.vtcol-sm {
  font-size: 12px;
  text-align: center;
}
.text-fail {
  color: var(--danger) !important;
}
.text-pass {
  color: var(--success) !important;
}

/* 有效性详细表 */
.validity-detail-table {
  margin-bottom: 8px;
}

/* ============================================
   中介效应分析
   ============================================ */
.mediation-results {
  margin-top: 10px;
}
.path-diagram {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
  margin-bottom: 10px;
  font-family: monospace;
  font-size: 14px;
  line-height: 1.8;
}

.effect-table {
  margin: 10px 0;
}
.effect-table table {
  width: 100%;
}
.effect-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.effect-label {
  color: var(--text-secondary);
}
.effect-value {
  font-weight: 600;
  color: var(--primary);
}
.effect-indirect {
  color: var(--danger);
  font-weight: 700;
}

.mediation-bar {
  margin: 12px 0;
}
.ratio-bar-bg {
  height: 28px;
  background: linear-gradient(90deg, #dbeafe, #eff6ff);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
}
.ratio-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 14px;
  transition: width 0.8s ease;
  display: flex;
  align-items: center;
  padding-left: 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  min-width: 30px;
}

/* ============================================
   分位数/类别结果
   ============================================ */
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.info-label {
  color: var(--text-secondary);
}
.info-value {
  font-weight: 600;
}

/* ============================================
   模型统计区
   ============================================ */
.model-stats {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius);
  padding: 24px 18px;
  margin-top: 18px;
  text-align: center;
}
.stats-count {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 6px;
}
.stats-sub {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

/* ============================================
   联系方式
   ============================================ */
.contact-card {
  margin: 24px 0 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: border-color var(--transition);
}
.contact-card:hover {
  border-color: var(--primary-light);
}
.contact-icon {
  font-size: 28px;
}
.contact-label {
  font-size: 14px;
  color: var(--text-secondary);
  display: block;
}
.contact-wx {
  font-size: 16px;
  color: var(--info);
  font-weight: 600;
  margin-top: 4px;
}

/* ============================================
   ICP 备案
   ============================================ */
.icp-bar {
  text-align: center;
  padding: 16px 0 8px;
}
.icp-text {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: underline;
}

/* ============================================
   Toast 通知
   ============================================ */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.3s ease;
  display: none;
}
.toast.show {
  display: block;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ============================================
   加载指示器
   ============================================ */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-text {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: center;
}

/* ============================================
   导出按钮
   ============================================ */
.export-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.export-btn {
  flex: 1;
  min-width: 140px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #f8fafc;
  transition: all var(--transition);
  text-align: center;
}
.export-btn:hover {
  background: #eff6ff;
  border-color: var(--primary-light);
}
.export-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.export-primary:hover {
  background: var(--primary-dark);
}

/* ============================================
   分享解锁
   ============================================ */
.share-lock-overlay {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 24px;
  text-align: center;
  border: 2px dashed var(--border);
}
.share-lock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.share-lock-emoji {
  font-size: 32px;
}
.share-lock-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}
.share-lock-text {
  font-size: 13px;
  color: var(--text-muted);
}
.share-btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--primary);
  color: #fff;
  margin-top: 8px;
  transition: all var(--transition);
}
.share-btn:hover {
  background: var(--primary-dark);
}

/* ============================================
   分类标签
   ============================================ */
.criteria-label {
  font-size: 12px;
  color: var(--text-muted);
}
.criteria-result {
  font-size: 12px;
  font-weight: 600;
}
.criteria-pass {
  color: var(--success);
}
.criteria-fail {
  color: var(--danger);
}

.ave-cr-highlight {
  background: #eff6ff;
  border-radius: 4px;
  padding: 2px 6px;
}

/* ============================================
   单因素/多因素分析专用
   ============================================ */
.group-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.group-card {
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
}
.gc-label {
  font-size: 13px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}
.gc-input {
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  width: 80px;
}

.p-range {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.p-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.p-label {
  font-size: 14px;
  color: var(--text-secondary);
  flex: 1;
}

.var-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
}
.var-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.var-idx {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}
.var-name-inp {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 14px;
  flex: 1;
  min-width: 100px;
}
.type-tag {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  cursor: pointer;
  border: none;
  background: #f1f5f9;
  color: var(--text-secondary);
}
.del-var-btn {
  cursor: pointer;
  padding: 4px 8px;
  color: var(--danger);
  font-weight: 600;
  font-size: 16px;
  border: none;
  background: none;
}
.del-var-btn:hover {
  background: #fef2f2;
  border-radius: 4px;
}
.var-labels {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.lbl-tag {
  font-size: 12px;
  color: var(--text-muted);
}
.lbl-inp {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  width: 60px;
}
.var-range {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.rng-inp {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  width: 60px;
}
.var-sigs {
  margin-top: 8px;
}
.sigs-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.sig-check-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.sig-check {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  transition: all var(--transition);
}
.sig-check.on {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
}
.sig-check.on::after {
  content: "✓";
}
.add-var-btn {
  padding: 6px 14px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  border: none;
  transition: background var(--transition);
}
.add-var-btn:hover {
  background: var(--primary-dark);
}

.round-toggle {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 14px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.round-toggle.on {
  background: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
}

/* ============================================
   加载遮罩
   ============================================ */
#loadingOverlay {
  display: none;
}
#loadingOverlay.active {
  display: flex;
}

/* ============================================
   模态对话框
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal-content {
  background: #fff;
  border-radius: var(--radius);
  padding: 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: scaleIn 0.2s ease;
}
.modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.modal-body {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.6;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================
   响应式设计 - 平板 (768px+)
   ============================================ */
@media (min-width: 768px) {
  .page {
    padding: 20px 40px;
  }
  .header {
    padding: 32px 20px 16px;
  }
  .header-title {
    font-size: 32px;
  }
  .card {
    padding: 22px;
    margin: 16px 0;
  }
  .card-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    gap: 14px;
  }
  .nav-bar {
    padding: 14px 24px;
  }
  .top-action-bar .action-bar {
    display: flex;
    flex-direction: row;
    gap: 10px;
  }
}

/* ============================================
   响应式设计 - 桌面 (1024px+)
   ============================================ */
@media (min-width: 1024px) {
  .app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
  }
  .page {
    padding: 24px 0;
  }
  .card-row {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .header-title {
    font-size: 36px;
  }
  .section-title {
    font-size: 19px;
  }
  .model-tab {
    font-size: 14px;
    padding: 8px 16px;
  }
  .form-input {
    font-size: 15px;
    padding: 12px 14px;
  }
}

/* ============================================
   响应式设计 - 大桌面 (1400px+)
   ============================================ */
@media (min-width: 1400px) {
  .app-container {
    max-width: 1300px;
  }
  .card-row {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ============================================
   小屏幕适配 (480px以下)
   ============================================ */
@media (max-width: 480px) {
  .header-title {
    font-size: 24px;
  }
  .card {
    padding: 14px;
  }
  .card-name {
    font-size: 15px;
  }
  .card-desc {
    font-size: 12px;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .group-cards {
    grid-template-columns: 1fr;
  }
  .form-row {
    flex-direction: column;
  }
  .action-bar {
    flex-direction: column;
  }
  .nav-title {
    font-size: 15px;
  }
  .export-row {
    flex-direction: column;
  }
}

/* ============================================
   打印样式
   ============================================ */
@media print {
  .nav-bar, .action-bar, .top-action-bar, .btn, .export-row,
  .share-lock-overlay, .icp-bar, .contact-card, .model-stats {
    display: none !important;
  }
  body {
    background: #fff;
  }
  .page {
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
}

/* ============================================
   辅助类
   ============================================ */
.hidden {
  display: none !important;
}
.text-center {
  text-align: center;
}
.mt-8 {
  margin-top: 8px;
}
.mt-12 {
  margin-top: 12px;
}
.mt-16 {
  margin-top: 16px;
}
.mb-8 {
  margin-bottom: 8px;
}
.mb-16 {
  margin-bottom: 16px;
}
.flex-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.flex-1 {
  flex: 1;
  min-width: 0;
}

/* 表格响应式滚动容器 */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 工具提示 */
.tooltip {
  position: relative;
}
.tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
}
