:root {
  --bg: #f2f5f3;
  --card: #ffffff;
  --ink: #122018;
  --muted: #6a7b70;
  --line: #e2ebe5;
  --brand: #1b7a4a;
  --brand-2: #0f5c38;
  --brand-soft: #e8f6ee;
  --warn: #c47a12;
  --danger: #c0392b;
  --ok: #1b7a4a;
  --radius: 16px;
  --shadow: 0 8px 24px rgba(18, 40, 28, 0.07);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 58px;
  --topbar-h: 56px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "SF Pro Display", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---- Auth ---- */
.auth-body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  position: relative;
}
.auth-admin-link {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  color: rgba(255,255,255,.92);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(8px);
}
.auth-admin-link:active { opacity: .85; }
.auth-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(31,122,76,.28), transparent 60%),
    radial-gradient(700px 360px at 100% 0%, rgba(196,122,18,.14), transparent 55%),
    linear-gradient(180deg, #0f5c38 0%, #1b7a4a 38%, #eef5f0 38%);
  z-index: 0;
}
.auth-card {
  position: relative; z-index: 1;
  width: min(400px, 100%);
  background: #fff;
  border-radius: 24px;
  padding: 28px 20px 22px;
  box-shadow: 0 20px 50px rgba(10, 40, 24, .18);
}
.auth-hero { text-align: center; margin-bottom: 18px; }
.auth-hero h1 { margin: 12px 0 4px; font-size: 22px; }
.auth-hero .muted { margin: 0; font-size: 13px; }
.mark {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #2f9b61, #176844);
  color: #fff; font-weight: 800;
}
.mark.lg {
  width: 64px; height: 64px; border-radius: 18px;
  margin: 0 auto; font-size: 26px;
  box-shadow: 0 10px 24px rgba(15, 92, 56, .35);
}
.auth-form { margin-top: 8px; }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input, .field textarea, .field select,
input[type=text], input[type=password], input[type=date], input[type=search], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #f7faf8;
  outline: none;
}
.field input:focus, textarea:focus, select:focus {
  border-color: #8fbfa2;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31,122,76,.12);
}
.btn {
  appearance: none; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #24945a, var(--brand-2));
  color: #fff; border-radius: 14px;
  padding: 13px 16px; font-weight: 700;
  min-height: 46px;
}
.btn:disabled { opacity: .65; }
.btn:active { transform: scale(.98); }
.btn.block { width: 100%; margin-top: 8px; }
.btn.lg { min-height: 50px; font-size: 16px; border-radius: 16px; }
.btn.ghost {
  background: #fff; color: var(--brand);
  border: 1px solid #c5ddcf;
}
.btn.warn { background: linear-gradient(180deg, #e0a03a, #b86a0c); }
.btn.danger { background: linear-gradient(180deg, #d65a4e, #a83228); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; min-height: 36px; }
.form-msg { color: var(--danger); margin: 10px 0 0; font-size: 14px; }

/* ---- App chrome ---- */
.app-body {
  min-height: 100dvh;
  padding-top: var(--safe-top);
  background: var(--bg);
}
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: 8px 12px;
  background: rgba(242,245,243,.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(0,0,0,.04);
}
.top-back {
  width: 36px; height: 36px; border: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 26px; line-height: 1;
  box-shadow: var(--shadow);
  cursor: pointer; flex: none;
}
.top-back[hidden] { display: none !important; }
.top-titles { flex: 1; min-width: 0; }
.topbar strong { display: block; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar small { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; gap: 6px; flex: none; align-items: center; }
.top-avatar {
  width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(27,122,74,.2); background: #eaf5ef;
}
.icon-btn, .linkish {
  border: 0; background: transparent; color: var(--brand);
  font-weight: 700; padding: 8px 10px; cursor: pointer; border-radius: 10px;
}
.icon-btn:active, .linkish:active { background: rgba(27,122,74,.08); }

.app-main {
  padding: 12px 14px 20px;
  max-width: 720px;
  margin: 0 auto;
  min-height: calc(100dvh - var(--topbar-h) - var(--safe-top));
}
body.has-tabbar .app-main {
  padding-bottom: calc(20px + var(--tabbar-h) + var(--safe-bottom));
}
body:not(.has-tabbar) .app-main {
  padding-bottom: calc(88px + var(--safe-bottom));
}

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 6px 18px var(--safe-bottom);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(0,0,0,.06);
  box-shadow: 0 -8px 24px rgba(0,0,0,.04);
}
.tabbar[hidden] { display: none !important; }
.tab-item {
  border: 0; background: transparent;
  display: grid; place-items: center; gap: 2px;
  color: var(--muted);
  font-size: 11px; font-weight: 700;
  cursor: pointer; border-radius: 14px;
  padding: 6px 0;
}
.tab-item .tab-ico { font-size: 18px; line-height: 1; }
.tab-item.active { color: var(--brand); background: var(--brand-soft); }

.card {
  background: var(--card);
  border: 1px solid rgba(0,0,0,.04);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

/* ---- Nearby ---- */
.loc-card {
  display: flex; gap: 12px; align-items: center;
  background: linear-gradient(135deg, #1b7a4a, #2f9b61);
  color: #fff; border: 0;
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 12px 28px rgba(15, 92, 56, .28);
}
.loc-card .pin {
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(255,255,255,.2);
  display: grid; place-items: center; font-size: 20px; flex: none;
}
.loc-body strong { display: block; font-size: 16px; }
.loc-body small { opacity: .9; font-size: 12px; }

.search-bar { margin-bottom: 8px; }
.search-field {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.05);
  border-radius: 14px;
  padding: 0 12px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.search-ico { color: var(--muted); font-size: 16px; }
.search-field input {
  border: 0; background: transparent; padding: 12px 0;
  box-shadow: none !important;
}
.filter-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.filter-chip {
  border: 0;
  background: #fff;
  border-radius: 14px;
  padding: 10px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  box-shadow: var(--shadow);
  text-align: center;
}
.filter-chip em {
  display: block;
  font-style: normal;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.filter-chip.active { color: #fff; }
.filter-chip.active em { color: #fff; }
.filter-chip.filter-all.active { background: #3d5248; }
.filter-chip.filter-unchecked.active { background: #c47a12; }
.filter-chip.filter-pass.active { background: #1b7a4a; }
.filter-chip.filter-fail.active { background: #c0392b; }

.section-title {
  margin: 14px 2px 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .02em;
}

.store-list, .hist-list, .type-list { display: grid; gap: 10px; }
.store-item, .hist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid rgba(0,0,0,.04);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  text-align: left; width: 100%;
  color: inherit;
}
.store-item:active, .hist-item:active, .type-card:active { transform: scale(.985); }
.store-main { flex: 1; min-width: 0; }
.store-item .row, .hist-item .row { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.store-item h3, .hist-item h3 { margin: 0; font-size: 15px; line-height: 1.35; }
.store-side {
  flex: none;
  display: grid;
  gap: 8px;
  justify-items: end;
  align-content: center;
}
.store-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.store-cta.cta-inspect {
  background: #e8f6ee;
  color: #1b7a4a;
}
.store-cta.cta-recheck {
  background: #fdecea;
  color: #a83228;
}
.store-cta.cta-again {
  background: #eef2f0;
  color: #44564c;
}
.dist {
  flex: none;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px; font-weight: 800;
}
.store-meta { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.store-meta-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.empty-box { padding: 36px 12px; }
.empty-tip { padding: 24px 8px; }

.badge {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 3px 8px;
  font-size: 11px; font-weight: 700;
  background: #eef2f0; color: #44564c;
}
.badge.ok { background: #e5f6ec; color: #176844; }
.badge.fail { background: #fdecea; color: #a83228; }
.badge.warn { background: #fff4e5; color: #9a5b08; }

.fill-progress { margin-top: 10px; display: grid; gap: 5px; }
.fill-progress-track {
  height: 8px; border-radius: 999px; background: #e6ece8; overflow: hidden;
}
.fill-progress-track i {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #2f8f57, #1b6b3a);
  width: 0; transition: width .25s ease;
}
.fill-progress-text { font-size: 12px; color: var(--muted); font-weight: 600; }
.form-fill-progress { margin-top: 10px; }
.form-fill-progress .fill-progress-track { height: 10px; }
.fill-progress-meta {
  display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap;
}
.auto-save-hint { font-size: 12px; color: var(--muted); }

/* ---- Store / type ---- */
.store-hero { padding: 16px; }
.store-hero-name { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
.kv { display: grid; gap: 8px; font-size: 14px; }
.kv.compact { gap: 6px; font-size: 13px; }
.kv div { display: flex; gap: 8px; }
.kv b { flex: none; color: var(--muted); font-weight: 500; min-width: 56px; }

.type-card {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  border: 0; cursor: pointer;
  border-radius: 18px;
  padding: 16px;
  color: #fff;
  box-shadow: var(--shadow);
}
.type-card.is-safe { background: linear-gradient(135deg, #1b7a4a, #2f9b61); }
.type-card.is-fire { background: linear-gradient(135deg, #d35400, #e74c3c); }
.type-card .type-ico {
  width: 44px; height: 44px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.22);
  font-size: 22px; flex: none;
}
.type-card strong { display: block; font-size: 17px; }
.type-card small { opacity: .88; font-size: 12px; }
.type-arrow { margin-left: auto; font-size: 28px; opacity: .8; line-height: 1; }

.type-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-pill {
  display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 14px; padding: 14px 12px;
  cursor: pointer; color: #fff; box-shadow: var(--shadow); text-align: left;
}
.type-ico {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.22); font-weight: 800; flex: none;
}
.type-tag {
  display: inline-flex; align-items: center;
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 800; color: #fff;
}
.tag-safe { background: #1b7a4a; }
.tag-fire { background: #d35400; }

/* ---- Form (app chips) ---- */
.form-top { margin-bottom: 10px; }
.form-top-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.cat-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 10px;
  margin: 0 -4px 8px;
  scrollbar-width: none;
}
.cat-chip-row::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: #fff;
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}
.cat-chip .chip-prog {
  font-size: 11px;
  color: var(--muted);
  background: #eef3ef;
  border-radius: 999px;
  padding: 2px 7px;
}
.cat-chip.active {
  background: var(--brand);
  color: #fff;
}
.cat-chip.active .chip-prog {
  background: rgba(255,255,255,.22);
  color: #fff;
}
.cat-chip.is-done .chip-prog {
  background: #c8f0d8;
  color: #0f5c38;
}
.cat-chip.active.is-done .chip-prog {
  background: rgba(255,255,255,.28);
  color: #fff;
}

.form-panels-card {
  background: transparent;
  margin-bottom: 8px;
}
.panel-cat-title {
  font-size: 14px;
  font-weight: 800;
  margin: 4px 2px 10px;
  color: var(--ink);
}
.check-panel { display: none; }
.check-panel.active { display: block; }

.check-item {
  background: #fff;
  border: 1px solid rgba(0,0,0,.04);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.check-item .label { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.seg { display: grid; gap: 8px; }
.seg-multi { grid-template-columns: 1fr 1fr; }
.seg-radio { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
.seg label {
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  background: #f7faf8;
  font-weight: 800;
  font-size: 15px;
  min-height: 48px;
  display: grid;
  place-items: center;
}
.seg input { display: none; }
.seg label.is-on-yes { background: #1b6b3a; border-color: #14532d; color: #fff; }
.seg label.is-on-no { background: #b42318; border-color: #912018; color: #fff; }

.rectify-photos {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.rectify-photos[hidden] { display: none !important; }
.photo-block { border-radius: 12px; padding: 10px; min-width: 0; }
.photo-block[data-kind="before"] { border: 1px solid #f0c4bc; background: #fdecea; }
.photo-block[data-kind="after"] { border: 1px solid #b7d9c4; background: #e8f6ee; }
.photo-head { font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.photo-block[data-kind="before"] .photo-head { color: #a83228; }
.photo-block[data-kind="after"] .photo-head { color: #176844; }
.photo-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin-bottom: 8px; }
.photo-grid:empty { display: none; margin: 0; }
.photo-thumb {
  position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,.7);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .photo-del {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; font-size: 14px; line-height: 22px; padding: 0; cursor: pointer;
}
.photo-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; cursor: pointer; background: rgba(255,255,255,.75) !important;
}
.photo-add input { display: none; }
.public-photos { margin-top: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.remark-input {
  margin-top: 8px; width: 100%;
  border: 1px dashed var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 13px; background: #fff;
  resize: vertical; min-height: 64px; line-height: 1.5;
  box-sizing: border-box;
}
/* AI 识别项：备注只作隐藏同步字段，避免与上方彩色结果重复 */
.remark-input.remark-ai-sync {
  display: none !important;
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.ai-remark-wrap { margin-top: 10px; }
.ai-remark-status {
  font-size: 12px; font-weight: 700; padding: 8px 10px;
  border-radius: 10px; margin-bottom: 8px;
}
.ai-remark-status.busy { background: #fff4e5; color: #9a5b08; }
.ai-remark-status.ok { background: #e5f6ec; color: #176844; }
.ai-remark-status.err { background: #fdecea; color: #a83228; }
.ai-inline {
  background: #fff; border: 1px solid #cfe5d8;
  border-radius: 16px; overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 92, 56, .06);
}
.ai-inline-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 12px 0;
}
.ai-inline-title-row .ai-inline-title { padding: 0; }
.ai-act-add {
  border: 0; background: #e5f6ec; color: #176844;
  font-size: 12px; font-weight: 800; padding: 6px 10px;
  border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.ai-act-add:active { opacity: .85; }
.ai-inline-actions {
  display: flex; gap: 8px; margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.ai-act-edit, .ai-act-del {
  flex: 1; border: 0; border-radius: 12px; padding: 10px 12px;
  font-size: 13px; font-weight: 800; cursor: pointer;
}
.ai-act-edit { background: #eef2f0; color: #2d4a3a; }
.ai-act-del { background: #fdecea; color: #a83228; }
.ai-act-edit:active, .ai-act-del:active { opacity: .88; }
.src-pill.manual { background: #e8f1ff; color: #1d4ed8; }
.ai-inline-edit {
  display: grid; gap: 10px;
}
.ai-inline-edit label {
  display: grid; gap: 5px;
  font-size: 12px; font-weight: 800; color: #4a5c52;
}
.ai-inline-edit input,
.ai-inline-edit textarea {
  width: 100%; box-sizing: border-box;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; font-size: 13px; font-weight: 500;
  color: var(--ink); background: #fff; resize: vertical;
  font-family: inherit; line-height: 1.45;
}
.ai-inline-edit input:focus,
.ai-inline-edit textarea:focus {
  outline: none; border-color: #8fbfa2; box-shadow: 0 0 0 3px rgba(27,122,74,.12);
}
.ai-edit-btns {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 2px;
}
.ai-inline-summary {
  margin: 6px 12px 0; padding: 8px 10px; border-radius: 10px;
  background: #f0faf4; color: #1f4d35; font-size: 12px; line-height: 1.45;
}
.ai-inline-tabs {
  display: flex; gap: 6px; padding: 10px 10px 0;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; border-bottom: 1px solid var(--line);
}
.ai-inline-tabs::-webkit-scrollbar { display: none; }
.ai-inline-tab {
  flex: 0 0 auto; border: 0; background: #e8eee9; color: #4a5c52;
  font-size: 12px; font-weight: 700; padding: 8px 12px;
  border-radius: 12px 12px 0 0; cursor: pointer; white-space: nowrap;
  max-width: 148px; overflow: hidden; text-overflow: ellipsis;
  position: relative; bottom: -1px;
}
.ai-inline-tab .n { opacity: .65; margin-right: 3px; }
.ai-inline-tab.on {
  background: #fff; color: var(--brand);
  box-shadow: inset 0 -2px 0 var(--brand);
}
.ai-inline-panel { display: none; padding: 12px; background: #fff; }
.ai-inline-panel.on { display: block; animation: ai-inline-in .18s ease; }
@keyframes ai-inline-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
.ai-inline-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 10px;
}
.ai-inline-head strong { font-size: 15px; display: block; }
.ai-inline-meta { margin-top: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.src-pill {
  flex: 0 0 auto;
  font-size: 11px; font-weight: 800; border-radius: 999px; padding: 3px 8px;
  background: #eef2f0; color: #44564c;
}
.src-pill.kb { background: #e5f6ec; color: #176844; }
.src-pill.ai { background: #fff4e5; color: #9a5b08; }
.ai-inline-blk {
  margin-top: 10px; font-size: 13px; line-height: 1.6;
}
.ai-inline-blk b {
  display: inline-flex; align-items: center;
  margin-bottom: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 800;
}
.ai-inline-blk span {
  display: block; padding: 10px 12px; border-radius: 12px; margin-top: 2px;
}
.ai-inline-blk.evidence b { background: #e8f1ff; color: #1d4ed8; }
.ai-inline-blk.evidence span { background: #f5f8ff; border: 1px solid #d6e4ff; color: #1e3a5f; }
.ai-inline-blk.law b { background: #f3e8ff; color: #7c3aed; }
.ai-inline-blk.law span { background: #faf5ff; border: 1px solid #e9d5ff; color: #4c1d95; }
.ai-inline-blk.fix b { background: #dcfce7; color: #15803d; }
.ai-inline-blk.fix span { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.ai-inline-empty { padding: 12px; font-size: 13px; }
.public-remark {
  margin-top: 8px; padding: 10px 12px; border-radius: 12px;
  background: #f7faf8; border: 1px solid var(--line);
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; color: #2d4a3a;
}
.ai-inline.public-ai { margin-top: 10px; }
.issue-row.issue-row-ai {
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
}
.issue-row.issue-row-ai .badge {
  grid-column: 2; justify-self: start; margin-top: 6px;
}
.issue-row.issue-row-ai .issue-body { min-width: 0; }
.issue-row.issue-row-ai .ai-inline { margin-top: 0; }

.result-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 12px; }
.result-seg label {
  border-radius: 16px; border: 1.5px solid var(--line);
  padding: 16px; text-align: center; font-weight: 800; cursor: pointer; background: #f7faf8;
  min-height: 52px; display: grid; place-items: center;
}
.result-seg input { display: none; }
.result-seg label.pass-on { background: #e5f6ec; border-color: #8fbfa2; color: #176844; }
.result-seg label.fail-on { background: #fdecea; border-color: #f0b4ad; color: #a83228; }

.issue-list { display: grid; gap: 8px; }
.issue-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px; align-items: start;
  background: #f7faf8; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px;
}
.issue-row textarea {
  width: 100%; min-height: 54px; border: 0; resize: vertical; padding: 0; background: transparent;
}
.issue-row .idx { color: var(--muted); font-weight: 700; padding-top: 2px; }

.sign-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.sign-col { min-width: 0; display: grid; gap: 8px; }
.sign-box {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.sign-box .sign-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700;
}
.sign-box canvas {
  width: 100%; height: 130px; display: block; touch-action: none; background: #fcfdfc;
}
.sign-preview { max-width: 100%; height: 64px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--line); }

.sticky-actions {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: .9fr 1.4fr;
  gap: 10px;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(0,0,0,.06);
  max-width: 720px;
  margin: 0 auto;
}
body.has-tabbar .sticky-actions { display: none; }
.sticky-actions-3 {
  grid-template-columns: 1fr 1.1fr 1fr;
}
.sticky-actions-3 .btn {
  font-size: 14px;
  padding: 12px 8px;
  white-space: nowrap;
}

/* 导出 PDF 弹窗 */
.export-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 20, 14, .48);
  display: grid; align-items: center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
}
.export-sheet {
  background: #fff; border-radius: 20px; overflow: hidden;
  max-height: min(92vh, 880px); height: min(88vh, 820px);
  display: flex; flex-direction: column;
  box-shadow: 0 22px 56px rgba(0,0,0,.24);
  max-width: 720px; width: 100%; margin: 0 auto;
}
.export-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.export-head strong { font-size: 17px; }
.export-close {
  border: 0; background: #eef2f0; width: 34px; height: 34px; border-radius: 50%;
  font-size: 20px; line-height: 1; cursor: pointer; color: #44564c;
}
.export-body { padding: 14px 20px 18px; overflow: auto; flex: 1; min-height: 0; }
.export-toolbar {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin: 0 0 14px; position: sticky; top: 0; z-index: 2;
  background: #fff; padding-bottom: 2px;
}
.export-tool-btn {
  border: 1px solid #cfe5d8; background: #f0f7f3; color: var(--brand);
  border-radius: 12px; padding: 10px 8px; font-size: 14px; font-weight: 800;
  cursor: pointer;
}
.export-tool-btn:active { background: #e2f0e8; }
.export-sec-title {
  font-size: 13px; font-weight: 800; color: var(--muted); margin: 4px 0 8px;
}
.export-cat-list, .export-opts { display: grid; gap: 8px; margin-bottom: 12px; }
.export-sec-title small { font-weight: 600; color: #8a9a90; }
.export-check {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #f7faf8; cursor: pointer; font-size: 14px; font-weight: 600;
}
.export-check input { margin-top: 2px; }
.export-check em { color: var(--muted); font-style: normal; font-weight: 600; font-size: 12px; }
.export-cat-group {
  border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden;
}
.export-cat-row {
  display: flex; align-items: stretch; gap: 0;
  background: #f0f7f3;
}
.export-cat-checkwrap {
  display: grid; place-items: center;
  padding: 0 12px; cursor: pointer; flex: none;
}
.export-cat-checkwrap input { width: 18px; height: 18px; margin: 0; }
.export-cat-toggle {
  flex: 1; display: flex; align-items: center; gap: 8px;
  border: 0; background: transparent; text-align: left;
  font-size: 14px; font-weight: 800; color: inherit;
  cursor: pointer; min-width: 0; padding: 12px 12px 12px 4px;
}
.export-cat-toggle:active { background: rgba(27,122,74,.06); }
.export-cat-name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: #143024;
}
.export-cat-count {
  font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted);
  background: #fff; border-radius: 999px; padding: 2px 8px; border: 1px solid #cfe5d8;
}
.export-toggle-text {
  color: var(--brand); font-size: 13px; font-weight: 800; white-space: nowrap;
}
.export-cat-main {
  flex: 1; display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 800; cursor: pointer; min-width: 0; padding: 8px 0;
}
.export-toggle {
  border: 0; background: transparent; color: var(--brand);
  font-size: 13px; font-weight: 800; padding: 8px 10px; cursor: pointer; white-space: nowrap;
}
.export-item-list {
  display: grid; gap: 0; border-top: 1px solid var(--line);
  max-height: 340px; overflow: auto;
}
.export-item-list[hidden] { display: none !important; }
.export-item-check {
  display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid #eef2f0; cursor: pointer;
  font-size: 13px; font-weight: 600;
}
.export-item-check:last-child { border-bottom: 0; }
.export-item-check:active { background: #f7faf8; }
.export-item-label { min-width: 0; line-height: 1.35; }
.export-ans {
  flex: none; font-size: 11px; font-weight: 800; border-radius: 999px;
  padding: 3px 8px; min-width: 36px; text-align: center;
  background: #eef2f0; color: #5a6b62;
}
.export-ans.ok { background: #e5f6ec; color: #176844; }
.export-ans.fail { background: #fdecea; color: #a83228; }
.export-ans.empty { background: #f1f3f2; color: #8a9a90; }
.export-actions-row { display: none; }
.export-foot {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}
@media (max-width: 560px) {
  .export-mask { align-items: end; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); }
  .export-sheet {
    max-height: min(94vh, 920px); height: min(90vh, 860px);
    border-radius: 18px 18px 14px 14px;
  }
  .export-body { padding: 12px 14px 16px; }
  .export-head, .export-foot { padding-left: 14px; padding-right: 14px; }
}

.qr-wrap { display: grid; place-items: center; gap: 10px; padding: 10px 0; }
.qr-wrap #qrcode, .qr-wrap .qrcode {
  padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line);
}
.share-url {
  word-break: break-all; font-size: 12px; color: var(--muted);
  background: #f4f7f5; border-radius: 10px; padding: 10px; width: 100%;
}

.log-item {
  border-left: 3px solid #8fbfa2;
  padding: 8px 10px; margin-bottom: 8px;
  background: #f7faf8; border-radius: 0 10px 10px 0; font-size: 13px;
}
.log-item time { display: block; color: var(--muted); font-size: 12px; margin-bottom: 2px; }

.toast {
  position: fixed; left: 50%; bottom: calc(78px + var(--safe-bottom));
  transform: translateX(-50%);
  background: rgba(20,35,26,.94); color: #fff;
  padding: 10px 16px; border-radius: 999px;
  font-size: 13px; z-index: 60; max-width: 88vw;
  box-shadow: 0 10px 24px rgba(0,0,0,.2);
}
body:not(.has-tabbar) .toast { bottom: calc(96px + var(--safe-bottom)); }

.public-body .topbar { background: #fff; }

/* legacy tablet form (unused on phone, keep for safety) */
.form-tablet {
  display: none;
  grid-template-columns: 132px 1fr;
  gap: 0; min-height: 360px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 12px;
}
.form-nav {
  background: linear-gradient(180deg, #1a3d2a 0%, #143024 100%);
  display: flex; flex-direction: column; overflow-y: auto; max-height: 62vh;
}
.form-nav-title {
  padding: 12px 10px 8px; font-size: 11px; font-weight: 800;
  color: rgba(255,255,255,.55); border-bottom: 1px solid rgba(255,255,255,.1);
}
.form-nav-item {
  appearance: none; border: 0; background: transparent; text-align: left;
  padding: 14px 10px; border-left: 4px solid transparent;
  border-bottom: 1px solid rgba(255,255,255,.08);
  cursor: pointer; color: rgba(255,255,255,.78);
}
.form-nav-item .nav-name { display: none; font-size: 13px; font-weight: 800; color: #fff; }
.form-nav-item .nav-short { display: block; font-size: 14px; font-weight: 800; color: #fff; }
.form-nav-item .nav-prog {
  display: inline-flex; margin-top: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: #d7efe2; background: rgba(255,255,255,.12);
}
.form-nav-item.active { background: rgba(255,255,255,.14); border-left-color: #7dffa8; }
.form-nav-item.active .nav-short, .form-nav-item.active .nav-name { color: #7dffa8; }
.form-panel-wrap { display: flex; flex-direction: column; min-width: 0; background: #fff; }
.form-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafcfb;
}
.form-panels { flex: 1; overflow-y: auto; max-height: 56vh; padding: 10px; }

@media (min-width: 768px) {
  .app-main { padding-top: 16px; }
  .sign-box canvas { height: 150px; }
}
