:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #ececf1;
  --line-strong: #e0e2ea;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --brand: #4f46e5;
  --brand-2: #6366f1;
  --brand-ink: #4338ca;
  --ok: #16a34a;
  --ok-bg: #ecfdf3;
  --warn: #d97706;
  --warn-bg: #fffaeb;
  --danger: #dc2626;
  --danger-bg: #fef3f2;
  --info-bg: #eef4ff;
  --info-ink: #1d4ed8;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow: 0 4px 14px rgba(15, 23, 42, .06), 0 2px 6px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 40px rgba(49, 46, 129, .10);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-ink); }

.wrap { max-width: 840px; margin: 0 auto; padding: 32px 16px 72px; }
.admin-wrap { max-width: 1080px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.hero::before {
  content: "";
  position: absolute;
  width: 320px; height: 320px;
  right: -90px; top: -160px;
  background: radial-gradient(circle, rgba(99,102,241,.18), transparent 70%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  left: -60px; bottom: -120px;
  background: radial-gradient(circle, rgba(56,189,248,.16), transparent 70%);
  pointer-events: none;
}
.hero h1 {
  position: relative;
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.2px;
  background: linear-gradient(120deg, var(--brand) 0%, #818cf8 60%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--brand);
}
.hero p {
  position: relative;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

/* ---------- Search ---------- */
.search {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.search form { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.field { flex: 1 1 260px; min-width: 0; }
.field label, .form-row label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 7px;
}
input[type=text], input[type=password], select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input[type=text]:hover, input[type=password]:hover, select:hover { border-color: #cbd0dc; }
input[type=text]:focus, input[type=password]:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79,70,229,.12);
  background: #fff;
}
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px;
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px rgba(79,70,229,.28);
  height: 46px;
  transition: transform .12s, box-shadow .15s, opacity .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79,70,229,.34); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: #fff; color: var(--brand);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { color: var(--brand-ink); border-color: var(--brand); transform: translateY(-1px); }
.btn.small { padding: 7px 13px; font-size: 13px; height: auto; box-shadow: none; }
.search .actions { display: flex; gap: 10px; align-items: flex-end; }

/* ---------- Notice ---------- */
.notice {
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.55;
  border: 1px solid var(--warn-bg);
  background: var(--warn-bg);
  color: #92400e;
}
.notice.info { border-color: #dbeafe; background: var(--info-bg); color: var(--info-ink); }
.notice.err { border-color: #fecaca; background: var(--danger-bg); color: #991b1b; }
.notice.ok { border-color: #bbf7d0; background: var(--ok-bg); color: #166534; }

/* 重复单号提示 */
.dup-notice strong { display: block; margin-bottom: 8px; font-size: 13.5px; }
.dup-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.dup-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: rgba(255, 255, 255, .68);
  border: 1px solid rgba(220, 38, 38, .18);
  border-radius: 9px; padding: 7px 11px;
}
.dup-no {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; font-weight: 600; color: #991b1b;
  word-break: break-all;
}
.dup-meta { font-size: 12px; color: #b45309; }
.dup-link {
  margin-left: auto; font-size: 12px; font-weight: 600;
  color: var(--brand); white-space: nowrap;
}

/* ---------- Result ---------- */
.result {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 20px;
  animation: rise .35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.result-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
}
.result-head .title { font-size: 15.5px; font-weight: 650; }
.result-head .title .no-sub { color: var(--faint); font-weight: 400; font-size: 13px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.signed { background: var(--ok-bg); color: #15803d; }
.badge.transit { background: var(--info-bg); color: var(--info-ink); }
.badge.other { background: #f1f5f9; color: #475569; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); }
.cell { background: #fff; padding: 16px 20px; transition: background .15s; }
.cell:hover { background: #fafbff; }
.cell .k {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500;
}
.cell .k svg { width: 15px; height: 15px; color: var(--faint); }
.cell .v { font-size: 16px; font-weight: 650; word-break: break-all; letter-spacing: -.1px; }
.cell.wide { grid-column: 1 / -1; }
.copy {
  margin-left: 8px; font-size: 12px; color: var(--brand);
  cursor: pointer; background: none; border: 0; padding: 0; vertical-align: baseline;
}
.copy:hover { color: var(--brand-ink); text-decoration: underline; }

/* ---------- Timeline ---------- */
.timeline { padding: 18px 20px; border-top: 1px solid var(--line); }
.timeline h3 { margin: 0 0 14px; font-size: 14px; font-weight: 650; }
.tl { list-style: none; margin: 0; padding: 0 0 0 26px; border-left: 2px solid var(--line-strong); }
.tl li { position: relative; padding: 0 0 18px 16px; }
.tl li:last-child { padding-bottom: 0; }
.tl li::before {
  content: ""; position: absolute; left: -33px; top: 4px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid var(--faint);
  transition: all .2s;
}
.tl li.active::before { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.16); }
.tl li.sign::before { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 0 4px rgba(22,163,74,.15); }
.tl li.sign::after {
  content: ""; position: absolute; left: -29px; top: 7px;
  width: 3px; height: 6px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.tl .t { font-size: 12px; color: var(--muted); }
.tl .d { font-size: 14px; margin-top: 2px; color: var(--text); }

/* ---------- Recent ---------- */
.recent {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 20px;
}
.recent h3 { margin: 0; padding: 15px 20px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 650; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafbfe; color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbff; }
td.no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 24px; }
.foot a { color: var(--muted); }
.empty { padding: 34px 18px; text-align: center; color: var(--faint); font-size: 14px; }

/* ---------- Admin ---------- */
.nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.nav a {
  padding: 8px 15px; border-radius: 999px; background: #fff;
  border: 1px solid var(--line); font-size: 13px; color: var(--text); box-shadow: var(--shadow-sm);
}
.nav a:hover { border-color: var(--brand); color: var(--brand); }
.nav a.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(79,70,229,.26); }

/* ---------- 前台应用布局（顶部导航 · 两行按钮） ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow-sm);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 10px 20px 12px;
  display: flex; flex-direction: column; gap: 10px;
}

.tb-row { display: flex; align-items: center; gap: 10px; }
.tb-row-1 { justify-content: space-between; }
.tb-row-2 { justify-content: flex-start; }

.tb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--text);
  font-family: var(--font); font-size: 14px; font-weight: 600;
  letter-spacing: -.1px; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  transition: transform .12s, box-shadow .15s, border-color .15s, background .15s, color .15s;
}
.tb-btn:hover {
  color: var(--brand-ink); border-color: var(--brand);
  box-shadow: 0 6px 16px rgba(79, 70, 229, .16);
  transform: translateY(-1px);
}
.tb-btn:active { transform: translateY(0); }

.tb-brand {
  font-size: 15.5px; font-weight: 700;
  border-color: transparent; box-shadow: none; background: transparent;
  padding-left: 4px;
}
.tb-brand:hover { background: #f4f5fb; box-shadow: none; }
.tb-brand .tb-text {
  background: linear-gradient(120deg, var(--brand), #818cf8);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.tb-ico { font-size: 19px; line-height: 1; }

.tb-user { display: flex; align-items: center; gap: 8px; }

.tb-member { padding-left: 6px; padding-right: 16px; }
.tb-avatar {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 3px 8px rgba(79, 70, 229, .28);
}

.tb-logout { color: var(--danger); border-color: #f6d5d5; background: #fffafa; }
.tb-logout:hover { color: #991b1b; border-color: var(--danger); box-shadow: 0 6px 16px rgba(220, 38, 38, .16); }

.tb-row-2 .tb-nav { flex: 1 1 0; min-width: 0; overflow: hidden; background: #f8f9fc; }
.tb-row-2 .tb-nav .tb-text { overflow: hidden; text-overflow: ellipsis; }
.tb-nav.on {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 6px 16px rgba(79, 70, 229, .26);
}
.tb-nav.on:hover { color: #fff; border-color: transparent; }

.app { display: block; background: var(--bg); }
.main {
  max-width: 1180px; margin: 0 auto;
  padding: 138px 20px 60px;
}
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* 录入表单 */
textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 14px; font-family: var(--font); background: #fff; color: var(--text); outline: none;
  resize: vertical; line-height: 1.6; transition: border-color .15s, box-shadow .15s;
}
textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
code { background: #f1f2f7; border-radius: 5px; padding: 1px 5px; font-size: 12px; color: var(--brand-ink); }

/* 本次统计 */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
@media (max-width: 640px) { .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

@media (max-width: 860px) {
  .topbar-inner { padding: 10px 12px 12px; gap: 9px; }
  .tb-row { gap: 8px; }

  /* 第一行：网站名称 + 成员 + 退出，改为等宽平铺按钮 */
  .tb-row-1 { flex-direction: row; }
  .tb-row-1 > .tb-btn,
  .tb-row-1 > .tb-user { flex: 1 1 0; min-width: 0; }
  .tb-row-1 > .tb-user { display: flex; gap: 8px; }
  .tb-row-1 > .tb-user > .tb-btn { flex: 1 1 0; min-width: 0; }
  .tb-btn {
    height: 40px; padding: 0 8px; font-size: 13.5px;
    overflow: hidden;
  }
  .tb-brand { padding-left: 8px; }
  .tb-member { padding-left: 6px; padding-right: 8px; }
  .tb-btn .tb-text { overflow: hidden; text-overflow: ellipsis; }
  .tb-avatar { width: 26px; height: 26px; font-size: 12px; }

  /* 第二行：四个导航等宽平铺 */
  .tb-row-2 { gap: 8px; }
  .tb-row-2 .tb-nav { padding: 0 6px; }

  .main { padding: 124px 12px 48px; }
}

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat .n { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.stat .l { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 各快递公司统计 */
.carrier-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px;
  margin: 4px 0 14px;
}
.carrier {
  background: linear-gradient(135deg, #f7f8ff, #eef1ff);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 16px 12px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.carrier-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.carrier-num { font-size: 26px; font-weight: 800; letter-spacing: -.5px;
  background: linear-gradient(120deg, var(--brand), #818cf8); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.carrier-label { font-size: 11px; color: var(--faint); }
.carrier-sum { font-size: 12.5px; color: var(--muted); }
@media (max-width: 640px) { .carrier-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px;
}
.panel h2 { margin: 0 0 16px; font-size: 16px; font-weight: 650; }

.form-row { margin-bottom: 16px; }
.form-row label:first-child { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; }
.form-row label.inline { display: inline-flex !important; align-items: center; gap: 7px; font-size: 13.5px; color: var(--text) !important; margin: 0 16px 0 0 !important; cursor: pointer; }
.form-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pager a { padding: 7px 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 13px; color: var(--text); }
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager span { padding: 7px 13px; font-size: 13px; color: var(--faint); }

/* ---------- 历史页搜索框 ---------- */
.search-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center; margin-bottom: 16px;
}
.search-input {
  position: relative; flex: 1 1 240px; min-width: 180px;
  display: flex; align-items: center;
}
.search-input .si-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--faint); display: inline-flex; pointer-events: none;
}
.search-input input {
  width: 100%; height: 46px; padding: 0 38px 0 40px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font);
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.search-input input::placeholder { color: var(--faint); }
.search-input input:hover { border-color: #cbd0dc; }
.search-input input:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79,70,229,.14);
}
.search-input .si-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; line-height: 22px; text-align: center;
  border-radius: 50%; background: var(--line); color: var(--muted);
  font-size: 16px; text-decoration: none;
}
.search-input .si-clear:hover { background: #e2e2ea; color: var(--text); }

/* 状态筛选与搜索按钮：与搜索框同高、上下对齐 */
.search-bar .search-filter {
  flex: 1 1 150px; min-width: 130px;
  height: 46px; padding: 0 36px 0 14px;
  border-radius: var(--radius-sm);
}
.search-bar .btn {
  flex: 1 1 110px; min-width: 96px;
  height: 46px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center;
}

@media (max-width: 640px) {
  .wrap { padding: 20px 12px 56px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search .actions { width: 100%; }
  th, td { white-space: normal; }
}

@media (max-width: 860px) {
  /* 手机端：搜索框 / 状态筛选 / 搜索按钮 三个平铺，上下对齐 */
  .search-bar { flex-direction: row; align-items: center; gap: 8px; }
  .search-input { flex: 1 1 0; min-width: 0; }
  .search-input input { padding-left: 36px; padding-right: 32px; font-size: 14px; }
  .search-input .si-ico { left: 11px; }
  .search-bar .search-filter { flex: 1 1 0; min-width: 0; font-size: 13.5px; padding-right: 30px; }
  .search-bar .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; font-size: 14px; }
}

/* ===== 定时任务页：代码块 ===== */.codeblock {
  display: block;
  margin: 8px 0 6px;
  padding: 14px 16px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-x: auto;
}

/* ===== 列表页操作条（如「刷新未签收」） ===== */
.list-actions {
  display: flex; align-items: center; flex-wrap: wrap;
  margin: 0 0 14px;
}
.list-actions .hint { color: var(--muted); font-size: 13px; }

/* ===== 页脚（含友情链接） ===== */
.site-footer {
  width: 100%;
  padding: 18px 20px 26px;
  text-align: center;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  color: var(--faint);
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 6px;
}
.footer-inner a { color: var(--muted); text-decoration: none; border-bottom: 1px dashed var(--line-strong); }
.footer-inner a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.footer-sep { color: var(--line-strong); }
