:root {
  --c-primary: #15559f;
  --c-primary-2: #2f86e0;
  --c-bg: #f4f6f9;
  --c-card: #ffffff;
  --c-line: #e3e8ef;
  --c-text: #1f2733;
  --c-sub: #6b7684;
  --c-ok: #17a673;
  --c-danger: #d94b4b;
  --radius: 14rpx;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--c-primary); text-decoration: none; }
h1, h2, h3 { margin: 0; }

/* ============ 前台 ============ */
.hero {
  background: linear-gradient(135deg, #15559f 0%, #2f86e0 100%);
  color: #fff;
  padding: 28px 0 56px;
}
.hero-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand .mark {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
}
.brand-txt h1 { font-size: 21px; font-weight: 600; letter-spacing: .5px; }
.brand-txt p { margin: 2px 0 0; font-size: 13px; opacity: .88; }
.hero-stat { font-size: 13px; opacity: .95; background: rgba(255,255,255,.16); padding: 6px 14px; border-radius: 20px; }
.hero-stat b { font-size: 15px; }

.wrap { max-width: 960px; margin: -34px auto 0; padding: 0 20px 40px; }

.search-card {
  background: var(--c-card);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(21, 85, 159, .12);
  padding: 18px;
}
.search-row { display: flex; gap: 10px; }
.search-input {
  flex: 1; height: 44px; padding: 0 14px;
  border: 1px solid var(--c-line); border-radius: 10px;
  font-size: 15px; outline: none; background: #fff; color: var(--c-text);
}
.search-input:focus { border-color: var(--c-primary-2); box-shadow: 0 0 0 3px rgba(47,134,224,.12); }

.btn {
  height: 44px; padding: 0 22px;
  border: none; border-radius: 10px;
  background: var(--c-primary); color: #fff;
  font-size: 15px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: opacity .15s;
}
.btn:hover { opacity: .9; }
.btn.primary { background: var(--c-primary); }
.btn.ghost { background: #fff; color: var(--c-primary); border: 1px solid var(--c-line); }
.btn.danger { background: var(--c-danger); }
.btn.small { height: 34px; padding: 0 14px; font-size: 13px; border-radius: 8px; }
.btn.tiny { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.hot { margin-top: 12px; font-size: 13px; color: var(--c-sub); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hot a { background: #f0f4f9; border-radius: 14px; padding: 3px 12px; color: var(--c-primary); }

.result { margin-top: 18px; }
.result-title { font-size: 14px; color: var(--c-sub); margin: 4px 4px 10px; }
.result-title b { color: var(--c-primary); font-size: 16px; }
.result-note { font-size: 13px; color: #b26a00; background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
.loading { text-align: center; color: var(--c-sub); padding: 30px 0; }

.card {
  background: var(--c-card);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card .code { font-size: 16px; font-weight: 700; color: var(--c-primary); letter-spacing: .3px; }
.card-name { margin: 6px 0 10px; color: var(--c-text); }
.link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.link-input {
  flex: 1; min-width: 200px; height: 34px; padding: 0 10px;
  border: 1px solid var(--c-line); border-radius: 8px;
  background: #f8fafc; color: var(--c-sub); font-size: 12px; outline: none;
}
.tag { font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.tag.ok { background: #e6f7f0; color: var(--c-ok); }
.tag.off { background: #f2f3f5; color: var(--c-sub); }

.card.empty { text-align: center; padding: 34px 16px; }
.empty-icon { font-size: 40px; color: #cfd6e0; line-height: 1; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--c-sub); margin-top: 8px; }
.empty-desc { font-size: 13px; color: var(--c-sub); margin-top: 6px; }
.card.err { border-color: #f3c6c6; background: #fff5f5; color: var(--c-danger); }

.foot { margin-top: 26px; text-align: center; color: #a3acb8; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(31, 39, 51, .92); color: #fff;
  padding: 10px 20px; border-radius: 22px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: all .22s; z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 后台 ============ */
body.admin { background: #eef1f5; }
.login-mask {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #15559f 0%, #2f86e0 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 340px; background: #fff; border-radius: 14px; padding: 30px 26px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .18); text-align: center;
}
.login-title { font-size: 18px; font-weight: 600; }
.login-sub { font-size: 12px; color: var(--c-sub); margin: 4px 0 20px; }
.login-card .input { margin-bottom: 12px; width: 100%; }
.login-msg { color: var(--c-danger); font-size: 13px; margin-top: 10px; min-height: 18px; }

.input {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--c-line); border-radius: 8px;
  font-size: 14px; outline: none; background: #fff; color: var(--c-text);
  font-family: inherit;
}
.input:focus { border-color: var(--c-primary-2); }
.select { height: 38px; }
.textarea { height: 200px; width: 100%; padding: 10px 12px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; resize: vertical; }

.admin-top {
  background: #fff; border-bottom: 1px solid var(--c-line);
  padding: 12px 22px; display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  position: sticky; top: 0; z-index: 20;
}
.admin-logo { font-size: 16px; font-weight: 600; color: var(--c-primary); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-body { max-width: 1400px; margin: 0 auto; padding: 18px 22px 40px; }

.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat {
  background: #fff; border: 1px solid var(--c-line); border-radius: 10px;
  padding: 10px 18px; min-width: 96px; display: flex; flex-direction: column; align-items: center;
}
.stat.wide { justify-content: center; min-width: 260px; }
.sv { font-size: 22px; font-weight: 700; color: var(--c-primary); line-height: 1.2; }
.sv.ok { color: var(--c-ok); }
.sv.off { color: var(--c-sub); }
.sl { font-size: 12px; color: var(--c-sub); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .input { width: auto; min-width: 130px; }
.toolbar #kw { flex: 1; min-width: 220px; }

.table-wrap {
  background: #fff; border: 1px solid var(--c-line); border-radius: 10px;
  overflow: auto; max-height: 68vh;
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid #f0f2f5; text-align: left; vertical-align: top; }
.table th {
  background: #f7f9fc; position: sticky; top: 0; z-index: 2;
  font-weight: 600; color: var(--c-sub); white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--c-primary); }
.table tbody tr:hover { background: #f8fbff; }
.c-id { width: 62px; color: var(--c-sub); }
.c-code { width: 130px; white-space: nowrap; }
.c-year { width: 62px; }
.c-name { max-width: 340px; }
.c-link { max-width: 300px; }
.c-link a { color: #2f86e0; font-size: 12px; word-break: break-all; }
.c-st { width: 64px; }
.c-op { width: 168px; white-space: nowrap; }
.table td.c-name, .table td.c-link {
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty-row { text-align: center; color: var(--c-sub); padding: 30px 0; }

.pager { margin-top: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pinfo { font-size: 13px; color: var(--c-sub); margin-right: 8px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(20, 28, 40, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  width: 460px; max-width: 92vw; background: #fff; border-radius: 12px; padding: 22px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .22);
}
.modal.wide { width: 720px; }
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.fl { display: block; font-size: 13px; color: var(--c-sub); margin-bottom: 10px; }
.fl .input { width: 100%; margin-top: 4px; }
.modal-msg { color: var(--c-danger); font-size: 13px; min-height: 18px; margin: 4px 0; }
.modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.tip-box { background: #fff7e6; border: 1px solid #ffe0a3; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: #96650d; margin-bottom: 10px; }

[hidden] { display: none !important; }

@media (max-width: 720px) {
  .c-name, .c-link { max-width: 160px; }
  .admin-body { padding: 12px; }
  .hero-stat { display: none; }
}
