/* 京东转链工具 - 浅色主题 */
:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #646a73;
  --subtle: #8f959e;
  --line: #e5e6eb;
  --line-soft: #f0f1f2;
  --brand: #e1251b;
  --brand-dark: #c81612;
  --brand-soft: #fff1f0;
  --ok: #00a870;
  --ok-soft: #e8f8f1;
  --warn: #d48806;
  --warn-soft: #fff8e6;
  --err: #d54941;
  --err-soft: #fff0ef;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 35, 41, .04), 0 6px 20px rgba(31, 35, 41, .05);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
main.wrap { padding-top: 24px; padding-bottom: 24px; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.brand-logo { display: block; width: 32px; height: 32px; border-radius: 8px; }
.nav { display: flex; gap: 6px; }
.nav a {
  padding: 8px 16px; border-radius: 8px; color: var(--muted); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--line-soft); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand); }

/* ---------- 页头 ---------- */
.page-head { padding: 32px 0 24px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; line-height: 1.35; letter-spacing: -.3px; }
.page-head p { margin: 0; color: var(--muted); }

/* ---------- 布局与卡片 ---------- */
.layout { display: grid; grid-template-columns: 480px minmax(0, 1fr); gap: 20px; align-items: start; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px; }
.card-title {
  margin: 0 0 4px; font-size: 16px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.card-title .dot { width: 4px; height: 16px; background: var(--brand); border-radius: 2px; }
.card-desc { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; margin-bottom: 7px; font-weight: 500; }
.field .hint { color: var(--subtle); font-size: 12px; margin-top: 6px; line-height: 1.5; }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(225, 37, 27, .09);
}
.textarea { resize: vertical; min-height: 300px; line-height: 1.7; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5L6 8l3.5-3.5' stroke='%23646a73' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.segmented { display: flex; gap: 8px; }
.segmented label {
  flex: 1; margin: 0; padding: 9px 8px; text-align: center; cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px; color: var(--muted);
  transition: all .15s; font-weight: 500;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented input:checked + span { color: var(--brand); }
.segmented label.is-checked {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}
.segmented label:has(input:checked) {
  border-color: var(--brand); background: var(--brand-soft); color: var(--brand);
}
.segmented label:hover { border-color: #d0d3d8; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.param-row .field { margin-bottom: 18px; }

/* ---------- 多密钥渠道 ---------- */
.credential-list { display: flex; flex-direction: column; gap: 12px; }
.credential-row {
  border: 1px solid var(--line); border-radius: 10px; padding: 14px;
  background: #fafbfc;
}
.credential-row-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.credential-row-head .t { font-weight: 600; font-size: 13px; }
.credential-row .row { gap: 10px; }
.credential-row .field { margin-bottom: 0; }
.credential-row .field label { font-size: 12px; margin-bottom: 5px; color: var(--muted); }
.btn-remove-credential { padding: 5px 10px; font-size: 12px; color: var(--err); border-color: #ffd4d1; background: #fff; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); cursor: pointer; font-weight: 500;
  transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: #c9ccd1; background: #fafbfc; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-block { width: 100%; }
.btn.grow { flex: 1; }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-group { display: flex; gap: 10px; align-items: stretch; }

/* ---------- 提示 ---------- */
.notice {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: 8px; margin-bottom: 18px;
  font-size: 13px; line-height: 1.55;
}
.notice-warn { background: var(--warn-soft); color: #8a5a00; border: 1px solid #ffe7a8; }
.notice-err { background: var(--err-soft); color: var(--err); border: 1px solid #ffd4d1; }
.notice-ok { background: var(--ok-soft); color: #067a55; border: 1px solid #b9ecd7; }
.notice .ico { flex: 0 0 auto; font-weight: 700; }

/* ---------- 统计卡 ---------- */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 12px; margin-top: 8px; margin-bottom: 20px; }
.stat {
  background: #fafbfc; border: 1px solid var(--line-soft); border-radius: 10px; padding: 14px;
}
.stat .k { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.stat .v { font-size: 20px; font-weight: 600; line-height: 1.3; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--subtle); margin-left: 2px; }
.stat.tone-ok { background: var(--ok-soft); border-color: #b9ecd7; }
.stat.tone-ok .k, .stat.tone-ok .v { color: var(--ok); }
.stat.tone-ok .v small { color: var(--ok); }
.stat.tone-fail { background: var(--err-soft); border-color: #ffd4d1; }
.stat.tone-fail .k, .stat.tone-fail .v { color: var(--err); }
.stat.tone-fail .v small { color: var(--err); }

/* ---------- 结果区 ---------- */
.result-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 320px; color: var(--subtle); text-align: center; gap: 12px;
}
.result-empty .empty-ico {
  width: 56px; height: 56px; border-radius: 50%; background: var(--line-soft);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.result-block { margin-bottom: 22px; }
.result-block:last-child { margin-bottom: 0; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.block-head h3 { margin: 0; font-size: 14px; font-weight: 600; }

.out-text {
  background: #fafbfc; border: 1px solid var(--line); border-radius: 8px;
  padding: 14px; height: 300px; overflow: auto;
  white-space: pre-wrap; word-break: break-all; line-height: 1.8; font-size: 13px;
}
.out-text .mark-fail { color: var(--err); font-weight: 600; }
.out-text .mark-points { color: var(--text); font-weight: 600; }
.out-text .mark-ok { color: var(--text); font-weight: 600; }

.result-copy { display: flex; margin-top: 18px; }
.btn-copy {
  width: 100%; padding: 10px 18px; font-size: 14px; font-weight: 600;
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 6px 16px rgba(225, 37, 27, .22);
}
.btn-copy:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { background: #fafbfc; color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
.url-cell { max-width: 240px; word-break: break-all; color: var(--muted); }
.short-cell { max-width: 230px; word-break: break-all; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-fail { background: var(--err-soft); color: var(--err); }
.badge-skip { background: var(--warn-soft); color: var(--warn); }

/* ---------- 后台 ---------- */
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.admin-sections { display: flex; flex-direction: column; gap: 20px; }
.section-title {
  display: flex; align-items: center; gap: 9px;
  margin: 0 0 18px; font-size: 15px; font-weight: 600;
}
.section-num {
  width: 22px; height: 22px; border-radius: 6px; background: var(--brand-soft);
  color: var(--brand); display: inline-flex; align-items: center; justify-content: center; font-size: 12px;
}
.switch-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; cursor: pointer; }
.switch-row:last-child { margin-bottom: 0; }
.switch-row input { margin-top: 4px; accent-color: var(--brand); width: 15px; height: 15px; }
.switch-row .t { font-weight: 500; }
.switch-row .d { color: var(--subtle); font-size: 12px; }

.side-card { position: sticky; top: 84px; }
.side-card .card-desc { margin-bottom: 14px; }
.info-list { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.info-list li { padding: 9px 0; border-bottom: 1px solid var(--line-soft); color: var(--muted); }
.info-list li:last-child { border-bottom: none; }
.info-list b { color: var(--text); font-weight: 500; }

.login-mask {
  position: fixed; inset: 0; background: rgba(31, 35, 41, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.login-box { width: 100%; max-width: 380px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.18); }
.login-box h2 { margin: 0 0 6px; font-size: 19px; }
.login-box p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px);
  background: #1f2329; color: #fff; padding: 11px 20px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 100;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: #0a8f63; }
.toast.err { background: #c9362e; }

.footer { padding: 36px 0 28px; text-align: center; color: var(--subtle); font-size: 12px; }

@media (max-width: 940px) {
  .layout, .admin-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 14px; }
  .page-head { padding: 24px 0 18px; }
  .page-head h1 { font-size: 22px; }
  .row { grid-template-columns: 1fr; }
  .card-pad { padding: 18px; }
  .nav a { padding: 8px 10px; font-size: 13px; }
}
