:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e4e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-weak: #eef4ff;
  --danger: #dc2626;
  --danger-weak: #fdecec;
  --ok: #059669;
  --ok-weak: #e7f6f0;
  --warn: #b45309;
  --warn-weak: #fdf3e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}
.hidden { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; cursor: pointer;
  background: #eef0f4; color: var(--text); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: #e3e6ec; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { border-color: #c9cfda; color: var(--text); background: #f7f8fa; }
.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: var(--danger-weak); border-color: #f3c4c4; }
.btn.sm { padding: 4px 10px; font-size: 13px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: not-allowed; }

/* ---- 登录 ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #eef3fb 0%, #f6f7fa 60%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 36px 32px 32px; text-align: center;
}
.login-mark {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 14px;
  background: var(--brand); color: #fff; font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center; letter-spacing: 1px;
}
.login-card h1 { font-size: 22px; }
.login-sub { margin: 6px 0 24px; color: var(--muted); font-size: 14px; }
.field { display: block; text-align: left; margin-bottom: 14px; font-size: 13px; color: var(--muted); }

input, textarea, select {
  width: 100%; margin-top: 6px; padding: 9px 12px;
  border: 1px solid #d6dbe3; border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--text); background: #fff;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 80px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
label.check input { width: auto; margin: 0; }
.form-error {
  background: var(--danger-weak); color: var(--danger);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; margin-bottom: 14px; text-align: left;
}

/* ---- 顶栏 ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  background: #fff; border-bottom: 1px solid var(--line);
  height: 56px; padding: 0 20px;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--brand); color: #fff;
  font-size: 12px; display: inline-flex; align-items: center; justify-content: center; letter-spacing: 1px;
}
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav button {
  border: 0; background: none; padding: 8px 14px; border-radius: 8px;
  color: var(--muted); font-size: 14px; cursor: pointer; white-space: nowrap;
}
.nav button:hover { background: #f3f5f8; color: var(--text); }
.nav button.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
.userbox { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.who { color: var(--muted); font-size: 13px; }

.main { max-width: 880px; margin: 0 auto; padding: 22px 20px 60px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h2 { font-size: 19px; }

/* ---- 卡片 / 列表 ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 16px; line-height: 1.45; }
.meta { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.body-text { white-space: pre-wrap; word-break: break-word; }
.row-actions { display: flex; gap: 8px; flex-shrink: 0; flex-wrap: wrap; }
.empty {
  text-align: center; color: var(--muted); padding: 48px 0;
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
}

.badge {
  display: inline-block; font-size: 12px; border-radius: 5px;
  padding: 1px 7px; vertical-align: 2px; margin-right: 6px; font-weight: 500;
}
.badge.pin { background: var(--warn-weak); color: var(--warn); }

.chip {
  display: inline-block; font-size: 12px; border-radius: 999px;
  padding: 2px 10px; font-weight: 500; white-space: nowrap;
}
.chip.pending { background: var(--warn-weak); color: var(--warn); }
.chip.approved { background: var(--ok-weak); color: var(--ok); }
.chip.rejected { background: var(--danger-weak); color: var(--danger); }
.chip.withdrawn { background: #eef0f4; color: var(--muted); }

.verdict {
  background: #f7f8fa; border-left: 3px solid var(--line);
  padding: 8px 12px; border-radius: 0 8px 8px 0;
  font-size: 13px; color: var(--muted); margin-top: 10px;
}

/* ---- 筛选 ---- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters button {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 4px 14px; font-size: 13px; cursor: pointer;
}
.filters button.active { background: var(--brand-weak); border-color: var(--brand); color: var(--brand); font-weight: 600; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }
td.strong { font-weight: 600; }
.dir-tools { margin-bottom: 14px; }
.dir-tools input { margin-top: 0; max-width: 320px; }

/* ---- 弹窗 ---- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 8vh 16px 16px; overflow-y: auto;
}
.modal {
  width: 100%; max-width: 520px; background: #fff;
  border-radius: 14px; box-shadow: 0 20px 50px rgba(15, 23, 42, .25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 20px; }
.modal-body label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.modal-body label.check { color: var(--text); }
.modal-hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ---- 提示 ---- */
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: #111827; color: #fff; border-radius: 8px;
  padding: 10px 18px; font-size: 14px; z-index: 60;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .3);
  max-width: 86vw;
}
.toast.error { background: var(--danger); }

/* ---- 移动端 ---- */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .userbox { margin-left: auto; }
  .who { display: none; }
  .main { padding: 14px 12px 60px; }
  .card { padding: 14px; }
  .card-head { flex-direction: column; }
  .row-actions { margin-top: 8px; }
}
