:root {
  --brand: #c8102e;
  --brand-dark: #a50d26;
  --primary: #1d4ed8;
  --primary-dark: #1e40af;
  --primary-soft: #eff4ff;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f7fb;
  --white: #ffffff;
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* ---------- layout ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 30px; width: auto; display: block; }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: .04em; color: var(--brand); }
.brand-sub { font-size: 12px; color: var(--text-3); margin-top: -2px; }
.nav { margin-left: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a, .nav button.link {
  color: var(--text-2); font-size: 14px; padding: 6px 10px; border-radius: 8px;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav a:hover, .nav button.link:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.nav a.active { color: var(--primary); font-weight: 600; }

.lang-select {
  appearance: none; border: 1px solid var(--line); background: var(--white);
  border-radius: 8px; padding: 6px 26px 6px 10px; font-size: 13px; color: var(--text-2);
  cursor: pointer; font-family: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236b7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}

/* ---------- hero ---------- */
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 { font-size: 30px; margin: 0 0 8px; letter-spacing: -.01em; }
.hero p { color: var(--text-3); margin: 0 0 28px; }
.search-box {
  max-width: 640px; margin: 0 auto; display: flex; gap: 10px;
  background: var(--white); padding: 8px; border-radius: 14px; box-shadow: var(--shadow);
}
.search-box input {
  flex: 1; border: 0; outline: none; padding: 12px 14px; font-size: 16px;
  border-radius: 10px; background: #f9fafb; font-family: inherit; letter-spacing: .04em;
}
.search-box input:focus { background: var(--white); box-shadow: inset 0 0 0 2px var(--primary-soft); }
.search-box button {
  background: var(--primary); color: #fff; border: 0; border-radius: 10px;
  padding: 0 26px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.search-box button:hover { background: var(--primary-dark); }
.search-tip { max-width: 640px; margin: 14px auto 0; font-size: 12.5px; color: var(--text-3); }

.result-alert {
  max-width: 640px; margin: 22px auto 0; padding: 14px 18px; border-radius: 10px;
  background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; font-size: 14px; text-align: left;
}
.result-alert.err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

/* ---------- archive ---------- */
.archive-head {
  background: var(--white); border-radius: var(--radius); padding: 24px 28px;
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.archive-code { font-size: 12.5px; color: var(--text-3); letter-spacing: .06em; }
.archive-title-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.archive-title { font-size: 24px; font-weight: 700; margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 3px 10px; border-radius: 999px; font-weight: 600; }
.badge.ok { background: #ecfdf5; color: #047857; }
.badge.warn { background: #fffbeb; color: #b45309; }
.badge.gray { background: #f3f4f6; color: #4b5563; }
.archive-meta { display: flex; gap: 28px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); border-top: 1px solid var(--line); padding-top: 14px; }
.archive-meta b { color: var(--text); font-weight: 600; margin-left: 4px; }

.login-banner {
  background: var(--white); border: 1px solid #dbeafe; border-radius: var(--radius);
  padding: 16px 20px; display: flex; gap: 14px; align-items: center; margin-bottom: 18px;
}
.login-banner .txt { flex: 1; }
.login-banner strong { display: block; font-size: 14px; }
.login-banner span { font-size: 12.5px; color: var(--text-3); }

.tabs { display: flex; gap: 4px; background: #e9edf5; padding: 4px; border-radius: 10px; margin-bottom: 14px; overflow-x: auto; }
.tab-btn {
  flex: 1; min-width: 110px; white-space: nowrap; border: 0; background: transparent;
  padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: var(--text-2);
  cursor: pointer; font-family: inherit; font-weight: 500;
}
.tab-btn.active { background: var(--white); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.panel { background: var(--white); border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow); margin-bottom: 18px; }
.panel-title { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.panel-desc { font-size: 12.5px; color: var(--text-3); margin: 0 0 18px; }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfcfe;
  min-height: 64px;
}
.field .k { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.field .v { font-size: 14.5px; margin-top: 4px; color: var(--text); word-break: break-word; }
.field.locked { background: #f9fafb; }
.field.locked .v { color: var(--text-3); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.lock-ico { display: inline-block; width: 13px; height: 13px; }

.section-title { font-size: 15px; font-weight: 700; margin: 26px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .count { font-size: 11px; background: var(--primary-soft); color: var(--primary); padding: 1px 8px; border-radius: 999px; }

.att-list { display: flex; flex-direction: column; gap: 10px; }
.att-row {
  display: flex; align-items: center; gap: 14px; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 16px; background: #fbfcfe;
}
.att-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--primary-soft); display: grid; place-items: center; flex: none; }
.att-ico svg { width: 18px; height: 18px; fill: var(--primary); }
.att-main { flex: 1; min-width: 0; }
.att-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.att-actions { display: flex; gap: 8px; flex: none; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--white); color: var(--text); padding: 7px 12px; font-size: 12.5px; cursor: pointer;
  font-family: inherit; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: #c7d2fe; color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); color: #fff; }
.btn.danger { color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 22px 0; }

.page-foot { text-align: center; color: var(--text-3); font-size: 12px; padding: 28px 0 40px; }
.page-foot .legal { margin-top: 6px; font-size: 11.5px; color: #9ca3af; }

/* ---------- auth ---------- */
.auth-wrap { max-width: 420px; margin: 48px auto 60px; }
.auth-card { background: var(--white); border-radius: 16px; padding: 32px 30px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 22px; margin: 0 0 4px; }
.auth-card .sub { color: var(--text-3); font-size: 13px; margin: 0 0 22px; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12.5px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; font-size: 14px;
  font-family: inherit; outline: none; background: var(--white); color: var(--text);
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
.btn-block { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; border-radius: 9px; }
.form-msg { font-size: 12.5px; margin: 10px 0 0; min-height: 18px; }
.form-msg.err { color: var(--danger); }
.form-msg.ok { color: #047857; }
.auth-switch { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 18px; }

/* ---------- modal ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--white); border-radius: 14px; width: min(960px, 96vw); height: min(760px, 92vh);
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.modal-head { display: flex; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 15px; flex: 1; }
.modal-body { flex: 1; background: #f3f4f6; }
.modal-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.modal-body .img-wrap { height: 100%; display: grid; place-items: center; padding: 10px; }
.modal-body img { max-height: 100%; object-fit: contain; }

/* ---------- admin ---------- */
.admin-body { background: #f3f5f9; }
.admin-shell { max-width: 1280px; margin: 0 auto; padding: 20px; }
.admin-grid { display: grid; grid-template-columns: 250px 1fr; gap: 18px; }
.side { background: var(--white); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); height: fit-content; }
.side a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text-2); font-size: 13.5px; margin-bottom: 2px; }
.side a.active, .side a:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; font-weight: 600; }
.card { background: var(--white); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { font-size: 17px; margin: 0 0 4px; }
.card .hint { font-size: 12.5px; color: var(--text-3); margin: 0 0 16px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar .input { width: auto; min-width: 200px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 10px 8px; border-bottom: 1px solid var(--line); background: #fbfcfe; }
.table td { padding: 10px 8px; border-bottom: 1px solid #f1f3f7; vertical-align: middle; }
.table tr:hover td { background: #fafbff; }
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #f3f4f6; color: #4b5563; }
.pill.ok { background: #ecfdf5; color: #047857; }
.pill.warn { background: #fffbeb; color: #b45309; }
.pill.red { background: #fef2f2; color: #b91c1c; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.upload-zone {
  border: 1.5px dashed #c7d2fe; background: #f8faff; border-radius: 12px; padding: 28px;
  text-align: center; color: var(--text-3); cursor: pointer;
}
.upload-zone:hover { background: #f0f5ff; border-color: var(--primary); }
.chk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 340px; overflow: auto; padding-right: 4px; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; padding: 6px 8px; border-radius: 8px; }
.chk:hover { background: #f9fafb; }
.chk input { margin-top: 3px; }
.tag { font-size: 10.5px; color: var(--danger); border: 1px solid #fecaca; border-radius: 4px; padding: 0 4px; margin-left: 4px; }

@media (max-width: 820px) {
  .field-grid { grid-template-columns: 1fr; }
  .hero { padding: 34px 0 26px; }
  .hero h1 { font-size: 22px; }
  .search-box { flex-direction: column; }
  .search-box button { padding: 11px; }
  .archive-head, .panel { padding: 18px 16px; }
  .att-row { flex-wrap: wrap; }
  .att-actions { width: 100%; justify-content: flex-end; }
  .admin-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .topbar-inner { gap: 10px; }
  .brand-sub { display: none; }
}

/* ---------- 窄屏（手机）精修 ---------- */
@media (max-width: 560px) {
  .topbar-inner { padding: 10px 14px; gap: 8px; }
  .brand img { height: 26px; }
  .nav { gap: 0; }
  .nav a, .nav button.link { padding: 6px 8px; font-size: 13px; }
  .lang-select { padding: 6px 22px 6px 8px; font-size: 12px; }
  .hero { padding: 26px 0 20px; }
  .hero h1 { font-size: 20px; line-height: 1.4; }
  .container { padding: 0 14px; }
  .tab-btn { min-width: 92px; padding: 9px 10px; font-size: 13px; }
  .archive-title { font-size: 20px; }
  .archive-meta { gap: 12px 20px; }
  .login-banner { flex-direction: column; align-items: flex-start; gap: 10px; }
  .att-row { align-items: flex-start; }
}
