:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --line: #e4e8f0;
  --text: #1c2437;
  --muted: #7a859c;
  --brand: #2f6bff;
  --brand-2: #6d4bff;
  --ok: #16a34a;
  --danger: #e0493d;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }

/* ---------- 前台 hero ---------- */
.hero {
  background: linear-gradient(135deg, #2f6bff 0%, #6d4bff 55%, #9a4bff 100%);
  color: #fff;
  padding: 56px 20px 64px;
}
.hero-inner { max-width: 1040px; margin: 0 auto; }
.hero h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: .5px; }
.hero p { margin: 0; opacity: .88; font-size: 15px; }

.ghost-btn {
  display: inline-block;
  margin-top: 18px;
  padding: 7px 16px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  transition: .18s;
}
.ghost-btn:hover { background: rgba(255, 255, 255, .16); }
.ghost-btn.light { margin-top: 0; background: rgba(255,255,255,.14); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1040px; margin: -34px auto 0; padding: 0 20px 40px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ---------- 软件卡片 ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(28, 36, 55, .06);
  transition: transform .16s, box-shadow .16s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(28, 36, 55, .1); }

.card-top { display: flex; gap: 12px; align-items: center; }

.icon {
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #e8efff, #efe8ff);
  color: var(--brand-2);
  font-size: 20px; font-weight: 700;
}
.head { min-width: 0; }
.card h2 {
  margin: 0 0 4px;
  font-size: 17px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 12px; color: var(--muted);
  background: #f3f5fa; border-radius: 6px; padding: 1px 7px;
}
.tag.ver { color: var(--brand); background: #eaf0ff; }

.desc {
  margin: 0;
  color: #4e5a72;
  font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding-top: 12px; border-top: 1px dashed var(--line);
}
.fname {
  flex: 1; min-width: 0;
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 20px;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: filter .16s, transform .16s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn.sm { padding: 6px 14px; font-size: 13px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 11px; }
.btn.danger { background: #fdeceb; color: var(--danger); }
.btn.danger:hover { background: #fbd9d6; }

/* ---------- 空态 / 页脚 ---------- */
.empty {
  background: var(--panel); border: 1px dashed var(--line);
  border-radius: var(--radius); padding: 48px; text-align: center;
  color: var(--muted);
}
.empty .hint { font-size: 13px; }
.foot { text-align: center; color: var(--muted); font-size: 12.5px; padding: 8px 0 40px; }

/* ---------- 表单 ---------- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: 0 6px 20px rgba(28, 36, 55, .05);
}
.panel h2 { margin: 0 0 16px; font-size: 16px; }

label { display: block; margin-bottom: 12px; }
label > span { display: block; font-size: 13px; color: #4e5a72; margin-bottom: 5px; font-weight: 600; }
label em { font-style: normal; color: var(--muted); font-weight: 400; }

input[type=text], input[type=password], input:not([type]), textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
  font-size: 14px;
  background: #fbfcfe;
  color: var(--text);
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input:focus, textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .12);
}
textarea { resize: vertical; font-family: inherit; }

input[type=file] {
  width: 100%;
  padding: 14px;
  border: 1.5px dashed #c8d2e6;
  border-radius: 10px;
  background: #fafbff;
  font-size: 13.5px;
  cursor: pointer;
}
input[type=file]:hover { border-color: var(--brand); }

.row2 { display: grid; grid-template-columns: 1fr 200px; gap: 14px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.pwd-hint { margin: -6px 0 16px; font-size: 13px; }
.pw-tip {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  background: #f6f8fd;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding: 8px 12px;
}
.pw-tip code {
  font-family: Consolas, "Courier New", monospace;
  background: #eaeef8; color: #3b4a6b;
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.ok-text { color: var(--ok); }
.err-text { color: var(--danger); }

.submit-row { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.muted { color: var(--muted); font-size: 13px; }

.progress {
  height: 8px; background: #eef1f8; border-radius: 99px; overflow: hidden; margin: 12px 0 6px;
}
.progress .bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .2s;
}

.flash {
  padding: 11px 15px;
  border-radius: 10px;
  background: #fdeceb;
  color: #a83228;
  font-size: 13.5px;
  margin-bottom: 16px;
  border: 1px solid #f8d5d2;
}
.flash.ok { background: #eaf7ee; color: #16794a; border-color: #cdebd8; }

/* ---------- 后台 ---------- */
.admin-bar {
  background: #1c2437;
  color: #fff;
  padding: 14px 20px;
}
.admin-bar-inner {
  max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
}
.admin-actions { display: flex; gap: 10px; }
.admin-wrap { margin-top: 24px; }

.item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item-file { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item-file .muted { font-size: 12.5px; }
.item-file .muted, .item-file strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.edit-form { display: grid; grid-template-columns: 150px 90px 1fr auto; gap: 8px; }
.edit-form input { padding: 6px 10px; font-size: 13px; }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box {
  width: 100%; max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(28, 36, 55, .1);
}
.login-box h1 { margin: 0 0 4px; font-size: 21px; }
.login-box .sub { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.login-box .back { display: block; margin-top: 14px; text-align: center; font-size: 13px; color: var(--muted); }
.login-box.center { text-align: center; }
.login-box.center h1 { font-size: 40px; }

@media (max-width: 720px) {
  .row2 { grid-template-columns: 1fr; }
  .row3 { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .edit-form { grid-template-columns: 1fr 1fr; }
  .edit-form input:nth-child(3) { grid-column: 1 / -1; }
  .hero { padding: 40px 20px 52px; }
  .hero h1 { font-size: 24px; }
}
