:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #1f2430;
  --muted: #7a8298;
  --line: #e6e9f2;
  --primary: #4b6cff;
  --primary-dark: #3853d6;
  --green: #1f9d72;
  --amber: #c98a13;
  --red: #d9534f;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}
a { color: var(--primary); text-decoration: none; }

/* ---------- 登录 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 20% 20%, #dfe6ff, #f4f6fb 55%);
  padding: 24px;
}
.auth-card {
  width: 380px;
  max-width: 100%;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.logo {
  width: 52px; height: 52px; border-radius: 15px;
  background: linear-gradient(135deg, #6b8bff, #4b6cff);
  color: #fff; font-weight: 700; font-size: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.logo.small { width: 34px; height: 34px; font-size: 17px; border-radius: 10px; margin: 0; }
.auth-brand h1 { font-size: 20px; margin: 0 0 6px; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.auth-form label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.auth-form input {
  width: 100%; margin-top: 6px; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
  background: #fbfcff; outline: none;
}
.auth-form input:focus { border-color: var(--primary); background: #fff; }
.auth-switch { text-align: center; color: var(--muted); font-size: 13px; margin: 18px 0 0; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 224px; flex: 0 0 224px;
  background: #151a28; color: #cdd3e6;
  display: flex; flex-direction: column;
  padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; font-weight: 600; }
#nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  color: #b9c0d6; font-size: 14px; border: none; background: none; text-align: left; width: 100%;
}
.nav-item:hover { background: #202739; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.sidebar-foot { border-top: 1px solid #262d40; padding-top: 12px; }
.user-box { padding: 8px; font-size: 12px; color: #9aa3bd; line-height: 1.7; }
.user-box b { color: #fff; font-size: 14px; display: block; }
.role-tag { display: inline-block; padding: 1px 8px; border-radius: 20px; background: #2a3350; color: #9db0ef; font-size: 11px; margin-top: 4px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 64px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-actions { display: flex; gap: 8px; }
.content { padding: 22px 24px 60px; }

/* ---------- 组件 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 9px; padding: 8px 14px;
  font-size: 13px; cursor: pointer; background: #eef1f8; color: #3a4258;
  transition: .15s; white-space: nowrap;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.danger { background: #fbe9e8; color: var(--red); }
.btn.success { background: #e5f6ef; color: var(--green); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.block { width: 100%; padding: 11px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.card {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-bottom: 18px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px;
}
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 6px; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.toolbar label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
input, select, textarea {
  font-family: inherit; font-size: 13px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfcff; outline: none; color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); background: #fff; }
textarea { resize: vertical; min-height: 80px; width: 100%; }
.spacer { flex: 1; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbff; white-space: nowrap; }
tbody tr:hover { background: #fafbff; }
.table-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.available { background: #e5f6ef; color: var(--green); }
.badge.claimed { background: #e9efff; color: var(--primary); }
.badge.completed { background: #eef1f6; color: #5b6478; }
.badge.modifying { background: #fff2dd; color: var(--amber); }
.badge.return_pending { background: #fde9e8; color: var(--red); }
.badge.pending { background: #fff2dd; color: var(--amber); }
.badge.rejected { background: #fde9e8; color: var(--red); }
.badge.active { background: #e5f6ef; color: var(--green); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.switch input { width: 16px; height: 16px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(21, 26, 40, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--panel); border-radius: 16px; box-shadow: var(--shadow);
  width: 620px; max-width: 100%; max-height: 88vh; overflow: auto; padding: 22px;
}
.modal.wide { width: 780px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: none; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.one { grid-template-columns: 1fr; }
.form-row label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.form-row input, .form-row select { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-bottom: 16px; }
.info-grid .k { color: var(--muted); font-size: 12px; }
.info-grid .v { font-size: 13px; word-break: break-all; }
.section-title { font-size: 13px; font-weight: 600; margin: 18px 0 10px; color: #3a4258; }
.feedback-item, .upload-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: #fbfcff;
}
.feedback-item .meta, .upload-item .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.feedback-item .body { font-size: 13px; white-space: pre-wrap; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: #1f2430; color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 100;
  font-size: 13px; box-shadow: var(--shadow);
}
.toast.error { background: #c0392b; }
.toast.success { background: #1f9d72; }

@media (max-width: 820px) {
  .sidebar { width: 64px; flex-basis: 64px; padding: 16px 8px; }
  .brand span, .nav-item span, .user-box { display: none; }
  .nav-item { justify-content: center; }
  .content { padding: 16px; }
  .topbar { padding: 0 14px; }
}
