/* ═════════ 万家网事 · 后台样式 ═════════ */
:root {
  --blue: #0f63da;
  --blue-dark: #0a4aa8;
  --blue-light: #e8f1fd;
  --ink: #12203a;
  --ink-2: #4a5b74;
  --ink-3: #8496ad;
  --line: #e3e9f2;
  --bg: #f4f7fb;
  --white: #fff;
  --green: #16a34a;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(18, 32, 58, .07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

/* ═════════ 登录页 ═════════ */
.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a4aa8 0%, #0f63da 45%, #1e88e5 100%);
  padding: 20px;
}
.login-shell { width: 100%; max-width: 900px; }
.login-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(6, 30, 70, .35);
}
@media (max-width: 760px) { .login-card { grid-template-columns: 1fr; } }

.login-card__brand {
  background: linear-gradient(150deg, #0a4aa8, #0f63da 60%, #1976d2);
  color: #fff;
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-card__brand h1 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: 1px;
}
.login-card__brand p { margin: 0; font-size: 13px; opacity: .88; }

.login-card__panel { padding: 44px 40px; }
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 26px;
  font-weight: 600;
  color: var(--ink-2);
}
.login-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #1e88e5);
  color: #fff;
  font-weight: 800;
  letter-spacing: .5px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span { font-size: 13px; color: var(--ink-2); font-weight: 600; }
.login-field input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.login-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15, 99, 218, .12); }

.login-field__pwd { position: relative; }
.login-field__pwd input { padding-right: 44px; }
.pwd-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent;
  color: var(--ink-3);
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.pwd-toggle:hover { background: var(--blue-light); color: var(--blue); }
.pwd-toggle--active { color: var(--blue); background: var(--blue-light); }

.login-submit {
  margin-top: 6px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), #1e88e5);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: filter .15s, transform .05s;
}
.login-submit:hover { filter: brightness(1.06); }
.login-submit:active { transform: translateY(1px); }
.login-submit:disabled { opacity: .65; cursor: not-allowed; }

.login-error {
  padding: 9px 12px;
  border-radius: 7px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 13px;
}
.login-tip { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--ink-3); }

/* ═════════ 顶栏 / 标签页 ═════════ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: linear-gradient(135deg, #0a4aa8, var(--blue));
  color: #fff;
  box-shadow: 0 2px 10px rgba(10, 74, 168, .25);
}
.topbar__brand { display: flex; align-items: center; gap: 10px; }
.brand-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(255, 255, 255, .18);
  font-weight: 800; font-size: 15px;
}
.topbar__brand h1 { margin: 0; font-size: 17px; font-weight: 600; }
.topbar__right { display: flex; align-items: center; gap: 12px; }
.user-chip {
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .16);
  font-size: 13px;
}

.tabs {
  position: sticky; top: 58px; z-index: 25;
  display: flex; gap: 4px;
  flex-wrap: wrap;
  padding: 6px 16px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  position: relative;
  padding: 13px 15px;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--blue); }
.tab--active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.badge {
  display: inline-block;
  min-width: 17px; padding: 0 5px;
  border-radius: 9px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
  vertical-align: 1px;
}

/* ═════════ 布局 / 卡片 ═════════ */
.container { max-width: 1560px; margin: 0 auto; padding: 20px 16px 60px; }
.panel { display: none; }
.panel--active { display: block; }
.panel__title { margin: 0 0 16px; font-size: 19px; font-weight: 600; }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--ink); }
.hint { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }
.hint code { background: var(--blue-light); color: var(--blue-dark); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--wrap { flex-wrap: wrap; }
.row input[type="text"], .row input[type="number"], .row input[type="date"], .row select {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13.5px;
  outline: none;
  min-width: 150px;
}
.row input:focus, .row select:focus { border-color: var(--blue); }
.row input[type="file"] { font-size: 13px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--ink-2); }
.field input, .field select { padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; font-size: 13.5px; }

.btn {
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn--primary {
  background: linear-gradient(135deg, var(--blue), #1e88e5);
  border-color: transparent;
  color: #fff;
}
.btn--primary:hover { filter: brightness(1.07); color: #fff; }
/* 白底描边按钮（用于白色卡片/表格/弹窗内的次要操作） */
.btn--ghost { background: var(--white); border-color: #d5dfeb; color: #334155; }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); background: var(--white); }

/* 顶栏（深色背景）里的次要按钮保持白色半透明 */
.topbar .btn--ghost {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .3);
  color: #fff;
}
.topbar .btn--ghost:hover {
  background: rgba(255, 255, 255, .26);
  border-color: rgba(255, 255, 255, .4);
  color: #fff;
}
.btn--sm { padding: 5px 10px; font-size: 12.5px; }
.btn--danger { color: var(--red); border-color: #fecaca; }
.btn--danger:hover { background: #fee2e2; }

.result {
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 8px;
  background: var(--blue-light);
  font-size: 13px;
  color: var(--blue-dark);
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}
.result--error { background: #fee2e2; color: #b91c1c; }

/* ═════════ 统计卡片 ═════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  border-left: 4px solid var(--blue);
}
.stat-card__label { font-size: 12.5px; color: var(--ink-3); margin-bottom: 6px; }
.stat-card__value { font-size: 24px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.stat-card--amber { border-left-color: var(--amber); }
.stat-card--red { border-left-color: var(--red); }
.stat-card--green { border-left-color: var(--green); }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ═════════ 表格 ═════════ */
.table-wrap { overflow-x: auto; margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  padding: 9px 11px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  background: #f8fafd;
  font-weight: 600;
  color: var(--ink-2);
  font-size: 12.5px;
  white-space: nowrap;
  position: sticky; top: 0;
}
.table tbody tr:hover { background: #f9fbfe; }
.table td { color: var(--ink-2); }
.table .empty { text-align: center; color: var(--ink-3); padding: 26px 0; }
.table--tagboard td { vertical-align: middle; }

/* ═════════ 标签徽章（参考截图配色） ═════════ */
.pill {
  display: inline-block;
  padding: 3px 10px;
  margin: 2px 3px 2px 0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.pill--pending { opacity: .45; border: 1px dashed currentColor; }

.tag-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tag-legend .pill { font-size: 12.5px; padding: 5px 13px; }

.score { font-weight: 700; }
.score--low { color: var(--red); }
.score--mid { color: var(--amber); }
.score--high { color: var(--green); }

.status { padding: 2px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.status--pending { background: #fef3c7; color: #92400e; }
.status--approved { background: #dcfce7; color: #166534; }
.status--rejected { background: #fee2e2; color: #991b1b; }
.status--done { background: #dcfce7; color: #166534; }
.status--failed { background: #fee2e2; color: #991b1b; }

/* ═════════ 弹窗 ═════════ */
/* 关键：hidden 属性必须能隐藏弹窗，否则 .modal 的 display:flex 会覆盖它导致页面被遮罩卡住 */
[hidden] { display: none !important; }

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10, 25, 50, .45);
  padding: 20px;
}
.modal__box {
  width: 100%; max-width: 900px;
  max-height: 88vh;
  background: var(--white);
  border-radius: 12px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(6, 30, 70, .3);
}
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.modal__head h3 { margin: 0; font-size: 16px; }
.modal__close {
  width: 30px; height: 30px;
  border: none; background: #f1f5f9; border-radius: 7px;
  font-size: 19px; line-height: 1; color: var(--ink-2);
  cursor: pointer;
}
.modal__close:hover { background: #e2e8f0; }
.modal__body { padding: 18px 20px; overflow: auto; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 20px; }
.detail-item { display: flex; gap: 8px; font-size: 13.5px; }
.detail-item dt { color: var(--ink-3); min-width: 90px; flex-shrink: 0; }
.detail-item dd { margin: 0; color: var(--ink); word-break: break-all; }
.detail-sec { margin-top: 20px; }
.detail-sec h4 {
  margin: 0 0 8px; font-size: 14px; font-weight: 600;
  padding-left: 9px; border-left: 3px solid var(--blue);
}

/* ═════════ Toast ═════════ */
.toast {
  position: fixed; left: 50%; bottom: 40px;
  transform: translateX(-50%);
  z-index: 200;
  padding: 11px 22px;
  border-radius: 9px;
  background: rgba(18, 32, 58, .92);
  color: #fff;
  font-size: 13.5px;
  max-width: 80vw;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}
.toast--error { background: rgba(185, 28, 28, .95); }

@media (max-width: 900px) {
  .topbar__brand h1 { font-size: 15px; }
  .container { padding: 14px 10px 50px; }
  .card { padding: 14px; }
}


/* ══════ 产能通报 ══════ */
.cap-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 820px) {
  .cap-grid2 { grid-template-columns: 1fr; }
}
.cap-card {
  border: 1px solid #e6ecf4;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fbfdff;
}
.cap-card h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #2c3e50;
}
.cap-rankline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed #eef2f7;
  font-size: 14px;
}
.cap-rankline:last-child { border-bottom: none; }
.cap-rankline em {
  font-style: normal;
  color: #8496ad;
  font-size: 12px;
  margin-left: 6px;
}
.cap-rankline b { color: #1a6cf5; font-size: 15px; }
.cap-profile {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #f6f9fd;
  border-left: 4px solid #cbd5e1;
  font-size: 14px;
  line-height: 1.7;
}
.cap-profile--good { border-left-color: #22c55e; background: #f0fdf4; }
.cap-profile--weak { border-left-color: #ef4444; background: #fef6f6; }
.cap-profile__rank {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #1a6cf5;
  color: #fff;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.cap-profile--good .cap-profile__rank { background: #22c55e; }
.cap-profile--weak .cap-profile__rank { background: #ef4444; }

/* ══════ LOGO ══════ */
.login-brand-logo { width: 370px; max-width: 100%; height: auto; margin-bottom: 18px; }
.login-mini-icon { width: 30px; height: 30px; }
.brand-logo-img { width: 36px; height: 36px; flex-shrink: 0; }
.brand-sub { font-weight: 400; opacity: .85; font-size: 15px; }


/* ═══════════ 低满客户关怀看板 ═══════════ */
.low-kpi {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.low-kpi__item {
  background: #fff; border-radius: 12px; padding: 16px 14px;
  border-left: 4px solid #cbd5e1; box-shadow: 0 1px 6px rgba(20,40,80,.06);
}
.low-kpi__v { font-size: 26px; font-weight: 700; color: #12203a; line-height: 1.15; }
.low-kpi__l { font-size: 12px; color: #64748b; margin-top: 4px; }
.low-kpi__item--green { border-left-color: #22c55e; }
.low-kpi__item--green .low-kpi__v { color: #15803d; }
.low-kpi__item--amber { border-left-color: #f59e0b; }
.low-kpi__item--amber .low-kpi__v { color: #b45309; }
.low-kpi__item--red { border-left-color: #ef4444; }
.low-kpi__item--red .low-kpi__v { color: #b91c1c; }

.low-insights { display: flex; flex-direction: column; gap: 10px; }
.low-insight {
  display: flex; gap: 10px; align-items: flex-start;
  background: #f8fafc; border-radius: 10px; padding: 12px 14px;
  font-size: 14px; color: #334155; line-height: 1.55;
  border-left: 3px solid #0f63da;
}
.low-insight__no {
  flex-shrink: 0; width: 20px; height: 20px; line-height: 20px; text-align: center;
  background: #0f63da; color: #fff; border-radius: 50%; font-size: 12px; font-weight: 600;
}

.low-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.low-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }

.low-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.low-bar__k { width: 118px; flex-shrink: 0; color: #475569; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.low-bar__track { flex: 1; height: 14px; background: #eef2f7; border-radius: 7px; overflow: hidden; }
.low-bar__track > i { display: block; height: 100%; background: #5b8def; border-radius: 7px; transition: width .4s; }
.low-bar__track > i.ok { background: #22c55e; }
.low-bar__track > i.warn { background: #f59e0b; }
.low-bar__track > i.bad { background: #ef4444; }
.low-bar__v { width: 34px; text-align: right; font-weight: 600; color: #12203a; font-variant-numeric: tabular-nums; }

.low-cross { display: flex; flex-direction: column; gap: 4px; }
.low-cross__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px dashed #eef2f7; font-size: 14px;
}
.low-cross__row:last-child { border-bottom: none; }
.low-cross__row span { color: #475569; }
.low-cross__row b { font-size: 18px; font-weight: 700; color: #12203a; }
.low-cross__row b.ok { color: #15803d; }
.low-cross__row b.bad { color: #b91c1c; }
.low-cross__row i { font-style: normal; font-size: 12px; color: #94a3b8; min-width: 56px; text-align: right; }

.low-rate { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eef2f7; color: #475569; }
.low-rate--ok { background: #dcfce7; color: #15803d; }
.low-rate--warn { background: #fef3c7; color: #b45309; }
.low-rate--bad { background: #fee2e2; color: #b91c1c; }

.low-sub { font-size: 12px; color: #94a3b8; margin-bottom: 8px; font-weight: 600; }

/* 小号按钮（表格行内操作） */
.btn--xs {
  height: 28px; line-height: 26px; padding: 0 10px; font-size: 12px;
  border-radius: 6px; margin-right: 6px;
}

/* 账号编辑弹窗表单 */
.um-field { margin-bottom: 14px; }
.um-field > label {
  display: block; font-size: 13px; color: #64748b;
  margin-bottom: 6px; font-weight: 500;
}
.um-field > input,
.um-field > select {
  width: 100%; box-sizing: border-box;
  height: 40px; padding: 0 12px;
  border: 1px solid #dbe3ee; border-radius: 8px;
  font-size: 14px; color: #12203a; background: #fff;
}
.um-field > input:focus,
.um-field > select:focus {
  outline: none; border-color: #0f63da;
  box-shadow: 0 0 0 3px rgba(15, 99, 218, .12);
}

/* 标签颜色选择行 */
.tm-color { display: flex; gap: 10px; align-items: center; }
.tm-color input[type="color"] {
  width: 52px; height: 40px; padding: 3px; border: 1px solid #dbe3ee;
  border-radius: 8px; background: #fff; cursor: pointer; flex-shrink: 0;
}
.tm-color input[type="text"] {
  flex: 1; height: 40px; padding: 0 12px; border: 1px solid #dbe3ee;
  border-radius: 8px; font-size: 14px; font-family: monospace; box-sizing: border-box;
}

/* 标签关联客户数（可点） */
.tag-cust-link {
  color: #0f63da; font-weight: 600; text-decoration: none;
  border-bottom: 1px dashed #93c5fd; padding-bottom: 1px;
}
.tag-cust-link:hover { color: #0a4aa8; border-bottom-style: solid; }

/* ═══ 表格排序表头 ═══ */
.table thead th {
  cursor: pointer; user-select: none; position: relative;
  transition: color .15s, background .15s;
}
.table thead th:hover { color: var(--blue); background: #f1f6fd; }
.table thead th.sort-asc::after,
.table thead th.sort-desc::after {
  font-size: 10px; margin-left: 4px; color: var(--blue); vertical-align: middle;
}
.table thead th.sort-asc::after { content: '\25B2'; }
.table thead th.sort-desc::after { content: '\25BC'; }

/* 低满风险客户统计 */
.low-risk-sum {
  display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.low-risk-chip {
  flex: 1; min-width: 110px; text-align: center;
  padding: 12px 8px; border-radius: 10px;
  background: #f1f5f9; border-left: 4px solid #cbd5e1;
}
.low-risk-chip b { display: block; font-size: 22px; font-weight: 800; color: #12203a; line-height: 1.2; }
.low-risk-chip span { display: block; font-size: 12px; color: #64748b; margin-top: 3px; }
.low-risk-chip--high { background: #fee2e2; border-left-color: #ef4444; }
.low-risk-chip--high b { color: #b91c1c; }
.low-risk-chip--mid { background: #fef3c7; border-left-color: #f59e0b; }
.low-risk-chip--mid b { color: #b45309; }
.low-risk-chip--muted { background: #f8fafc; }
.low-risk-chip--muted b { color: #475569; }

/* 榜单 AI 点评 */
.cap-comment {
  margin-top: 12px; padding: 11px 13px;
  background: #f0f6ff; border-radius: 9px;
  border-left: 3px solid #0f63da;
  font-size: 12.5px; color: #334155; line-height: 1.7;
}
.cap-comment__tag {
  display: inline-block; margin-right: 7px;
  padding: 1px 7px; border-radius: 5px;
  background: #0f63da; color: #fff;
  font-size: 11px; font-weight: 600; vertical-align: 1px;
}
