:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --card: #ffffff;
  --text: #2c2c2a;
  --muted: #6b6b66;
  --border: #e3e4e8;
  --primary: #185fa5;
  --primary-d: #0c447c;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.hidden { display: none !important; }
button { cursor: pointer; font-family: inherit; }

/* 登录 */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  width: 340px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}
.login-card h1 { font-size: 18px; font-weight: 600; margin: 0 0 22px; text-align: center; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
.form input:focus { border-color: var(--primary); }
.hint { font-size: 12px; color: var(--muted); margin: 0 0 4px; line-height: 1.5; }
.msg { font-size: 12px; color: #a32d2d; min-height: 16px; }
.switch-line { font-size: 12px; color: var(--muted); text-align: center; }
.switch-line a { color: var(--primary); cursor: pointer; }

/* 图形验证码 */
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: 2px; }
.captcha-img {
  height: 40px;
  width: 120px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: #f4f7fa;
  object-fit: cover;
}

/* 按钮 */
.btn {
  height: 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 8px;
  font-size: 14px;
  padding: 0 16px;
}
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.block { width: 100%; height: 42px; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.danger { color: #a32d2d; border-color: #f7c1c1; }

/* 顶栏与布局 */
.topbar {
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}
.brand { font-weight: 600; font-size: 15px; }
.user-box { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.role-tag {
  background: #e6f1fb; color: var(--primary-d);
  padding: 2px 8px; border-radius: 6px; font-size: 12px;
}
.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 180px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav-item {
  text-align: left;
  border: none;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
}
.nav-item:hover { background: #f0f1f4; }
.nav-item.active { background: #e6f1fb; color: var(--primary-d); font-weight: 500; }
.nav-item.new { color: var(--primary); margin-top: 8px; }
.content { flex: 1; padding: 24px; overflow: auto; }

/* 看板 */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.stat-card .num { font-size: 28px; font-weight: 600; }
.stat-card .label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.section-title { font-size: 15px; font-weight: 600; margin: 28px 0 12px; }
.overdue-item {
  background: #fcebeb; border: 1px solid #f7c1c1; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 8px; display: flex; justify-content: space-between; font-size: 13px;
  transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
}
.overdue-item:hover { box-shadow: 0 3px 12px rgba(180, 40, 40, .14); border-color: #e79a9a; transform: translateX(2px); }

/* ---------- 看板钻取：卡片可点击 + 悬停高亮 ---------- */
.stat-card.drill {
  position: relative;
  cursor: pointer;
  user-select: none;
  overflow: hidden;
  transition: box-shadow .18s ease, border-color .18s ease, transform .18s ease, background-color .18s ease;
}
/* 左侧主色竖条：默认隐藏，悬停时展开 */
.stat-card.drill::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  transform: scaleY(0);
  transform-origin: center;
  transition: transform .18s ease;
}
.stat-card.drill:hover,
.stat-card.drill:focus-visible {
  border-color: var(--primary);
  background: #fbfdff;
  box-shadow: 0 6px 20px rgba(24, 95, 165, .18);
  transform: translateY(-2px);
  outline: none;
}
.stat-card.drill:hover::before,
.stat-card.drill:focus-visible::before { transform: scaleY(1); }
.stat-card.drill:hover .num,
.stat-card.drill:focus-visible .num { color: var(--primary-d); }
.stat-card.drill .label { transition: color .18s ease; }
.stat-card.drill:hover .label,
.stat-card.drill:focus-visible .label { color: var(--primary); }
/* 悬停时右上角浮现"查看明细"提示 */
.stat-card.drill::after {
  content: "查看明细 →";
  position: absolute;
  top: 8px; right: 10px;
  font-size: 11px;
  color: var(--primary);
  background: #eaf3fb;
  border-radius: 20px;
  padding: 2px 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.stat-card.drill:hover::after,
.stat-card.drill:focus-visible::after { opacity: 1; transform: translateY(0); }

/* 钻取筛选提示条 */
.drill-bar {
  background: #eaf3fb; border: 1px solid #bcdcf5; color: var(--primary-d);
  border-radius: 8px; padding: 9px 14px; margin-bottom: 14px; font-size: 13px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.drill-bar a {
  color: var(--primary); cursor: pointer; font-weight: 500;
  padding: 2px 10px; border-radius: 20px; background: #fff; border: 1px solid #bcdcf5;
  transition: background-color .15s ease, color .15s ease;
}
.drill-bar a:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 看板预警条目的"查看明细"链接 */
.drill-link {
  color: var(--primary); cursor: pointer; font-size: 13px; margin-left: 8px; font-weight: 500;
  padding: 2px 10px; border-radius: 20px; background: #eaf3fb; border: 1px solid #bcdcf5;
  display: inline-block; transition: background-color .15s ease, color .15s ease;
}
.drill-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }

/* 房源列表 */
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; font-size: 13px;
}
.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 12px; overflow: hidden; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; transition: background-color .12s ease; }
.table th { background: #f7f8fa; color: var(--muted); font-weight: 500; }
/* 可点击行：悬停明显高亮 + 左侧主色指示 */
.table tbody tr[data-id], .table tbody tr[data-hid] { cursor: pointer; }
.table tbody tr[data-id]:hover, .table tbody tr[data-hid]:hover { background: #eaf3fb; }
.table tbody tr[data-id]:hover td:first-child, .table tbody tr[data-hid]:hover td:first-child {
  box-shadow: inset 3px 0 0 var(--primary);
  color: var(--primary-d); font-weight: 600;
}

/* 状态标签 */
.tag {
  display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500;
}
.tag.draft { background: #f1efe8; color: #5f5e5a; }
.tag.listed { background: #e6f1fb; color: #0c447c; }
.tag.active { background: #e1f5ee; color: #0f6e56; }
.tag.signed { background: #faeeda; color: #854f0b; }
.tag.deal { background: #eaf3de; color: #27500a; }
.tag.off { background: #f1efe8; color: #5f5e5a; }

/* 详情 / 表单 */
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.detail-head h2 { font-size: 18px; margin: 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 18px; }
.panel h3 { font-size: 14px; margin: 0 0 14px; }
.field { display: flex; gap: 12px; margin-bottom: 12px; align-items: center; }
.field label { width: 92px; color: var(--muted); font-size: 13px; flex-shrink: 0; }
.field input, .field textarea, .field select {
  flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; font-family: inherit; resize: vertical;
}
.status-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.followup { border-left: 3px solid var(--primary); padding: 8px 12px; margin-bottom: 10px; background: #f9fafb; border-radius: 0 8px 8px 0; }
.followup .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.followup .content { font-size: 13px; }
.log-item { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.back-btn { background: none; border: none; color: var(--primary); font-size: 13px; padding: 0; margin-bottom: 14px; }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* 图片上传 / 画廊 */
.img-prev { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.thumb { position: relative; width: 92px; height: 70px; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #f7f8fa; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-x { position: absolute; top: 2px; right: 2px; background: rgba(0,0,0,.6); color: #fff; border: none; border-radius: 50%; width: 18px; height: 18px; line-height: 16px; cursor: pointer; font-size: 12px; padding: 0; }
.img-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.img-gallery img { width: 120px; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); cursor: zoom-in; transition: transform .15s; }
.img-gallery img:hover { transform: scale(1.04); }

/* 图片灯箱（点击放大原图） */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); display: none; align-items: center; justify-content: center; z-index: 9999; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); cursor: default; }
.lightbox .lb-close { position: absolute; top: 18px; right: 24px; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; user-select: none; }

/* 智能匹配 */
.rec-item { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }

/* 带看记录中的房源编号：可点击进详情 */
.link-hid { color: var(--primary); cursor: pointer; text-decoration: underline; }
.link-hid:hover { color: var(--primary-d); }

/* 智能匹配卡片：整卡可点击进入房源详情 */
.rec-item-link {
  cursor: pointer; position: relative;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease, transform .15s ease;
}
.rec-item-link:hover {
  border-color: var(--primary);
  background: #fbfdff;
  box-shadow: 0 4px 14px rgba(24, 95, 165, .16);
  transform: translateY(-1px);
}
.rec-item-link:hover .rec-go { opacity: 1; }
.rec-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rec-go {
  font-size: 12px; color: var(--primary); font-weight: 500;
  opacity: 0; transition: opacity .15s ease; white-space: nowrap;
}
.rec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rec-score { margin-left: auto; background: var(--primary); color: #fff; border-radius: 10px; padding: 1px 8px; font-size: 12px; }
.rec-info { color: var(--muted); font-size: 13px; margin: 4px 0; }
.rec-reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rec-tag { background: #f7f8fa; border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; font-size: 12px; }

/* 小区卡片 */
.comm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.comm-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.comm-cover { height: 120px; background: #eef1f6 center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.comm-cover-ph { font-size: 30px; }
.comm-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.comm-name { font-size: 15px; font-weight: 600; }
.comm-meta { font-size: 12px; color: var(--muted); }
.comm-actions { margin-top: 10px; display: flex; gap: 8px; }

/* 员工列表操作列 / 说明文字 */
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-right: 6px; }
.muted { color: var(--muted); }

/* 多选框组（小区户型等） */
.checkbox-group { flex: 1; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.checkbox-group .cb { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); cursor: pointer; }
.checkbox-group .cb input { width: auto; flex: 0; margin: 0; }

/* ============ 移动端适配（手机版） ============ */
/* 汉堡按钮默认隐藏，仅窄屏显示 */
.menu-btn { display: none; background: none; border: none; font-size: 22px; line-height: 1; color: var(--text); padding: 0 8px 0 0; }
.topbar-left { display: flex; align-items: center; gap: 10px; }
.nav-overlay { display: none; }

@media (max-width: 768px) {
  body { font-size: 14px; }
  .topbar { padding: 0 14px; height: 52px; }
  .brand { font-size: 14px; }
  .user-box { gap: 8px; font-size: 12px; }
  .user-box .role-tag { display: none; } /* 窄屏省空间 */
  .menu-btn { display: block; }

  /* 布局：侧边栏变可滑出抽屉 */
  .layout { display: block; position: relative; }
  .sidebar {
    position: fixed; top: 52px; left: 0; bottom: 0;
    width: 80%; max-width: 260px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 1000; overflow-y: auto;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.12);
  }
  body.nav-open .sidebar { transform: translateX(0); }
  body.nav-open .nav-overlay {
    display: block; position: fixed; inset: 52px 0 0 0;
    background: rgba(0, 0, 0, 0.4); z-index: 999;
  }
  .content { padding: 14px; }

  /* 表单：标签与输入纵向堆叠 */
  .field { flex-direction: column; align-items: stretch; gap: 6px; }
  .field label { width: auto; }
  .field input, .field textarea, .field select { width: 100%; }
  .checkbox-group { gap: 6px 12px; }

  /* 表格：横向滚动，避免挤变形 */
  .table { display: block; overflow-x: auto; white-space: nowrap; font-size: 12px; }
  .table th, .table td { white-space: nowrap; padding: 10px; }

  /* 看板 / 小区卡片：更紧凑的栅格 */
  .dash-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  .comm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .stat-card { padding: 12px; }
  .stat-card .num { font-size: 22px; }
  .section-title { margin: 20px 0 10px; }

  /* 登录卡：全宽 */
  .login-card { width: 100%; max-width: 340px; margin: 16px; padding: 24px 18px; box-sizing: border-box; }

  /* 触控目标放大 */
  .btn, .nav-item { min-height: 40px; }
  .nav-item { padding: 12px; }

  /* 工具栏与详情头部：纵向铺满 */
  .toolbar { flex-direction: column; }
  .toolbar input, .toolbar select, .toolbar .btn { width: 100%; }
  .detail-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .status-actions .btn { flex: 1 1 auto; }
  .panel { padding: 16px; }

  /* 实拍图缩略图略缩小 */
  .img-gallery img { width: 84px; height: 64px; }
  .thumb { width: 78px; height: 60px; }

  /* 智能匹配卡片内边距收紧 */
  .rec-item { padding: 10px; }
  /* 移动端无悬停：提示常显 + 按压反馈 */
  .rec-go { opacity: 1; }
  .rec-item-link:active { transform: scale(.99); }

  /* 看板钻取：移动端无 hover，用按压态反馈 */
  .stat-card.drill:active { transform: scale(.97); }
  .drill-bar { font-size: 12px; }
}

/* ---------- 列表分页 ---------- */
.pager {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap;
}
.pager .pg-info { font-size: 13px; color: var(--muted); }
.pager .pg-size-wrap {
  font-size: 13px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 4px; margin-left: auto;
}
.pager .pg-size {
  height: 30px; border: 1px solid var(--border); border-radius: 6px;
  padding: 0 6px; font-size: 13px; background: #fff;
}
.pager .btn[disabled] { opacity: .45; cursor: not-allowed; }

/* 备份恢复面板输出 */
.bk-out { margin-top: 12px; }
.bk-out .table { margin-top: 6px; width: auto; min-width: 320px; }
.bk-out .table td:first-child { color: var(--muted); width: 160px; }

/* ---------- 新房模块（一手楼盘） ---------- */
.tag.coming { background: #fdf3e0; color: #946200; }
.tag.soldout { background: #f1efe8; color: #5f5e5a; }
.panel h4 { font-size: 13px; margin: 18px 0 10px; color: var(--ink); }
.nh-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.nh-meta span { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; }
.nh-cover { margin: 12px 0; }
.nh-cover img { max-width: 100%; max-height: 280px; border-radius: 10px; border: 1px solid var(--border); }
.nh-intro { line-height: 1.8; font-size: 14px; color: var(--ink); white-space: normal; }
.nh-sub { display: flex; flex-direction: column; gap: 10px; }
.nh-item { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.nh-item-h { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.nh-item-h b { font-size: 14px; }
.nh-price { color: #b4412e; font-weight: 600; font-size: 13px; }
.nh-period { color: #0c447c; font-size: 12px; }
.nh-note { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.6; }
.nh-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.nh-row input { flex: 1 1 0; min-width: 0; }
.nh-row-x { border: none; background: #f7c1c1; color: #a32d2d; border-radius: 6px; width: 28px; height: 28px; cursor: pointer; flex-shrink: 0; font-size: 16px; line-height: 1; }
.nh-row-x:hover { background: #f3a9a9; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.btn.danger:hover { background: #fdeaea; }

