/* ==========================================================
   社会化成熟度深度评估系统 · 基础设计系统
   ========================================================== */

:root {
  /* 背景与面 */
  --bg: #F4F3F0;
  --bg-soft: #FAF9F6;
  --surface: #FFFFFF;
  --surface-2: #FBFAF8;
  --surface-3: #F5F3EF;

  /* 文字 */
  --ink: #15171B;
  --ink-2: #3C424C;
  --ink-3: #6E757E;
  --ink-4: #9AA1A9;
  --ink-inv: #FFFFFF;

  /* 描边 */
  --line: #E7E4DE;
  --line-2: #F0EEEA;
  --line-strong: #D6D2CA;

  /* 品牌 */
  --brand: #2E6B5E;
  --brand-600: #24564B;
  --brand-500: #357A6B;
  --brand-400: #5B9A8B;
  --brand-100: #E4EFEB;
  --brand-50: #F1F7F5;

  /* 辅助色 */
  --accent: #C2703F;
  --accent-100: #F8EEE5;
  --gold: #B8892B;
  --gold-100: #FAF2E0;
  --danger: #B4473C;
  --danger-100: #FAE9E6;
  --warn: #C08321;
  --warn-100: #FAF1DF;
  --ok: #2E6B5E;
  --ok-100: #E4EFEB;
  --info: #3D6A9C;
  --info-100: #E7EEF7;

  /* 圆角 */
  --r-xl: 24px;
  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;
  --r-xs: 8px;

  /* 阴影 */
  --sh-1: 0 1px 2px rgba(21, 23, 27, .04), 0 2px 6px rgba(21, 23, 27, .04);
  --sh-2: 0 2px 4px rgba(21, 23, 27, .04), 0 14px 30px -14px rgba(21, 23, 27, .18);
  --sh-3: 0 10px 44px -14px rgba(21, 23, 27, .28);
  --sh-brand: 0 6px 20px -6px rgba(46, 107, 94, .45);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", "Source Han Sans SC", sans-serif;

  --ease: cubic-bezier(.32, .72, .28, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: .01em;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

::selection { background: var(--brand-100); color: var(--brand-600); }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #DAD6CE; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #C6C1B7; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 排版工具 ---------- */
.t-xs { font-size: 12px; }
.t-sm { font-size: 13px; }
.t-md { font-size: 15px; }
.t-lg { font-size: 17px; }
.muted { color: var(--ink-3); }
.muted-2 { color: var(--ink-4); }
.strong { font-weight: 600; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.eyebrow {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 700;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease),
    background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(.985); }
.btn[disabled], .btn.is-disabled {
  opacity: .45; pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-500), var(--brand-600));
  color: #fff;
  box-shadow: var(--sh-brand);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 10px 26px -8px rgba(46, 107, 94, .55); }

.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #262A31; }

.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--ink-4); }

.btn-soft { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }
.btn-soft:hover { background: var(--brand-100); }

.btn-danger { background: var(--danger-100); color: var(--danger); border-color: #F0D6D2; }
.btn-danger:hover { background: #F5DDD9; }

.btn-sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-xs { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-xs); font-weight: 500; }
.btn-block { width: 100%; }
.btn-lg { height: 52px; font-size: 16px; border-radius: var(--r-md); }

.btn .spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.input, .textarea, .select {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s;
  outline: none;
}
.textarea { height: auto; padding: 12px 14px; line-height: 1.7; resize: vertical; }
.select { appearance: none; background-image: none; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 4px rgba(46, 107, 94, .12);
}
.input.is-error { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(180, 71, 60, .1); }
.input-group { display: flex; gap: 8px; }
.input-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .04em; }

.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; line-height: 1.6; }
.err-text { font-size: 12.5px; color: var(--danger); margin-top: 8px; display: none; }
.err-text.show { display: block; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card-pad { padding: 22px; }

/* ---------- 徽标 / 标签 ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line-2);
  white-space: nowrap;
}
.chip-brand { background: var(--brand-50); color: var(--brand-600); border-color: var(--brand-100); }
.chip-accent { background: var(--accent-100); color: var(--accent); border-color: #F2E0D0; }
.chip-gold { background: var(--gold-100); color: var(--gold); border-color: #F2E4C4; }
.chip-danger { background: var(--danger-100); color: var(--danger); border-color: #F3D9D5; }
.chip-warn { background: var(--warn-100); color: var(--warn); border-color: #F3E4C4; }
.chip-info { background: var(--info-100); color: var(--info); border-color: #DCE6F3; }
.chip-lg { height: 34px; padding: 0 14px; font-size: 13.5px; }

.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
table.tbl th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-3);
  font-size: 12px;
  letter-spacing: .04em;
  padding: 10px 14px;
  background: var(--surface-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.tbl td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-2);
  vertical-align: middle;
}
table.tbl tbody tr { transition: background .15s; }
table.tbl tbody tr:hover { background: var(--brand-50); }
table.tbl tbody tr:last-child td { border-bottom: none; }
td .row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 空状态 ---------- */
.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--ink-4);
}
.empty .e-icon {
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--surface-3);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  font-size: 24px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(21, 23, 27, .94);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--sh-3);
  animation: toastIn .28s var(--ease);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 8px;
}
.toast.ok { background: rgba(36, 86, 75, .96); }
.toast.err { background: rgba(150, 54, 44, .96); }
.toast.hide { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(.98); } }

/* ---------- Modal ---------- */
.modal-root { position: fixed; inset: 0; z-index: 900; display: none; }
.modal-root.show { display: block; }
.modal-mask {
  position: absolute; inset: 0;
  background: rgba(21, 23, 27, .42);
  backdrop-filter: blur(3px);
  animation: fadeIn .2s var(--ease);
}
.modal-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  margin: 60px auto 0;
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-3);
  animation: modalIn .26s var(--ease);
  padding: 26px;
}
.modal-panel.wide { width: min(760px, calc(100vw - 32px)); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-title { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.modal-close {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-3); font-size: 17px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: .16s;
}
.modal-close:hover { background: var(--surface-3); color: var(--ink); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

/* ---------- 进度条 ---------- */
.progress {
  height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden;
}
.progress > i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand));
  transition: width .45s var(--ease);
}

/* ---------- 分隔 ---------- */
.hr { height: 1px; background: var(--line-2); border: 0; margin: 18px 0; }

/* ---------- 动画 ---------- */
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } }
.rise { animation: riseIn .5s var(--ease) both; }
.rise-1 { animation-delay: .04s; }
.rise-2 { animation-delay: .09s; }
.rise-3 { animation-delay: .15s; }
.rise-4 { animation-delay: .21s; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
