* { box-sizing: border-box; }
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e3e8ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --green: #16a34a;
  --green-bg: #ecfdf3;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --red: #dc2626;
  --shadow: 0 8px 28px rgba(31, 41, 55, .08);
  --radius: 12px;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* 登录 */
.login-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); padding: 40px 36px 28px; text-align: center;
}
.logo-mark {
  width: 46px; height: 46px; border-radius: 12px; background: #07c160; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700;
}
.logo-mark.tiny { width: 26px; height: 26px; border-radius: 7px; font-size: 14px; }
.login-card h1 { margin: 18px 0 4px; font-size: 22px; }
.login-sub { margin: 0 0 26px; color: var(--muted); }
.login-foot { margin: 22px 0 0; font-size: 12px; color: #9ca3af; }
.field { display: block; text-align: left; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; color: #374151; font-weight: 500; }
input, select {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
input::placeholder { color: #b6bdc8; }
.form-error { min-height: 20px; color: var(--red); font-size: 13px; margin: 2px 0 8px; text-align: left; }

/* 按钮 */
button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid transparent; transition: .15s; }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: var(--primary); color: #fff; border-color: var(--primary); padding: 8px 18px; font-weight: 500; }
.primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.wide { width: 100%; height: 42px; margin-top: 6px; }
.ghost { background: var(--surface); color: #374151; border-color: var(--border); padding: 7px 14px; }
.ghost:hover:not(:disabled) { background: #f3f4f6; }

/* 顶部栏 */
.topbar {
  height: 60px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.who { color: var(--muted); margin-right: 6px; }

/* 销售端 */
.sales-main { max-width: 820px; margin: 0 auto; padding: 56px 24px; }
.sales-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px; }
.sales-card h2 { margin: 0 0 4px; font-size: 20px; }
.sales-card > .muted { margin: 0 0 26px; }
.searchbar { display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 6px 6px 14px; background: #fff; }
.searchbar:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.searchbar input { flex: 1; height: 42px; border: 0; box-shadow: none !important; font-size: 16px; }
.searchbar .primary { height: 42px; min-width: 88px; }
.search-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: #9ca3af; stroke-width: 2; stroke-linecap: round; }
.result-box { margin-top: 26px; }
.result-card { display: flex; gap: 14px; padding: 20px; border-radius: 10px; border: 1px solid; }
.result-card.new { background: var(--green-bg); border-color: #bbf7d0; }
.result-card.duplicate { background: var(--orange-bg); border-color: #fed7aa; }
.result-icon { width: 34px; height: 34px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: #fff; }
.result-card.new .result-icon { background: var(--green); }
.result-card.duplicate .result-icon { background: var(--orange); }
.result-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.result-card.new .result-title { color: #15803d; }
.result-card.duplicate .result-title { color: #c2410c; }
.result-detail { font-size: 15px; margin-top: 8px; }
.result-meta { margin-top: 8px; color: var(--muted); font-size: 13px; }

/* 管理后台 */
.admin-main { max-width: 1240px; margin: 0 auto; padding: 24px; }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 16px; color: var(--muted); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.summary-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 18px; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 2px; }
.stat-value.green { color: var(--green); }
.stat-value.orange { color: var(--orange); }
.stat-value.blue { color: var(--primary); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 16px; }
.panel-actions { display: flex; align-items: center; gap: 10px; }
.panel-actions input { width: 220px; height: 36px; }
.note { margin: 14px 0 0; font-size: 12px; }
.checkline { display: flex; align-items: center; gap: 8px; color: var(--text); margin-top: 4px; }
.checkline input { width: 16px; height: 16px; flex: none; }
.filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 14px; margin-bottom: 18px; }
.filters label { display: block; color: var(--muted); font-size: 12px; }
.filters input, .filters select { margin-top: 4px; height: 36px; }
.filters button { align-self: end; height: 36px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; background: #f8fafc; color: #475569; font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table .empty { text-align: center; color: var(--muted); padding: 30px; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.tag.new { background: var(--green-bg); color: #15803d; }
.tag.duplicate { background: var(--orange-bg); color: #c2410c; }
.tag.on { background: #eff6ff; color: var(--primary); }
.tag.off { background: #f3f4f6; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 16px; color: var(--muted); }
.report-row { display: flex; align-items: end; gap: 14px; margin-top: 12px; }
.report-row label { color: var(--muted); font-size: 12px; }
.report-row input { display: block; margin-top: 4px; width: 200px; }
.report-row button { height: 40px; }
.row-actions { display: flex; gap: 8px; }

/* 弹窗与提示 */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .42); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 24px; }
.modal-card h3 { margin: 0 0 18px; font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast { position: fixed; left: 50%; top: 24px; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 80; box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .topbar { padding: 0 16px; }
  .who { display: none; }
}
@media (max-width: 560px) {
  .sales-card { padding: 22px; }
  .searchbar { flex-wrap: wrap; }
  .searchbar .primary { width: 100%; }
  .summary-grid, .filters { grid-template-columns: 1fr; }
}
