/* 东少说房·移动经纪人 —— 客户端样式 */
:root {
  --pri: #ff4a2e;
  --pri-2: #ff6a3d;
  --grad: linear-gradient(160deg, #ff7a3c 0%, #ff4a2e 55%, #ff3546 100%);
  --price: #ff4a2e;
  --bg: #f5f6f8;
  --line: #ececec;
  --txt: #222;
  --sub: #888;
  --nav-h: 54px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--txt); font-size: 15px;
  overscroll-behavior-y: none;
}
button { font-family: inherit; border: 0; background: none; cursor: pointer; color: inherit; }
input, textarea { font-family: inherit; border: 0; outline: none; }
a { color: inherit; text-decoration: none; }
img { display: block; }

/* ============ 布局 ============ */
#app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; background: var(--bg); }
.view { display: none; min-height: 100vh; }
.view.on { display: block; }
body.nav-show #tabbar { display: flex; }
body.no-nav #tabbar { display: none !important; }

/* ============ 首页头部 ============ */
.hd { background: var(--grad); padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 0; color: #fff; border-radius: 0 0 18px 18px; }
.hd-brand { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; }
.hd-brand .avatar { width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); object-fit: cover; }
.hd-brand .b-name { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.hd-brand .b-sub { font-size: 11px; opacity: .85; display: flex; align-items: center; gap: 4px; }
.hd-brand .b-sub .dot { width: 6px; height: 6px; border-radius: 50%; background: #7dff8a; display: inline-block; }
.hd-brand .grow { flex: 1; }
.hd-call { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.5); color: #fff; font-size: 12px; padding: 6px 12px; border-radius: 999px; display: flex; align-items: center; gap: 4px; }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 9px 14px; margin-bottom: 12px; }
.search svg { flex: none; }
.search input { flex: 1; font-size: 14px; color: #333; background: transparent; }
.search input::placeholder { color: #aaa; }
.seg { display: flex; gap: 26px; }
.seg button { color: rgba(255,255,255,.75); font-size: 17px; font-weight: 600; padding: 6px 2px 10px; position: relative; }
.seg button.on { color: #fff; font-size: 19px; }
.seg button.on::after { content: ""; position: absolute; left: 50%; transform: translateX(-50%); bottom: 4px; width: 22px; height: 3.5px; border-radius: 3px; background: #fff; }

/* ============ 筛选 chips ============ */
.chips { display: flex; gap: 8px; padding: 12px 14px 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; font-size: 12.5px; color: #666; background: #fff; border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; }
.chip.on { color: var(--pri); border-color: var(--pri); background: #fff4f1; font-weight: 600; }

/* ============ 房源卡片 ============ */
.list { padding: 8px 12px calc(var(--nav-h) + var(--safe-b) + 20px); display: flex; flex-direction: column; gap: 10px; }
.card { display: flex; gap: 11px; background: #fff; border-radius: 14px; padding: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.card:active { background: #fafafa; }
.thumb { position: relative; width: 132px; height: 99px; flex: none; border-radius: 10px; overflow: hidden; background: #eee; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .play { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; }
.thumb .play::after { content: ""; border-left: 11px solid #fff; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.thumb .vtag { position: absolute; left: 6px; top: 6px; font-size: 10px; color: #fff; background: linear-gradient(135deg,#ff7a3c,#ff3546); border-radius: 5px; padding: 2px 6px; }
.card .info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.card .t { font-size: 15.5px; font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .sub { font-size: 12.5px; color: #555; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { font-size: 12px; color: var(--sub); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .tags { display: flex; gap: 5px; margin-top: 5px; overflow: hidden; }
.card .tag { font-size: 10.5px; color: #4c84ff; background: #eef3ff; border-radius: 4px; padding: 1.5px 5px; flex: none; }
.card .tag.hot { color: #fff; background: linear-gradient(135deg,#ff7a3c,#ff3546); }
.card .p-row { margin-top: auto; display: flex; align-items: baseline; gap: 5px; }
.card .p-num { color: var(--price); font-size: 18px; font-weight: 800; }
.card .p-unit { color: var(--price); font-size: 12px; }
.card .p-more { margin-left: auto; font-size: 11px; color: #bbb; }
.empty { text-align: center; padding: 60px 0 100px; color: #999; }
.empty .e-icon { font-size: 44px; margin-bottom: 10px; }
.empty p { font-size: 13.5px; line-height: 1.7; }
.foot-note { text-align: center; color: #c0c0c0; font-size: 11px; padding: 6px 0 calc(var(--nav-h) + var(--safe-b) + 18px); }

/* ============ 详情页 ============ */
#view-detail { background: #f5f6f8; padding-bottom: calc(64px + var(--safe-b)); }
.video-wrap { position: relative; background: #000; }
#video { width: 100%; max-height: 53vh; display: block; object-fit: contain; background: #000; }
.back { position: absolute; left: 10px; top: calc(env(safe-area-inset-top, 0px) + 10px); width: 34px; height: 34px; border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 20px; z-index: 5; }
.big-play { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: 62px; height: 62px; border-radius: 50%; background: rgba(0,0,0,.5); border: 2px solid rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; }
.big-play::after { content: ""; border-left: 20px solid #fff; border-top: 12px solid transparent; border-bottom: 12px solid transparent; margin-left: 5px; }
.no-video { width: 100%; height: 240px; object-fit: cover; }
.detail-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.d-card { background: #fff; border-radius: 14px; padding: 14px; }
.d-price { display: flex; align-items: baseline; gap: 6px; }
.d-price .n { color: var(--price); font-size: 26px; font-weight: 800; }
.d-price .u { color: var(--price); font-size: 13px; font-weight: 600; }
.d-price .up { margin-left: auto; color: var(--sub); font-size: 12px; }
.d-title { font-size: 17.5px; font-weight: 700; line-height: 1.45; margin-top: 6px; }
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.d-tags span { font-size: 11px; color: #4c84ff; background: #eef3ff; padding: 3px 8px; border-radius: 5px; }
.d-tags span.hot { color: #fff; background: linear-gradient(135deg,#ff7a3c,#ff3546); }
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 13px 8px; }
.grid .g-it .k { font-size: 11.5px; color: var(--sub); }
.grid .g-it .v { font-size: 13.5px; font-weight: 600; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-sec { font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.d-sec::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--pri); }
.d-desc { font-size: 13.5px; color: #444; line-height: 1.8; white-space: pre-wrap; word-break: break-all; }
.agent { display: flex; align-items: center; gap: 11px; }
.agent img { width: 50px; height: 50px; border-radius: 50%; }
.agent .a-name { font-size: 15.5px; font-weight: 700; }
.agent .a-sub { font-size: 11.5px; color: var(--sub); margin-top: 3px; }
.agent .a-act { margin-left: auto; display: flex; gap: 8px; }
.agent .a-act a, .agent .a-act button { width: 38px; height: 38px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 9.5px; gap: 1px; }
.a-tel { background: #fff4f1; color: var(--pri); }
.a-chat { background: #eef3ff; color: #4c84ff; }
.d-tip { font-size: 12px; color: #999; line-height: 1.7; }
.detail-bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; background: #fff; box-shadow: 0 -2px 10px rgba(0,0,0,.06); display: flex; align-items: center; gap: 10px; padding: 9px 12px calc(var(--safe-b) + 9px); z-index: 20; }
.detail-bar .bar-share { display: flex; flex-direction: column; align-items: center; font-size: 10.5px; color: #666; gap: 2px; padding: 0 4px; }
.detail-bar .bar-chat { flex: 1; height: 42px; border-radius: 999px; border: 1.5px solid var(--pri); color: var(--pri); font-size: 14.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; }
.detail-bar .bar-tel { flex: 1.2; height: 42px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 14.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 5px; }

/* ============ 聊天页 ============ */
#view-chat { display: none; flex-direction: column; height: 100vh; height: 100dvh; background: #f0f1f4; }
#view-chat.on { display: flex; }
.chat-hd { background: var(--grad); color: #fff; padding: calc(env(safe-area-inset-top,0px) + 10px) 14px 11px; display: flex; align-items: center; gap: 10px; }
.chat-hd img { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid rgba(255,255,255,.8); }
.chat-hd .c-name { font-size: 16px; font-weight: 700; }
.chat-hd .c-st { font-size: 11px; opacity: .85; display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.chat-hd .c-st .dot { width: 6px; height: 6px; border-radius: 50%; background: #7dff8a; }
.chat-list { flex: 1; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 9px; max-width: 84%; }
.msg .m-ava { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.msg .m-body { display: flex; flex-direction: column; gap: 3px; }
.msg .m-name { font-size: 10.5px; color: #a5a5a5; }
.msg .bubble { padding: 9px 12px; border-radius: 4px 12px 12px 12px; font-size: 14.5px; line-height: 1.55; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.04); word-break: break-all; white-space: pre-wrap; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg.me .bubble { background: var(--grad); color: #fff; border-radius: 12px 4px 12px 12px; }
.msg.me .m-name { text-align: right; }
.m-time { align-self: center; font-size: 10.5px; color: #b3b3b3; }
.chat-input { display: flex; align-items: flex-end; gap: 9px; background: #fff; padding: 8px 10px calc(var(--safe-b) + 8px); box-shadow: 0 -2px 8px rgba(0,0,0,.05); }
.chat-input textarea { flex: 1; resize: none; background: #f4f5f7; border-radius: 18px; padding: 9px 13px; font-size: 14.5px; max-height: 96px; min-height: 38px; line-height: 1.45; }
.chat-send { flex: none; width: 62px; height: 38px; border-radius: 999px; background: var(--grad); color: #fff; font-size: 14px; font-weight: 600; }

/* ============ 我的 ============ */
#view-mine { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 20px); }
.mine-hd { background: var(--grad); padding: calc(env(safe-area-inset-top,0px) + 22px) 16px 46px; color: #fff; }
.mine-card { display: flex; align-items: center; gap: 13px; }
.mine-card img { width: 62px; height: 62px; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); }
.mine-card .m-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 7px; }
.mine-card .m-cert { font-size: 10px; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.5); padding: 2px 7px; border-radius: 999px; font-weight: 400; }
.mine-card .m-sub { font-size: 12px; opacity: .9; margin-top: 5px; }
.mine-body { padding: 0 12px; margin-top: -32px; }
.cells { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); margin-bottom: 12px; }
.cell { display: flex; align-items: center; gap: 11px; padding: 14px; border-bottom: 1px solid #f5f5f5; position: relative; }
.cell:last-child { border-bottom: 0; }
.cell:active { background: #fafafa; }
.cell .c-ico { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex: none; }
.cell .c-t { font-size: 14.5px; font-weight: 500; flex: 1; }
.cell .c-val { color: #999; font-size: 13px; }
.cell .arr { color: #ccc; font-size: 15px; }
.ico-org { background: #fff4f1; } .ico-blu { background: #eef3ff; } .ico-grn { background: #eafaf0; } .ico-gry { background: #f3f4f6; }
.about { text-align: center; color: #b5b5b5; font-size: 11px; line-height: 1.8; padding: 14px 0 6px; }

/* ============ 底部导航 ============ */
#tabbar { display: none; position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 560px; background: #fff; border-top: 1px solid #f0f0f0; padding-bottom: var(--safe-b); z-index: 30; }
#tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 6px; font-size: 10.5px; color: #999; position: relative; }
#tabbar a.on { color: var(--pri); font-weight: 600; }
#tabbar .badge { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 16px; height: 16px; border-radius: 999px; background: #ff3b30; color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center; padding: 0 4px; font-weight: 700; }

/* ============ 通用 ============ */
#toast { position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(10px); background: rgba(17,17,17,.85); color: #fff; font-size: 13px; padding: 9px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: .25s; z-index: 99; max-width: 80%; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spin { width: 26px; height: 26px; border: 3px solid #eee; border-top-color: var(--pri); border-radius: 50%; margin: 40px auto; animation: sp .8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
