:root {
  --wx-green: #07c160;
  --wx-green-dark: #06ad56;
  --bg: #ededed;
  --card: #ffffff;
  --text: #1a1a1a;
  --text-sub: #888;
  --line: #e6e6e6;
  --nav-h: 48px;
  --tab-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}

/* 顶部导航 */
.wx-nav {
  position: sticky; top: 0; z-index: 30;
  height: var(--nav-h);
  background: var(--wx-green);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  padding: 0 12px;
}
.wx-nav__title { font-size: 17px; font-weight: 600; }
.wx-nav__action {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,0.18); color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 50%; font-size: 22px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* 主内容 */
.wx-main { padding: 10px; }
.view { animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to {opacity:1;transform:none;} }

/* 搜索 */
.search-bar { padding: 4px 2px 10px; }
.search-bar input {
  width: 100%; height: 36px; border: none; border-radius: 8px;
  background: #fff; padding: 0 12px; font-size: 14px; outline: none;
}

/* 房源卡片 */
.house-list { display: flex; flex-direction: column; gap: 10px; }
.house-card {
  background: var(--card); border-radius: 12px; padding: 12px;
  display: flex; gap: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease;
}
.house-card:active { transform: scale(.99); }
.house-card__thumb {
  width: 84px; height: 84px; border-radius: 10px; flex: 0 0 84px;
  background: #f2f2f2 center/cover no-repeat; display: flex;
  align-items: center; justify-content: center; font-size: 28px; color: #ccc;
}
.house-card__body { flex: 1; min-width: 0; }
.house-card__name { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.house-card__sub { color: var(--text-sub); font-size: 12px; margin: 2px 0; }
.house-card__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag {
  font-size: 11px; padding: 1px 7px; border-radius: 4px; background: #eafaf0; color: var(--wx-green-dark);
}
.tag--gray { background: #f2f2f2; color: #999; }
.tag--warn { background: #fff3e0; color: #e08a00; }

/* 评分条 */
.stars { color: #ffb400; letter-spacing: 1px; font-size: 13px; }
.stars .star-off { color: #ddd; }

/* 卡片通用 */
.card {
  background: var(--card); border-radius: 12px; padding: 14px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card__title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card__hint { color: var(--text-sub); font-size: 12px; margin: 0 0 10px; line-height: 1.5; }

/* 表单 */
.form-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.form-row > span { width: 86px; flex: 0 0 86px; color: var(--text-sub); font-size: 13px; }
.form-row input, .form-row textarea {
  flex: 1; border: none; outline: none; font-size: 14px; background: transparent; resize: none; width: 100%;
}
.form-row--col { flex-direction: column; align-items: flex-start; }
.form-row--col > span { margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.switch { position: relative; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch__slider { position: absolute; inset: 0; background: #ccc; border-radius: 24px; transition: .2s; }
.switch__slider::before { content: ""; position: absolute; width: 20px; height: 20px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .switch__slider { background: var(--wx-green); }
.switch input:checked + .switch__slider::before { transform: translateX(20px); }

/* 功能网格 */
.form-block { padding: 12px 0; border-bottom: 1px solid var(--line); }
.form-block__title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.form-hint { color: var(--text-sub); font-size: 11px; margin: 6px 0 0; }
.feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.feature-item { display: flex; align-items: center; justify-content: space-between; background: #f7f7f7; padding: 9px 10px; border-radius: 8px; font-size: 13px; }
.feature-item .yes-no { font-size: 16px; }
.feature-item .feat-del { margin-left: 6px; color: #bbb; background: none; border: none; font-size: 13px; cursor: pointer; }
.feature-add { display: flex; gap: 8px; margin-top: 8px; }
.feature-add input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; outline: none; background: #fff; }
.feature-add .btn { white-space: nowrap; padding: 8px 14px; }

/* 评分列表 */
.rating-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.rating-item { display: flex; align-items: center; justify-content: space-between; }
.rating-item > span { font-size: 13px; }
.rating-stars { display: flex; gap: 2px; font-size: 20px; }
.rating-stars .rs { color: #ddd; cursor: pointer; transition: transform .1s; }
.rating-stars .rs.on { color: #ffb400; }
.rating-stars .rs:active { transform: scale(1.2); }

/* 照片 */
.photo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 8px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 8px; background: #f2f2f2 center/cover no-repeat; }
.photo-cell__del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; border: none; font-size: 12px; line-height: 1; }

/* 按钮 */
.btn { border: none; border-radius: 8px; font-size: 14px; padding: 10px 16px; cursor: pointer; transition: opacity .15s; }
.btn:active { opacity: .85; }
.btn--primary { background: var(--wx-green); color: #fff; }
.btn--ghost { background: #f2f2f2; color: #333; }
.btn--upload { background: #f7f7f7; color: var(--wx-green-dark); width: 100%; border: 1px dashed #cfcfcf; }
.btn--danger { background: #fa5151; color: #fff; }
.btn--block { width: 100%; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { width: 100%; max-width: 560px; height: 92vh; max-height: 92vh; background: #f7f7f7; border-radius: 14px 14px 0 0; overflow: hidden; display: flex; flex-direction: column; animation: slideUp .22s ease; }
@keyframes slideUp { from { transform: translateY(100%);} to { transform: none; } }
.modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; width: 100%; }
.modal > :not(form) { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.modal > :not(form) > .modal__body { flex: 1 1 auto; }
.modal__head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; padding: 14px 16px; font-size: 16px; font-weight: 600; background: #fff; }
.modal__close { background: none; border: none; font-size: 18px; color: #999; }
.modal__body { padding: 0 16px; overflow-y: auto; flex: 1 1 auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.modal__foot { display: flex; flex: 0 0 auto; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.modal__foot .btn { flex: 1; }

/* 详情 */
.detail-view { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; padding: 10px 10px 20px; }
.detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.detail-back { background: var(--wx-green); color: #fff; border: none; border-radius: 8px; padding: 6px 12px; font-size: 14px; }
.detail-title { font-size: 18px; font-weight: 700; }
.detail-section { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.detail-section h3 { margin: 0 0 10px; font-size: 15px; }
.detail-section p { margin: 4px 0; color: #444; line-height: 1.6; }
.detail-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.detail-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.info-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row span:first-child { color: var(--text-sub); }
.feature-line { display: flex; flex-wrap: wrap; gap: 8px; }
.feature-pill { font-size: 12px; padding: 4px 10px; border-radius: 14px; background: #f2f2f2; color: #666; }
.feature-pill.on { background: #eafaf0; color: var(--wx-green-dark); }
.feature-pill.off { background: #fdeaea; color: #d9534f; }

/* 地图 */
.map-box { width: 100%; height: 200px; border-radius: 10px; background: #eef; overflow: hidden; }
.map-tip { color: var(--text-sub); font-size: 12px; padding: 8px 0; }
.commute-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.commute-row .ic { font-size: 20px; }
.commute-row .meta { flex: 1; }
.commute-row .meta b { font-size: 14px; }
.commute-row .meta small { color: var(--text-sub); }
.shuttle-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.shuttle-row .dot { color: var(--wx-green); }

/* 提醒 */
.reminder-summary { background: linear-gradient(135deg, var(--wx-green), #2bd17e); color: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.reminder-summary .big { font-size: 26px; font-weight: 700; }
.reminder-card { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.reminder-card .top { display: flex; justify-content: space-between; align-items: center; }
.reminder-card .when { font-size: 15px; font-weight: 600; }
.reminder-card .house { color: var(--text-sub); font-size: 12px; margin: 4px 0; }
.reminder-card .email { font-size: 12px; color: #555; }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.badge--wait { background: #fff3e0; color: #e08a00; }
.badge--sent { background: #eafaf0; color: var(--wx-green-dark); }
.badge--miss { background: #fdeaea; color: #d9534f; }
.empty { text-align: center; color: var(--text-sub); padding: 40px 0; font-size: 13px; }

/* Tab */
.wx-tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  background: #fafafa; border-top: 1px solid #e2e2e2;
  display: flex; padding-bottom: env(safe-area-inset-bottom);
}
.wx-tab { flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #999; font-size: 11px; }
.wx-tab.is-active { color: var(--wx-green); }
.wx-tab__icon { font-size: 22px; }

/* Toast */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: rgba(0,0,0,.8); color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 14px; z-index: 100; max-width: 80%; text-align: center;
}

/* 浮动添加按钮（详情页） */
.fab-add { position: fixed; right: 16px; bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom)); z-index: 25; width: 50px; height: 50px; border-radius: 50%; background: var(--wx-green); color: #fff; border: none; font-size: 26px; box-shadow: 0 4px 12px rgba(7,193,96,.4); }

/* 分享 */
.share-link-box { display: flex; gap: 8px; align-items: center; background: #f2f2f2; border-radius: 8px; padding: 6px 8px; margin-bottom: 12px; }
.share-link-box input { flex: 1; border: none; background: transparent; font-size: 12px; outline: none; min-width: 0; color: #444; }
.share-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }

/* 云端共享列表 */
.shared-list .map-tip { margin: 6px 0; }
.shared-list .house-card { box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 10px; }
.shared-list .house-card__thumb { height: 96px; }
.shared-list .house-card__name { font-size: 14px; }
.shared-list .house-card { position: relative; }
.house-card__del {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer;
}
.house-card__del:active { background: rgba(0,0,0,.65); }

/* 地点搜索候选 */
.loc-suggest {
  margin: -6px 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; max-height: 220px; overflow-y: auto; box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.loc-suggest__item { padding: 9px 10px; border-bottom: 1px solid #f2f2f2; display: flex; flex-direction: column; gap: 2px; }
.loc-suggest__item:last-child { border-bottom: none; }
.loc-suggest__item b { font-size: 14px; }
.loc-suggest__item small { color: var(--text-sub); font-size: 12px; }
.loc-suggest__item:active { background: #f6f6f6; }
.loc-suggest__empty { color: var(--text-sub); font-size: 12px; }

/* 固定通勤卡片 */
.commute-block { margin-top: 4px; }
.commute-head { font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }
.commute-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px;
  background: #f8fbf9; border: 1px solid #e3f0ea; border-radius: 10px; margin-bottom: 8px;
}
.commute-row .ic { font-size: 18px; line-height: 1.4; }
.commute-row .meta { flex: 1; min-width: 0; }
.commute-row .meta b { font-size: 14px; }
.commute-lines { display: flex; flex-direction: column; gap: 3px; margin-top: 5px; }
.commute-oneline { font-size: 13px; color: #333; }
.commute-oneline small { color: var(--text-sub); }
.commute-acts { display: flex; flex-direction: column; gap: 6px; }
.commute-acts .btn--sm { padding: 5px 12px; font-size: 12px; min-width: 56px; text-align: center; text-decoration: none; }
.btn--sm { display: inline-block; }
