:root {
  --bg: #f6f7fa;
  --surface: #ffffff;
  --surface-soft: #fafbfd;
  --ink: #242937;
  --ink-soft: #4d5465;
  --muted: #8a91a3;
  --border: #ebedf3;
  --border-strong: #e0e3ec;
  --accent: #7b94c6;
  --accent-deep: #5f7caf;
  --accent-soft: #f0f4fb;
  --green: #7ba48f;
  --green-deep: #5c8874;
  --green-soft: #edf6f1;
  --amber: #c09a58;
  --amber-soft: #fbf5e9;
  --lilac: #a291c4;
  --lilac-soft: #f4f0fa;
  --danger: #c47979;
  --danger-soft: #fbf0f0;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(31, 41, 55, 0.04), 0 10px 28px rgba(31, 41, 55, 0.05);
  --shadow-lg: 0 30px 80px rgba(31, 41, 55, 0.18);
  --ring: 0 0 0 4px rgba(123, 148, 198, 0.14);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.65; }
.orb-a { width: 460px; height: 460px; background: #e7eefb; top: -190px; left: -140px; }
.orb-b { width: 380px; height: 380px; background: #f7efe5; top: 160px; right: -160px; }
.orb-c { width: 420px; height: 420px; background: #eef0fa; bottom: -220px; left: 28%; }

/* ---------- header ---------- */
.topbar {
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: 30px 32px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent-deep);
  background: linear-gradient(145deg, #f4f7fd, #e8eef9);
  border: 1px solid #e2e8f4;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  flex: none;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-mark.large {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  margin: 0 auto 18px;
}
.brand-mark.large svg { width: 30px; height: 30px; }
.brand-text h1 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: 0.01em; }
.brand-text p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.admin-badge {
  font-size: 12px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border: 1px solid #e3eaf7;
  padding: 5px 10px;
  border-radius: 999px;
}

/* ---------- layout ---------- */
.shell {
  position: relative;
  z-index: 2;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 32px 40px;
}

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: none;
}
.stat-icon svg { width: 20px; height: 20px; }
.tint-blue { background: var(--accent-soft); color: var(--accent-deep); }
.tint-amber { background: var(--amber-soft); color: var(--amber); }
.tint-green { background: var(--green-soft); color: var(--green-deep); }
.tint-lilac { background: var(--lilac-soft); color: var(--lilac); }
.stat-label { margin: 0; font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }

/* ---------- panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
  flex-wrap: wrap;
}
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: #f3f5f9;
  border-radius: 12px;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: 0.18s ease;
}
.tab:hover { color: var(--ink-soft); }
.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(31, 41, 55, 0.06), 0 2px 8px rgba(31, 41, 55, 0.05);
}
.tab-count {
  font-size: 11.5px;
  color: var(--muted);
  background: #eef0f6;
  border-radius: 999px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}
.tab.active .tab-count { background: var(--accent-soft); color: var(--accent-deep); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 22px;
  flex-wrap: wrap;
}
.search {
  flex: 1 1 320px;
  max-width: 460px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: 0.18s ease;
}
.search:focus-within { border-color: var(--accent); box-shadow: var(--ring); background: #fff; }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: none; }
.search input {
  border: 0;
  outline: 0;
  background: transparent;
  width: 100%;
  font-size: 13.5px;
}
.search input::placeholder { color: #a6acba; }

.select-wrap { position: relative; }
.select-wrap select {
  appearance: none;
  height: 40px;
  padding: 0 34px 0 13px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  font-size: 13.5px;
  color: var(--ink-soft);
  outline: 0;
  min-width: 132px;
  transition: 0.18s ease;
}
.select-wrap select:focus { border-color: var(--accent); box-shadow: var(--ring); }
.select-arrow {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.result-hint { font-size: 12.5px; color: var(--muted); margin-left: auto; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
.records { width: 100%; min-width: 960px; border-collapse: collapse; }
.records th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 14px;
  background: #fafbfd;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.records th:first-child { padding-left: 22px; }
.records th:last-child { padding-right: 22px; text-align: right; }
.records td {
  padding: 13px 14px;
  border-bottom: 1px solid #f1f2f7;
  vertical-align: middle;
}
.records td:first-child { padding-left: 22px; }
.records td:last-child { padding-right: 22px; }
.records tbody tr { transition: background 0.15s ease; }
.records tbody tr:hover { background: #fbfcfe; }
.records tbody tr:last-child td { border-bottom: 0; }

.book-title {
  font-weight: 500;
  font-size: 13.8px;
  color: var(--ink);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.col-no { width: 78px; }
.record-no {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.book-author { font-size: 12px; color: var(--muted); margin-top: 2px; }
.book-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  font-size: 11.5px;
  color: #8ea3c8;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.book-link:hover { color: var(--accent-deep); text-decoration: none; }
.book-link svg { width: 12px; height: 12px; flex: none; opacity: 0.8; }
.platform-pill {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-soft);
  background: #f5f6fa;
  border: 1px solid #edeff5;
  border-radius: 8px;
  padding: 3px 9px;
  white-space: nowrap;
}
.mono { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted-dash { color: #c3c7d2; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.75; }
.chip.pending { color: #a9863f; background: var(--amber-soft); }
.chip.done { color: var(--green-deep); background: var(--green-soft); }
.chip.rejected { color: #8a91a3; background: #f2f3f7; }

.col-time { width: 122px; }
.time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-actions { width: 112px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  color: var(--muted);
  transition: 0.16s ease;
  padding: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { background: var(--accent-soft); color: var(--accent-deep); border-color: #e4ebf7; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #f4e3e3; }
.icon-btn.done:hover { background: var(--green-soft); color: var(--green-deep); border-color: #e3efe8; }

/* ---------- empty / pager ---------- */
.empty {
  padding: 58px 24px 64px;
  text-align: center;
  border-top: 1px solid var(--border);
}
.empty-mark {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: var(--surface-soft);
  border: 1px dashed #dde2ee;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  color: #a9b3c7;
}
.empty-mark svg { width: 26px; height: 26px; }
.empty-title { margin: 0; font-weight: 500; color: var(--ink-soft); }
.empty-sub { margin: 4px 0 16px; font-size: 12.5px; color: var(--muted); }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}
.page-info { font-size: 12.5px; color: var(--muted); }
.pager-btns { display: flex; gap: 8px; }
.pager-btns .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.footnote { text-align: center; font-size: 12px; color: #a3a9b8; margin: 18px 0 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  transition: 0.16s ease;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn.primary {
  background: linear-gradient(180deg, #88a0ce, #7b94c6);
  color: #fff;
  box-shadow: 0 6px 14px rgba(123, 148, 198, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}
.btn.primary:hover { background: linear-gradient(180deg, #7f98c8, #7089bd); transform: translateY(-1px); }
.btn.ghost { background: #fff; border-color: var(--border-strong); color: var(--ink-soft); }
.btn.ghost:hover { background: var(--surface-soft); border-color: #d4d9e6; }
.btn.soft { background: var(--accent-soft); color: var(--accent-deep); }
.btn.soft:hover { background: #e8eefa; }
.btn.block { width: 100%; height: 44px; }
.btn:disabled { cursor: default; transform: none; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 38, 51, 0.3);
  backdrop-filter: blur(3px);
}
.modal-card {
  position: relative;
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.22s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 0;
}
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.modal-head .icon-btn { font-size: 22px; line-height: 1; color: var(--muted); }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  padding: 20px 24px 6px;
}
.span2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); }
.field > span b { color: var(--danger); font-weight: 500; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  background: var(--surface-soft);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  outline: 0;
  transition: 0.16s ease;
}
.field input, .field select { height: 40px; }
.field textarea { resize: vertical; min-height: 76px; }
.field input::placeholder, .field textarea::placeholder { color: #aeb4c2; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: var(--ring);
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px 22px;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  right: 26px;
  bottom: 26px;
  z-index: 80;
  background: #2b3040;
  color: #fff;
  font-size: 13px;
  padding: 11px 16px;
  border-radius: 11px;
  box-shadow: 0 16px 40px rgba(31, 41, 55, 0.24);
  animation: toastIn 0.2s ease;
}
.toast.error { background: #8f5a5a; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- login ---------- */
.login-body {
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 50% -10%, #fbfcff 0%, var(--bg) 55%);
}
.login-wrap { width: 100%; padding: 28px; position: relative; z-index: 2; }
.login-card {
  width: min(430px, 100%);
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  padding: 40px 36px 30px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(49, 62, 88, 0.12);
}
.login-card h1 { margin: 0; font-size: 23px; font-weight: 600; letter-spacing: 0.01em; }
.login-sub { margin: 6px 0 26px; font-size: 13px; color: var(--muted); }
.login-form { text-align: left; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.password-wrap .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.login-form .btn { margin-top: 4px; }
.form-error {
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 7px 10px;
}
.login-foot { margin: 22px 0 0; font-size: 11.5px; color: #a6acba; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { padding: 22px 20px 0; }
  .shell { padding: 18px 20px 32px; }
}
@media (max-width: 640px) {
  .brand-text p { display: none; }
  .top-actions .btn { padding: 0 10px; }
  .admin-badge { display: none; }
  .panel-head { padding: 16px 16px 0; }
  .toolbar { padding: 14px 16px; }
  .search { flex-basis: 100%; max-width: none; }
  .result-hint { margin-left: 0; }
  .records th:first-child, .records td:first-child { padding-left: 16px; }
  .pager { padding: 14px 16px; }
  .form-grid { grid-template-columns: 1fr; padding: 18px 18px 4px; }
  .span2 { grid-column: span 1; }
  .modal-head, .modal-foot { padding-left: 18px; padding-right: 18px; }
  .login-card { padding: 32px 24px 24px; }
}
