:root {
  --bg: #f2f5fa;
  --card: #ffffff;
  --ink: #101828;
  --ink-2: #475467;
  --muted: #8a94a6;
  --line: #e7ebf3;
  --brand: #1e4fd8;
  --brand-2: #4b7bf5;
  --ok: #0f9d58;
  --warn: #d98324;
  --danger: #d93a3a;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .12);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------------- 登录 ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 15% 0%, #e4ecff 0%, transparent 60%),
    radial-gradient(800px 480px at 90% 10%, #eef3ff 0%, transparent 55%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 22px;
  padding: 32px 30px 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .8);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 50%;
  object-fit: contain; flex: none;
  background: #fff;
  box-shadow: 0 6px 16px -8px rgba(15, 44, 80, .45);
}
.brand-logo.sm { width: 38px; height: 38px; }
.brand-title { font-size: 16px; font-weight: 650; letter-spacing: .02em; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.field-label {
  display: block; margin: 28px 0 8px;
  font-size: 12.5px; color: var(--ink-2); font-weight: 600;
}
.field { position: relative; }
.field input {
  width: 100%; height: 46px; padding: 0 60px 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: #fbfcfe; font-size: 14px; color: var(--ink);
  outline: none; transition: .18s;
  font-family: inherit;
}
.field input:focus {
  border-color: var(--brand); background: #fff;
  box-shadow: 0 0 0 4px rgba(30, 79, 216, .1);
}
.eye {
  position: absolute; right: 6px; top: 7px;
  height: 32px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 12px; font-family: inherit;
}
.eye:hover { background: #f0f4fb; color: var(--ink-2); }

.hint { font-size: 12px; color: var(--muted); margin: 10px 2px 20px; line-height: 1.6; }
.hint code {
  background: #f3f6fc; padding: 1px 5px; border-radius: 4px;
  font-size: 11.5px; color: #3c4a63;
}

.btn-primary {
  width: 100%; height: 46px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, #1e4fd8, #3f74f0);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: .18s;
  box-shadow: 0 8px 20px -8px rgba(30, 79, 216, .7);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 24px -8px rgba(30, 79, 216, .75); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .6; cursor: default; transform: none; }

.login-err {
  margin-top: 12px; font-size: 12.5px; color: var(--danger);
  min-height: 18px; text-align: center;
}
.login-foot { margin-top: 22px; font-size: 12px; color: #9aa3b2; text-align: center; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.top-actions { display: flex; gap: 8px; }
.btn-ghost {
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  font-size: 13px; cursor: pointer; font-family: inherit; transition: .15s;
}
.btn-ghost:hover { border-color: #cfd8e8; color: var(--ink); background: #fafcff; }
.btn-ghost.danger:hover { border-color: #f3c9c9; color: var(--danger); background: #fff7f7; }

/* ---------------- 布局 ---------------- */
.container { max-width: 1120px; margin: 0 auto; padding: 24px 24px 8px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px 22px;
  margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 15.5px; font-weight: 650; letter-spacing: .01em; }
.panel-note { font-size: 12px; color: var(--muted); }

/* ---------------- 统计 ---------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat {
  background: linear-gradient(180deg, #fbfcff, #f7f9fd);
  border: 1px solid var(--line);
  border-radius: 13px; padding: 14px 16px;
}
.stat-label { font-size: 12px; color: var(--muted); }
.stat-value {
  font-size: 26px; font-weight: 700; letter-spacing: -.02em;
  margin: 4px 0 2px; font-variant-numeric: tabular-nums;
}
.stat-foot { font-size: 11.5px; color: #98a2b3; }

/* ---------------- 上传卡 ---------------- */
.upload-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.up-card {
  border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; background: #fdfefe;
  display: flex; flex-direction: column; gap: 12px;
  transition: .18s;
}
.up-card:hover { border-color: #d6dfef; }
.up-head { display: flex; gap: 10px; align-items: flex-start; }
.up-badge {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; color: #fff;
}
.up-badge.c1 { background: linear-gradient(140deg, #2f6bff, #6b9bff); }
.up-badge.c2 { background: linear-gradient(140deg, #12a594, #4ecdc4); }
.up-badge.c3 { background: linear-gradient(140deg, #d98324, #f0b357); }
.up-badge.c4 { background: linear-gradient(140deg, #7b3fe4, #a67bf3); }
.up-title h3 { margin: 0; font-size: 14px; font-weight: 650; }
.up-title p { margin: 3px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.drop {
  border: 1.5px dashed #cfdaea; border-radius: 12px;
  background: #fafcff; padding: 18px 12px; text-align: center;
  cursor: pointer; transition: .18s; outline: none;
}
.drop:hover, .drop:focus { border-color: var(--brand-2); background: #f4f8ff; }
.drop.dragover { border-color: var(--brand); background: #eaf1ff; }
.drop.has-file { border-style: solid; border-color: #bfe0cd; background: #f4fbf7; }
.drop-icon { font-size: 20px; color: #b6c2d6; line-height: 1; margin-bottom: 6px; }
.drop.has-file .drop-icon { color: var(--ok); }
.drop-text { font-size: 12.5px; color: var(--ink-2); }
.drop-file {
  margin-top: 6px; font-size: 11.5px; color: var(--ok);
  word-break: break-all; line-height: 1.5;
}

.btn-up {
  height: 38px; border: 0; border-radius: 10px; cursor: pointer;
  background: #eef3fe; color: var(--brand); font-weight: 600;
  font-size: 13px; font-family: inherit; transition: .16s;
}
.btn-up:not(:disabled):hover { background: var(--brand); color: #fff; }
.btn-up:disabled { opacity: .55; cursor: default; }
.btn-up.loading { background: #e6ecfa; color: #5b6b86; }

.up-msg { font-size: 11.5px; line-height: 1.6; min-height: 0; color: var(--ink-2); }
.up-msg.ok { color: #0b7a45; }
.up-msg.err { color: var(--danger); }
.up-msg ul { margin: 4px 0 0; padding-left: 16px; }

/* ---------------- 货源情况备注 ---------------- */
.rmk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 16px;
}
.rmk-picker, .rmk-editor {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fdfefe;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rmk-picker-head, .rmk-editor-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--ink-2); margin-bottom: 10px;
}
.rmk-picker-head span { color: var(--muted); font-size: 12px; }
.rmk-search {
  height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fbfcfe; font-size: 13px; color: var(--ink); outline: none;
  font-family: inherit; transition: .16s; width: 100%;
}
.rmk-search:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(30, 79, 216, .1); }
.brand-list {
  margin-top: 10px; max-height: 268px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.brand-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-bottom: 1px solid #f3f6fb;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.brand-item:last-child { border-bottom: 0; }
.brand-item:hover { background: #f6f9ff; }
.brand-item.on { background: #eef3fe; color: #23408f; }
.brand-item input { accent-color: var(--brand); margin: 0; }
.brand-item .b-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-item .b-flag {
  flex: none; font-size: 10.5px; padding: 1px 6px; border-radius: 999px;
  background: #eef3fe; color: #2f6bff;
}
.brand-item .b-flag.p { background: #fdf4e7; color: #b5741c; }
.brand-item .b-mark { flex: none; color: var(--danger); font-size: 11px; }
.brand-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 12.5px; }

.link-btn {
  border: 0; background: transparent; color: var(--brand); font-size: 12px;
  cursor: pointer; font-family: inherit; padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); margin-left: 8px; }

.sel-chips {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px;
  padding: 8px; border: 1px dashed #d8e1f0; border-radius: 10px;
  background: #fbfcff; max-height: 112px; overflow-y: auto;
}
.sel-empty { color: #a6b0c2; font-size: 12px; }
.sel-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid #d9e3f5; border-radius: 999px;
  padding: 3px 6px 3px 10px; font-size: 12px; color: #2c3e63;
}
.sel-chip i {
  font-style: normal; color: #9aa6ba; cursor: pointer; padding: 0 3px;
  font-size: 13px; line-height: 1;
}
.sel-chip i:hover { color: var(--danger); }

.rmk-text {
  margin-top: 10px; width: 100%; min-height: 96px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; line-height: 1.6; color: var(--ink); background: #fbfcfe;
  font-family: inherit; outline: none; transition: .16s;
}
.rmk-text:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(30, 79, 216, .1); }
.rmk-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }
.rmk-count { font-size: 11.5px; color: var(--muted); margin-right: auto; }
.rmk-count.under {
  display: block; margin: 6px 2px 0; text-align: right;
  font-size: 11.5px; color: var(--muted);
}

/* 精准投放策略 */
.rmk-editor-tools { display: inline-flex; align-items: center; gap: 2px; }
.rmk-label {
  display: block; margin-top: 14px; font-size: 12.5px;
  font-weight: 600; color: var(--ink-2);
}
.rmk-label em {
  font-style: normal; font-size: 11px; font-weight: 500;
  color: #c0392b; margin-left: 6px;
}
.rmk-label em.opt { color: var(--muted); }
.rmk-input {
  margin-top: 8px; width: 100%; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; font-size: 13px;
  color: var(--ink); background: #fbfcfe; font-family: inherit;
}
.rmk-input:focus {
  border-color: var(--brand); background: #fff; outline: none;
  box-shadow: 0 0 0 3px rgba(30, 79, 216, .1);
}
.tag-brand {
  display: inline-block; margin: 0 6px 6px 0; padding: 2px 8px;
  border-radius: 999px; background: #eef3fe; color: #2f6bff; font-size: 11.5px;
}
table.logs td.t-brands { max-width: 340px; line-height: 1.9; }
.btn-primary.sm { width: auto; height: 36px; padding: 0 18px; font-size: 13px; }
.rmk-table-wrap { margin-top: 16px; }
.rmk-table-wrap td .t-remark { color: var(--danger); line-height: 1.6; }

/* ---------------- 提示 ---------------- */
.tips {
  margin-top: 16px; padding: 14px 16px;
  background: #f8faff; border: 1px solid #e7eefb;
  border-radius: 12px; font-size: 12.5px; color: #4a5876; line-height: 1.75;
}
.tips strong { color: #2c3e63; font-weight: 650; }
.tips ul { margin: 6px 0 0; padding-left: 18px; }
.tips li { margin: 2px 0; }
.tips li strong { color: #2c3e63; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table.logs { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.logs th {
  text-align: left; font-weight: 600; color: var(--muted);
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; white-space: nowrap;
}
table.logs td {
  padding: 10px; border-bottom: 1px solid #f2f5fa; color: var(--ink-2);
  vertical-align: top;
}
table.logs tr:last-child td { border-bottom: 0; }
table.logs td.empty { text-align: center; color: var(--muted); padding: 24px; }
.pill {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.pill.p1 { background: #eef3fe; color: #2f6bff; }
.pill.p2 { background: #e9f8f4; color: #0b8f78; }
.pill.p3 { background: #fdf4e7; color: #b5741c; }
.pill.p4 { background: #f3ecfe; color: #7b3fe4; }
.pill.p5 { background: #fdecec; color: #c22d2d; }

.foot { text-align: center; font-size: 11.5px; color: #a3adbd; padding: 18px 0 30px; }

/* 备案号（未配置时由 hidden 隐藏） */
.icp-line { margin-top: 8px; text-align: center; font-size: 11.5px; color: #a3adbd; }
.icp-line .icp-link { color: #a3adbd; text-decoration: none; border-bottom: 1px dotted #cbd3df; }
.icp-line .icp-link:hover { color: var(--primary, #1e4fd8); border-bottom-color: var(--primary, #1e4fd8); }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  background: #16233d; color: #fff; padding: 11px 20px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .24s;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4); z-index: 90; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: #a92626; }
.toast.ok { background: #0d7a44; }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .upload-grid { grid-template-columns: 1fr; }
  .rmk-grid { grid-template-columns: 1fr; }
  .container { padding: 16px 14px 8px; }
  .topbar-inner { padding: 10px 14px; }
}

@media (max-width: 480px) {
  .login-card { padding: 26px 20px 22px; border-radius: 18px; }
  .stat-value { font-size: 22px; }
  .panel { padding: 16px; }
}
