:root {
  --brand: #2563eb;
  --brand-2: #4f46e5;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --card: #fff;
  --danger: #dc2626;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { cursor: pointer; }

/* ================= PC 登录页 ================= */
.pc-login { min-height: 100vh; display: flex; }
.pc-left {
  flex: 0 0 44%; position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 56px 60px;
  color: #fff;
  background:
    radial-gradient(700px 400px at 12% 8%, rgba(96, 165, 250, .45), transparent 60%),
    radial-gradient(600px 420px at 100% 100%, rgba(79, 70, 229, .55), transparent 58%),
    linear-gradient(150deg, #1e293b 0%, #0f172a 100%);
}
.brand-lg .logo {
  width: 62px; height: 62px; border-radius: 18px; margin-bottom: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 800; font-style: italic;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 14px 30px rgba(59, 130, 246, .4);
}
.brand-lg h1 { margin: 0 0 8px; font-size: 38px; letter-spacing: 4px; }
.brand-lg .slogan { margin: 0 0 36px; font-size: 17px; color: #cbd5e1; letter-spacing: 2px; }
.feats { list-style: none; padding: 0; margin: 0; }
.feats li {
  position: relative; padding-left: 30px; margin-bottom: 16px;
  font-size: 15px; color: #e2e8f0;
}
.feats li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  width: 20px; height: 20px; line-height: 20px; text-align: center;
  font-size: 12px; font-weight: 700; color: #fff; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
}
.pc-left .foot { font-size: 13px; color: #94a3b8; letter-spacing: 1px; }

.pc-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; }
.pc-form { width: 100%; max-width: 380px; animation: rise .45s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.pc-form h2 { margin: 0 0 8px; font-size: 26px; }
.pc-form .sub { margin: 0 0 30px; color: var(--ink-3); font-size: 14px; }

.field { display: block; margin-bottom: 20px; }
.field span { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; font-weight: 600; }
input {
  width: 100%; padding: 13px 15px; font-size: 15px; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
input::placeholder { color: #b6c0cd; }
input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, .12); }

.btn-primary {
  width: 100%; padding: 14px; font-size: 16px; font-weight: 700; letter-spacing: 3px;
  color: #fff; border: 0; border-radius: 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 22px rgba(37, 99, 235, .3);
}
.btn-primary:active { transform: translateY(1px); }
.msg { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 12px; }
.tip { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); color: var(--ink-3); font-size: 12.5px; text-align: center; }

/* ================= 后台布局 ================= */
#dash { display: flex; min-height: 100vh; }
.side {
  width: 224px; flex: 0 0 224px; color: #cbd5e1;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  display: flex; flex-direction: column; padding: 20px 0;
}
.side-logo {
  display: flex; align-items: center; gap: 10px; padding: 0 22px 22px;
  color: #fff; font-weight: 700; font-size: 16px; letter-spacing: 1px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.side-logo .logo {
  width: 30px; height: 30px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-style: italic; background: linear-gradient(135deg, #3b82f6, #6366f1);
}
.side nav { padding: 14px 12px; flex: 1; }
.side nav a {
  display: block; padding: 12px 16px; margin-bottom: 6px; border-radius: 10px;
  color: #cbd5e1; text-decoration: none; font-size: 14.5px; transition: .16s;
}
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side nav a.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 8px 18px rgba(37, 99, 235, .35); }
.side-foot { padding: 16px 22px; font-size: 12px; color: #64748b; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; background: #fff; border-bottom: 1px solid var(--line);
}
.topbar h3 { margin: 0; font-size: 18px; }
.topbar .user { color: var(--ink-2); font-size: 14px; }
.topbar .user a { margin-left: 14px; color: var(--brand); text-decoration: none; font-weight: 600; }

.content { padding: 24px 28px; }
.card { background: var(--card); border-radius: 14px; padding: 20px 22px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h4 { margin: 0; font-size: 15.5px; }
.muted { color: var(--ink-3); font-size: 13px; }
.btn-sm {
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: #fff; border: 0; border-radius: 8px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.btn-line {
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--brand); border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; background: #fff;
}

/* 商家经营范围勾选 */
.catpick { max-height: 46vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; }
.catpick .catgroup { border-top: 1px solid #eef2f7; padding: 10px 0; }
.catpick .catgroup:first-child { border-top: 0; }
.catpick .catgroup > label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.catpick .catsubs { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 7px 0 0 24px; }
.catpick .catsubs label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.catpick input { width: auto; margin: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 12px; border-bottom: 1px solid #eef2f7; font-size: 14px; }
th { color: var(--ink-3); font-weight: 600; font-size: 13px; background: #f8fafc; }
tbody tr:hover { background: #f8fafc; }
td b { color: var(--brand); }

.weights { display: flex; flex-wrap: wrap; gap: 18px; }
.weights label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink-2); font-weight: 600; }
.weights input { width: 140px; }

/* ===== AI 配置 ===== */
.ai-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 20px; }
.ai-grid .field { margin-bottom: 14px; }
.ai-grid .field.wide { grid-column: span 2; }
.ai-grid select, .ai-grid input { width: 100%; }
.ai-grid .hint { display: block; margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.ai-banner { padding: 12px 15px; border-radius: 10px; font-size: 13.5px; margin-bottom: 20px; line-height: 1.6; }
.ai-banner.on { background: #dcfce7; color: #15803d; }
.ai-banner.off { background: #fef3c7; color: #b45309; }
.ai-banner.err { background: #fee2e2; color: #b91c1c; }
.ai-actions { display: flex; align-items: center; gap: 12px; margin-top: 6px; flex-wrap: wrap; }
.ai-actions .spacer { flex: 1; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.switch input { width: 17px; height: 17px; }
.ai-test { margin-top: 18px; border-top: 1px dashed #e2e8f0; padding-top: 16px; }
.ai-test .ok { color: #15803d; font-weight: 600; }
.ai-test .bad { color: #b91c1c; font-weight: 600; }
.ai-test table { margin-top: 12px; }
.ai-notes { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); line-height: 1.9; }
.ai-notes b { color: var(--ink); }
@media (max-width: 860px) {
  .ai-grid { grid-template-columns: 1fr; }
  .ai-grid .field.wide { grid-column: span 1; }
}

@media (max-width: 860px) {
  .pc-left { display: none; }
  .pc-right { flex: 1; }
  #dash { flex-direction: column; }
  .side { width: 100%; flex: none; flex-direction: row; align-items: center; padding: 0 12px; }
  .side-logo { border: 0; padding: 14px 12px; }
  .side nav { display: flex; padding: 0; }
  .side nav a { margin: 0 4px; }
  .side-foot { display: none; }
}

/* ================= 统计卡 / 待办 ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border-radius: 14px; padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-ic {
  width: 48px; height: 48px; border-radius: 13px; flex: none; font-size: 22px;
  display: flex; align-items: center; justify-content: center; background: #eff6ff;
}
.stat-v { font-size: 24px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.stat-t { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.todo-item { padding: 11px 14px; background: #f8fafc; border-radius: 10px; margin-bottom: 8px; font-size: 14px; color: var(--ink-2); }

/* ================= 表格增强 ================= */
.filters { display: flex; align-items: center; gap: 12px; }
.filters select { padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 8px; font-size: 13.5px; color: var(--ink); background: #fff; }
.ops { white-space: nowrap; }
.link { color: var(--brand); font-weight: 600; text-decoration: none; margin-right: 10px; font-size: 13.5px; }
.link:hover { text-decoration: underline; }
.link.ok { color: #16a34a; }
.link.bad { color: var(--danger); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; background: #eff6ff; color: var(--brand); }
.tag.ok { background: #dcfce7; color: #16a34a; }
.tag.bad { background: #fee2e2; color: var(--danger); }
.tag.wait { background: #fef3c7; color: #b45309; }

/* ================= 弹窗 ================= */
.modal-mask {
  position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 30px;
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  width: 100%; max-width: 760px; max-height: 86vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 16px; box-shadow: 0 30px 70px rgba(2, 6, 23, .35);
  animation: rise .25s cubic-bezier(.2, .8, .2, 1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-x { font-size: 26px; line-height: 1; color: var(--ink-3); cursor: pointer; }
.modal-x:hover { color: var(--ink); }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-body h5.sec { margin: 20px 0 12px; font-size: 14px; color: var(--ink); padding-left: 10px; border-left: 3px solid var(--brand); }
.modal-body h5.sec:first-child { margin-top: 0; }
.modal-body table { margin-bottom: 6px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 12px; border-bottom: 1px dashed #eef2f7; font-size: 13.5px; }
.kv span { color: var(--ink-3); }
.kv b { color: var(--ink); font-weight: 600; text-align: right; }
.coeff-row { display: flex; flex-wrap: wrap; gap: 10px; }
.coeff-row span { padding: 9px 14px; background: #f8fafc; border-radius: 9px; font-size: 13px; color: var(--ink-2); }
.coeff-row span b { color: var(--ink); }
.coeff-row .hl { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.coeff-row .hl b { color: #fff; }
.modal-ops { display: flex; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.btn-sm.ghost { background: #fff; color: var(--brand); border: 1.5px solid var(--brand); }
