/* 诸葛选房 管理后台样式
   视觉规范沿用 prototype.html 后台部分（深色侧栏 + 浅灰正文 + 珊瑚色强调） */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* 关键：JS 用 hidden 属性切换视图，必须防止自定义 display 覆盖它 */
[hidden] { display: none !important; }
:root {
  --primary: #185FA5; --primary-light: #E6F1FB; --primary-dark: #0C447C;
  --accent: #0F6E56; --accent-light: #E1F5EE;
  --coral: #D85A30; --coral-light: #FAECE7;
  --amber: #BA7517; --amber-light: #FAEEDA;
  --red: #E24B4A; --red-light: #FCEBEB;
  --gray-50: #F7F8FA; --gray-100: #F1F3F5; --gray-200: #E9ECEF; --gray-300: #DEE2E6;
  --gray-400: #CED4DA; --gray-500: #868E96; --gray-600: #6C757D; --gray-700: #495057;
  --gray-900: #212529;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px; color: var(--gray-900); background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ============ 登录 ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0C447C, #185FA5);
}
.login-card {
  width: 380px; background: #fff; border-radius: 14px; padding: 32px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 12px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 700;
}
.login-title { font-size: 19px; font-weight: 700; }
.login-sub { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.fld { display: block; margin-bottom: 16px; }
.fld span { display: block; font-size: 12px; color: var(--gray-600); margin-bottom: 6px; }
.fld input {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--gray-300);
  border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s;
}
.fld input:focus { border-color: var(--primary); }
.login-err { min-height: 18px; font-size: 12px; color: var(--red); margin-bottom: 8px; }
.btn-login {
  width: 100%; height: 44px; border: none; border-radius: 8px; background: var(--primary);
  color: #fff; font-size: 15px; font-weight: 600;
}
.btn-login:hover { background: var(--primary-dark); }
.btn-login:disabled { opacity: .6; cursor: not-allowed; }
.login-tip { text-align: center; font-size: 11px; color: var(--gray-500); margin-top: 16px; line-height: 1.6; }

/* ============ 布局 ============ */
.layout { display: flex; height: 100vh; overflow: hidden; }
.side { width: 220px; background: #1a1d24; color: #fff; display: flex; flex-direction: column; flex-shrink: 0; }
.side-head { padding: 20px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side-head .t { font-size: 16px; font-weight: 700; }
.side-head .s { font-size: 11px; color: rgba(255, 255, 255, .5); margin-top: 2px; }
.nav { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-sep { font-size: 11px; color: rgba(255, 255, 255, .35); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  font-size: 13px; color: rgba(255, 255, 255, .65); cursor: pointer; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.on { background: var(--primary); color: #fff; }
.nav-item .ic { width: 18px; text-align: center; font-size: 13px; }
.side-foot { padding: 14px 16px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 11px; color: rgba(255, 255, 255, .4); line-height: 1.7; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top {
  height: 56px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; background: #fff; flex-shrink: 0;
}
.top-title { font-size: 16px; font-weight: 600; }
.top-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--gray-600); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--coral); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.role-tag { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: var(--primary-light); color: var(--primary); }
.btn-ghost {
  border: 1px solid var(--gray-300); background: #fff; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; color: var(--gray-700);
}
.btn-ghost:hover { border-color: var(--gray-400); background: var(--gray-50); }
.body { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ============ 通用组件 ============ */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); }
.card .l { font-size: 12px; color: var(--gray-500); }
.card .v { font-size: 26px; font-weight: 700; margin-top: 6px; }
.card .d { font-size: 11px; color: var(--gray-500); margin-top: 6px; }

.panel { background: #fff; border-radius: 10px; box-shadow: 0 1px 3px rgba(0, 0, 0, .05); margin-bottom: 20px; overflow: hidden; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: 15px; font-weight: 600; }
.panel-title .hint { font-size: 12px; font-weight: 400; color: var(--gray-500); margin-left: 8px; }
.panel-body { padding: 18px; }
.panel-body.nopad { padding: 0; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input {
  height: 32px; border: 1px solid var(--gray-300); border-radius: 6px; padding: 0 10px;
  font-size: 12px; background: #fff; outline: none; color: var(--gray-700);
}
.filters input { width: 160px; }
.filters select:focus, .filters input:focus { border-color: var(--primary); }
.btn {
  border: none; border-radius: 6px; padding: 7px 14px; font-size: 12px; font-weight: 500;
  background: var(--primary); color: #fff;
}
.btn:hover { background: var(--primary-dark); }
.btn.coral { background: var(--coral); }
.btn.coral:hover { background: #B94A26; }
.btn.line { background: #fff; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn.line:hover { background: var(--gray-50); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--gray-500);
  padding: 10px 14px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); vertical-align: middle; }
tbody tr:hover { background: #FBFCFD; }
tbody tr.clickable { cursor: pointer; }
.phone { font-weight: 600; font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--gray-500); }
.small { font-size: 12px; }

.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.pill.blue { background: var(--primary-light); color: var(--primary); }
.pill.coral { background: var(--coral-light); color: var(--coral); }
.pill.green { background: var(--accent-light); color: var(--accent); }
.pill.amber { background: var(--amber-light); color: var(--amber); }
.pill.gray { background: var(--gray-100); color: var(--gray-600); }
.pill.red { background: var(--red-light); color: var(--red); }

.empty { padding: 60px 20px; text-align: center; color: var(--gray-500); font-size: 13px; }
.empty .big { font-size: 32px; margin-bottom: 10px; opacity: .35; }
.loading { padding: 50px; text-align: center; color: var(--gray-500); font-size: 13px; }

.placeholder { padding: 70px 20px; text-align: center; color: var(--gray-500); }
.placeholder .big { font-size: 36px; opacity: .3; margin-bottom: 14px; }
.placeholder h3 { font-size: 15px; color: var(--gray-700); margin-bottom: 8px; font-weight: 600; }
.placeholder p { font-size: 13px; line-height: 1.9; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; }
.bar-label { width: 110px; color: var(--gray-600); flex-shrink: 0; }
.bar-track { flex: 1; height: 16px; background: var(--gray-100); border-radius: 8px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 8px; }
.bar-val { width: 62px; text-align: right; color: var(--gray-700); flex-shrink: 0; }

/* ============ 抽屉（线索轨迹） ============ */
.drawer-mask { position: fixed; inset: 0; background: rgba(20, 26, 34, .38); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 760px; max-width: 94vw; background: var(--gray-50);
  z-index: 50; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
  animation: slideIn .22s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: .6; } to { transform: translateX(0); opacity: 1; } }
.drawer-head {
  padding: 16px 22px; background: #fff; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-shrink: 0;
}
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { font-size: 12px; color: var(--gray-500); margin-top: 5px; line-height: 1.6; }
.btn-close { border: none; background: transparent; font-size: 16px; color: var(--gray-500); padding: 4px 8px; border-radius: 6px; }
.btn-close:hover { background: var(--gray-100); }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 40px; }

/* 归因卡 */
.attrib {
  background: linear-gradient(135deg, #FAECE7, #FDF6F2); border: 1px solid #F3D9CD;
  border-radius: 10px; padding: 16px 18px; margin-bottom: 16px;
}
.attrib h4 { font-size: 13px; color: var(--coral); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.attrib .line { font-size: 13px; line-height: 2; color: var(--gray-700); }
.attrib .line b { color: var(--gray-900); }
.attrib .line .hl { color: var(--coral); font-weight: 600; }

.sum-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.sum-box { background: #fff; border-radius: 8px; padding: 12px 14px; border: 1px solid var(--gray-200); }
.sum-box .l { font-size: 11px; color: var(--gray-500); }
.sum-box .v { font-size: 17px; font-weight: 700; margin-top: 4px; }
.sum-box.hl .v { color: var(--coral); }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tagc { font-size: 12px; padding: 5px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--gray-200); color: var(--gray-700); }
.tagc b { color: var(--primary); font-weight: 600; }
.tagc .t { color: var(--gray-500); font-size: 11px; margin-left: 4px; }

/* 时间轴 */
.tl-title { font-size: 13px; font-weight: 600; color: var(--gray-700); margin: 6px 0 14px; display: flex; align-items: center; gap: 8px; }
.tl-title::after { content: ""; flex: 1; height: 1px; background: var(--gray-200); }
.tl { position: relative; padding-left: 30px; }
.tl::before { content: ""; position: absolute; left: 10px; top: 8px; bottom: 8px; width: 2px; background: var(--gray-200); }
.tl-item {
  position: relative; background: #fff; border: 1px solid var(--gray-200); border-radius: 8px;
  padding: 11px 14px; margin-bottom: 9px;
}
.tl-dot {
  position: absolute; left: -26px; top: 16px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--gray-400); box-shadow: 0 0 0 3px var(--gray-50);
}
.tl-item.after { border-color: #D6E4F2; }
.tl-item.after .tl-dot { background: var(--primary); }
.tl-item.login { border-color: var(--coral); background: var(--coral-light); box-shadow: 0 2px 10px rgba(216, 90, 48, .12); }
.tl-item.login .tl-dot { background: var(--coral); width: 14px; height: 14px; left: -28px; top: 14px; }
.tl-item.login .tl-head { color: var(--coral); font-weight: 600; }
.tl-head { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-sub { font-size: 12px; color: var(--gray-500); margin-top: 5px; line-height: 1.7; }
.tl-sub .obj { color: var(--primary); }
.tl-meta { font-size: 11px; color: var(--gray-500); margin-top: 5px; display: flex; gap: 12px; flex-wrap: wrap; }
.tl-time { font-variant-numeric: tabular-nums; }
.tl-seg { font-size: 12px; color: var(--gray-500); margin: 16px 0 10px; display: flex; align-items: center; gap: 8px; }

.phone-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 90;
  background: rgba(33, 37, 41, .94); color: #fff; font-size: 13px; padding: 10px 20px; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* ============ 资料管理 ============ */
.pkg-thumb {
  width: 76px; height: 48px; object-fit: cover; border-radius: 6px;
  border: 1px solid var(--gray-200); display: block;
}
.fld select, .fld textarea {
  width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--gray-300);
  border-radius: 8px; font-size: 14px; outline: none; background: #fff;
  transition: border-color .15s; box-sizing: border-box;
}
.fld select:focus, .fld textarea:focus { border-color: var(--primary); }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; z-index: 80; background: rgba(20, 22, 26, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal {
  background: #fff; border-radius: 12px; width: 720px; max-width: 100%;
  max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
.modal-head {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 10px;
}
.pm-upload {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-top: 6px; padding: 16px; background: var(--gray-50); border-radius: 10px;
}
.pm-up-item { display: flex; flex-direction: column; gap: 8px; }
.pm-up-title { font-size: 12px; color: var(--gray-600); }
.pm-cover {
  width: 100%; height: 92px; object-fit: cover; border-radius: 8px;
  border: 1px solid var(--gray-200); background: #fff;
}
.pm-cover-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400, #b9bec4); font-size: 12px;
}
.pm-file-state { height: 92px; display: flex; align-items: center; background: #fff; border: 1px solid var(--gray-200); border-radius: 8px; justify-content: center; }
@media (max-width: 720px) {
  .modal-grid, .pm-upload { grid-template-columns: 1fr; }
}
