:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #66716b;
  --line: #dfe4e1;
  --soft: #f4f6f5;
  --paper: #ffffff;
  --forest: #1f5a43;
  --forest-strong: #174633;
  --red: #a23a32;
  --amber: #9a6818;
  --blue: #315f85;
  --shadow: 0 8px 24px rgba(23, 32, 28, 0.08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, select, input[type="file"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(49, 95, 133, 0.24);
  outline-offset: 2px;
}

.login-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  align-items: center;
  gap: 56px;
  padding: clamp(28px, 6vw, 88px);
  background: #17201c url("/customer/assets/project.jpg") center / cover no-repeat;
}
.login-shell::before { content: ""; position: absolute; inset: 0; background: rgba(12, 20, 16, .66); }
.login-brand, .login-panel { position: relative; z-index: 1; }
.login-brand { align-self: end; padding-bottom: 6vh; color: #fff; }
.login-brand .brand-mark { color: #d9b968; }
.login-brand h1 { max-width: 680px; margin: 10px 0 0; font-size: clamp(34px, 5vw, 64px); line-height: 1.08; letter-spacing: 0; }
.login-brand p { margin: 16px 0 0; color: rgba(255,255,255,.78); font-size: 16px; }
.login-panel { display: grid; gap: 18px; padding: 28px; border-radius: 7px; background: rgba(255,255,255,.98); box-shadow: 0 24px 64px rgba(0,0,0,.28); }
.login-panel h2 { margin: 0; font-size: 22px; }
.login-panel p { margin: 4px 0 0; color: var(--muted); }
.login-submit { width: 100%; }
.login-error { min-height: 21px; color: var(--red); font-size: 13px; }
.demo-accounts { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.demo-accounts div { display: grid; grid-template-columns: 80px 1fr auto; align-items: center; gap: 8px; font-size: 12px; }
.demo-accounts span { color: var(--muted); }
.demo-accounts button { border: 0; padding: 0; color: var(--forest); background: transparent; text-align: left; font-weight: 700; }
.demo-accounts code { padding: 2px 5px; border-radius: 3px; background: var(--soft); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #f8fbf9;
  background: #18201c;
}
.brand { padding: 0 10px 24px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-mark { font-size: 12px; color: #a8b7af; }
.brand-name { margin-top: 4px; font-size: 20px; font-weight: 720; }
.nav { display: grid; gap: 5px; padding: 20px 0; }
.nav-button {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 12px;
  text-align: left;
  color: #c9d2cd;
  background: transparent;
}
.nav-button:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-button.active { color: #fff; background: #2b3b33; box-shadow: inset 3px 0 #d7a84a; }
.side-meta { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.12); }
.side-meta strong { display: block; font-size: 13px; }
.side-meta span { color: #94a39b; font-size: 12px; }

.workspace { min-width: 0; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
}
.topbar h1 { margin: 0; font-size: 21px; line-height: 1.25; }
.topbar-sub { margin-top: 2px; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.demo-flag {
  padding: 4px 8px;
  border: 1px solid #dfca99;
  border-radius: 4px;
  color: #73501a;
  background: #fff8e8;
  font-size: 12px;
  white-space: nowrap;
}
.user-chip { display: grid; min-width: 82px; line-height: 1.2; text-align: right; }
.user-chip strong { font-size: 13px; }
.user-chip span { margin-top: 3px; color: var(--muted); font-size: 11px; }

.content { width: min(1440px, 100%); margin: 0 auto; padding: 26px 32px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ledger-tabs { display: flex; gap: 2px; margin: -4px 0 16px; border-bottom: 1px solid var(--line); }
.ledger-tab { min-height: 42px; border: 0; border-bottom: 2px solid transparent; padding: 8px 16px; color: var(--muted); background: transparent; }
.ledger-tab strong { display: inline-flex; min-width: 23px; justify-content: center; margin-left: 5px; color: inherit; font-variant-numeric: tabular-nums; }
.ledger-tab.active { color: var(--forest); border-bottom-color: var(--forest); font-weight: 700; }
.page-head h2 { margin: 0; font-size: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  font-weight: 650;
  white-space: nowrap;
}
.btn:hover { border-color: #b6c0ba; background: #fafbfa; }
.btn.primary { border-color: var(--forest); color: #fff; background: var(--forest); }
.btn.primary:hover { background: var(--forest-strong); }
.btn.danger { border-color: #d8aaa6; color: var(--red); background: #fff; }
.btn.subtle { background: var(--soft); }
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 12px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--line); background: var(--paper); }
.metric { min-width: 0; padding: 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { margin-top: 8px; font-size: 30px; font-weight: 760; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-note { margin-top: 8px; color: var(--muted); font-size: 12px; }

.ledger-count { color: var(--muted); font-size: 12px; font-weight: 650; }
.kpi-ledger { overflow: hidden; }
.kpi-ledger-row {
  display: grid;
  grid-template-columns: 132px 150px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.kpi-ledger-row:last-child { border-bottom: 0; }
.kpi-ledger-head { min-height: 40px; color: var(--muted); background: #fafbfa; font-size: 11px; font-weight: 700; }
.kpi-ledger-time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-ledger-metric { display: flex; align-items: center; gap: 8px; min-width: 0; }
.kpi-ledger-metric > span { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--forest); }
.kpi-ledger-metric strong { overflow-wrap: anywhere; font-size: 13px; }
.kpi-ledger-customer { min-width: 0; }
.kpi-ledger-customer strong, .kpi-ledger-customer span { display: block; overflow-wrap: anywhere; }
.kpi-ledger-customer span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.kpi-ledger-delta { justify-self: end; font-size: 16px; font-variant-numeric: tabular-nums; }
.kpi-ledger-delta.positive { color: #1d6748; }
.kpi-ledger-delta.negative { color: var(--red); }

.section { margin-top: 24px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-title h3 { margin: 0; font-size: 15px; }
.section-title a, .text-link { border: 0; padding: 0; color: var(--forest); background: transparent; font-weight: 650; }
.panel { border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 18px; }
.list { margin: 0; padding: 0; list-style: none; }
.list-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 76px minmax(155px, .95fr) 104px minmax(80px, .5fr) 78px 94px;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.list-row.with-owner { grid-template-columns: minmax(160px, 1fr) 76px minmax(142px, .9fr) 104px minmax(80px, .5fr) minmax(90px, .55fr) 78px 94px; }
.list-row:last-child { border-bottom: 0; }
.list-row.head { min-height: 42px; color: var(--muted); background: #fafbfa; font-size: 12px; font-weight: 650; }
.row-title { overflow-wrap: anywhere; font-weight: 680; }
.row-link { display: block; border: 0; padding: 0; color: var(--ink); background: transparent; text-align: left; }
.row-link:hover { color: var(--forest); }
.row-sub { margin-top: 2px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.interest-stars { display: inline-flex; align-items: center; white-space: nowrap; letter-spacing: 0; }
.interest-stars .filled { color: #b77a12; }
.interest-stars .empty-stars { color: #d6dcd8; }
.interest-empty { color: var(--muted); font-size: 12px; }
.interest-empty.pending { color: #936112; font-weight: 650; }
.lead-property, .lead-source { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.profile-pending { color: #936112; font-weight: 650; }
.mobile-only { display: none; }
.align-right { text-align: right; }
.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid #cbd6d0;
  border-radius: 4px;
  color: #3f554a;
  background: #f5f8f6;
  font-size: 12px;
  white-space: nowrap;
}
.status.good { color: #1d6748; border-color: #a8d0bd; background: #edf8f1; }
.status.warn { color: #815713; border-color: #dfca99; background: #fff8e8; }
.status.bad { color: #8b332d; border-color: #e2b5b1; background: #fff3f2; }
.status.info { color: #315f85; border-color: #b4cade; background: #f0f6fb; }

.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.quick-action {
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
}
.quick-action:hover { border-color: #9eb6a9; background: #f8fbf9; }
.quick-action strong { display: block; font-size: 14px; }
.quick-action span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.lead-filters {
  display: grid;
  grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(130px, 1fr));
  gap: 10px 12px;
  margin-bottom: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.filter-field { min-width: 0; }
.filter-field > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.filter-wide { grid-column: span 2; }
.lead-filter-actions { display: flex; align-items: flex-end; gap: 8px; }
.lead-profile-alert { margin: -2px 0 14px; }
.visit-filters .input, .visit-filters .select { width: auto; min-width: 150px; }
.visit-status-filter { position: relative; width: 170px; }
.visit-status-filter summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  border: 1px solid #cfd6d2;
  border-radius: 5px;
  padding: 8px 32px 8px 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}
.visit-status-filter summary::-webkit-details-marker { display: none; }
.visit-status-filter summary::after {
  content: "";
  position: absolute;
  right: 13px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #63716a;
  border-bottom: 1.5px solid #63716a;
  transform: translateY(-2px) rotate(45deg);
}
.visit-status-filter[open] summary::after { transform: translateY(2px) rotate(225deg); }
.visit-status-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  width: 210px;
  border: 1px solid #cfd6d2;
  border-radius: 5px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(25, 48, 38, .14);
}
.visit-status-option { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 6px 8px; cursor: pointer; }
.visit-status-option:hover { background: #f2f6f3; }
.visit-status-option.all { border-bottom: 1px solid var(--line); margin-bottom: 4px; font-weight: 650; }
.visit-status-option input { width: 16px; height: 16px; accent-color: #315846; }
.filter-summary { margin: -2px 0 12px; color: var(--muted); font-size: 12px; }
.field { min-width: 0; }
.field label { display: block; margin-bottom: 6px; color: #4e5a54; font-size: 12px; font-weight: 650; }
.input, .select, .textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cfd6d2;
  border-radius: 5px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}
.textarea { min-height: 86px; resize: vertical; }
.search { width: min(320px, 100%); }
.filter-select { width: 160px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.field.full { grid-column: 1 / -1; }
.form-placeholder { min-height: 80px; display: grid; place-items: center; color: var(--muted); background: var(--soft); }
.form-section { margin: 22px 0; padding-top: 18px; border-top: 1px solid var(--line); }
.form-section.first { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.form-section-head h3 { margin: 0; font-size: 15px; }
.form-section-head span { color: var(--muted); font-size: 11px; }
.profile-completeness { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 11px 12px; border-left: 3px solid var(--amber); background: #fff8e8; }
.profile-completeness.complete { border-left-color: var(--forest); background: #edf7f1; }
.profile-completeness strong, .profile-completeness span { display: block; }
.profile-completeness span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.profile-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); }
.profile-detail-grid > div { min-width: 0; padding: 11px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-detail-grid > div:nth-child(3n) { border-right: 0; }
.profile-detail-grid span, .profile-detail-grid strong { display: block; overflow-wrap: anywhere; }
.profile-detail-grid span { color: var(--muted); font-size: 11px; }
.profile-detail-grid strong { margin-top: 3px; font-size: 13px; }
.choice { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice label { margin: 0; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid #cfd6d2; border-radius: 5px; font-weight: 650; }
.choice input:checked + span { color: var(--forest); border-color: var(--forest); background: #edf7f1; }

dialog {
  width: min(600px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  border: 0;
  border-radius: 7px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(0,0,0,.24);
}
.dialog-wide { width: min(760px, calc(100vw - 28px)); }
#reviewDialog { width: min(980px, calc(100vw - 28px)); }
dialog::backdrop { background: rgba(15, 22, 18, .52); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 4px; background: var(--soft); font-size: 22px; line-height: 1; }
.dialog-body { max-height: calc(100vh - 170px); overflow: auto; padding: 20px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.detail-summary { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); }
.detail-summary div { padding: 12px; border-right: 1px solid var(--line); }
.detail-summary div:last-child { border-right: 0; }
.detail-summary span { display: block; color: var(--muted); font-size: 11px; }
.detail-summary strong { display: block; margin-top: 3px; }
.detail-form { margin-top: 20px; }
.detail-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.lead-closure { margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--red); color: #71302b; background: #fff3f2; }
.lead-closure.pending { border-left-color: #b17a22; color: #6d4b17; background: #fff8e8; }
.lead-closure strong, .lead-closure span { display: block; }
.lead-closure span { margin-top: 4px; font-size: 12px; line-height: 1.55; }
.visit-detail-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.evidence-photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.evidence-photo { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 5px; color: inherit; background: #fff; text-decoration: none; }
.evidence-photo img, .photo-expired { width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; object-fit: cover; background: #e8edea; }
.evidence-photo > span { display: block; padding: 10px; }
.evidence-photo strong, .evidence-photo small { display: block; }
.evidence-photo strong { font-size: 12px; }
.evidence-photo small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.photo-expired { color: var(--muted); font-size: 13px; }
.visit-timeline { display: grid; border-left: 1px solid #b8c5be; margin-left: 5px; }
.visit-timeline > div { position: relative; display: grid; grid-template-columns: 150px 120px minmax(0, 1fr); gap: 12px; padding: 8px 0 8px 18px; }
.visit-timeline > div::before { content: ""; position: absolute; width: 7px; height: 7px; left: -4px; top: 13px; border-radius: 50%; background: var(--forest); }
.visit-timeline time, .visit-timeline span { color: var(--muted); font-size: 12px; }
.visit-timeline strong { font-size: 12px; }
.visit-review-row > div:first-child span { display: block; margin-top: 3px; }
.review-row-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.followup-list { display: grid; border: 1px solid var(--line); }
.followup-item { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.followup-item:last-child { border-bottom: 0; }
.followup-item > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.followup-item > div:first-child span { color: var(--muted); font-size: 12px; }
.followup-item p { margin: 6px 0; }
.empty.compact { padding: 22px 14px; border: 1px solid var(--line); }

.visit-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .75fr); align-items: start; gap: 18px; }
.visit-operation { min-width: 0; overflow: hidden; }
.visit-photo-queue { min-width: 0; }
.visit-photo-queue > .section-title { align-items: flex-start; min-height: 38px; }
.visit-photo-queue > .section-title span { max-width: 150px; text-align: right; }
.visit-photo-queue .visit-flow-grid { grid-template-columns: 1fr; }
.visit-queue-section + .visit-queue-section { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }
.visit-queue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.visit-queue-head h3 { margin: 2px 0 0; font-size: 14px; }
.visit-queue-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.visit-queue-head > strong { min-width: 28px; color: var(--amber); font-size: 22px; line-height: 1; text-align: right; }
.visit-queue-head > div > span { color: var(--amber); font-size: 10px; font-weight: 750; }
.visit-queue-head.compact > div > span { display: none; }
.interest-backfill-queue > .visit-queue-head { padding: 10px 12px; border-left: 3px solid var(--amber); background: #fff8e8; }
.interest-backfill-alert { border: 1px solid #ead8ac; border-left: 3px solid var(--amber); }
.project-scene { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, .42fr); height: 320px; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.project-visual { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #dfe5e1; }
.project-visual img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.project-visual::after { content: ""; position: absolute; inset: 62% 0 0; background: rgba(11,18,14,.72); }
.scene-copy { position: absolute; z-index: 1; left: 20px; right: 20px; bottom: 18px; color: #fff; }
.scene-copy strong { display: block; font-size: 20px; }
.scene-copy span { font-size: 12px; color: rgba(255,255,255,.8); }
.scene-guide { min-width: 0; padding: 16px 18px; border-left: 1px solid var(--line); background: #fff; }
.scene-guide-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.scene-guide-title strong { font-size: 14px; }
.scene-guide-title span { color: var(--muted); font-size: 11px; }
.compact-steps { padding: 0; }
.compact-steps .step { grid-template-columns: 22px minmax(0, 1fr) auto; min-height: 34px; gap: 7px; }
.compact-steps .step-index { width: 20px; height: 20px; font-size: 10px; }
.compact-steps .step strong { font-size: 12px; }
.compact-steps .row-sub { font-size: 10px; }
.scene-guide-note { padding-top: 9px; }
.scene-guide-note strong, .scene-guide-note span { display: block; }
.scene-guide-note strong { font-size: 12px; }
.scene-guide-note span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.visit-main { padding: 18px; }
.visit-main > .section-title { align-items: flex-start; }
.visit-choice-list { overflow: hidden; border: 1px solid var(--line); border-radius: 5px 5px 0 0; }
.visit-choice { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.visit-choice:last-child { border-bottom: 0; }
.visit-choice input, .visit-pick input { width: 18px; height: 18px; accent-color: var(--forest); }
.visit-choice span { min-width: 0; display: grid; gap: 2px; }
.visit-choice small { color: var(--muted); }
.visit-batch-actions { display: flex; justify-content: flex-end; padding: 12px 14px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 5px 5px; background: #fafbfa; }
.active-visit-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-top: 26px; padding-bottom: 10px; }
.active-visit-head h3 { margin: 0; font-size: 15px; }
.active-visit-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.active-visit-list { overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.active-visit-row { display: grid; grid-template-columns: auto minmax(130px, 1fr) 110px auto; align-items: center; gap: 12px; min-height: 76px; padding: 11px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.active-visit-row:last-child { border-bottom: 0; }
.active-visit-customer, .active-visit-clock { min-width: 0; }
.active-visit-customer strong, .active-visit-customer small, .active-visit-clock strong, .active-visit-clock small { display: block; }
.active-visit-customer strong { overflow-wrap: anywhere; }
.active-visit-customer small, .active-visit-clock small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.active-visit-clock strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.active-visit-actions { display: flex; justify-content: flex-end; gap: 6px; }
.visit-flow-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.visit-flow-card { min-width: 0; overflow: hidden; }
.visit-flow-head { min-height: 64px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.visit-flow-head > div > strong { overflow-wrap: anywhere; }
.visit-flow-head:not(:has(.visit-pick)) { grid-template-columns: minmax(0, 1fr) auto; }
.visit-flow-body { padding: 14px; }
.timer.compact { padding-bottom: 10px; }
.timer.compact .timer-value { font-size: 28px; }
.timer { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.timer-value { font-size: 40px; font-weight: 760; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-label { margin-top: 6px; color: var(--muted); font-size: 12px; }
.progress { height: 7px; overflow: hidden; margin-top: 14px; border-radius: 3px; background: #e7ebe9; }
.progress span { display: block; height: 100%; background: var(--forest); transition: width .25s ease; }
.steps { margin: 0; padding: 4px 18px; list-style: none; }
.step { display: grid; grid-template-columns: 26px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 56px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step-index { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); background: #edf0ee; font-size: 12px; font-weight: 700; }
.step.done .step-index { color: #fff; background: var(--forest); }
.interest-rating { min-width: 0; margin: 0 0 14px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 5px; background: #fafbfa; }
.interest-rating legend { padding: 0 5px; color: var(--ink); font-size: 12px; font-weight: 700; }
.interest-rating legend span { margin-left: 5px; color: var(--muted); font-size: 10px; font-weight: 500; }
.interest-picker { display: grid; grid-template-columns: repeat(5, 36px); gap: 4px; }
.interest-star { width: 36px; height: 36px; border: 1px solid #d4dad7; border-radius: 4px; color: #c8cfcb; background: #fff; font-size: 23px; line-height: 1; }
.interest-star:hover, .interest-star:focus-visible { border-color: #b77a12; color: #b77a12; }
.interest-star.selected { border-color: #d6b168; color: #b77a12; background: #fff8e8; }
.interest-star:disabled { cursor: wait; opacity: .6; }
.interest-rating output { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.photo-slot {
  position: relative;
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px dashed #aeb9b3;
  border-radius: 5px;
  color: var(--muted);
  background: #f8faf9;
  text-align: center;
}
.photo-slot input { position: absolute; inset: 0; opacity: 0; }
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot span { padding: 8px; font-size: 12px; }
.photo-slot.filled { border-style: solid; }
.photo-slot.filled::after { content: "已上传"; position: absolute; right: 5px; bottom: 5px; padding: 2px 5px; border-radius: 3px; color: #fff; background: rgba(23,70,51,.9); font-size: 10px; }

.qr-layout { display: grid; grid-template-columns: minmax(380px, 1.2fr) minmax(280px, .8fr); gap: 18px; }
.venue-qr { display: grid; place-items: center; min-height: 520px; padding: 32px; }
.qr-display-note { margin: 12px 18px 18px; padding: 14px; border-left: 3px solid var(--forest); background: var(--soft); }
.qr-display-note strong, .qr-display-note span { display: block; }
.qr-display-note span { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.6; }

.qr-display-body { min-width: 0; min-height: 100svh; margin: 0; padding: 0; color: #f5f7f6; background: #0f1814; }
.qr-display-shell { min-height: 100svh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: clamp(22px, 4vw, 52px); }
.qr-display-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.qr-display-head > div:first-child span { color: #9dafa5; font-size: 12px; letter-spacing: 0; }
.qr-display-head h1 { margin: 5px 0 0; color: #fff; font-size: clamp(28px, 4vw, 52px); letter-spacing: 0; }
.qr-display-status { display: inline-flex; align-items: center; gap: 9px; padding-top: 8px; color: #cbd5d0; font-size: 13px; }
.qr-display-status i { width: 9px; height: 9px; border-radius: 50%; background: #63c291; box-shadow: 0 0 0 5px rgba(99,194,145,.12); }
.qr-display-stage { min-height: 0; display: grid; place-items: center; align-content: center; gap: 22px; padding: 28px 0; }
.qr-display-stage img { width: min(58vh, 62vw, 680px); max-width: 100%; aspect-ratio: 1; display: block; padding: clamp(12px, 2vw, 24px); border-radius: 6px; background: #fff; }
.qr-display-copy { text-align: center; }
.qr-display-copy strong { display: block; color: #fff; font-size: clamp(20px, 2.4vw, 30px); }
.qr-display-copy span { display: block; margin-top: 7px; color: #9dafa5; font-size: 13px; font-variant-numeric: tabular-nums; }
.qr-display-shell footer { color: #728279; font-size: 11px; text-align: center; }

@media (max-width: 640px) {
  .qr-display-body { padding-bottom: 0; }
  .qr-display-shell { padding: 20px 16px; }
  .qr-display-head { align-items: flex-start; }
  .qr-display-head h1 { font-size: 28px; }
  .qr-display-stage img { width: min(86vw, 58vh); }
}
.qr-frame { width: min(360px, 100%); aspect-ratio: 1; display: grid; place-items: center; border: 12px solid #17201c; background: #fff; }
.qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; }
.qr-countdown { display: flex; align-items: baseline; gap: 7px; margin-top: 18px; }
.qr-countdown strong { font-size: 30px; font-variant-numeric: tabular-nums; }
.qr-countdown span { color: var(--muted); font-size: 12px; }
.qr-meta { align-self: start; padding: 18px; }
.qr-meta > div { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.qr-meta span { color: var(--muted); }
.qr-meta .btn { width: 100%; margin-top: 18px; }
.scanner { position: relative; min-height: 300px; overflow: hidden; border-radius: 6px; background: #18201c; }
.scanner video { width: 100%; height: 300px; display: block; object-fit: cover; }
.scanner-idle { position: absolute; inset: 0; display: grid; place-content: center; gap: 8px; color: #fff; text-align: center; }
.scanner-idle[hidden] { display: none; }
.scanner-idle strong { font-size: 54px; }
.scanner-idle span { color: rgba(255,255,255,.68); font-size: 12px; }
.scanner-line { position: absolute; z-index: 1; left: 12%; right: 12%; top: 50%; height: 2px; background: #d9b968; box-shadow: 0 0 12px rgba(217,185,104,.7); }
.scan-state { min-height: 42px; padding-top: 14px; color: var(--muted); text-align: center; }

.empty { padding: 44px 20px; color: var(--muted); text-align: center; }
.alert-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--amber); background: #fff8e8; }
.duplicate-overview { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid #e8d5a8; border-left: 4px solid var(--amber); background: #fffaf0; }
.duplicate-alert-mark { display: grid; width: 32px; height: 32px; flex: 0 0 auto; place-items: center; border-radius: 50%; color: #fff; background: var(--amber); font-size: 18px; font-weight: 800; }
.duplicate-overview-copy { min-width: 0; flex: 1; }
.duplicate-overview-copy strong, .duplicate-overview-copy span { display: block; }
.duplicate-overview-copy strong { font-size: 14px; }
.duplicate-overview-copy span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.duplicate-private-note { flex: 0 0 auto; color: #755018; font-size: 12px; font-weight: 700; }
.duplicate-list { overflow: hidden; }
.duplicate-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 14px; min-height: 92px; padding: 15px 16px; border-bottom: 1px solid var(--line); transition: background-color .15s ease; }
.duplicate-row:last-child { border-bottom: 0; }
.duplicate-row:hover { background: #fbfcfb; }
.duplicate-risk { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #dfca99; border-radius: 50%; color: #815713; background: #fff8e8; }
.duplicate-risk span { font-size: 18px; font-weight: 800; line-height: 1; }
.duplicate-main { min-width: 0; }
.duplicate-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.duplicate-title strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.duplicate-meta { display: flex; flex-wrap: wrap; gap: 5px 18px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.duplicate-meta span { position: relative; }
.duplicate-meta span + span::before { content: ""; position: absolute; left: -10px; top: 50%; width: 3px; height: 3px; border-radius: 50%; background: #aeb8b2; transform: translateY(-50%); }
.duplicate-action { display: flex; align-items: center; gap: 16px; }
.duplicate-score { min-width: 58px; text-align: right; }
.duplicate-score span, .duplicate-score strong { display: block; }
.duplicate-score span { color: var(--muted); font-size: 10px; }
.duplicate-score strong { margin-top: 1px; color: #815713; font-size: 20px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.duplicate-empty strong, .duplicate-empty span { display: block; }
.duplicate-empty strong { color: var(--ink); font-size: 14px; }
.duplicate-empty span { margin-top: 5px; font-size: 12px; }
#caseDialog { width: min(720px, calc(100vw - 28px)); overflow: hidden; }
#caseDialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#caseDialog .dialog-body { max-height: none; }
.duplicate-dialog-head { border-top: 4px solid var(--amber); }
.duplicate-case-notice { padding: 12px 14px; border-left: 3px solid var(--amber); color: #6d4b17; background: #fff8e8; }
.duplicate-case-notice strong, .duplicate-case-notice span { display: block; }
.duplicate-case-notice span { margin-top: 3px; color: #79643f; font-size: 12px; }
.duplicate-candidates { margin-top: 20px; }
.duplicate-section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.duplicate-section-title h3 { margin: 0; font-size: 14px; }
.duplicate-section-title span { color: var(--muted); font-size: 12px; }
.case-option { position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr); align-items: start; gap: 11px; padding: 13px 14px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: border-color .15s ease, background-color .15s ease; }
.case-option + .case-option { border-top: 0; }
.case-option:first-of-type { border-radius: 5px 5px 0 0; }
.case-option:last-of-type { border-radius: 0 0 5px 5px; }
.case-option:hover { background: #fafcfb; }
.case-option:has(input:checked) { z-index: 1; border-color: var(--forest); background: #f2f8f4; box-shadow: inset 3px 0 var(--forest); }
.case-option > input { position: absolute; opacity: 0; pointer-events: none; }
.case-radio { display: grid; width: 18px; height: 18px; margin-top: 2px; place-items: center; border: 1px solid #aeb8b2; border-radius: 50%; background: #fff; }
.case-option input:checked + .case-radio { border: 5px solid var(--forest); }
.case-option input:focus-visible + .case-radio { outline: 3px solid rgba(49, 95, 133, .24); outline-offset: 2px; }
.case-option-main { min-width: 0; }
.case-option-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.case-option-title strong { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.case-option-title > span { flex: 0 0 auto; color: var(--forest); font-size: 11px; font-weight: 700; }
.case-option-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 16px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.case-option-meta span { min-width: 0; overflow-wrap: anywhere; }
.case-option-meta b { margin-right: 7px; color: var(--ink); font-size: 11px; }
.duplicate-decision-form { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.case-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.case { padding: 16px; }
.case-top { display: flex; justify-content: space-between; gap: 12px; }
.case h3 { margin: 0; font-size: 15px; }
.case-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.case-meta div { padding: 10px; background: var(--soft); }
.case-meta span { display: block; color: var(--muted); font-size: 11px; }
.case-meta strong { display: block; margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.rule-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; padding: 18px; }
.evidence-list { display: grid; gap: 8px; margin: 14px 0; }
.evidence { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; background: var(--soft); }
.evidence span { min-width: 0; }
.evidence small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.evidence-choice { align-items: center; cursor: pointer; }
.evidence-choice > span { display: flex; align-items: center; gap: 8px; }

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 5px;
  color: #fff;
  background: #1f2c25;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }

@media (min-width: 721px) and (max-width: 1180px) {
  .list-row, .list-row.with-owner { grid-template-columns: minmax(0, 1fr) auto; min-height: 82px; padding: 12px 14px; }
  .list-row.head { display: none; }
  .list-row .lead-property, .list-row .lead-need, .list-row .lead-source, .list-row .lead-interest, .list-row .lead-owner, .list-row .lead-time { display: none; }
  .list-row .lead-status { justify-self: end; }
  .lead-primary { min-width: 0; }
  .lead-mobile-meta { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  .lead-mobile-meta > span { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
  .lead-mobile-meta b { min-width: 44px; color: var(--ink); font-size: 11px; }
  .lead-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .login-shell { grid-template-columns: minmax(0, 1fr) minmax(330px, 390px); gap: 32px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .split-grid, .visit-layout, .visit-flow-grid { grid-template-columns: 1fr; }
  .visit-photo-queue > .section-title { min-height: 0; }
  .case-grid { grid-template-columns: 1fr; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-meta { width: 100%; }
}

@media (max-width: 720px) {
  .login-shell { display: flex; min-height: 100svh; flex-direction: column; justify-content: flex-end; gap: 22px; padding: 24px 16px; }
  .login-brand { width: 100%; align-self: auto; padding: 0; }
  .login-brand h1 { max-width: 340px; font-size: 34px; }
  .login-brand p { margin-top: 10px; font-size: 13px; }
  .login-panel { width: 100%; padding: 22px; gap: 14px; }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 64px; padding: 10px 16px; align-items: flex-start; }
  .topbar h1 { font-size: 18px; }
  .topbar-sub, .demo-flag { display: none; }
  .top-actions { gap: 6px; }
  .user-chip { display: none; }
  .content { padding: 18px 14px 28px; }
  .page-head { align-items: flex-start; margin-bottom: 16px; }
  .page-head h2 { font-size: 18px; }
  .page-head p { max-width: 220px; }
  .project-scene { grid-template-columns: 1fr; height: auto; }
  .project-visual { min-height: 180px; }
  .scene-guide { border-top: 1px solid var(--line); border-left: 0; }
  .visit-main { padding: 14px; }
  .active-visit-head { align-items: flex-start; }
  .active-visit-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px 10px; }
  .active-visit-clock, .active-visit-actions { grid-column: 2; }
  .active-visit-actions { justify-content: flex-start; flex-wrap: wrap; }
  .metric { padding: 15px; }
  .metric-value { font-size: 25px; }
  .kpi-ledger-head { display: none; }
  .kpi-ledger-row:not(.kpi-ledger-head) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "metric delta" "customer customer" "time time";
    gap: 4px 12px;
    min-height: 94px;
    padding: 12px 13px;
  }
  .kpi-ledger-metric { grid-area: metric; }
  .kpi-ledger-delta { grid-area: delta; align-self: start; }
  .kpi-ledger-customer { grid-area: customer; }
  .kpi-ledger-time { grid-area: time; margin-top: 3px; }
  .list-row, .list-row.with-owner { grid-template-columns: minmax(0,1fr) auto; min-height: 64px; padding: 11px 13px; }
  .list-row.head { display: none; }
  .list-row .lead-property, .list-row .lead-need, .list-row .lead-source, .list-row .lead-interest, .list-row .lead-owner, .list-row .lead-time { display: none; }
  .list-row .lead-status { justify-self: end; }
  .lead-primary { min-width: 0; }
  .lead-primary .row-title { max-width: 100%; line-height: 1.45; }
  .lead-mobile-meta { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
  .lead-mobile-meta > span { display: flex; align-items: center; gap: 7px; margin-top: 4px; }
  .lead-mobile-meta b { min-width: 44px; color: var(--ink); font-size: 11px; }
  .mobile-only { display: block; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .profile-detail-grid { grid-template-columns: 1fr; }
  .profile-detail-grid > div { border-right: 0; }
  .field.full { grid-column: auto; }
  .filters { display: grid; grid-template-columns: minmax(0,1fr) 125px; }
  .lead-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 12px 0; }
  .lead-filters .filter-wide { grid-column: 1 / -1; }
  .lead-filter-actions { grid-column: 1 / -1; }
  .lead-filter-actions .btn { flex: 1; }
  .visit-filters { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .visit-filters .input, .visit-filters .select { width: 100%; min-width: 0; }
  .visit-status-filter { width: 100%; }
  .visit-status-menu { width: min(240px, calc(200% + 10px)); }
  .search, .filter-select { width: 100%; }
  .project-visual { min-height: 190px; }
  .timer-value { font-size: 34px; }
  .photo-grid { gap: 7px; }
  .rule-grid { grid-template-columns: 1fr; }
  .detail-summary { grid-template-columns: 1fr; }
  .detail-summary div { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-summary div:last-child { border-bottom: 0; }
  .venue-qr { min-height: 430px; padding: 20px; }
  .dialog-foot { flex-wrap: wrap; }
  .dialog-foot .btn { flex: 1 1 auto; }
  .visit-detail-meta, .evidence-photo-grid { grid-template-columns: 1fr; }
  .visit-timeline > div { grid-template-columns: 1fr; gap: 3px; }
  .visit-review-row { align-items: flex-start; }
  .review-row-actions { align-items: flex-end; flex-direction: column; }
  .duplicate-overview { align-items: flex-start; padding: 12px 13px; }
  .duplicate-private-note { display: none; }
  .duplicate-row { grid-template-columns: 34px minmax(0, 1fr); align-items: start; gap: 10px; padding: 13px; }
  .duplicate-risk { width: 32px; height: 32px; }
  .duplicate-action { grid-column: 2; justify-content: space-between; margin-top: 4px; }
  .duplicate-score { text-align: left; }
  .duplicate-title { align-items: flex-start; }
  .duplicate-title strong { white-space: normal; }
  .duplicate-meta { display: grid; gap: 3px; margin-top: 6px; }
  .duplicate-meta span + span::before { display: none; }
  .case-option { padding: 12px; }
  .case-option-meta { grid-template-columns: 1fr; gap: 4px; }
  .duplicate-dialog-body { padding: 16px; }
  .mobile-nav {
    position: fixed;
    z-index: 10;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0,1fr));
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 4px 5px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,.98);
  }
  .mobile-nav button { min-width: 0; border: 0; padding: 3px 2px; color: var(--muted); background: transparent; font-size: 11px; }
  .mobile-nav button.active { color: var(--forest); font-weight: 750; }
  .toast { right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); }
}

.lhint { color: var(--muted); font-size: 13px; line-height: 1.65; }
.lhint a { color: var(--forest); }
.loading { min-height: 180px; display: grid; place-items: center; color: var(--muted); }
.scan-ready { margin-top: 14px; padding: 12px 14px; border-left: 3px solid var(--forest); background: #eef5f0; }
.scan-ready strong, .scan-ready span { display: block; }
.scan-ready span { margin-top: 3px; color: var(--muted); font-size: 13px; }
.photo-note { margin-top: 12px; }
.form-card { padding: 22px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; font-weight: 700; }
.kpi-group-section { margin-top: 18px; }
.kpi-group-section:first-of-type { margin-top: 0; }
.kpi-group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.kpi-group-head h3 { margin: 0; font-size: 15px; }
.kpi-group-head span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.kpi-group-head > strong { color: var(--muted); font-size: 12px; font-weight: 600; }
.review-table-wrap { overflow-x: auto; }
.visit-review-table, .pool-table { min-width: 980px; border-collapse: separate; border-spacing: 0 8px; }
.visit-review-table th, .pool-table th { padding: 3px 14px 7px; border: 0; }
.visit-review-table td, .pool-table td { padding: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; vertical-align: middle; }
.visit-review-table td:first-child, .pool-table td:first-child { border-left: 1px solid var(--line); border-radius: 6px 0 0 6px; }
.visit-review-table td:last-child, .pool-table td:last-child { border-right: 1px solid var(--line); border-radius: 0 6px 6px 0; }
.visit-review-table td strong, .visit-review-table td small, .pool-table td strong, .pool-table td small, .reviewer-cell, .reviewer-cell small { display: block; }
.visit-review-table td small, .pool-table td small, .reviewer-cell small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.visit-review-table td:nth-child(1) { width: 19%; }
.visit-review-table td:nth-child(2) { width: 18%; }
.visit-review-table td:nth-child(3) { width: 23%; }
.visit-review-table td:nth-child(4) { width: 11%; }
.visit-review-table td:nth-child(5) { width: 17%; }
.pool-table td:nth-child(1) { width: 20%; }
.pool-table td:nth-child(2) { width: 18%; }
.pool-table td:nth-child(3) { width: 17%; }
.pool-table td:nth-child(4) { width: 15%; }
.pool-assign { display: flex; align-items: center; gap: 8px; min-width: 250px; }
.pool-assign .select { min-width: 132px; }
.settings-list { padding: 0; overflow: hidden; }
.setting-row { min-height: 66px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row > div strong, .setting-row > div span, .dept-select strong, .dept-select span { display: block; }
.setting-row > div span, .dept-select span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.setting-select { width: 142px; flex: 0 0 142px; }
.access-controls { display: flex; align-items: center; justify-content: flex-end; gap: 16px; min-width: 0; }
.access-controls .switch span { margin-top: 0; color: inherit; }
.qr-permission b { min-width: 84px; }
.visit-review-permission b { min-width: 108px; }
.settings-filter { width: min(230px, 100%); }
.kpi-review-row { align-items: flex-start; }
.kpi-review-row > div { min-width: 0; }
.kpi-review-items { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; }
.kpi-review-items span { margin: 0 !important; padding: 4px 7px; border-radius: 3px; color: var(--text) !important; background: var(--soft); font-size: 12px; overflow-wrap: anywhere; }
.group-column-head { min-height: 38px; padding: 8px 16px; display: grid; grid-template-columns: minmax(130px, 1fr) minmax(140px, 200px) minmax(140px, 200px) 78px 78px; gap: 10px; align-items: end; color: var(--muted); background: var(--soft); font-size: 12px; }
.group-column-head span:nth-last-child(-n+2) { text-align: right; }
.group-setting-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(140px, 200px) minmax(140px, 200px) 78px 78px; gap: 10px; }
.group-name-input { width: 100%; }
.leader-check { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; font-size: 13px; cursor: pointer; }
.leader-check input { width: 17px; height: 17px; accent-color: var(--forest); }
.group-save { min-height: 64px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--soft); }
.group-save span { color: var(--muted); font-size: 12px; }
.dept-select { appearance: none; border: 0; background: transparent; padding: 7px 10px; text-align: left; color: inherit; cursor: pointer; min-width: 180px; }
.dept-select.active { box-shadow: inset 3px 0 var(--forest); background: #f2f6f3; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 42px; height: 24px; border-radius: 12px; background: #c7cfca; position: relative; transition: background .18s ease; }
.switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0003; transition: transform .18s ease; }
.switch input:checked + span { background: var(--forest); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch b { min-width: 48px; font-size: 12px; }

.circle-list { overflow: hidden; }
.circle-row { min-height: 96px; padding: 15px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.circle-row:last-child { border-bottom: 0; }
.circle-main { min-width: 0; flex: 1; }
.circle-title { display: flex; align-items: center; gap: 10px; }
.circle-title strong { overflow-wrap: anywhere; }
.circle-meta { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.circle-live { color: var(--forest); font-variant-numeric: tabular-nums; font-weight: 750; }
.circle-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; flex: 0 0 auto; }
.circle-upload { display: inline-flex; align-items: center; }
.review-note { margin-top: 8px; padding: 7px 9px; border-left: 3px solid var(--amber); background: #fff8e8; color: #6f501b; font-size: 12px; }
.warn-text { color: var(--red); font-weight: 650; }
.circle-review-permission b { min-width: 108px; }

@media (max-width: 720px) {
  .mobile-nav { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(76px, 1fr); grid-template-columns: none; overflow-x: auto; justify-content: start; }
  .setting-row { align-items: center; }
  .setting-row > .access-controls { align-items: flex-end; flex-direction: column; gap: 9px; }
  .section-title:has(.settings-filter) { align-items: stretch; flex-direction: column; }
  .settings-filter { width: 100%; }
  .kpi-review-row { align-items: stretch; flex-direction: column; }
  .kpi-review-row .btn { align-self: flex-end; }
  .group-column-head { display: none; }
  .group-setting-row { grid-template-columns: minmax(105px, .8fr) minmax(120px, 1fr); gap: 8px; }
  .group-setting-row > div { grid-row: span 2; }
  .group-setting-row .leader-check { grid-column: 2; justify-content: flex-start; }
  .group-save { align-items: stretch; flex-direction: column; }
  .dept-select { min-width: 0; }
  .switch b { display: none; }
  .qr-permission b { display: block; }
  .visit-review-permission b { display: block; }
  .circle-review-permission b { display: block; }
  .review-table-wrap { overflow: visible; }
  .visit-review-table, .visit-review-table tbody, .visit-review-table tr, .visit-review-table td,
  .pool-table, .pool-table tbody, .pool-table tr, .pool-table td { display: block; width: 100%; min-width: 0; }
  .visit-review-table, .pool-table { border-spacing: 0; }
  .visit-review-table thead, .pool-table thead { display: none; }
  .visit-review-table tr, .pool-table tr { margin-bottom: 12px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #fff; }
  .visit-review-table td:nth-child(n), .pool-table td:nth-child(n) { width: 100%; }
  .visit-review-table td, .visit-review-table td:first-child, .visit-review-table td:last-child,
  .pool-table td, .pool-table td:first-child, .pool-table td:last-child { display: grid; grid-template-columns: 88px minmax(0, 1fr); align-items: start; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; white-space: normal; }
  .visit-review-table td:last-child, .pool-table td:last-child { border-bottom: 0; }
  .visit-review-table td::before, .pool-table td::before { content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700; }
  .visit-review-table td .btn, .pool-table td .btn { justify-self: start; }
  .pool-assign { min-width: 0; align-items: stretch; flex-direction: column; }
  .circle-row { align-items: stretch; flex-direction: column; gap: 12px; }
  .circle-actions { justify-content: flex-start; }
  .circle-actions .btn { flex: 1 1 auto; }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-label, .metric-note { overflow-wrap: anywhere; }
  .quick-actions { grid-template-columns: 1fr; }
  .button-row .btn { flex: 1 1 auto; }
}
