/* ============ 千川选品 · 联系方式库 ============ */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --line: #e6e9ef;
  --line-strong: #d8dee9;
  --text: #1a1d24;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-soft: #eff4ff;
  --green: #15803d;
  --green-soft: #e8f8ee;
  --green-line: #a9e2bd;
  --radius: 12px;
  --topbar-h: 45px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: .2px;
  min-width: 0;
  white-space: nowrap;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}
.brand small { color: var(--muted); font-weight: 400; font-size: 12px; }
.topbar .spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.userbox .uname {
  color: var(--muted);
  padding: 4px 10px;
  background: #f2f4f8;
  border-radius: 999px;
}
.linkbtn {
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  font: inherit;
  cursor: pointer;
}
.linkbtn:hover { color: var(--primary); background: var(--primary-soft); }

/* ---------------- 主体 ---------------- */
.wrap {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 60px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 20px; font-weight: 650; letter-spacing: .3px; }
.stat.green .v { color: var(--green); }

/* ---------------- 工具栏 ---------------- */
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
}
.search input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 36px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  font: inherit;
  color: var(--text);
  outline: none;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; stroke: var(--muted);
}
.seg {
  display: inline-flex;
  background: #eceff5;
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
  overflow: hidden;
}
.seg a {
  padding: 7px 12px;
  border-radius: 8px;
  color: #4b5563;
  font-size: 13px;
  white-space: nowrap;
}
.seg a.on {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn-primary {
  height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.btn-primary:hover { background: #1d4ed8; }

/* ---------------- 列表 ---------------- */
.list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.listhead,
.row {
  display: grid;
  grid-template-columns: 52px 210px 190px minmax(0, 1fr) 76px;
  align-items: start;
}
.listhead {
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  font-size: 12px;
  color: var(--muted);
  padding: 9px 16px;
  position: sticky;
  top: var(--topbar-h);
  z-index: 10;
}
.row {
  padding: 10px 16px;
  border-bottom: 1px solid #f1f3f7;
  transition: background .15s;
}
.row:last-child { border-bottom: 0; border-radius: 0 0 var(--radius) var(--radius); }
.row:hover { background: #fbfcfe; }
.row.is-copied { background: #fbfefc; }
.cell { min-width: 0; padding-right: 10px; display: flex; align-items: center; }
.cell.idx { color: #9aa3af; font-size: 12px; font-variant-numeric: tabular-nums; }
.cell.shop { font-weight: 500; word-break: break-all; }
.cell.product { color: #374151; line-height: 1.45; word-break: break-all; }
.cell.more { justify-content: flex-end; padding-right: 0; }

/* 联系方式 chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 11px;
  border: 1px solid #d5e2f8;
  border-radius: 999px;
  background: var(--primary-soft);
  color: #1d4ed8;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.chip .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip .badge { display: none; flex: none; font-size: 11px; font-weight: 600; }
.chip:hover { border-color: #b9cff5; background: #e8f0ff; }
.chip:active { transform: scale(.98); }
.chip.copied {
  background: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
}
.chip.copied .badge { display: inline; }
.chip.empty {
  background: #f4f5f7;
  border-color: #e5e7eb;
  color: #9aa3af;
  font-weight: 400;
  cursor: default;
}
.chip.empty:active { transform: none; }

.more-btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: #4b5563;
  border-radius: 8px;
  height: 30px;
  padding: 0 10px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.more-btn:hover { border-color: var(--primary); color: var(--primary); }
.more-btn .caret { transition: transform .18s; font-size: 10px; }
.more-btn[aria-expanded="true"] { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.more-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

/* 更多信息面板 */
.detail {
  grid-column: 1 / -1;
  margin: 10px 0 2px;
  padding: 12px 14px;
  background: #fafbfd;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(-2px); } to { opacity: 1; transform: none; } }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 6px 18px;
}
.kv { display: flex; gap: 8px; font-size: 12.5px; align-items: baseline; min-width: 0; }
.kv .k { color: var(--muted); flex: none; min-width: 74px; }
.kv .v { color: #374151; word-break: break-all; }
.kv .v a { text-decoration: underline; text-decoration-color: #bfd3f7; }
.kv.wide { grid-column: 1 / -1; }
.detail-loading { color: var(--muted); font-size: 12.5px; padding: 2px 0; }

.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------------- 分页 ---------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.pager a, .pager span.pg, .pager .jump {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
  color: #4b5563;
  font-size: 13px;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager .pg.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager .pg.dots { border: 0; background: none; color: var(--muted); min-width: 20px; }
.pager .pg.disabled { color: #c3c9d4; background: #fafbfd; }
.pager .info { border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 0 6px; }
.pager form { display: inline-flex; align-items: center; gap: 4px; }
.pager input[type="number"] {
  width: 58px; height: 36px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: 9px;
  font: inherit; font-size: 13px; text-align: center; color: var(--text);
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  background: rgba(23, 26, 33, .92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  max-width: min(86vw, 460px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: all .22s ease;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: rgba(21, 128, 61, .95); }

.flash { animation: flash 1.6s ease; }
@keyframes flash {
  0%, 100% { background: transparent; }
  15%, 55% { background: #fff8e1; }
  35%, 75% { background: transparent; }
}

/* ---------------- 登录页 ---------------- */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #e8efff 0%, transparent 60%), var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 26px 24px 22px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .08);
}
.login-card h1 { font-size: 18px; margin: 0 0 3px; letter-spacing: .2px; }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 12.5px; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 42px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  font: inherit; color: var(--text); background: #fbfcfe; outline: none;
}
.field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.login-card .btn-primary { width: 100%; height: 42px; margin-top: 6px; }
.msg { font-size: 13px; padding: 8px 11px; border-radius: 8px; margin-bottom: 12px; }
.msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.ok { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-line); }
.hint { margin-top: 14px; color: #9aa3af; font-size: 12px; text-align: center; }
.pwd-card { max-width: 420px; margin: 40px auto; }
.pwd-card .row-actions { display: flex; gap: 10px; margin-top: 6px; align-items: center; }

/* ---------------- 手机端 ---------------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-inner { padding: 0 14px; }
  .wrap { padding: 12px 12px 70px; }

  .list { background: transparent; border: 0; box-shadow: none; border-radius: 0; }
  .listhead { display: none; }

  .row {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 12px 13px;
    margin-bottom: 10px;
  }
  .row:hover { background: var(--surface); }
  .row.is-copied { border-color: var(--green-line); }
  .cell { padding: 0; display: flex; align-items: flex-start; gap: 8px; }
  .cell.idx { display: none; }
  .cell::before {
    content: attr(data-label);
    flex: none;
    width: 52px;
    color: var(--muted);
    font-size: 12px;
    line-height: 22px;
  }
  .cell.contact {
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #eef1f6;
  }
  .cell.contact::before { content: none; }
  .chip {
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
    padding: 8px 14px;
    font-size: 15px;
    border-radius: 10px;
  }
  .chip .t { white-space: normal; word-break: break-all; line-height: 1.35; }
  .chip.copied { background: var(--green-soft); }
  .cell.shop { font-size: 14px; line-height: 22px; }
  .cell.product { color: #4b5563; font-size: 13px; line-height: 20px; }
  .cell.more {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #eef1f6;
    justify-content: stretch;
  }
  .more-btn { width: 100%; height: 34px; justify-content: center; }
  .detail { margin: 10px 0 0; padding: 10px 12px; }
  .detail-grid { grid-template-columns: 1fr; gap: 5px; }
  .kv { font-size: 12.5px; }
  .kv .k { min-width: 68px; }

  .toolbar { gap: 8px; }
  .search { flex: 1 1 100%; }
  .seg {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-width: 0;
  }
  .seg a {
    text-align: center;
    padding: 8px 2px;
    font-size: 12.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .toolbar .btn-primary { flex: 0 0 auto; padding: 0 16px; }
  .brand { font-size: 14px; }
  .brand small { display: none; }
  .userbox { gap: 2px; }
  .userbox .linkbtn { padding: 6px; }
  .pager { justify-content: flex-start; gap: 5px; }
  .pager a, .pager span.pg { min-width: 34px; height: 34px; padding: 0 8px; }
  .pager .info { flex: 1 1 100%; padding: 4px 0; }
  .toast { bottom: 20px; }
}

@media (max-width: 380px) {
  .stat .v { font-size: 17px; }
  .brand small { display: none; }
}
