/* zx 家装助手 — 移动端优先响应式样式 */
:root {
  --bg: #f4f6f5; --card: #fff; --ink: #22302b; --sub: #6b7a74;
  --brand: #1f6f54; --brand-2: #2d9a75; --brand-soft: #e3f2ec;
  --warn: #d97706; --bad: #dc2626; --line: #e5eae8;
  --corp: #1f6f54; --main: #b45309; --self: #6d28d9; --misc: #64748b;
  --radius: 14px; --shadow: 0 1px 3px rgba(20,40,30,.08);
  --tb-h: 52px; --tab-h: 58px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  padding-top: var(--tb-h); padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); text-decoration: none; }

/* ---- 顶栏 ---- */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--tb-h); z-index: 90;
  display: flex; align-items: center; justify-content: space-between; padding: 0 14px;
  background: linear-gradient(135deg, #1f6f54, #2d9a75); color: #fff;
  box-shadow: var(--shadow);
}
.tb-title { font-weight: 700; font-size: 16px; letter-spacing: .5px; }
.tb-right { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 13px; opacity: .95; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn {
  background: rgba(255,255,255,.16); color: #fff; border: none; border-radius: 8px;
  padding: 4px 10px; font-size: 13px;
}
.sync-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.sync-ok { background: #a7f3d0; } .sync-busy { background: #fcd34d; } .sync-err { background: #fca5a5; }

/* ---- 底部导航 ---- */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); z-index: 90; display: flex;
  background: #fff; border-top: 1px solid var(--line);
}
#tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--sub); font-size: 11px; gap: 2px;
}
#tabbar a i { font-style: normal; font-size: 20px; line-height: 1; }
#tabbar a.on { color: var(--brand); font-weight: 600; }

/* ---- 页面容器 ---- */
#page { max-width: 860px; margin: 0 auto; padding: 14px 14px 30px; }
@media (min-width: 700px) { #page { padding: 20px 20px 40px; } }

.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px; margin-bottom: 14px;
}
.card h3 { margin: 0 0 10px; font-size: 15.5px; display: flex; align-items: center; justify-content: space-between; }
.card h3 .hint { font-size: 12px; color: var(--sub); font-weight: 400; }
.muted { color: var(--sub); font-size: 12.5px; }
.big { font-size: 24px; font-weight: 700; }
.row { display: flex; align-items: center; gap: 8px; }
.spread { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: repeat(4, 1fr); } }

/* ---- 按钮/输入 ---- */
.btn {
  border: none; border-radius: 10px; padding: 8px 14px; background: var(--brand); color: #fff;
  font-size: 14px; cursor: pointer;
}
.btn.gray { background: #eef1f0; color: var(--ink); }
.btn.warn { background: var(--warn); }
.btn.bad { background: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .5; }
input[type=text], input[type=number], input[type=password], input[type=date], select, textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 7px 9px; background: #fff; width: 100%;
  outline-color: var(--brand-2);
}
textarea { resize: vertical; min-height: 70px; }
.seg { display: flex; background: #eef1f0; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button {
  flex: 1; border: none; background: transparent; padding: 6px 4px; border-radius: 8px;
  color: var(--sub); font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line);
  font-size: 13px; color: var(--sub); cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.badge {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; color: #fff;
  background: var(--misc); vertical-align: middle;
}
.badge.corp { background: var(--corp); } .badge.main { background: var(--main); }
.badge.self { background: var(--self); } .badge.misc { background: var(--misc); }
.badge.aux { background: #0891b2; }
.split-chip { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; border-radius: 10px;
  padding: 1px 7px; font-size: 11.5px; margin-left: 5px; cursor: pointer; }
.split-chip:hover { background: #bae6fd; }
.badge.opt { background: #94a3b8; }
.badge.ok { background: #16a34a; } .badge.no { background: var(--bad); } .badge.todo { background: #94a3b8; }

/* ---- 总览 ---- */
.hero { background: linear-gradient(135deg, #1f6f54, #2d9a75); color: #fff; }
.hero .big { font-size: 30px; }
.hero .muted { color: rgba(255,255,255,.75); }
.splitbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: 10px 0 6px; }
.splitbar div { height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--sub); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; }
.mod-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.mod-row:last-child { border-bottom: none; }
.mod-name { width: 92px; flex: 0 0 auto; font-size: 13.5px; }
.mod-bar { flex: 1; height: 10px; background: #eef1f0; border-radius: 5px; overflow: hidden; }
.mod-bar div { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-2)); border-radius: 5px; }
.mod-amt { width: 88px; text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; flex: 0 0 auto; }

/* ---- 清单 ---- */
.item {
  border-bottom: 1px solid var(--line); padding: 9px 0;
}
.item:last-child { border-bottom: none; }
.item.off .item-main { opacity: .45; }
.item-main { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.item-check {
  width: 20px; height: 20px; flex: 0 0 auto; margin-top: 2px; border-radius: 6px;
  border: 2px solid #cbd5d1; background: #fff; position: relative;
}
.item.done .item-check { background: var(--brand); border-color: var(--brand); }
.item.done .item-check::after {
  content: "✓"; color: #fff; font-size: 13px; position: absolute; top: -2px; left: 2.5px;
}
.item-name { font-size: 14.5px; }
.item-spec { font-size: 12px; color: var(--sub); }
.item-sub { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-edit { display: none; padding: 8px 0 4px 30px; gap: 8px; flex-wrap: wrap; }
.item.open .item-edit { display: flex; }
.item-edit label { font-size: 12px; color: var(--sub); display: flex; flex-direction: column; gap: 3px; }
.item-edit input, .item-edit select { width: 110px; }
.sticky-sum {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); z-index: 40;
  background: var(--brand); color: #fff; border-radius: 12px; padding: 8px 14px; margin: 10px 0;
  display: flex; justify-content: space-between; align-items: center; box-shadow: var(--shadow);
  font-variant-numeric: tabular-nums;
}

/* ---- 采购/进度/验收/付款 ---- */
.purch-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.purch-row:last-child { border-bottom: none; }
.purch-main { display: flex; align-items: center; gap: 9px; flex: 1; min-width: 180px; cursor: pointer; }
.purch-edit { display: flex; gap: 6px; flex-wrap: wrap; width: 100%; padding-left: 29px; }
.purch-edit input, .purch-edit select { width: 120px; }
.over { color: var(--bad); font-weight: 600; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 6px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 3px solid #cbd5d1;
}
.tl-item.done::before { border-color: var(--brand); background: var(--brand); }
.acc-ok { color: #16a34a; } .acc-no { color: var(--bad); }
.pay-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pay-row:last-child { border-bottom: none; }

/* ---- 日志 ---- */
.photo-grid { display: flex; gap: 8px; flex-wrap: wrap; }
.photo-grid img, .photo-grid .ph-add {
  width: 74px; height: 74px; object-fit: cover; border-radius: 10px; background: #eef1f0;
  border: 1px solid var(--line); cursor: pointer;
}
.ph-add { display: flex; align-items: center; justify-content: center; font-size: 26px; color: var(--sub); }
.log-item { border-bottom: 1px solid var(--line); padding: 12px 0; }
.log-item:last-child { border-bottom: none; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 200; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.viewer img { max-width: 96vw; max-height: 96vh; will-change: transform; transition: transform .12s; }
.viewer-bar {
  position: absolute; bottom: calc(22px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  display: flex; gap: 8px; align-items: center; background: rgba(20,30,26,.72);
  border-radius: 999px; padding: 6px 12px; cursor: default;
}
.viewer-bar button { border: none; background: rgba(255,255,255,.16); color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.viewer-title { color: #fff; font-size: 12.5px; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 700px) { .plan-grid { grid-template-columns: repeat(4, 1fr); } }
.plan-item img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); background: #eef1f0; cursor: zoom-in; display: block;
}
.plan-title { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-add-big {
  border: 2px dashed var(--line); border-radius: 12px; min-height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--sub); cursor: pointer; gap: 4px; font-size: 30px; background: #fff;
}
.ph-add-big span { font-size: 13px; }

/* ---- 弹层/Toast ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,25,20,.45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  background: #fff; width: 100%; max-width: 640px; max-height: 86vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 700px) {
  .modal-mask { align-items: center; }
  .modal { border-radius: 18px; }
}
.modal h2 { margin: 0 0 4px; font-size: 17px; padding-right: 30px; }
.modal .close {
  position: absolute; right: 14px; top: 12px; border: none; background: #eef1f0; color: var(--sub);
  width: 28px; height: 28px; border-radius: 50%; font-size: 15px; cursor: pointer;
}
.modal-mask { position: fixed; }
.modal-wrap { position: relative; }
#toastRoot { position: fixed; top: calc(var(--tb-h) + 10px); left: 0; right: 0; z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(30,40,36,.92); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 13.5px;
  max-width: 86vw; animation: fadein .2s;
}
.toast.err { background: rgba(180,30,30,.95); }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

/* ---- 表格（公司榜/三档）---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 8px 6px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th { color: var(--sub); font-weight: 500; cursor: pointer; user-select: none; }
.tbl th.on { color: var(--brand); font-weight: 700; }
.tbl tr.company { cursor: pointer; }
.tbl tr.company:active { background: var(--brand-soft); }
@media (min-width: 700px) { .tbl { font-size: 14px; } }

/* ---- 更多入口 ---- */
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .menu-grid { grid-template-columns: repeat(4, 1fr); } }
.menu-card {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink); font-size: 13.5px;
}
.menu-card i { font-style: normal; font-size: 28px; }
.menu-card small { color: var(--sub); font-size: 11px; }

/* ---- 地图 ---- */
#map { height: 58vh; border-radius: var(--radius); z-index: 1; background: #dde5e2; }
.store-li { padding: 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.store-li:last-child { border-bottom: none; }
.pin { display: flex; align-items: center; justify-content: center; font-size: 15px; color: #fff;
  width: 30px; height: 30px; border-radius: 50% 50% 50% 4px; transform: rotate(-45deg);
  background: var(--brand); box-shadow: var(--shadow); }
.pin span { transform: rotate(45deg); }
.leaflet-container { font: inherit; }
.amap-attrib { font-size: 10px; }

/* ---- 避坑 ---- */
.pit { border-bottom: 1px solid var(--line); padding: 10px 0; }
.pit:last-child { border-bottom: none; }
.pit b { font-size: 14px; }
.pit .sol { font-size: 13px; margin-top: 3px; }
.pit .ev { font-size: 12px; color: var(--warn); margin-top: 2px; }
.confirm-row { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.confirm-row:last-child { border-bottom: none; }
.confirm-row .item-check { margin-top: 3px; }
.confirm-row.done .cf-name { text-decoration: line-through; color: var(--sub); }
progress { width: 100%; height: 8px; accent-color: var(--brand); }

/* ---- 登录 ---- */
.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-logo { text-align: center; font-size: 44px; }
.login-box { background: #fff; border-radius: 18px; padding: 24px 20px; box-shadow: var(--shadow); }
.login-box h1 { font-size: 19px; margin: 0 0 4px; text-align: center; }
.login-box .muted { text-align: center; display: block; margin-bottom: 16px; }
.login-box input { margin-bottom: 12px; }
.login-box .btn { width: 100%; padding: 11px; }
.empty { text-align: center; color: var(--sub); padding: 30px 0; }


/* ===== 户型与建模 / 现场补量 / 渲染图 ===== */
.ver { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.ver:last-child { border-bottom: none; }
.tag { background: #eef1f0; color: var(--sub); border-radius: 6px; padding: 2px 7px; font-size: 11.5px; white-space: nowrap; }
.tag.warn { background: #fef3c7; color: #92400e; }
.tag.ok { background: #dcfce7; color: #166534; }
.sv-warn { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; line-height: 1.65; }
.sv-group { margin: 14px 2px 6px; font-weight: 700; font-size: 14px; }
.sv-item { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 10px; }
.sv-item.sv-done { border-color: #86efac; }
.sv-item.sv-conflict { border-color: #fca5a5; }
.sv-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.sv-id { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand); }
.sv-title { font-size: 14px; font-weight: 600; }
.sv-room { font-size: 11.5px; color: var(--sub); }
.sv-chip { margin-left: auto; font-size: 11.5px; border-radius: 999px; padding: 2px 9px; background: #eef1f0; color: var(--sub); }
.sv-chip.sv-done { background: #dcfce7; color: #166534; }
.sv-chip.sv-conflict { background: #fee2e2; color: #991b1b; }
.sv-chip.sv-confirmed { background: #dbeafe; color: #1e3a8a; }
.sv-chip.sv-blocked { background: #fef3c7; color: #92400e; }
.sv-line { font-size: 12.5px; margin-top: 4px; line-height: 1.65; }
.sv-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sv-f { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--sub); }
.sv-f input, .sv-f select { width: 118px; }
.sv-item .photo-grid img, .sv-item .photo-grid .ph-add { width: 76px; height: 76px; }
.rv-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.rv-item { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.rv-item img { width: 100%; display: block; aspect-ratio: 16 / 10; object-fit: cover; background: #eef1f0; }
.rv-cap { padding: 6px 8px; }
.rv-slot { border: 1px dashed #cbd5e1; border-radius: 12px; min-height: 96px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 10px; background: #fafafa; color: var(--sub); }
.rv-slot b { color: var(--ink); font-size: 13px; }

/* ===== 毛坯模型 3D 查看器 ===== */
.v3-wrap{position:relative;width:100%;height:62vh;min-height:300px;border-radius:12px;overflow:hidden;background:#e7ebf0;touch-action:none;user-select:none;-webkit-user-select:none}
.v3-wrap.expanded{position:fixed;inset:0;height:100vh;width:100vw;border-radius:0;z-index:1200}
.v3-wrap canvas{display:block}
.v3-status{position:absolute;left:10px;top:10px;padding:6px 10px;border-radius:8px;background:rgba(17,22,28,.72);color:#fff;font-size:12.5px;z-index:3}
.v3-tools{position:absolute;right:8px;top:8px;display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end;max-width:72%;z-index:3}
.v3-t{padding:7px 11px;border-radius:9px;border:1px solid rgba(0,0,0,.12);background:rgba(255,255,255,.92);color:#1f2937;font-size:12.5px;box-shadow:0 1px 4px rgba(0,0,0,.10)}
.v3-t:active{background:#e5e7eb}
.v3-zoom{position:absolute;right:8px;bottom:170px;display:grid;gap:6px;z-index:3}
.v3-pad{position:absolute;right:8px;bottom:8px;display:grid;grid-template-columns:repeat(3,46px);grid-template-rows:repeat(3,46px);gap:6px;z-index:3}
.v3-pad .v3-up{grid-area:1/2}.v3-pad .v3-left{grid-area:2/1}.v3-pad .v3-right{grid-area:2/3}.v3-pad .v3-down{grid-area:3/2}
.v3-b{width:46px;height:46px;border-radius:10px;border:1px solid rgba(0,0,0,.12);background:rgba(255,255,255,.92);color:#1f2937;font-size:18px;line-height:1;display:flex;align-items:center;justify-content:center;box-shadow:0 1px 4px rgba(0,0,0,.12)}
.v3-b:active{background:#d8dde4}
.v3-hint{position:absolute;left:8px;bottom:8px;padding:5px 9px;border-radius:8px;background:rgba(255,255,255,.84);color:#374151;font-size:11.5px;max-width:54%;z-index:3}

/* 装修预览：配色卡 */
.pal-grid { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 4px; }
.pal-item { display: flex; align-items: center; gap: 8px; }
.pal-chip { width: 26px; height: 26px; border-radius: 6px; border: 1px solid rgba(0,0,0,.14); flex: none; }
.pal-txt { font-size: 12px; line-height: 1.25; color: #52525b; }
.pal-txt b { font-size: 11px; color: #18181b; letter-spacing: .2px; }
