:root {
  --bg: #0e1015;
  --bg-soft: #141820;
  --panel: #171b24;
  --panel-2: #1c212c;
  --border: #2a3040;
  --border-soft: #232937;
  --text: #e8ebf2;
  --muted: #98a1b3;
  --dim: #6f7a8d;
  --accent: #5b8cff;
  --accent-hover: #72a0ff;
  --accent-soft: rgba(91, 140, 255, .13);
  --danger: #f06b6b;
  --ok: #4fc08d;
  --radius: 12px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1100px 600px at 50% -15%, #1a2233 0%, var(--bg) 62%) no-repeat, var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
svg { display: block; }

/* ---------------- 登录 ---------------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 34px 32px 26px;
}
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-icon {
  width: 46px; height: 46px; flex: 0 0 46px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(91, 140, 255, .25);
}
.brand-icon.small { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.field input, .field .select {
  width: 100%; height: 42px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 0 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--dim); }
.field input:focus, .field .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha-row input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 2px; }
#captcha-img {
  width: 120px; height: 42px; flex: 0 0 120px;
  border-radius: 9px; border: 1px solid var(--border);
  background: #eef1f7; cursor: pointer; object-fit: cover;
}
.icon-btn {
  height: 42px; width: 40px; flex: 0 0 40px;
  display: grid; place-items: center;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border); border-radius: 9px;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }

.alert {
  background: rgba(240, 107, 107, .1);
  border: 1px solid rgba(240, 107, 107, .3);
  color: #ff9d9d;
  padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px;
}
.primary-btn {
  width: 100%; height: 44px; border: 0; border-radius: 9px;
  background: var(--accent); color: #fff; font-weight: 600; letter-spacing: 3px;
  transition: background .15s, transform .05s;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn:disabled { opacity: .6; cursor: not-allowed; }
.primary-btn.compact {
  width: auto; height: 32px; padding: 0 14px;
  letter-spacing: 0; font-size: 13px; white-space: nowrap;
}
.login-foot { margin: 20px 0 0; text-align: center; font-size: 12px; color: var(--dim); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  height: 66px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: rgba(20, 24, 32, .92);
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar h2 { margin: 0; font-size: 16px; }
.topbar .sub { font-size: 11px; color: var(--dim); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.lock-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--ok);
  background: rgba(79, 192, 141, .1); border: 1px solid rgba(79, 192, 141, .22);
  padding: 5px 10px; border-radius: 20px;
}
.ghost-btn {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 7px 14px; font-size: 13px;
}
.ghost-btn:hover { color: var(--text); border-color: var(--accent); }
.ghost-btn.small { padding: 6px 11px; font-size: 12px; }

/* ---------------- 主体 ---------------- */
.container { max-width: 1080px; margin: 0 auto; padding: 26px 24px 60px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat strong { font-size: 21px; font-weight: 600; letter-spacing: .3px; }

.panel {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); margin-bottom: 18px; overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-bottom: 1px solid var(--border-soft);
}
.panel-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.hint { font-size: 11px; color: var(--dim); }
.panel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.select {
  height: 32px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 0 9px; outline: none; font-size: 13px;
}
.select:focus { border-color: var(--accent); }
.filter-select { width: 128px; }
.search {
  height: 32px; width: 190px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); padding: 0 11px; outline: none; font-size: 13px;
}
.search:focus { border-color: var(--accent); }

.drop-zone {
  margin: 18px; padding: 28px 18px;
  border: 1.5px dashed var(--border);
  border-radius: 10px; text-align: center; color: var(--muted);
  background: var(--panel-2); transition: border-color .15s, background .15s;
  outline: none;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragover {
  border-color: var(--accent); background: var(--accent-soft); color: var(--text);
}
.drop-zone svg { margin: 0 auto 8px; color: var(--accent); }
.drop-zone p { margin: 0 0 3px; }
.drop-zone b { color: var(--accent-hover); font-weight: 600; }
.drop-zone small { color: var(--dim); font-size: 12px; }

.progress { margin: 0 18px 16px; height: 6px; background: var(--bg-soft); border-radius: 6px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.upload-result {
  margin: 0 18px 16px; padding: 10px 13px; font-size: 13px;
  border-radius: 8px; background: rgba(79, 192, 141, .09);
  border: 1px solid rgba(79, 192, 141, .25); color: #9fe0c1;
}
.upload-result.has-error { background: rgba(240, 107, 107, .09); border-color: rgba(240, 107, 107, .28); color: #ffadad; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); }
th { font-size: 12px; color: var(--dim); font-weight: 500; background: rgba(255, 255, 255, .015); }
td { font-size: 13px; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(255, 255, 255, .02); }
.th-name { color: var(--text); }
.file-name { display: flex; align-items: center; gap: 9px; word-break: break-all; }
.file-ext {
  flex: 0 0 auto; font-size: 10px; font-weight: 600; letter-spacing: .5px;
  padding: 2px 6px; border-radius: 5px; color: var(--accent);
  background: var(--accent-soft); border: 1px solid rgba(91, 140, 255, .2);
  text-transform: uppercase;
}
.cat-tag {
  display: inline-block; white-space: nowrap;
  font-size: 12px; color: var(--muted);
  padding: 2px 9px; border-radius: 20px;
  background: rgba(152, 161, 179, .1); border: 1px solid var(--border-soft);
}
.muted { color: var(--muted); }
.right { text-align: right; }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.link-btn {
  background: transparent; border: 0; padding: 3px 4px;
  color: var(--accent); font-size: 13px;
}
.link-btn:hover { color: var(--accent-hover); text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.empty { padding: 40px 18px; text-align: center; color: var(--dim); font-size: 13px; }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 12px 18px;
  border-top: 1px solid var(--border-soft);
}
.pager-left, .pager-right { display: flex; align-items: center; gap: 10px; }
.pager-summary { font-size: 12px; color: var(--muted); }
.pager-size {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.size-select { width: 70px; height: 28px; }
.page-info { font-size: 12px; color: var(--muted); min-width: 62px; text-align: center; }
.ghost-btn.small:disabled { opacity: .4; cursor: not-allowed; border-color: var(--border-soft); }
.ghost-btn.small:disabled:hover { color: var(--muted); border-color: var(--border-soft); }

/* ---------------- 弹窗 / 提示 ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 7, 11, .7); display: grid; place-items: center; padding: 20px;
}
.modal-card {
  width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 14px; padding: 24px;
  box-shadow: var(--shadow);
}
.modal-card.wide { max-width: 520px; }
.modal-card h3 { margin: 0 0 10px; font-size: 16px; }
.modal-card p { margin: 0 0 22px; color: var(--muted); font-size: 13px; word-break: break-all; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-head h3 { margin: 0; }
.close-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: transparent; color: var(--muted); font-size: 22px; line-height: 1;
  border: 1px solid var(--border); border-radius: 8px;
}
.close-btn:hover { color: var(--text); border-color: var(--accent); }
.modal-card .modal-desc { margin: 6px 0 16px; font-size: 12px; color: var(--dim); word-break: normal; }
.modal-card.wide .field { margin-bottom: 14px; }
.modal-card.wide .drop-zone { margin: 0 0 14px; padding: 24px 14px; }
.modal-card.wide .progress { margin: 0 0 14px; }
.modal-card.wide .upload-result { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.danger-btn { background: var(--danger); color: #fff; border: 0; border-radius: 8px; padding: 8px 16px; font-size: 13px; }
.danger-btn:hover { background: #ff8080; }
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  z-index: 60; background: #262d3b; color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 18px; font-size: 13px; box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .lock-badge { display: none; }
  .container { padding: 18px 14px 40px; }
  .panel-head { flex-wrap: wrap; }
  .panel-actions { width: 100%; }
  .filter-select { width: 118px; }
  .search { width: 150px; flex: 1; min-width: 110px; }
  .pager { padding: 12px; }
  .pager-right { width: 100%; justify-content: flex-end; }
  th, td { padding: 10px 12px; }
}

/* ---------------- 删除确认 / 编辑 / 多选 / 批量 ---------------- */
.captcha-img {
  width: 120px; height: 42px; flex: 0 0 120px;
  border-radius: 9px; border: 1px solid var(--border);
  background: #eef1f7; cursor: pointer; object-fit: cover;
}
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }
input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .5; }

.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px 18px;
  background: var(--accent-soft); border-bottom: 1px solid var(--border-soft);
}
.bulk-count { font-size: 12px; color: var(--text); white-space: nowrap; }
.bulk-count b { color: var(--accent-hover); font-size: 14px; }
.bulk-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bulk-actions .select { width: 120px; }
.danger-ghost { color: var(--danger); }
.danger-ghost:hover { color: #ff9d9d; border-color: var(--danger); }
.col-check { width: 38px; text-align: center !important; padding-left: 12px !important; padding-right: 4px !important; }

.modal-card.wide .confirm-desc { margin: 10px 0 16px; font-size: 13px; word-break: break-all; }
.warn { color: var(--danger); font-weight: 600; }
.modal-actions { margin-top: 4px; }
.modal-card .field .select { cursor: pointer; }

@media (max-width: 640px) {
  .bulk-bar { padding: 10px 12px; }
  .bulk-actions { width: 100%; }
  .col-check { width: 32px; padding-left: 8px !important; }
}
