/* 公共基础样式：设计变量、表单控件、按钮、提示、弹窗 */
:root {
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-light: #6366f1;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #1f2937;
  --text-strong: #111827;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --success: #16a34a;
  --success-bg: #f0fdf4;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 3px rgba(17, 24, 39, .06);
  --shadow: 0 10px 30px rgba(17, 24, 39, .08);
  --shadow-lg: 0 24px 60px rgba(17, 24, 39, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p, ul, ol { margin: 0; }
ul { list-style: none; padding: 0; }
.hidden { display: none !important; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 7px;
}
.field-label .req { color: var(--danger); margin-left: 2px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-strong);
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.input::placeholder { color: var(--muted-light); }
.input:hover { border-color: var(--border-strong); }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.input.is-error { border-color: var(--danger); background: #fffafa; }
.input:disabled { background: var(--surface-soft); color: var(--muted); cursor: not-allowed; }
textarea.input { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.7; }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field-error { min-height: 16px; font-size: 12px; color: var(--danger); margin-top: 5px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.input-affix { position: absolute; right: 12px; display: flex; gap: 6px; align-items: center; }
.icon-btn {
  border: 0; background: transparent; color: var(--muted);
  padding: 5px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg); color: var(--text); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  transition: transform .12s, background .18s, box-shadow .18s, border-color .18s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 12px rgba(79, 70, 229, .22); }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .3); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn-soft { background: var(--brand-50); color: var(--brand-dark); }
.btn-soft:hover:not(:disabled) { background: var(--brand-100); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.btn-danger:hover:not(:disabled) { background: #fee2e2; }
.btn-block { width: 100%; }
.btn-lg { height: 48px; font-size: 15px; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }

/* ---------- 标签 / 状态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--bg); color: var(--muted);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-brand { background: var(--brand-50); color: var(--brand); }

/* ---------- 提示条 ---------- */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6; margin-bottom: 18px;
  background: var(--info-bg); color: #1e40af; border: 1px solid #bfdbfe;
}
.notice-warn { background: var(--warn-bg); color: #92400e; border-color: #fde68a; }
.notice-error { background: var(--danger-bg); color: #991b1b; border-color: #fecaca; }
.notice-success { background: var(--success-bg); color: #166534; border-color: #bbf7d0; }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 3000; display: flex; flex-direction: column; gap: 9px;
  width: min(92vw, 420px); pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: 11px;
  background: #fff; border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); font-size: 13.5px; color: var(--text);
  animation: toast-in .22s ease-out; pointer-events: auto;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; }
.toast-success .dot { background: var(--success); }
.toast-error .dot { background: var(--danger); }
.toast-info .dot { background: var(--info); }
.toast.out { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(17, 24, 39, .52); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade-in .18s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  width: min(100%, 720px); max-height: min(86vh, 860px);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modal-in .22s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border); flex: none;
}
.modal-title { font-size: 17px; font-weight: 700; color: var(--text-strong); }
.modal-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.modal-close {
  width: 32px; height: 32px; border: 0; background: var(--bg); color: var(--muted);
  border-radius: 8px; font-size: 20px; line-height: 1; display: grid; place-items: center;
}
.modal-close:hover { background: var(--brand-50); color: var(--brand); }
.modal-body { padding: 22px; overflow: auto; flex: 1; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; flex: none; }

/* ---------- 文档正文渲染 ---------- */
.doc-body { font-size: 14px; line-height: 1.85; color: #374151; }
.doc-body h2 {
  font-size: 15.5px; color: var(--text-strong); font-weight: 700;
  margin: 26px 0 10px; padding-left: 11px; border-left: 3px solid var(--brand);
}
.doc-body h2:first-child { margin-top: 0; }
.doc-body p { margin: 9px 0; }
.doc-body li { position: relative; padding-left: 18px; margin: 6px 0; }
.doc-body li::before { content: ''; position: absolute; left: 4px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--brand-light); }
.doc-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px dashed var(--border); }

/* ---------- 通用卡片 ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 700; color: var(--text-strong); }
.card-desc { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.card-body { padding: 22px; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d7dbe3; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #b9bfca; background-clip: padding-box; }
