/* 房产单边代理系统 · 样式 */
:root {
  --bg: #f4f6fa;
  --card: #ffffff;
  --line: #e6eaf2;
  --text: #1f2430;
  --muted: #697180;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-weak: #e8efff;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .05);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea { resize: vertical; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); }
input[type="color"] { width: 64px; height: 36px; padding: 3px; }
select { cursor: pointer; }
h1, h2, h3 { margin: 0; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13.5px; cursor: pointer; background: #eef1f6; color: var(--text);
  white-space: nowrap; transition: all .15s;
}
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #fff; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); filter: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.ghost.danger { background: #fff; color: var(--danger); border-color: #f3c9c9; }
.btn.ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  border: none; background: none; cursor: pointer; color: var(--muted);
  padding: 6px; border-radius: 8px; display: inline-flex;
}
.icon-btn:hover { background: #f1f4f9; color: var(--text); }
.flex-grow { flex: 1; }

/* ---------- 徽标 / 标签 ---------- */
.role-badge { font-size: 11.5px; padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.role-admin { background: #ede9fe; color: #7c3aed; }
.role-ops { background: #e0f2fe; color: #0284c7; }
.role-sales { background: #dcfce7; color: #16a34a; }
.chip {
  display: inline-flex; align-items: center; padding: 2.5px 9px; border-radius: 999px;
  font-size: 12px; line-height: 1.5; margin: 2px 4px 2px 0; white-space: nowrap;
}
.chip-gray { background: #eef1f6; color: #64748b; }
.chip-warn { background: #fef3c7; color: #b45309; }
.chip-blue { background: #e0eaff; color: #2563eb; }
.chip-ok { background: #dcfce7; color: #16a34a; }
.chip-orange { background: #ffedd5; color: #c2410c; }
.chip-red { background: #fee2e2; color: #dc2626; }
.chip-green { background: #d1fae5; color: #047857; }
.chip.pickable { cursor: pointer; border: 1px solid transparent; padding: 3px 11px; font-size: 12.5px; }
.chip.pickable:hover { transform: translateY(-1px); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.brand-logo {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 14.5px; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: none; background: none; border-radius: 9px; font-size: 14px;
  color: var(--muted); cursor: pointer; text-align: left; transition: all .15s;
}
.nav-item:hover { background: #f4f7fd; color: var(--text); }
.nav-item.active { background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.sidebar-foot { padding: 12px 16px; font-size: 11px; color: #b6bfce; }
.main-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: sticky; top: 0; z-index: 5;
}
.topbar-title { font-weight: 700; font-size: 15.5px; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.uname { font-weight: 600; font-size: 13.5px; }
.main { padding: 20px; max-width: 1200px; width: 100%; margin: 0 auto; flex: 1; }

/* ---------- 卡片 / 统计 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-title { font-weight: 700; font-size: 14px; }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.stat-val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; }
.stat-val.warn { color: #b45309; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.dash-actions { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-cols { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; margin-top: 14px; }
.bar-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.bar-name { width: 92px; font-size: 13px; display: flex; align-items: center; flex-shrink: 0; }
.bar-track { flex: 1; height: 8px; background: #eef1f7; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .3s; }
.bar-num { width: 30px; text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.mini-table { margin-top: 10px; }
.mini-head, .mini-row { display: grid; grid-template-columns: 1.3fr .9fr .8fr .8fr .9fr .9fr; padding: 9px 6px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: center; }
.mini-head { color: var(--muted); font-size: 12px; }
.mini-row:last-child { border-bottom: none; }

/* ---------- 工具条 / 列表 ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar select { width: auto; }
.search-box { position: relative; width: 270px; }
.search-box svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 32px; }
.hint-line { font-size: 12.5px; color: #92600a; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 8px; max-width: 620px; line-height: 1.6; }
.list-card { padding: 0; overflow: hidden; }
.phead, .prow {
  display: grid; align-items: center; gap: 10px; padding: 11px 14px;
  grid-template-columns: 26px minmax(200px, 2.1fr) minmax(100px, 1fr) minmax(120px, 1.1fr) 76px minmax(130px, 1.2fr) 88px 105px auto;
  border-bottom: 1px solid var(--line);
}
.list-card.nochk .phead, .list-card.nochk .prow {
  grid-template-columns: minmax(200px, 2.1fr) minmax(100px, 1fr) minmax(120px, 1.1fr) 76px minmax(130px, 1.2fr) 88px 105px auto;
}
.phead { font-size: 12px; color: var(--muted); background: #fafbfe; }
.prow { cursor: pointer; font-size: 13.5px; transition: background .12s; }
.prow:hover { background: #f7f9fe; }
.prow:last-child { border-bottom: none; }
.prow .t, .urow .t { font-weight: 600; }
.prow .s, .urow .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.c-price { font-weight: 700; color: #b45309; }
.c-act { display: flex; gap: 6px; justify-content: flex-end; }
.chk { display: inline-flex; align-items: center; }
.empty { padding: 32px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.loading { padding: 48px; text-align: center; color: var(--muted); }

/* ---------- 用户表 ---------- */
.uhead, .urow {
  display: grid; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line);
  align-items: center; font-size: 13.5px;
  grid-template-columns: 1.6fr .9fr .8fr .8fr .8fr 1.2fr 1.4fr;
}
.uhead { background: #fafbfe; font-size: 12px; color: var(--muted); }
.urow:last-child { border-bottom: none; }
.tags-head, .tags-row { grid-template-columns: 1.8fr .6fr 1fr 1.5fr; }

/* ---------- 抽屉 ---------- */
.drawer-wrap {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 30;
  display: flex; justify-content: flex-end; animation: fadeIn .15s;
}
.drawer { width: min(560px, 100%); background: var(--bg); height: 100%; overflow-y: auto; animation: slideIn .2s ease; }
.drawer-head {
  position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line);
  padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; z-index: 2;
}
.d-title { font-weight: 700; font-size: 16px; }
.d-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.drawer-body { padding: 16px; display: flex; flex-direction: column; gap: 12px; padding-bottom: 40px; }
.drawer .sec { padding: 14px 16px; }
.tags-line { margin-top: 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.tag-pick { margin-top: 10px; padding: 10px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 10px; display: flex; flex-wrap: wrap; gap: 4px; }
.assign-line { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.assign-line select { width: auto; }
.assign-log { margin-top: 10px; font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.pool-reason { color: #dc2626; font-size: 12px; margin-top: 3px; }
.pool-note {
  margin-top: 10px; font-size: 12.5px; color: #9a3412; line-height: 1.6;
  background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 8px 12px;
}
.prow.stale .c-main .t { color: #b91c1c; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; margin-top: 12px; }
.kv .k { font-size: 12px; color: var(--muted); }
.kv .v { font-size: 13.5px; margin-top: 2px; word-break: break-all; }
.fu-form { margin-top: 12px; }
.fu-form textarea { margin-bottom: 8px; }
.fu-form-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.fu-form-foot select { width: auto; }
.fu-list { margin-top: 6px; }
.fu-item { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.fu-item:last-child { border-bottom: none; }
.fu-head { display: flex; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.fu-who { font-weight: 600; color: var(--text); }
.fu-prop { background: #f1f4f9; border-radius: 6px; padding: 1px 7px; }
.fu-time { margin-left: auto; }
.fu-content { margin-top: 5px; font-size: 13.5px; white-space: pre-wrap; line-height: 1.6; }

/* ---------- 弹窗 ---------- */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .42); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 16px; animation: fadeIn .15s;
}
.modal {
  background: #fff; border-radius: 14px; width: min(520px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 0; }
.modal-title { font-weight: 700; font-size: 16px; }
.modal-body { padding: 16px 20px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.field { display: block; margin-bottom: 13px; }
.f-label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.check-field { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.check-field.inline { display: inline-flex; }
.form-err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0; }
.confirm-msg { font-size: 13.5px; line-height: 1.7; color: var(--text); }

/* ---------- 批量条 ---------- */
.batch-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff; padding: 10px 16px; border-radius: 12px;
  display: flex; gap: 12px; align-items: center; z-index: 25;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3); font-size: 13.5px;
}
.batch-bar .btn.ghost { background: transparent; color: #d1d5db; border-color: #374151; }
.batch-bar .btn.ghost:hover { color: #fff; border-color: #6b7280; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: #111827; color: #fff; padding: 9px 18px; border-radius: 9px;
  font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); animation: fadeIn .2s;
  max-width: 80vw;
}
.toast.warn { background: #b45309; }

/* ---------- 登录 ---------- */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #eef3ff 0%, #f7f9fc 52%, #ecf9f2 100%); padding: 20px;
}
.login-card {
  width: 390px; max-width: 94vw; background: #fff; border: 1px solid var(--line);
  border-radius: 18px; padding: 38px 34px; box-shadow: 0 12px 48px rgba(15, 23, 42, .08);
  text-align: center;
}
.login-logo { font-size: 42px; }
.login-card h1 { font-size: 20px; margin: 12px 0 5px; letter-spacing: 1px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.login-card form { text-align: left; }
.login-card label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.login-card label input { margin-top: 6px; }
.login-hint {
  margin-top: 20px; font-size: 11.5px; color: #97a1b2; line-height: 1.8;
  background: #f8fafc; border-radius: 8px; padding: 10px 12px; text-align: left;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(36px); opacity: .4; } to { transform: none; opacity: 1; } }

/* ---------- 移动端 ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: fixed; bottom: 0; top: auto;
    flex-direction: row; border-top: 1px solid var(--line); border-right: none;
    z-index: 20; padding: 3px 4px;
  }
  .brand, .sidebar-foot { display: none; }
  .nav { flex-direction: row; padding: 0; gap: 2px; }
  .nav-item { flex: 1; flex-direction: column; gap: 3px; font-size: 10.5px; padding: 8px 2px; justify-content: center; min-width: 0; }
  .nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .main { padding: 12px 12px 80px; }
  .topbar { padding: 0 12px; }
  .topbar-user .uname { display: none; }
  .phead { display: none; }
  .prow {
    display: block; padding: 12px; border: 1px solid var(--line);
    border-radius: 10px; margin-bottom: 10px;
  }
  .prow > div { margin: 3px 0; }
  .prow .c-act { justify-content: flex-start; margin-top: 8px; }
  .chk { position: absolute; right: 12px; top: 12px; }
  .prow { position: relative; }
  .drawer { width: 100%; }
  .dash-cols { grid-template-columns: 1fr; }
  .batch-bar { bottom: 70px; width: calc(100% - 24px); justify-content: center; flex-wrap: wrap; }
  .search-box { width: 100%; }
  .uhead, .urow { grid-template-columns: 1.5fr 1fr 1fr 1.2fr; }
  .uhead span:nth-child(n+4):nth-child(-n+6), .urow > div:nth-child(n+4):nth-child(-n+6) { display: none; }
  .tags-head, .tags-row { grid-template-columns: 1.8fr 1fr; }
  .tags-head span:nth-child(2), .tags-head span:nth-child(3),
  .urow.tags-row > div:nth-child(2), .urow.tags-row > div:nth-child(3) { display: none; }
  .info-grid { grid-template-columns: 1fr; }
}

/* ---------- 房主委托（v1.7） ---------- */
.consign-list { display: flex; flex-direction: column; gap: 10px; }
.consign-card {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
}
.cs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cs-title { font-size: 15.5px; font-weight: 700; color: var(--text); }
.cs-badge { flex: none; font-size: 12px; padding: 3px 10px; border-radius: 999px; }
.cs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 4px 16px; margin: 9px 0 2px; font-size: 13px; color: var(--muted);
}
.cs-grid b { color: var(--text); }
.cs-tel { color: var(--primary); font-weight: 600; text-decoration: none; }
.cs-price b { color: #ea580c; }
.cs-remark, .cs-note {
  margin-top: 8px; font-size: 12.5px; line-height: 1.6; color: var(--muted);
  background: #f8fafc; border-radius: 8px; padding: 8px 10px;
}
.cs-note { background: #fffbeb; color: #92400e; }
.cs-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.cs-time { font-size: 12px; color: #94a3b8; }
.empty { text-align: center; color: #94a3b8; padding: 60px 0; font-size: 14px; }

/* ---------- 小程序展示（v1.9） ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-top: 8px; }
.photo-item { position: relative; aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: #f1f5f9; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
  border: none; background: rgba(15,23,42,.62); color: #fff; font-size: 13px; line-height: 18px;
  cursor: pointer; padding: 0;
}
.photo-del:hover { background: #dc2626; }
.photo-cover {
  position: absolute; left: 0; bottom: 0; background: rgba(37,99,235,.85); color: #fff;
  font-size: 10.5px; padding: 2px 7px; border-radius: 0 8px 0 0;
}
.photo-add {
  aspect-ratio: 4/3; border: 1.5px dashed #cbd5e1; border-radius: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: #64748b; font-size: 12px; text-align: center; line-height: 1.3; user-select: none;
}
.photo-add:hover { border-color: #2563eb; color: #2563eb; }
.hl-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.hl-chip { cursor: pointer; }
