/* GitHub 搜索下载器 - 全站样式（浅色主题） */

:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --line: #e3e6ea;
  --line-2: #eef0f3;
  --text: #1f2328;
  --muted: #6a737d;
  --brand: #2563eb;
  --brand-dk: #1d4ed8;
  --brand-bg: #eef4ff;
  --ok: #15803d;
  --ok-bg: #e9f7ef;
  --err: #b91c1c;
  --err-bg: #fdeceb;
  --warn: #b45309;
  --warn-bg: #fdf3e3;
  --gold: #a16207;
  --gold-bg: #fdf6e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre { font-family: var(--mono); font-size: .92em; }

/* ---------------------------------------------------------------- 顶栏 */
header.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: 1180px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: .2px;
}
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #2563eb, #6d28d9);
  color: #fff; display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.top-search { flex: 1 1 260px; min-width: 200px; max-width: 520px; }
.top-search form { display: flex; gap: 8px; }
.top-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 布局 */
.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 18px 60px; }
.wrap.narrow { max-width: 460px; }
.page-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .sp { margin-left: auto; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.card > .card-h {
  padding: 12px 16px; border-bottom: 1px solid var(--line-2);
  font-weight: 650; display: flex; align-items: center; gap: 10px;
}
.card > .card-h .sp { margin-left: auto; font-weight: 400; }
.card > .card-b { padding: 16px; }
.card.flush > .card-b { padding: 0; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.sp { margin-left: auto; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.mt0 { margin-top: 0; } .mt1 { margin-top: 8px; } .mt2 { margin-top: 16px; }
.mb0 { margin-bottom: 0; } .mb1 { margin-bottom: 8px; } .mb2 { margin-bottom: 16px; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------------------------------------------------------------- 表单 */
input[type=text], input[type=password], input[type=number], input[type=search],
select, textarea {
  width: 100%; padding: 8px 11px; color: var(--text); background: #fff;
  border: 1px solid var(--line); border-radius: 8px; font: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { min-height: 78px; resize: vertical; }
label.fld { display: block; margin-bottom: 12px; }
label.fld > span.t {
  display: block; font-weight: 600; margin-bottom: 5px; font-size: 13px;
}
label.fld > span.h { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline > input, .inline > select { width: auto; flex: 1 1 auto; min-width: 0; }
.check { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.check input { width: auto; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: .15s;
  text-decoration: none !important;
}
.btn:hover { background: var(--panel-2); border-color: #d3d8de; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
}
.btn.primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(.94); }
.btn.danger { background: #fff; border-color: #f0c2c0; color: var(--err); }
.btn.danger:hover { background: var(--err-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-bg); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .55; pointer-events: none; }

/* ---------------------------------------------------------------- 标签 */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 999px; font-size: 12px; font-weight: 650;
  background: var(--line-2); color: var(--muted); border: 1px solid transparent;
  white-space: nowrap;
}
.badge.b-brand { background: var(--brand-bg); color: var(--brand-dk); }
.badge.b-ok { background: var(--ok-bg); color: var(--ok); }
.badge.b-err { background: var(--err-bg); color: var(--err); }
.badge.b-warn { background: var(--warn-bg); color: var(--warn); }
.badge.b-gold { background: var(--gold-bg); color: var(--gold); }
.lang-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #8b949e; vertical-align: -1px;
}

/* ---------------------------------------------------------------- 表格 */
.tw { overflow-x: auto; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tb th, table.tb td {
  padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
table.tb th {
  background: var(--panel-2); font-weight: 650; color: var(--muted);
  font-size: 12.5px; white-space: nowrap; position: sticky; top: 0;
}
table.tb tbody tr:hover { background: #fafbfc; }
table.tb td.num { text-align: right; font-family: var(--mono); }

/* ---------------------------------------------------------------- 提示 */
.flash {
  padding: 10px 14px; border-radius: 8px; margin-bottom: 12px;
  border: 1px solid; font-size: 13.5px;
}
.flash.ok { background: var(--ok-bg); border-color: #b7e2c7; color: #14612f; }
.flash.err { background: var(--err-bg); border-color: #f3c6c4; color: #9b1c1c; }
.notice {
  background: var(--warn-bg); border: 1px solid #f2ddb6; color: #8a5a10;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px;
}
.empty { text-align: center; color: var(--muted); padding: 44px 16px; }
.empty .ic { font-size: 32px; opacity: .5; display: block; margin-bottom: 8px; }

/* ---------------------------------------------------------------- 搜索 */
.searchbar {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.searchbar .main { display: flex; gap: 10px; }
.searchbar .main input[type=search] { font-size: 15px; padding: 10px 13px; }
.searchbar .adv {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--line);
}
.searchbar .adv label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.searchbar .adv select, .searchbar .adv input { width: auto; padding: 5px 8px; font-size: 12.5px; }

.repo-card { display: flex; flex-direction: column; gap: 9px; padding: 15px 16px; }
.repo-card .ttl { font-size: 15.5px; font-weight: 650; line-height: 1.35; word-break: break-word; }
.repo-card .ttl .owner { color: var(--muted); font-weight: 500; }
.repo-card .desc {
  color: var(--muted); font-size: 13px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 40px;
}
.repo-card .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.repo-card .acts { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }
.repo-card .topics { display: flex; gap: 6px; flex-wrap: wrap; }

.pager { display: flex; gap: 6px; justify-content: center; align-items: center; margin: 22px 0 8px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 11px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; font-size: 13px; color: var(--text);
}
.pager a:hover { background: var(--brand-bg); border-color: #c7d9ff; text-decoration: none; }
.pager .cur { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 650; }
.pager .off { opacity: .45; }

/* ---------------------------------------------------------------- 仓库页 */
.repo-hero { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.repo-hero .stats { display: flex; gap: 16px; flex-wrap: wrap; }
.stat { min-width: 74px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 17px; font-weight: 700; font-family: var(--mono); }
.readme {
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 12px 14px; max-height: 340px; overflow: auto;
  font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap;
  word-break: break-word; line-height: 1.55;
}
.asset {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: #fff;
}
.asset + .asset { margin-top: 8px; }
.asset .nm { font-weight: 600; word-break: break-all; flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- 进度 */
.progress {
  height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden;
}
.progress > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #7c3aed); transition: width .35s;
}
.progress.done > i { background: var(--ok); }
.progress.err > i { background: var(--err); }

#tasks {
  position: fixed; right: 18px; bottom: 18px; width: 372px; max-width: calc(100vw - 24px);
  z-index: 90; display: flex; flex-direction: column; gap: 10px;
  max-height: calc(100vh - 40px); overflow: auto;
}
.task {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: 13px;
}
.task .hd { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.task .nm { font-weight: 650; word-break: break-all; flex: 1 1 auto; min-width: 0; }
.task .x { cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1; }
.task .x:hover { color: var(--err); }
.task .kv { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 6px; }

/* ---------------------------------------------------------------- 后台 */
.admin-shell { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: start; }
@media (max-width: 860px) { .admin-shell { grid-template-columns: 1fr; } }
.admin-nav { position: sticky; top: 70px; }
.admin-nav a {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 8px;
  color: var(--text); font-weight: 600; font-size: 13.5px;
}
.admin-nav a:hover { background: var(--panel-2); text-decoration: none; }
.admin-nav a.on { background: var(--brand-bg); color: var(--brand-dk); }

.kpi { padding: 14px 16px; }
.kpi .k { color: var(--muted); font-size: 12.5px; margin-bottom: 3px; }
.kpi .v { font-size: 22px; font-weight: 700; font-family: var(--mono); line-height: 1.25; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

details.fold { border: 1px solid var(--line); border-radius: 8px; padding: 0; background: #fff; }
details.fold > summary {
  cursor: pointer; padding: 10px 14px; font-weight: 650; font-size: 13.5px;
  list-style: none; display: flex; align-items: center; gap: 8px;
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--muted); }
details.fold[open] > summary::before { content: "▾"; }
details.fold > .bd { padding: 2px 14px 14px; border-top: 1px solid var(--line-2); }

/* ---------------------------------------------------------------- 页脚 */
footer.bot {
  max-width: 1180px; margin: 0 auto; padding: 22px 18px 34px;
  color: var(--muted); font-size: 12.5px; text-align: center;
  border-top: 1px solid var(--line); margin-top: 30px;
}
footer.bot a { color: var(--muted); }
