/* 量房管家 · 样式（手机优先，桌面查看模式自动适配） */
:root {
  --bg: #f2f5f9;
  --surface: #fff;
  --surface-2: #f7f9fc;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --text-2: #52607a;
  --text-3: #8b98ad;
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-soft: #e8efff;
  --ok: #059669;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 4px 18px rgba(15, 23, 42, .1);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --top-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --surface: #131c2e; --surface-2: #182238; --line: #26334d;
    --line-strong: #35456a; --text: #e8eefb; --text-2: #a4b2cc; --text-3: #7c8aa6;
    --brand: #4f83ff; --brand-2: #3b6fe8; --brand-soft: #1b2a4d;
    --warn-bg: #3a2a08; --warn: #fbbf24;
    --shadow: 0 4px 18px rgba(0,0,0,.4); --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font: 400 15px/1.5 "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
.spacer { flex: 1; }

/* ---------- 框架 ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  height: calc(var(--top-h) + var(--safe-t));
  padding: var(--safe-t) 10px 0;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
body.no-topbar .topbar { display: none; }
.title-wrap { min-width: 0; flex: 1; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 4px; align-items: center; }

.icon-btn {
  width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-2); border-radius: 10px; cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn.sm { width: 32px; height: 32px; }

.screen { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.screen.pad { padding: 12px; padding-bottom: calc(16px + var(--safe-b)); }
.screen.center { display: grid; place-items: center; padding: 20px; }

.tabbar {
  display: flex; border-top: 1px solid var(--line); background: var(--surface);
  padding-bottom: var(--safe-b); z-index: 20;
}
.tab {
  flex: 1; border: 0; background: transparent; padding: 7px 0 5px; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; cursor: pointer;
}
.tab.active { color: var(--brand); }
.tab svg { width: 21px; height: 21px; }

/* ---------- 通用组件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: var(--radius-sm); font-weight: 650; font-size: 15px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  cursor: pointer; white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:active { background: var(--brand-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn.sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-3); margin-bottom: 5px; }
input[type=text], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 16px; /* 16px 防止 iOS 聚焦缩放 */
}
textarea { min-height: 76px; resize: vertical; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px; margin-bottom: 10px;
}
.card.tap:active { background: var(--surface-2); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap; flex: 0 0 auto;
}
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.chip.ok { background: #e7f8f0; color: var(--ok); border-color: #b9ead4; }

.empty { text-align: center; color: var(--text-3); padding: 46px 16px; font-size: 14px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.tiny { font-size: 12px; color: var(--text-3); }

/* 应用内相机（不依赖系统文件选择器） */
.cam-overlay {
  position: fixed; inset: 0; z-index: 95; background: #000;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.cam-overlay video {
  width: 100%; height: 100%; display: block;
  /* contain：预览不裁切，和拍出来的照片一致（之前 cover 会看着"焦距很大"） */
  object-fit: contain;
  transition: transform .08s linear;
}
.cam-zoom {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(112px + var(--safe-b));
  width: min(64%, 320px);
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.45); border-radius: 999px; padding: 8px 14px;
}
.cam-zoom input[type="range"] { flex: 1; accent-color: #fff; height: 22px; background: transparent; }
.cam-zoom-label {
  color: #fff; font-size: 12.5px; min-width: 38px; text-align: center;
  font-variant-numeric: tabular-nums;
}

/* 镜头 / 画幅 面板 */
.cam-gear {
  position: absolute; right: 12px; top: calc(var(--safe-t) + 10px);
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(0,0,0,.45); color: #fff; border: 1px solid rgba(255,255,255,.25);
  font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
}
.cam-panel {
  position: absolute; left: 12px; right: 12px; top: calc(var(--safe-t) + 56px);
  background: rgba(12,16,26,.96); border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px; padding: 12px; color: #fff; z-index: 2;
  max-height: 54vh; overflow: auto;
}
.cam-panel-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.cam-devlist { display: grid; gap: 6px; }
.cam-dev {
  text-align: left; font-size: 12.5px; padding: 8px 10px; border-radius: 9px;
  background: rgba(255,255,255,.08); color: #e5e7eb;
  border: 1px solid rgba(255,255,255,.12); cursor: pointer;
}
.cam-dev.active { background: rgba(59,130,246,.35); border-color: #3b82f6; color: #fff; }
.cam-panel-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.cam-panel .tiny { color: #94a3b8; }
.cam-tip {
  position: absolute; top: calc(var(--safe-t) + 14px); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.55); color: #fff; font-size: 12.5px; padding: 6px 12px;
  border-radius: 999px; max-width: 88%; text-align: center; line-height: 1.4;
}
.cam-bar {
  position: absolute; left: 0; right: 0; bottom: calc(22px + var(--safe-b));
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
}
.cam-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.16); color: #fff; font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.cam-shutter {
  width: 74px; height: 74px; border-radius: 50%; border: 4px solid #fff;
  background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.cam-shutter span { display: block; width: 58px; height: 58px; border-radius: 50%; background: #fff; }
.cam-shutter:active span { transform: scale(.93); }

/* 键值行（清单、我的等页面用） */
.kv { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13px; color: var(--text-2); }
.kv b { color: var(--text); font-weight: 700; }

/* ---------- 登录 ---------- */
.auth { width: 100%; max-width: 380px; }
.auth .logo { text-align: center; margin-bottom: 18px; }
.auth .logo .mark { font-size: 44px; }
.auth .logo h2 { margin: 6px 0 2px; font-size: 21px; }
.auth .logo p { margin: 0; color: var(--text-3); font-size: 13px; }
.auth-switch { text-align: center; margin-top: 12px; font-size: 13.5px; color: var(--text-2); }
.auth-switch button { border: 0; background: 0; color: var(--brand); font-weight: 650; cursor: pointer; padding: 4px; }

/* ---------- 项目列表 ---------- */
.proj { display: flex; gap: 12px; align-items: flex-start; }
.proj .main { flex: 1; min-width: 0; }
.proj .name { font-weight: 700; font-size: 16px; margin-bottom: 3px; word-break: break-all; }
.proj .meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }
.proj .ops { display: flex; gap: 2px; }

.fab {
  position: fixed; right: 18px; bottom: calc(76px + var(--safe-b)); z-index: 15;
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; box-shadow: var(--shadow-lg); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.fab svg { width: 26px; height: 26px; stroke-width: 2.2; }

/* ---------- 房间 / 照片 ---------- */
.room-head { display: flex; align-items: center; gap: 8px; margin: 16px 0 8px; }
.room-head h3 { margin: 0; font-size: 15px; font-weight: 750; }
.room-head .count { font-size: 12px; color: var(--text-3); }
.room-head .ops { margin-left: auto; display: flex; gap: 2px; }

.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.photo-cell { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); min-width: 0; }
.photo-cell img, .photo-cell canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-cell .badge {
  position: absolute; left: 4px; top: 4px; background: rgba(15,23,42,.72); color: #fff;
  font-size: 10px; padding: 1px 5px; border-radius: 6px;
}
.photo-cell .pick {
  position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(15,23,42,.35); display: grid; place-items: center;
}
.photo-cell.sel { outline: 3px solid var(--brand); outline-offset: -3px; }
.photo-cell.sel .pick { background: var(--brand); }
.photo-cell.sel .pick::after { content: "✓"; color: #fff; font-size: 12px; line-height: 1; }
.photo-add {
  aspect-ratio: 1; border: 1.5px dashed var(--line-strong); border-radius: 10px;
  display: grid; place-items: center; color: var(--text-3); background: var(--surface);
  cursor: pointer; font-size: 11.5px; gap: 2px;
}
.photo-add svg { width: 24px; height: 24px; }

.selectbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface);
  border-top: 1px solid var(--line); padding: 10px 12px calc(10px + var(--safe-b));
  display: flex; gap: 8px; align-items: center; box-shadow: 0 -6px 24px rgba(15,23,42,.08);
}
.selectbar .n { font-size: 13px; color: var(--text-2); margin-right: 4px; }

/* ---------- 照片标注编辑 ---------- */
.editor { position: relative; background: #0b1220; height: 100%; overflow: hidden; }
.editor canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.editor .hint {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%);
  background: rgba(15,23,42,.8); color: #e5e7eb; padding: 6px 12px; border-radius: 999px;
  font-size: 12.5px; pointer-events: none; max-width: 92%; text-align: center;
}
.editor-tools {
  position: absolute; left: 10px; bottom: calc(12px + var(--safe-b)); display: flex; gap: 8px; z-index: 5;
}
.etool {
  width: 52px; height: 52px; border-radius: 14px; border: 1px solid rgba(255,255,255,.16);
  background: rgba(15,23,42,.72); color: #e5e7eb; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1px; font-size: 10px; cursor: pointer;
  backdrop-filter: blur(8px);
}
.etool.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.etool svg { width: 20px; height: 20px; }
.editor-fab {
  position: absolute; right: 10px; bottom: calc(12px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; z-index: 5;
}
.editor-fab button {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16);
  background: rgba(15,23,42,.72); color: #e5e7eb; cursor: pointer; display: grid; place-items: center;
  backdrop-filter: blur(8px);
}
.editor-fab button.bt { background: #0ea5e9; border-color: #0ea5e9; }
.editor-fab button.bt.on { background: #22c55e; border-color: #22c55e; }

/* ---------- 弹层 ---------- */
.sheet-wrap, .modal-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-mask, .modal-mask { position: absolute; inset: 0; background: rgba(15,23,42,.46); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 8px 14px calc(16px + var(--safe-b));
  max-height: 82vh; overflow-y: auto; box-shadow: var(--shadow-lg);
}
.sheet::before { content: ""; display: block; width: 38px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 4px auto 10px; }
.sheet h3 { margin: 2px 0 12px; font-size: 16px; }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px)); background: var(--surface); border-radius: 16px;
  padding: 16px; box-shadow: var(--shadow-lg); max-height: 84vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 10px);
  background: rgba(15,23,42,.92); color: #f8fafc; padding: 9px 16px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: .2s;
  z-index: 90; max-width: calc(100% - 40px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
/* 底部弹层打开时，提示条挪到顶部，避免压住输入框 */
.toast.top { bottom: auto; top: calc(var(--top-h) + var(--safe-t) + 12px); transform: translate(-50%, -10px); }
.toast.top.show { transform: translate(-50%, 0); }

.sync-chip {
  position: fixed; left: 12px; bottom: calc(86px + var(--safe-b)); z-index: 25;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 4px 10px; border-radius: 999px; font-size: 11.5px; color: var(--text-2);
  pointer-events: none;
}
body.viewer .sync-chip { bottom: 20px; left: 20px; }
.sync-chip.busy { color: var(--brand); }
.sync-chip.err { color: var(--danger); }

/* 颜色选择 */
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch.active { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--surface); }

/* 数值输入 */
.value-row { display: flex; gap: 8px; align-items: center; }
.value-row input { font-size: 22px; font-weight: 700; text-align: center; letter-spacing: .5px; }
.value-row .unit { font-size: 14px; color: var(--text-3); font-weight: 700; }
.bt-state { font-size: 12px; color: var(--text-3); margin: 6px 0 10px; display: flex; align-items: center; gap: 6px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); }
.dot.on { background: var(--ok); }
.dot.err { background: var(--danger); }
.reading { font-size: 13px; color: var(--brand); font-weight: 650; }

/* ---------- 工具箱 ---------- */
.tools-screen { max-width: 1080px; margin: 0 auto; }
.tools-hero {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 22px 22px 20px; margin-bottom: 14px;
  border: 1px solid var(--line); border-radius: 18px;
  background:
    radial-gradient(420px 180px at 92% 0%, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%),
    linear-gradient(135deg, var(--surface), var(--surface-2));
}
.tools-hero::after {
  content: ""; position: absolute; right: -26px; bottom: -46px; width: 180px; height: 180px;
  border: 26px solid color-mix(in srgb, var(--brand) 8%, transparent); border-radius: 50%;
  pointer-events: none;
}
.tools-kicker { font-size: 10px; font-weight: 800; letter-spacing: .18em; color: var(--brand); margin-bottom: 5px; }
.tools-hero h2 { margin: 0; font-size: 23px; letter-spacing: -.02em; }
.tools-hero p { max-width: 620px; margin: 7px 0 0; color: var(--text-2); font-size: 12.5px; line-height: 1.65; }
.tools-counter {
  position: relative; z-index: 1; flex: 0 0 auto; display: flex; flex-direction: column; align-items: center;
  min-width: 76px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}
.tools-counter strong { font-size: 30px; line-height: 1; color: var(--brand); letter-spacing: -.04em; }
.tools-counter span { margin-top: 4px; font-size: 10.5px; color: var(--text-3); }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 12px; }
.tool-card {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 15px;
  padding: 17px 18px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text); text-align: left; font: inherit;
  cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tool-card.live:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card.live:active { transform: translateY(0); }
.tool-card.soon { cursor: default; background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); opacity: .78; }
.tool-icon {
  width: 58px; height: 58px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 15px; color: var(--brand);
  background: linear-gradient(145deg, var(--brand-soft), color-mix(in srgb, var(--brand-soft) 35%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--brand) 18%, var(--line));
}
.tool-icon svg { width: 42px; height: 42px; }
.tool-icon.muted { color: var(--text-3); background: var(--surface-2); border-color: var(--line); }
.tool-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.tool-title { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; font-size: 16.5px; font-weight: 750; }
.tool-tag {
  display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 5px;
  font-size: 9.5px; font-weight: 750; letter-spacing: .02em;
  color: var(--brand); background: var(--brand-soft);
}
.tool-tag.soon-tag { color: var(--text-3); background: var(--surface-2); }
.tool-desc { color: var(--text-2); font-size: 12.5px; line-height: 1.65; }
.tool-meta { color: var(--text-3); font-size: 10.5px; }
.tool-arrow { color: var(--brand); font-size: 22px; line-height: 1; padding: 0 2px; }
.tools-note {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; padding: 12px 14px;
  border: 1px dashed color-mix(in srgb, var(--warn) 35%, var(--line)); border-radius: 12px;
  color: var(--text-2); font-size: 11.5px; line-height: 1.65;
  background: color-mix(in srgb, var(--warn-bg) 45%, var(--surface));
}
.tools-note b { flex: 0 0 auto; color: var(--warn); }

/* 工具全屏容器：上面一条返回条，下面是同源 iframe */
.screen.tool-screen {
  min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: #070b0f;
}
.tool-frame-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: calc(6px + var(--safe-t)) 10px 6px;
  background: #0b1118; color: #e9f0f7; border-bottom: 1px solid #22303d;
}
.tool-back, .tool-frame-open {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 9px; border: 1px solid #2b3a48; border-radius: 8px;
  background: rgba(255,255,255,.04); color: #c8d6e2; font-size: 11px; cursor: pointer;
}
.tool-back:hover, .tool-frame-open:hover { background: rgba(245,165,36,.12); border-color: rgba(245,165,36,.4); color: #ffd28b; }
.tool-back svg, .tool-frame-open svg { width: 16px; height: 16px; }
.tool-frame-title {
  flex: 1; min-width: 0; font-size: 13px; font-weight: 650; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tool-frame-title span { display: block; margin-top: 2px; color: #7f93a5; font-size: 9.5px; font-weight: 400; }
.tool-frame { flex: 1; width: 100%; min-height: 0; display: block; border: 0; background: #070b0f; }
@media (max-width: 640px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tools-hero { padding: 17px 16px 16px; align-items: flex-start; }
  .tools-hero h2 { font-size: 20px; }
  .tools-counter { display: none; }
  .tool-card { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 14px; }
  .tool-arrow { display: none; }
  .tool-icon { width: 48px; height: 48px; border-radius: 12px; }
  .tool-icon svg { width: 35px; height: 35px; }
  .tool-title { font-size: 15.5px; }
  .tool-frame-open span, .tool-frame-title span { display: none; }
  .tool-frame-open { padding: 0 8px; }
}

/* ---------- 桌面查看模式 ---------- */
body.viewer .tabbar { display: none; }
body.viewer .screen.pad { width: 100%; max-width: 1240px; margin: 0 auto; padding: 18px; }
body.viewer .fab { bottom: 24px; }
.viewer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.viewer-grid .card { margin: 0; cursor: pointer; }
.viewer-grid .card:active { transform: none; }
.cover { aspect-ratio: 4/3; border-radius: 10px; overflow: hidden; background: var(--surface-2); margin-bottom: 10px; }
.cover img, .cover canvas { width: 100%; height: 100%; object-fit: cover; display: block; }
.viewer-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.viewer-photo { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; }
.viewer-photo img { width: 100%; display: block; }
.viewer-photo .cap { padding: 8px 10px; font-size: 12.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; }
.badge-mode { font-size: 11.5px; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 999px; font-weight: 650; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(5,8,15,.94); display: flex; flex-direction: column; }
.lb-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; color: #e5e7eb; }
.lb-btn {
  min-width: 38px; height: 34px; padding: 0 10px; border-radius: 9px; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.18);
  font-size: 15px; display: inline-flex; align-items: center; justify-content: center;
}
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-zoom { font-size: 12.5px; color: #cbd5e1; min-width: 44px; text-align: center; }
.lb-stage { flex: 1; overflow: hidden; display: grid; place-items: center; touch-action: none; cursor: grab; }
.lb-stage:active { cursor: grabbing; }
.lb-stage canvas { display: block; transition: transform .06s linear; }
@media (max-width: 767px) {
  .lb-bar { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .topbar h1 { font-size: 16px; }
}

/* ---------- 团队 / 提醒 ---------- */
.invite-box{display:flex;align-items:center;gap:10px;margin:12px 0 4px;padding:12px 14px;border-radius:14px;background:rgba(34,197,94,.10);border:1px solid rgba(34,197,94,.25)}
.invite-code{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:26px;font-weight:800;letter-spacing:4px;flex:1}
.member-row{display:flex;align-items:center;gap:10px;padding:10px 0;border-bottom:1px solid rgba(0,0,0,.06)}
.member-row:last-child{border-bottom:0}
.avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;background:#e6f6ec;color:#15803d;font-weight:700}
.badge-owner{display:inline-block;padding:1px 7px;border-radius:8px;background:rgba(59,130,246,.12);color:#1d4ed8;font-size:11px;margin-left:4px}
.badge-note{display:inline-block;padding:1px 7px;border-radius:8px;background:rgba(239,68,68,.12);color:#b91c1c;font-size:11px;font-weight:600;margin-left:4px}
.notes-bar{position:absolute;left:12px;bottom:96px;z-index:5}
.notes-chip{border:0;border-radius:999px;padding:8px 14px;background:#fff;box-shadow:0 6px 18px rgba(0,0,0,.18);font-size:13px;font-weight:600;color:#b91c1c}
.note-row{padding:10px 12px;border-radius:12px;background:#f8fafc;margin-bottom:8px}
.note-row.done{opacity:.55}
.note-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}
.note-text{font-size:14px;line-height:1.5;word-break:break-word}
.note-ops{display:flex;gap:8px;margin-top:8px}

.card.locked{opacity:.55}
.card.locked .name::after{content:" 🔒";font-size:13px}
.badge-lock{display:inline-block;padding:1px 7px;border-radius:8px;background:rgba(120,113,108,.16);color:#57534e;font-size:11px;margin-left:4px}
.badge-design{display:inline-block;padding:1px 7px;border-radius:8px;background:rgba(34,197,94,.14);color:#15803d;font-size:11px;font-weight:600;margin-left:4px}
.badge-claim{display:inline-block;padding:1px 7px;border-radius:8px;background:rgba(234,179,8,.18);color:#a16207;font-size:11px;font-weight:600;margin-left:4px}

/* 测量人对设计师提醒的回复 */
.note-reply {
  margin: 6px 0 2px;
  padding: 7px 10px;
  font-size: 13px;
  color: #065f46;
  background: #ecfdf5;
  border-left: 3px solid #059669;
  border-radius: 6px;
}