:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #e8eaee;
  --bg: #f6f7f9;
  --card: #ffffff;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.logo {
  width: 42px; height: 42px;
  flex: 0 0 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 3px 10px rgba(37, 99, 235, .28);
}

.brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.2px;
}

.brand p {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
}

.admin-link {
  flex: 0 0 auto;
  font-size: 12.5px;
  color: var(--text-3);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 5px 12px;
  border-radius: 6px;
  transition: .15s;
}
.admin-link:hover { color: var(--blue); border-color: #c7d7fe; background: var(--blue-soft); }

/* ---------- 公告 ---------- */
.notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

/* ---------- 工具条 ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  stroke: var(--text-3);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: .15s;
}
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: #bfd3fe; box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); }

select, .btn-plain {
  height: 40px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card) url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center;
  font-size: 13.5px;
  color: var(--text-2);
  outline: none;
  appearance: none;
  cursor: pointer;
}
select:focus { border-color: #bfd3fe; }

/* ---------- 分类 ---------- */
.cats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 14px;
  min-height: 26px;
}

.cat {
  font-size: 12.5px;
  padding: 3px 11px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  cursor: pointer;
  transition: .15s;
  user-select: none;
}
.cat:hover { border-color: #c7d7fe; color: var(--blue); }
.cat.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- 列表 ---------- */
.list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.head-row {
  display: grid;
  grid-template-columns: 42px 1fr 96px 116px 92px 88px;
  gap: 12px;
  align-items: center;
  padding: 9px 16px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .3px;
}

.row {
  display: grid;
  grid-template-columns: 42px 1fr 96px 116px 92px 88px;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f3f5;
  transition: background .12s;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: #fafbfd; }

.ficon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: -.2px;
  color: #fff;
  background: #94a3b8;
  flex: 0 0 38px;
}
.ficon.exe { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.ficon.zip, .ficon.rar, .ficon.tar, .ficon.gz, .ficon.sevenz { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.ficon.msi { background: linear-gradient(135deg, #34d399, #10b981); }
.ficon.iso { background: linear-gradient(135deg, #94a3b8, #64748b); }
.ficon.apk { background: linear-gradient(135deg, #4ade80, #22c55e); }
.ficon.pdf { background: linear-gradient(135deg, #f87171, #ef4444); }
.ficon.doc, .ficon.docx { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.ficon.img { background: linear-gradient(135deg, #c084fc, #a855f7); }
.ficon.video { background: linear-gradient(135deg, #fb7185, #f43f5e); }

.fmain { min-width: 0; }

.fname {
  font-size: 13.8px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}

.fdesc {
  font-size: 12.3px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.fmeta { display: none; font-size: 12px; color: var(--text-3); margin-top: 3px; }

.col-size, .col-time, .col-dl {
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.col-time { color: var(--text-3); }
.col-dl { color: var(--text-3); }

.badge {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1.5;
}
.badge.lock { background: #fef3c7; color: #b45309; }
.badge.tag { background: #f1f5f9; color: #64748b; font-weight: 400; }
.badge.exp { background: #fee2e2; color: #b91c1c; }

.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 32px;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-size: 12.8px;
  font-weight: 500;
  border: 0;
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
  font-family: inherit;
}
.dl-btn:hover { background: var(--blue-dark); box-shadow: 0 2px 8px rgba(37, 99, 235, .3); }
.dl-btn:active { transform: translateY(1px); }
.dl-btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.2; }

/* ---------- 空态 / 骨架 ---------- */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-3);
  font-size: 13.5px;
}
.empty svg { width: 38px; height: 38px; stroke: #cbd5e1; fill: none; stroke-width: 1.5; margin-bottom: 10px; }

.skel { height: 63px; border-bottom: 1px solid #f1f3f5; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pager button {
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12.8px;
  cursor: pointer;
  font-family: inherit;
  transition: .12s;
}
.pager button:hover:not(:disabled) { border-color: #c7d7fe; color: var(--blue); }
.pager button.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- 页脚统计 ---------- */
.foot {
  margin-top: 26px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.9;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
  animation: pop .18s cubic-bezier(.2, .8, .3, 1);
}
@keyframes pop { from { transform: scale(.96); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.modal h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 600; }
.modal .sub { font-size: 12.5px; color: var(--text-3); margin-bottom: 16px; word-break: break-all; }

.modal input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  font-size: 15px;
  letter-spacing: 3px;
  text-align: center;
  outline: none;
  font-family: inherit;
  text-transform: lowercase;
}
.modal input:focus { border-color: #bfd3fe; box-shadow: 0 0 0 3px rgba(37, 99, 235, .09); }

.modal .err { color: var(--red); font-size: 12.5px; height: 18px; margin-top: 7px; }

.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal-actions button {
  flex: 1;
  height: 38px;
  border-radius: var(--radius);
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
}
.modal-actions .primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 500; }
.modal-actions .primary:hover { background: var(--blue-dark); }

/* ---------- 提示条 ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%) translateY(12px);
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  transition: .22s;
  z-index: 200;
  max-width: 86vw;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .wrap { padding: 18px 12px 40px; }
  .head-row { display: none; }
  .row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 11px 12px;
  }
  .row .col-size, .row .col-time, .row .col-dl { display: none; }
  .fmeta { display: block; }
  .brand h1 { font-size: 17px; }
  .logo { width: 37px; height: 37px; flex-basis: 37px; font-size: 17px; }
  .toolbar { flex-wrap: wrap; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar select { flex: 1 1 100%; width: 100%; }
  .dl-btn { padding: 0 13px; font-size: 12.5px; height: 34px; }
}
