/* ================= 基础重置与设计变量 ================= */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --brand: #15559a;
  --brand-700: #0f4278;
  --brand-600: #134d8c;
  --brand-500: #1d6fbf;
  --brand-400: #3d8bd4;
  --brand-50: #eef4fb;
  --brand-100: #dbe8f7;

  --accent: #d93a2b;
  --accent-50: #fdf0ee;
  --success: #12805c;
  --success-50: #e8f6f1;
  --warn: #b8741a;
  --warn-50: #fdf6e9;

  --text: #17212f;
  --text-2: #54637a;
  --text-3: #8b98ab;
  --line: #e4e9f0;
  --line-2: #eef1f6;
  --bg: #f3f5f9;
  --card: #ffffff;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(23, 33, 47, .06);
  --shadow: 0 4px 16px rgba(21, 85, 154, .08);
  --shadow-lg: 0 12px 32px rgba(15, 66, 120, .14);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: "SF Mono", "DIN Alternate", Consolas, "Courier New", monospace;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand-500); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4, p { margin: 0; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d2e0; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0;
  margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* 通用按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 42px; padding: 0 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: all .16s ease; user-select: none;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); }
.btn-primary:disabled { background: #b9c4d4; cursor: not-allowed; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #c22f21; }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: #c8d3e2; color: var(--brand); background: var(--brand-50); }
.btn-soft { background: var(--brand-50); color: var(--brand); }
.btn-soft:hover { background: var(--brand-100); }
.btn-danger-soft { background: var(--accent-50); color: var(--accent); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 6px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 5px; }
.btn-block { width: 100%; }

/* 状态标签 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 5px;
  font-size: 12px; font-weight: 500; letter-spacing: .2px;
}
.tag-open { background: var(--success-50); color: var(--success); }
.tag-draft { background: #f1f3f7; color: var(--text-3); }
.tag-closed { background: #f1f3f7; color: var(--text-2); }
.tag-pending { background: var(--warn-50); color: var(--warn); }
.tag-approved { background: var(--success-50); color: var(--success); }
.tag-rejected { background: var(--accent-50); color: var(--accent); }
.tag-accent { background: var(--accent-50); color: var(--accent); }

/* 表单控件 */
.field { margin-bottom: 18px; }
.label {
  display: block; margin-bottom: 7px;
  font-size: 14px; font-weight: 500; color: var(--text); line-height: 1.4;
}
.label .req { color: var(--accent); margin-left: 2px; font-weight: 600; }
.input, .textarea, .select {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font-size: 15px; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input::placeholder, .textarea::placeholder { color: #a8b4c4; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(29, 111, 191, .12);
}
.textarea { resize: vertical; min-height: 88px; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b98ab' d='M1.4 1.4 6 6l4.6-4.6L12 2.8 6 8.8 0 2.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 34px;
}
.help { margin-top: 6px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.err { margin-top: 6px; font-size: 12.5px; color: var(--accent); line-height: 1.5; }
.input.is-error, .textarea.is-error, .select.is-error { border-color: var(--accent); }

/* 提示条 */
.alert {
  display: flex; gap: 8px; padding: 11px 13px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.6;
}
.alert svg { flex: none; margin-top: 1px; }
.alert-info { background: var(--brand-50); color: var(--brand-700); }
.alert-warn { background: var(--warn-50); color: #8a5710; }
.alert-error { background: var(--accent-50); color: #a92a1e; }
.alert-success { background: var(--success-50); color: #0d6146; }

/* 空状态 */
.empty { padding: 56px 20px; text-align: center; color: var(--text-3); }
.empty svg { margin: 0 auto 14px; opacity: .5; }
.empty p { font-size: 14px; }

/* 骨架屏 */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton {
  background: linear-gradient(90deg, #eef1f6 25%, #f6f8fb 37%, #eef1f6 63%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}

/* Toast */
#toast-wrap {
  position: fixed; left: 50%; top: 32px; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 90vw;
}
.toast {
  padding: 10px 18px; border-radius: 8px; font-size: 14px; line-height: 1.5;
  background: rgba(23, 33, 47, .92); color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  animation: toastIn .22s ease;
  max-width: 90vw;
}
.toast.error { background: #b5301f; }
.toast.success { background: #0f6b4d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 25, 40, .48);
  display: flex; align-items: center; justify-content: center; z-index: 800;
  padding: 20px; backdrop-filter: blur(2px); animation: fadeIn .16s ease;
}
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: #fff; border-radius: var(--radius-lg); width: 100%; max-width: 520px;
  max-height: 86vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: modalIn .2s cubic-bezier(.2,.8,.3,1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--line-2);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 22px 18px; border-top: 1px solid var(--line-2);
}
.icon-btn {
  width: 32px; height: 32px; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--text-3);
  transition: all .15s;
}
.icon-btn:hover { background: var(--line-2); color: var(--text); }
