/* ===== 基础与变量 ===== */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #161a1d;
  --text-soft: #6b7280;
  --border: #e8eaed;
  --primary: #0e7c66;
  --primary-strong: #0a5e4d;
  --primary-soft: #e6f4f1;
  --accent: #ff6a2c;
  --accent-soft: #fff1ea;
  --gold: #f5b301;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 2px 8px rgba(16, 24, 32, .06), 0 6px 20px rgba(16, 24, 32, .06);
  --shadow-up: 0 -2px 12px rgba(16, 24, 32, .08);

  /* 状态色 */
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #ca8a04;
  --yellow-bg: #fef9c3;
  --gray: #6b7280;
  --gray-bg: #eef0f2;
  --darkgray: #9ca3af;
  --darkgray-bg: #f1f3f4;

  /* v2.8 头部动态取色变量（JS 从 banner 图提主色后覆写；默认=品牌绿） */
  --hdr-h: 56px;
  --hdr-c1: #0b5044;
  --hdr-c2: #0e7c66;
  --hdr-c2-70: rgba(14, 124, 102, .7);
  --hdr-c2-45: rgba(14, 124, 102, .45);
  --hdr-c2t: rgba(14, 124, 102, 0);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ===== 头部（v2.8：全站吸顶 + 雾状渐变——中心浓、上/左/右边缘羽化透明） ===== */
.app-header {
  position: fixed;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; /* 与 body 480px 容器对齐，PC 不再拉满全屏（同 tabbar 方案） */
  z-index: 100;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: 12px;
  /* 雾：中心在底部中央偏下，向上/向两角逐渐透明 */
  background: radial-gradient(130% 145% at 50% 122%,
    var(--hdr-c2) 0%, var(--hdr-c2) 30%,
    var(--hdr-c2-70) 62%, var(--hdr-c2t) 95%);
  color: #fff;
}

/* v2.7：头部吸顶后给页面内容让位（含刘海屏安全区）；无头部页不受影响 */
body.has-hdr {
  padding-top: calc(var(--hdr-h) + env(safe-area-inset-top, 0px));
}

.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .5px;
}

.about { position: relative; }
.about-summary {
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 999px;
  user-select: none;
}
.about-summary::-webkit-details-marker { display: none; }
.about[open] .about-summary { background: rgba(255, 255, 255, .15); }
.about-body {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(86vw, 320px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
  padding: 14px 16px;
}
.about-body p { margin: 0; font-size: 13px; color: var(--text-soft); }

/* ===== 筛选栏（v2.4：去吸顶，与整页一体滚动） ===== */
.filters {
  position: static;
  background: var(--bg);
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.filter-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}
.field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
/* F-12：密码框眼睛图标（明文/密文切换） */
.pw-input-wrap { position: relative; display: flex; align-items: center; }
.pw-input-wrap input { width: 100%; padding-right: 40px; }
.pw-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  cursor: pointer; font-size: 18px; opacity: .5; user-select: none; -webkit-user-select: none;
}
.pw-eye.on { opacity: 1; }
.field-label { font-size: 12px; color: var(--text-soft); }
.select, .search {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
}
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236b7280' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 30px;
}
.search-field { margin-bottom: 10px; }

/* 标签 chips */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: all .15s ease;
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== 结果计数 ===== */
.result-count {
  margin: 10px 16px 0;
  font-size: 12px;
  color: var(--text-soft);
}

/* ===== 列表 ===== */
.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 24px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.card-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #eef0f2;
  overflow: hidden;
}
.card-cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.card-body { padding: 14px; }
.card-price {
  font-size: 15px;
  font-weight: 700;
  color: #b45309;
}
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.city-badge {
  display: inline-block;
  font-size: 12px;
  color: var(--primary-strong);
  background: #e6f4f1;
  border-radius: 6px;
  padding: 2px 8px;
}
.card-name {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}
.card-summary {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-src {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-soft);
  opacity: .85;
}
.meta-dot { color: var(--border); }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.badge-diff {
  font-size: 12px;
  background: var(--gray-bg);
  color: var(--text);
  border-radius: 6px;
  padding: 2px 8px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.card-tag {
  font-size: 12px;
  color: var(--text-soft);
  background: var(--bg);
  border-radius: 6px;
  padding: 2px 8px;
}

/* 状态徽章 */
.badge {
  display: inline-block;
  font-size: 12px;
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 500;
}
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-yellow { color: var(--yellow); background: var(--yellow-bg); }
.badge-gray { color: var(--gray); background: var(--gray-bg); }
.badge-darkgray { color: var(--darkgray); background: var(--darkgray-bg); }

/* ===== 状态提示 ===== */
.state-msg {
  text-align: center;
  color: var(--text-soft);
  font-size: 14px;
  padding: 40px 16px;
}
.state-msg.error { color: #b91c1c; }
.state-msg .retry {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 16px;
  border: 1px solid var(--primary);
  color: var(--primary);
  background: #fff;
  border-radius: 8px;
  cursor: pointer;
}

/* 加载中旋转 */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  vertical-align: -4px;
  margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 加载更多 ===== */
.loadmore-wrap { padding: 0 16px 32px; text-align: center; }
.loadmore {
  width: 100%;
  height: 44px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

/* ===== 详情弹层 ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .45);
}
.modal-panel {
  position: relative;
  margin-top: auto;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px 16px 0 0;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .2s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  border: none;
  background: var(--gray-bg);
  color: var(--text-soft);
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.modal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.modal-title { margin: 0 0 10px; font-size: 19px; font-weight: 700; padding-right: 36px; }
.modal-summary { margin: 0 0 14px; color: var(--text-soft); font-size: 14px; }
.modal-info { margin: 0 0 14px; display: grid; gap: 8px; }
.modal-info > div { display: flex; gap: 10px; font-size: 14px; }
.modal-info dt { width: 64px; flex: none; color: var(--text-soft); margin: 0; }
.modal-info dd { margin: 0; }
.modal-section { margin-bottom: 14px; }
.modal-section h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-soft); font-weight: 600; }
.modal-section p { margin: 0; font-size: 14px; }
.modal-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.modal-tags .card-tag { background: var(--bg); }

.btn-primary {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 18px;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 12px;
  text-decoration: none;
}
.btn-primary:active { background: var(--primary-strong); }

/* ===== 桌面端居中（移动端优先） ===== */
@media (min-width: 640px) {
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 24px rgba(0, 0, 0, .05); }
  .app-header { border-radius: 0; }
}

/* ===== 承接方机构资料编辑弹窗（我的页 账号设置 → 机构资料） ===== */
.ml-modal {
  position: fixed; inset: 0; background: rgba(8,28,18,.5); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; z-index: 200;
}
.ml-modal.show { display: flex; }
.ml-modal .box {
  background: #fff; border-radius: 16px; padding: 24px 22px;
  max-width: 340px; width: 90%; text-align: center;
}
.ml-modal .box h3 { font-size: 16px; font-weight: 800; color: #1a2b23; margin: 0 0 8px; }
.ml-modal .b-row { display: flex; gap: 10px; }
.ml-modal .b1, .ml-modal .b2, .ml-modal .b3 {
  flex: 1; padding: 11px; border-radius: 10px; font-size: 13.5px; font-weight: 700;
  cursor: pointer; border: none; font-family: inherit;
}
.ml-modal .b1 { background: #f4f7f5; color: #5d6b64; }
.ml-modal .b2 { background: #1f6b4a; color: #fff; }
.ml-modal .b3 { background: rgba(192,57,43,.1); color: #c0392b; }
.op-box { text-align: left !important; max-width: 340px; }
.op-box h3 { text-align: center; }
.op-f { margin-bottom: 12px; }
.op-f label { display: block; font-size: 12px; color: #5d6b64; margin-bottom: 4px; font-weight: 600; }
.op-f input, .op-f select, .op-f textarea {
  width: 100%; box-sizing: border-box; border: 1px solid #e2e8e4; border-radius: 9px;
  padding: 9px 10px; font-size: 13px; font-family: inherit; color: #1a2b23;
  background: #fafbfa; outline: none;
}
.op-f input:focus, .op-f select:focus, .op-f textarea:focus { border-color: #1f6b4a; }
.op-f textarea { resize: vertical; }
.op-err { color: #c0392b; font-size: 12px; margin: -4px 0 10px; }
