:root {
  --blue: #2563eb;
  --blue-light: #eff6ff;
  --text: #111827;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --bg: #f3f4f6;
  --card: #ffffff;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #d97706;
  --nav-h: 56px;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; background: var(--bg); font-family: -apple-system, 'PingFang SC', 'Helvetica Neue', sans-serif; color: var(--text); font-size: 15px; }

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }

#page { padding-bottom: calc(var(--nav-h) + 8px); }

/* ===== 顶部导航 ===== */
.topbar { background: var(--blue); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-size: 17px; font-weight: 600; flex: 1; }
.topbar-back { font-size: 20px; cursor: pointer; padding: 2px 6px; }
.topbar-action { font-size: 14px; cursor: pointer; opacity: .9; }

/* ===== 底部导航 ===== */
#bottom-nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: var(--nav-h); background: #fff; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-around; z-index: 20; }
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--text-secondary); cursor: pointer; flex: 1; padding: 6px 0; text-decoration: none; }
.nav-item.active { color: var(--blue); }
.nav-icon { font-size: 20px; line-height: 1; }
.nav-publish { background: var(--blue); border-radius: 50%; width: 46px; height: 46px; margin-top: -16px; flex: none; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(37,99,235,.4); }
.nav-icon-plus { color: #fff; font-size: 28px; line-height: 1; }

/* ===== Toast ===== */
#toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,.75); color: #fff; padding: 10px 20px; border-radius: 8px; font-size: 14px; z-index: 999; display: none; text-align: center; max-width: 240px; }
#toast.show { display: block; }

/* ===== Loading overlay ===== */
#overlay { position: fixed; inset: 0; background: rgba(0,0,0,.2); z-index: 998; display: flex; align-items: center; justify-content: center; }
.spinner { width: 36px; height: 36px; border: 3px solid #fff; border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 通用组件 ===== */
.card { background: var(--card); border-radius: var(--radius); margin: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); overflow: hidden; }
.section { padding: 12px 16px; }
.divider { height: 1px; background: var(--border); margin: 0 16px; }

.btn { display: block; width: 100%; padding: 13px; border-radius: 10px; border: none; font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:active { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: default; }
.btn-outline { background: #fff; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:active { background: var(--blue-light); }
.btn-danger { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn-sm { padding: 7px 14px; font-size: 13px; width: auto; display: inline-block; border-radius: 8px; }

.tag { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.tag-sale { background: #dbeafe; color: #1d4ed8; }
.tag-rent { background: #d1fae5; color: #065f46; }
.tag-sold { background: #f3f4f6; color: var(--text-secondary); }
.tag-off { background: #f3f4f6; color: var(--text-secondary); }

.empty { padding: 60px 20px; text-align: center; color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* ===== 登录页 ===== */
.login-wrap { padding: 40px 24px 24px; }
.login-logo { font-size: 48px; text-align: center; margin-bottom: 8px; }
.login-title { font-size: 22px; font-weight: 700; text-align: center; margin-bottom: 6px; }
.login-sub { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 32px; }
.form-group { margin-bottom: 16px; }
.form-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.form-input { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; background: #fff; outline: none; }
.form-input:focus { border-color: var(--blue); }
.form-hint { font-size: 12px; color: var(--text-secondary); margin-top: 20px; text-align: center; line-height: 1.6; }

/* ===== 首页 ===== */
.search-bar { padding: 12px; background: var(--blue); display: flex; gap: 8px; }
.search-input { flex: 1; padding: 9px 14px; border-radius: 20px; border: none; font-size: 14px; outline: none; background: rgba(255,255,255,.95); }
.search-btn { padding: 9px 16px; background: rgba(255,255,255,.25); border: none; border-radius: 20px; color: #fff; font-size: 14px; cursor: pointer; }

.type-tabs { display: flex; background: #fff; border-bottom: 1px solid var(--border); }
.type-tab { flex: 1; padding: 11px 0; text-align: center; font-size: 14px; color: var(--text-secondary); cursor: pointer; border-bottom: 2.5px solid transparent; }
.type-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }

.category-bar { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.category-bar::-webkit-scrollbar { display: none; }
.cat-btn { flex-shrink: 0; padding: 5px 14px; border-radius: 20px; border: 1.5px solid var(--border); background: #fff; font-size: 13px; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.cat-btn.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); }

.listing-list { padding: 8px 0; }
.listing-card { background: #fff; margin: 8px 12px; border-radius: var(--radius); display: flex; gap: 12px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: pointer; }
.listing-card:active { background: #f9fafb; }
.listing-thumb { width: 88px; height: 88px; border-radius: 8px; object-fit: cover; background: #f3f4f6; flex-shrink: 0; }
.listing-thumb-placeholder { width: 88px; height: 88px; border-radius: 8px; background: #f3f4f6; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; color: #d1d5db; }
.listing-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.listing-title { font-size: 15px; font-weight: 500; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.listing-price { font-size: 17px; font-weight: 700; color: var(--red); }
.listing-price-rent { font-size: 15px; font-weight: 600; color: var(--blue); }
.listing-meta { font-size: 12px; color: var(--text-secondary); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; }

.load-more { padding: 16px; text-align: center; }
.load-more-btn { padding: 10px 32px; border-radius: 20px; border: 1.5px solid var(--border); background: #fff; font-size: 14px; color: var(--text-secondary); cursor: pointer; }

/* ===== 详情页 ===== */
.detail-images { width: 100%; aspect-ratio: 4/3; background: #f3f4f6; overflow: hidden; position: relative; }
.detail-images img { width: 100%; height: 100%; object-fit: cover; }
.detail-img-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 56px; color: #d1d5db; }
.img-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 5px; }
.img-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.5); }
.img-dot.active { background: #fff; }

.detail-price { font-size: 24px; font-weight: 700; color: var(--red); }
.detail-price-rent { font-size: 20px; font-weight: 700; color: var(--blue); }
.detail-title { font-size: 18px; font-weight: 600; margin: 4px 0; }
.detail-row { display: flex; align-items: baseline; gap: 8px; margin: 6px 0; font-size: 14px; }
.detail-row-label { color: var(--text-secondary); flex-shrink: 0; min-width: 60px; }
.detail-desc { font-size: 14px; line-height: 1.7; color: #374151; white-space: pre-wrap; }

.contact-card { margin: 12px; background: #fff; border-radius: var(--radius); overflow: hidden; }
.contact-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.contact-row:last-child { border-bottom: none; }
.contact-label { font-size: 14px; color: var(--text-secondary); }
.contact-value { font-size: 15px; font-weight: 500; }
.copy-btn { font-size: 13px; color: var(--blue); cursor: pointer; padding: 4px 8px; }

.action-bar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; padding: 10px 16px; border-top: 1px solid var(--border); display: flex; gap: 10px; z-index: 10; }

/* ===== 发布页 ===== */
.form-section { background: #fff; border-radius: var(--radius); margin: 12px; padding: 16px; }
.form-section-title { font-size: 13px; color: var(--text-secondary); margin-bottom: 14px; font-weight: 500; }
.type-selector { display: flex; gap: 10px; margin-bottom: 4px; }
.type-btn { flex: 1; padding: 10px; border-radius: 10px; border: 2px solid var(--border); text-align: center; font-size: 15px; cursor: pointer; color: var(--text-secondary); }
.type-btn.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue); font-weight: 600; }

.form-field { margin-bottom: 16px; }
.form-field:last-child { margin-bottom: 0; }
.field-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; display: block; }
.field-label.required::after { content: ' *'; color: var(--red); }
.field-input { width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; background: #fff; outline: none; }
.field-input:focus { border-color: var(--blue); }
.field-select { width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; background: #fff; outline: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.field-textarea { width: 100%; padding: 11px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 15px; background: #fff; outline: none; resize: none; min-height: 90px; font-family: inherit; }
.field-textarea:focus { border-color: var(--blue); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; }
.toggle { position: relative; width: 44px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #d1d5db; border-radius: 13px; cursor: pointer; transition: .2s; }
.toggle-slider::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
input:checked + .toggle-slider { background: var(--blue); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

.date-range { display: flex; gap: 8px; align-items: center; }
.date-range .field-input { flex: 1; }
.date-sep { color: var(--text-secondary); flex-shrink: 0; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-item { position: relative; width: 80px; height: 80px; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.photo-del { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; cursor: pointer; }
.photo-add { width: 80px; height: 80px; border: 2px dashed var(--border); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 28px; color: #d1d5db; cursor: pointer; background: #fafafa; }

/* ===== 我的页 ===== */
.profile-header { background: var(--blue); padding: 24px 20px 20px; color: #fff; }
.profile-avatar { width: 56px; height: 56px; background: rgba(255,255,255,.25); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 10px; }
.profile-name { font-size: 18px; font-weight: 600; }
.profile-phone { font-size: 13px; opacity: .8; margin-top: 2px; }
.profile-invite-btn { margin-top: 14px; display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.2); padding: 7px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; }

.my-item-card { background: #fff; margin: 8px 12px; border-radius: var(--radius); padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: pointer; }
.my-item-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; }
.my-item-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.my-item-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ===== 邀请页 ===== */
.invite-code-box { margin: 16px; background: var(--blue); border-radius: var(--radius); padding: 24px; text-align: center; color: #fff; }
.invite-code-label { font-size: 13px; opacity: .8; margin-bottom: 8px; }
.invite-code { font-size: 32px; font-weight: 700; letter-spacing: 6px; margin-bottom: 16px; }
.invite-share-hint { font-size: 13px; opacity: .75; margin-top: 12px; }

.invited-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.invited-item:last-child { border-bottom: none; }
.invited-name { font-size: 15px; font-weight: 500; }
.invited-time { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.invited-status { font-size: 12px; }
.invited-status.published { color: var(--green); }
.invited-status.pending { color: var(--text-secondary); }
