:root {
  --bg: #f5f6f8; --card: #fff; --text: #1f2430; --muted: #6b7280; --line: #e5e7eb;
  --primary: #2563eb; --primary-d: #1d4ed8; --danger: #dc2626;
  --ok: #059669; --ok-bg: #ecfdf5; --warn: #b45309; --warn-bg: #fffbeb;
  --err-bg: #fef2f2; --info: #1d4ed8; --info-bg: #eff6ff;
  --radius: 12px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 12px; }

/* ---------- 顶栏 ---------- */
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: #111827; color: #fff; position: sticky; top: 0; z-index: 10; }
.brand { font-weight: 700; font-size: 16px; }
.topbar-sub { color: #9ca3af; font-size: 13px; }

/* ---------- 首页 ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 28px 24px; }
.page-head { margin-bottom: 20px; } .page-head h1 { font-size: 22px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.project-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; min-height: 170px;
  transition: transform .12s, box-shadow .12s, border-color .12s; }
.project-card:hover { transform: translateY(-2px); border-color: #c7d2fe; box-shadow: 0 6px 16px rgba(37,99,235,.12); }
.card-top { display: flex; justify-content: flex-end; }
.card-title { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-metric { display: flex; align-items: baseline; gap: 6px; margin-top: auto; }
.metric-num { font-size: 26px; font-weight: 700; } .metric-label { color: var(--muted); }
.card-foot { color: var(--muted); font-size: 12px; }
.add-card { min-height: 170px; border: 2px dashed #cbd5e1; background: transparent; box-shadow: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 14px; }
.add-card:hover { border-color: var(--primary); color: var(--primary); background: #f8faff; }
.plus { font-size: 40px; line-height: 1; font-weight: 300; }
.skeleton { min-height: 170px; background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: sk 1.2s infinite; }
.skeleton.tall { min-height: 320px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- 状态标签 ---------- */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; vertical-align: middle; }
.pill-muted { background: #f3f4f6; color: var(--muted); } .pill-info { background: var(--info-bg); color: var(--info); }
.pill-warn { background: var(--warn-bg); color: var(--warn); } .pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-err { background: var(--err-bg); color: var(--danger); }

/* ---------- 详情布局 ---------- */
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 56px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 18px 12px; }
.back { display: block; color: var(--muted); padding: 4px 10px 14px; } .back:hover { color: var(--primary); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 8px;
  background: none; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.nav-item.active { background: var(--info-bg); color: var(--primary); font-weight: 600; }
.nav-item:disabled { color: #9ca3af; cursor: not-allowed; }
.nav-icon { width: 18px; text-align: center; }
.soon { margin-left: auto; font-size: 11px; color: #9ca3af; }
.main { padding: 28px 32px; max-width: 1000px; width: 100%; display: flex; flex-direction: column; gap: 18px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.detail-title { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.section { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.section-head { display: flex; justify-content: space-between; align-items: center; } .section-head h2 { font-size: 16px; }

.file-row { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
.file-icon { width: 44px; height: 44px; border-radius: 8px; background: #e8f5ee; color: #15803d; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.file-meta { flex: 1; min-width: 0; } .file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.alert { padding: 10px 14px; border-radius: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert-ok { background: var(--ok-bg); color: var(--ok); } .alert-warn { background: var(--warn-bg); color: var(--warn); }
.alert-err { background: var(--err-bg); color: var(--danger); flex-direction: column; align-items: flex-start; }
.alert-info { background: var(--info-bg); color: var(--info); }
.error-box { padding: 16px; background: var(--err-bg); color: var(--danger); border-radius: 10px; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { background: #f9fafb; border-radius: 10px; padding: 12px 14px; }
.stat-num { font-size: 22px; font-weight: 700; } .stat-label { color: var(--muted); font-size: 12px; }
.downloads { display: flex; flex-direction: column; gap: 10px; }
.dl-item { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; }
.dl-title { font-weight: 600; }
.issues summary { cursor: pointer; color: var(--warn); font-weight: 500; }
.issues ul { margin: 8px 0 0; padding-left: 18px; max-height: 260px; overflow: auto; }
.issues li { margin: 3px 0; } .issue-error { color: var(--danger); }
.issues code { background: #f3f4f6; padding: 0 5px; border-radius: 4px; }

/* ---------- 按钮 ---------- */
.btn { border: 1px solid transparent; border-radius: 8px; padding: 8px 16px; font: inherit; font-weight: 500;
  cursor: pointer; background: #f3f4f6; color: var(--text); white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; } .btn-primary:hover:not(:disabled) { background: var(--primary-d); }
.btn-outline { background: #fff; border-color: #c7d2fe; color: var(--primary); }
.btn-ghost { background: transparent; border-color: var(--line); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { background: #fff; border-color: #fecaca; color: var(--danger); }
.btn-danger-outline:hover { background: var(--err-bg); }
.icon-btn { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }

/* ---------- 上传区 / 进度 ---------- */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px; border: 2px dashed #cbd5e1;
  border-radius: 12px; cursor: pointer; text-align: center; background: #fafbfc; transition: .15s; }
.dropzone.compact { padding: 18px; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: #f5f8ff; }
.dropzone.has-file { border-color: var(--ok); background: var(--ok-bg); }
.dz-icon { font-size: 22px; color: var(--primary); } .dz-hint { color: var(--muted); font-size: 12px; }
.dz-file { font-weight: 600; color: var(--ok); }
.progress { height: 6px; background: #e5e7eb; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 弹窗 / 表单 / toast ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.45); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: 460px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; }
.modal-foot { padding: 0 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.confirm-msg { margin: 0; line-height: 1.7; }
.field { display: flex; flex-direction: column; gap: 6px; } .field span { font-weight: 500; } .field em { color: var(--danger); font-style: normal; }
.field input { padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; }
.field input:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
#toast-root { position: fixed; top: 70px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { padding: 10px 16px; border-radius: 8px; background: #111827; color: #fff; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px); transition: .25s; max-width: 380px; }
.toast.show { opacity: 1; transform: none; }
.toast-ok { background: var(--ok); } .toast-err { background: var(--danger); }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar nav { flex-direction: row; overflow-x: auto; } .soon { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); } .main { padding: 20px 16px; }
}
