:root {
  --forest-950: #102d25;
  --forest-900: #173c30;
  --forest-800: #20513f;
  --forest-700: #2f6b50;
  --forest-600: #3f8061;
  --forest-100: #e8f1ec;
  --forest-50: #f3f7f4;
  --amber: #c68426;
  --amber-soft: #fff3d9;
  --red: #b9483e;
  --red-soft: #fcebea;
  --ink: #1c2521;
  --muted: #67736d;
  --line: #dbe3de;
  --surface: #ffffff;
  --canvas: #f4f6f4;
  --shadow: 0 10px 28px rgba(16, 45, 37, 0.08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
.icon, .lucide { width: 18px; height: 18px; stroke-width: 2; flex: 0 0 auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.mobile-shell { min-height: 100vh; padding-bottom: 92px; }
.mobile-header {
  position: relative;
  overflow: hidden;
  padding: 20px 18px 54px;
  color: white;
  background: var(--forest-950);
}
.mobile-header::after {
  content: "";
  position: absolute;
  inset: auto -8% -58px;
  height: 110px;
  border-radius: 50%;
  background: var(--canvas);
}
.brand-row { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; max-width: 760px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; color: var(--forest-950); background: #dcebd9; border-radius: 50%; }
.brand-mark .icon, .brand-mark .lucide { width: 23px; height: 23px; }
.brand h1 { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 700; }
.brand p { margin: 5px 0 0; color: #b7c9c0; font-size: 12px; }
.online-state { display: flex; align-items: center; gap: 6px; color: #cfe0d6; font-size: 12px; }
.online-dot { width: 7px; height: 7px; border-radius: 50%; background: #87c491; box-shadow: 0 0 0 4px rgba(135, 196, 145, .12); }

.collector-main { position: relative; z-index: 2; width: calc(100% - 28px); max-width: 720px; margin: -29px auto 0; }
.form-panel { background: var(--surface); border: 1px solid rgba(219, 227, 222, .75); border-radius: var(--radius); box-shadow: var(--shadow); }
.section { padding: 20px 18px; border-bottom: 1px solid var(--line); }
.section:last-child { border-bottom: 0; }
.section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.step { display: grid; width: 26px; height: 26px; place-items: center; color: white; background: var(--forest-700); border-radius: 50%; font-size: 12px; font-weight: 700; }
.section-heading h2 { margin: 0; font-size: 16px; font-weight: 700; }
.section-heading small { margin-left: auto; color: var(--muted); font-size: 12px; }

.photo-picker { display: block; border: 1px dashed #9eb6aa; border-radius: var(--radius); overflow: hidden; background: var(--forest-50); cursor: pointer; }
.photo-empty { display: grid; min-height: 188px; place-items: center; padding: 28px 20px; text-align: center; }
.camera-disc { display: grid; width: 54px; height: 54px; place-items: center; color: white; background: var(--forest-700); border-radius: 50%; box-shadow: 0 7px 18px rgba(47,107,80,.2); }
.camera-disc .icon, .camera-disc .lucide { width: 25px; height: 25px; }
.photo-empty strong { display: block; margin-top: 13px; font-size: 15px; }
.photo-empty span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; }
.preview-grid { display: none; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 8px; }
.preview-grid.has-images { display: grid; }
.preview-item { position: relative; overflow: hidden; aspect-ratio: 1; border-radius: 6px; background: #e7ebe8; }
.preview-item img { width: 100%; height: 100%; object-fit: cover; }
.preview-remove { position: absolute; top: 5px; right: 5px; display: grid; width: 26px; height: 26px; place-items: center; padding: 0; color: white; border: 0; border-radius: 50%; background: rgba(16,45,37,.82); }
.preview-remove .icon, .preview-remove .lucide { width: 14px; height: 14px; }
.add-photo { display: grid; aspect-ratio: 1; place-items: center; color: var(--forest-700); border: 1px dashed #9eb6aa; border-radius: 6px; background: white; }
.add-photo .icon, .add-photo .lucide { width: 24px; height: 24px; }

.location-box { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fbfcfb; }
.location-status { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.location-icon { display: grid; width: 38px; height: 38px; place-items: center; color: var(--forest-700); border-radius: 50%; background: var(--forest-100); }
.location-status strong { display: block; font-size: 14px; }
.location-status span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.locate-button { display: inline-flex; align-items: center; gap: 7px; margin-left: auto; padding: 8px 11px; color: var(--forest-700); border: 1px solid #b9cfc3; border-radius: 6px; background: white; font-size: 13px; font-weight: 700; }
.coordinate-grid, .field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.field { display: block; min-width: 0; }
.field + .field.full { margin-top: 13px; }
.field span { display: flex; align-items: center; gap: 4px; margin-bottom: 7px; color: #435049; font-size: 13px; font-weight: 700; }
.required { color: var(--red); }
.input-wrap { position: relative; }
.input-wrap input { padding-right: 42px; }
.unit { position: absolute; top: 50%; right: 12px; color: var(--muted); font-size: 12px; transform: translateY(-50%); }
input, select, textarea {
  width: 100%;
  color: var(--ink);
  border: 1px solid #cfd9d3;
  border-radius: 6px;
  outline: none;
  background: white;
  transition: border-color .18s, box-shadow .18s;
}
input, select { height: 43px; padding: 0 12px; }
textarea { min-height: 96px; padding: 11px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--forest-600); box-shadow: 0 0 0 3px rgba(63,128,97,.12); }
.form-stack { display: grid; gap: 14px; }
.submit-area { padding: 18px; }
.primary-button { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: center; gap: 9px; color: white; border: 0; border-radius: 7px; background: var(--forest-700); font-weight: 700; box-shadow: 0 8px 18px rgba(47,107,80,.18); }
.primary-button:hover { background: var(--forest-800); }
.submit-note { margin: 10px 0 0; color: var(--muted); text-align: center; font-size: 12px; }
.mobile-footer { margin-top: 18px; color: #88918d; text-align: center; font-size: 11px; }

.toast { position: fixed; z-index: 100; right: 16px; bottom: 20px; left: 16px; display: flex; max-width: 430px; min-height: 48px; align-items: center; gap: 10px; margin: auto; padding: 12px 14px; color: white; border-radius: 7px; background: var(--forest-950); box-shadow: 0 14px 34px rgba(0,0,0,.22); transform: translateY(100px); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #76352f; }
.toast .icon, .toast .lucide { flex: 0 0 auto; }

/* Admin */
.admin-body { min-width: 1120px; background: #f2f5f3; }
.admin-layout { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: 248px; color: #fff; background: var(--forest-950); }
.side-brand { display: flex; height: 82px; align-items: center; gap: 11px; padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-brand .brand-mark { width: 37px; height: 37px; }
.side-brand strong { display: block; font-size: 16px; }
.side-brand span { display: block; margin-top: 3px; color: #9cb6aa; font-size: 11px; }
.nav-list { padding: 22px 12px; }
.nav-label { margin: 0 10px 9px; color: #779388; font-size: 11px; }
.nav-item { display: flex; align-items: center; gap: 11px; height: 46px; margin-bottom: 5px; padding: 0 13px; color: #b9ccc3; border-radius: 6px; text-decoration: none; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.12); box-shadow: inset 3px 0 0 #9ccaa7; }
.nav-item:hover { color: white; }
.sidebar-foot { position: absolute; right: 0; bottom: 18px; left: 0; padding: 0 22px; color: #79948a; font-size: 11px; }
.admin-main { grid-column: 2; min-width: 0; }
.topbar { height: 82px; border-bottom: 1px solid var(--line); background: white; }
.topbar-inner { display: flex; width: 100%; max-width: 1600px; height: 100%; align-items: center; justify-content: space-between; margin: 0 auto; padding: 0 30px; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.today { display: flex; align-items: center; gap: 7px; margin-right: 7px; color: var(--muted); font-size: 12px; }
.admin-content { width: 100%; max-width: 1600px; margin: 0 auto; padding: 28px 30px 40px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 16px; }
.stat-card { position: relative; display: flex; min-height: 112px; align-items: center; gap: 16px; padding: 20px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 3px 12px rgba(16,45,37,.025); }
.stat-card::after { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--forest-600); opacity: .65; }
.stat-card.warning::after { background: var(--amber); }
.stat-icon { display: grid; width: 46px; height: 46px; place-items: center; color: var(--forest-700); border-radius: 7px; background: var(--forest-100); }
.stat-card.warning .stat-icon { color: #a86914; background: var(--amber-soft); }
.stat-value { margin: 0; font-size: 28px; line-height: 1; font-weight: 700; }
.stat-label { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.toolbar { display: flex; min-height: 66px; align-items: center; justify-content: space-between; gap: 18px; margin: 18px 0 14px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.filter-group { display: flex; min-width: 0; align-items: center; gap: 9px; }
.search-box { position: relative; width: clamp(280px, 29vw, 390px); flex: 0 1 390px; }
.search-box > .lucide { position: absolute; z-index: 1; top: 50%; left: 13px; color: #77817c; pointer-events: none; transform: translateY(-50%); }
.search-box input { padding-left: 39px; }
.filter-select { width: 138px; }
.date-input { width: 156px; }
.button { display: inline-flex; height: 42px; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; border: 1px solid #cad5cf; border-radius: 6px; background: white; color: #34423b; font-weight: 700; white-space: nowrap; text-decoration: none; }
.button:hover { border-color: #9fb4a9; background: #f8faf8; }
.button.subtle { color: #59665f; border-color: transparent; background: #f3f6f4; }
.button.primary { flex: 0 0 auto; color: white; border-color: var(--forest-700); background: var(--forest-700); }
.button.primary:hover { background: var(--forest-800); }
.table-panel { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
.table-meta { display: flex; height: 54px; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--line); }
.table-meta strong { font-size: 14px; }
.table-meta span { color: var(--muted); font-size: 12px; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; min-width: 1000px; border-collapse: collapse; table-layout: fixed; }
th { height: 46px; padding: 0 14px; color: #5d6b64; background: #f7f9f7; text-align: left; font-size: 12px; font-weight: 700; white-space: nowrap; }
td { height: 72px; padding: 10px 14px; border-top: 1px solid #e8edea; font-size: 13px; vertical-align: middle; }
th:nth-child(1) { width: 7%; }
th:nth-child(2) { width: 16%; }
th:nth-child(3) { width: 15%; }
th:nth-child(4) { width: 13%; }
th:nth-child(5) { width: 16%; }
th:nth-child(6) { width: 13%; }
th:nth-child(7) { width: 10%; }
th:nth-child(8) { width: 10%; }
tbody tr:hover { background: #fafcfb; }
.record-photo { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: #e8ece9; }
.record-id { color: var(--forest-700); font-weight: 700; }
.subtext { display: block; max-width: 180px; margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 11px; white-space: nowrap; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.status.pending { color: #925d10; background: var(--amber-soft); }
.status.pending::before { background: #c68426; }
.status.confirmed { color: #286349; background: var(--forest-100); }
.status.confirmed::before { background: var(--forest-600); }
.status.done { color: #53616a; background: #e9eef1; }
.status.done::before { background: #7c8c94; }
.row-actions { display: flex; gap: 5px; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; color: #59655f; border: 1px solid transparent; border-radius: 5px; background: transparent; }
.icon-button:hover { color: var(--forest-700); border-color: var(--line); background: white; }
.icon-button.danger:hover { color: var(--red); border-color: #ecc7c3; background: var(--red-soft); }
.empty-state { display: grid; min-height: 230px; place-items: center; padding: 42px 20px; color: var(--muted); text-align: center; }
.empty-state > div { display: grid; justify-items: center; }
.empty-state .icon, .empty-state .lucide { width: 38px; height: 38px; margin-bottom: 10px; color: #96aaa0; }
.empty-state strong { color: #4f5f57; font-size: 13px; }
.empty-state span { margin-top: 5px; font-size: 12px; }
.loading-row td { padding: 50px; color: var(--muted); text-align: center; }

.modal-backdrop { position: fixed; z-index: 50; inset: 0; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(9,29,23,.62); }
.modal-backdrop.open { display: flex; }
.modal { width: min(860px, 92vw); max-height: 90vh; overflow: auto; border-radius: var(--radius); background: white; box-shadow: 0 26px 80px rgba(0,0,0,.28); }
.modal-head { position: sticky; z-index: 2; top: 0; display: flex; height: 62px; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); background: white; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.detail-layout { display: grid; grid-template-columns: minmax(280px, 1fr) 1fr; gap: 22px; }
.detail-photo-main { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; background: #e6ebe7; }
.thumbs { display: flex; gap: 7px; margin-top: 8px; overflow-x: auto; }
.thumb { width: 58px; height: 58px; padding: 0; border: 2px solid transparent; border-radius: 5px; overflow: hidden; background: none; }
.thumb.active { border-color: var(--forest-600); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 18px; }
.detail-item { min-width: 0; }
.detail-item.full { grid-column: 1 / -1; }
.detail-item span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.detail-item strong { display: block; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
.detail-status { display: flex; gap: 7px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-status .button { flex: 1; }
.detail-status .button.selected { color: white; border-color: var(--forest-700); background: var(--forest-700); }

@media (max-width: 560px) {
  .mobile-header { padding-top: 16px; }
  .collector-main { width: calc(100% - 20px); }
  .section { padding: 18px 15px; }
  .coordinate-grid, .field-grid { gap: 9px; }
  .location-status { flex-wrap: wrap; }
  .locate-button { margin-left: 0; }
}

@media (min-width: 760px) {
  .mobile-header { padding-top: 28px; }
  .form-panel { border-radius: 8px; }
  .section { padding: 24px; }
  .preview-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1280px) {
  .admin-layout { grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { width: 218px; }
  .side-brand { padding: 0 16px; }
  .admin-content, .topbar-inner { padding-right: 22px; padding-left: 22px; }
  .search-box { width: 280px; }
  .button.subtle { width: 42px; padding: 0; font-size: 0; }
}

/* Map-first mobile collector */
.collector-body {
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  background: #dbe4dc;
}

.map-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.collection-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  background: #dce4dd;
}

/* 高德地图缩放控件（右下角，避开底部操作栏） */
.amap-maps .amap-zoom { bottom: 110px !important; }

.map-header {
  position: absolute;
  z-index: 1000;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  display: flex;
  height: 60px;
  align-items: center;
  justify-content: space-between;
  padding: 0 13px;
  color: white;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  background: rgba(16, 45, 37, .94);
  box-shadow: 0 10px 28px rgba(16, 45, 37, .2);
  backdrop-filter: blur(10px);
}

.map-brand { display: flex; min-width: 0; align-items: center; gap: 10px; }
.map-brand-mark { display: grid; width: 36px; height: 36px; place-items: center; color: var(--forest-950); border-radius: 50%; background: #dcebd9; }
.map-brand-mark .lucide { width: 21px; height: 21px; }
.map-brand h1 { margin: 0; font-size: 16px; line-height: 1.2; }
.map-brand p { margin: 3px 0 0; color: #b9cdc3; font-size: 10px; }
.map-header-actions { display: flex; align-items: center; gap: 8px; }
.map-header-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  color: #d7e6de;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  background: rgba(255,255,255,.07);
}
.map-header-button:hover, .map-header-button:focus-visible { color: white; background: rgba(255,255,255,.14); outline: none; }
.map-network { color: #d6e4dd; }

.map-status {
  position: absolute;
  z-index: 900;
  top: calc(max(12px, env(safe-area-inset-top)) + 72px);
  left: 12px;
  display: flex;
  max-width: calc(100% - 70px);
  min-height: 48px;
  align-items: center;
  gap: 9px;
  padding: 8px 12px 8px 8px;
  color: #324139;
  border: 1px solid rgba(53, 78, 66, .16);
  border-radius: 7px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 7px 20px rgba(16,45,37,.12);
  backdrop-filter: blur(8px);
}

.map-status-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  color: #6d7c74;
  border-radius: 50%;
  background: #edf2ee;
}

.map-status.located .map-status-icon { color: white; background: var(--forest-700); }
.map-status > div > strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.map-status > div > span { display: block; max-width: 260px; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.map-actions {
  position: absolute;
  z-index: 1100;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  left: 12px;
  display: grid;
  height: 76px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 3px;
  padding: 6px;
  border: 1px solid rgba(41,71,57,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 12px 32px rgba(16,45,37,.2);
  backdrop-filter: blur(12px);
}

.map-action {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 2px;
  color: #4e5c55;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  user-select: none;
}

.map-action:hover, .map-action:focus-visible { color: var(--forest-700); background: var(--forest-50); outline: none; }
.map-action-icon { position: relative; display: grid; width: 31px; height: 29px; place-items: center; }
.map-action-icon .lucide { width: 22px; height: 22px; }
.map-action.submit-action { color: white; background: var(--forest-700); }
.map-action.submit-action:hover, .map-action.submit-action:focus-visible { color: white; background: var(--forest-800); }
.map-action.is-loading .lucide { animation: collector-spin .8s linear infinite; }
.map-action.is-tracking { color: white; background: var(--forest-700); }
.map-action.is-tracking:hover, .map-action.is-tracking:focus-visible { color: white; background: var(--forest-800); }
.map-action.is-tracking .map-action-icon::after {
  content: '';
  position: absolute;
  top: 1px;
  right: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #7ee2a8;
  box-shadow: 0 0 0 0 rgba(126,226,168,.55);
  animation: collector-pulse 1.6s ease-out infinite;
}
@keyframes collector-pulse {
  0% { box-shadow: 0 0 0 0 rgba(126,226,168,.55); }
  70% { box-shadow: 0 0 0 7px rgba(126,226,168,0); }
  100% { box-shadow: 0 0 0 0 rgba(126,226,168,0); }
}

.action-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  padding: 0 4px;
  color: white;
  border: 2px solid white;
  border-radius: 9px;
  background: var(--amber);
  font-size: 9px;
  line-height: 1;
}

.action-badge[hidden], .photo-float[hidden] { display: none; }

.photo-float {
  position: absolute;
  z-index: 900;
  bottom: calc(max(12px, env(safe-area-inset-bottom)) + 87px);
  left: 12px;
  display: flex;
  height: 56px;
  align-items: center;
  gap: 9px;
  padding: 6px 12px 6px 6px;
  color: var(--ink);
  border: 1px solid rgba(41,71,57,.16);
  border-radius: 7px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 8px 22px rgba(16,45,37,.16);
}

.photo-float-thumb { width: 42px; height: 42px; overflow: hidden; border-radius: 5px; background: #dfe6e1; }
.photo-float-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-float > span:last-child { display: block; text-align: left; }
.photo-float strong, .photo-float small { display: block; }
.photo-float strong { font-size: 11px; }
.photo-float small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.sheet-backdrop {
  position: fixed;
  z-index: 1200;
  inset: 0;
  background: rgba(9, 29, 23, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease;
}

.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.collection-sheet {
  position: fixed;
  z-index: 1300;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: min(82vh, 760px);
  max-height: min(82dvh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 8px 8px 0 0;
  background: white;
  box-shadow: 0 -18px 52px rgba(9,29,23,.24);
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.22,.8,.3,1);
}

.collection-sheet.open { transform: translateY(0); }
.sheet-handle { position: sticky; z-index: 5; top: 0; width: 38px; height: 4px; margin: 8px auto 0; border-radius: 2px; background: #c6d0ca; }
.sheet-header { position: sticky; z-index: 4; top: 0; display: flex; min-height: 70px; align-items: center; justify-content: space-between; padding: 12px 17px 10px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.97); }
.sheet-header h2 { margin: 0; font-size: 17px; }
.sheet-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.sheet-close { display: grid; width: 36px; height: 36px; place-items: center; padding: 0; color: #59665f; border: 1px solid var(--line); border-radius: 50%; background: white; }
.sheet-form { display: block; }
.sheet-section { padding: 18px 17px; border-bottom: 1px solid var(--line); scroll-margin-top: 74px; }
.sheet-section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-section-title h3 { margin: 0; font-size: 14px; }
.sheet-section-title span { color: var(--muted); font-size: 10px; }
.sheet-photo-empty { display: flex; min-height: 70px; align-items: center; gap: 12px; padding: 13px; color: var(--forest-700); border: 1px dashed #a9bdb2; border-radius: 7px; background: var(--forest-50); }
.sheet-photo-empty[hidden] { display: none; }
.sheet-photo-empty > .lucide { width: 25px; height: 25px; }
.sheet-photo-empty strong, .sheet-photo-empty span { display: block; }
.sheet-photo-empty strong { color: #34423b; font-size: 12px; }
.sheet-photo-empty span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.sheet-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 0; }
.sheet-preview-grid .add-photo { cursor: pointer; }
.sheet-full-field { display: block; margin-top: 13px; }
.sheet-submit { position: sticky; bottom: 0; padding: 12px 17px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.collector-body .primary-button { min-height: 46px; }
.collector-body .toast { z-index: 1500; bottom: calc(20px + env(safe-area-inset-bottom)); }

.history-sheet {
  display: flex;
  height: min(82vh, 760px);
  height: min(82dvh, 760px);
  flex-direction: column;
  overflow: hidden;
}

.history-sheet-header { flex: 0 0 auto; }
.history-head-leading, .sheet-header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.history-head-leading > div { min-width: 0; }
.sheet-nav-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: #4c5b53;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
}
.sheet-nav-button[hidden], .history-toolbar[hidden] { display: none; }

.history-toolbar { flex: 0 0 auto; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #f7f9f7; }
.history-search { position: relative; display: block; }
.history-search > .lucide { position: absolute; z-index: 1; top: 50%; left: 12px; color: #77847d; pointer-events: none; transform: translateY(-50%); }
.history-search input { height: 42px; padding-left: 39px; }

.history-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 10px 12px calc(18px + env(safe-area-inset-bottom)); background: #f3f6f4; }
.history-loading, .history-empty { display: grid; min-height: 260px; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.history-loading .lucide { margin-bottom: 10px; animation: collector-spin .8s linear infinite; }
.history-empty .lucide { width: 34px; height: 34px; margin-bottom: 10px; color: #91a49a; }
.history-empty strong, .history-empty span { display: block; }
.history-empty strong { color: #4a5952; font-size: 13px; }
.history-empty span { margin-top: 5px; font-size: 11px; }

.history-record {
  display: grid;
  width: 100%;
  min-height: 92px;
  grid-template-columns: 68px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 11px;
  margin-bottom: 9px;
  padding: 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  box-shadow: 0 3px 10px rgba(16,45,37,.035);
  text-align: left;
}
.history-record:hover, .history-record:focus-visible { border-color: #abc2b6; outline: none; }
.history-photo { display: block; width: 68px; height: 68px; overflow: hidden; border-radius: 6px; background: #dce4df; }
.history-photo img { width: 100%; height: 100%; object-fit: cover; }
.history-record-body { display: block; min-width: 0; }
.history-record-top { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; }
.history-record-top > strong { overflow: hidden; color: var(--forest-700); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.history-record-name { display: block; margin-top: 7px; overflow: hidden; font-size: 13px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.history-record-meta { display: flex; min-width: 0; gap: 10px; margin-top: 7px; color: var(--muted); font-size: 9px; }
.history-record-meta > span { display: flex; min-width: 0; align-items: center; gap: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-record-meta > span:last-child { flex: 1; }
.history-record-meta .lucide { width: 11px; height: 11px; }
.history-chevron { width: 16px; height: 16px; color: #91a098; }

.history-detail { min-height: 100%; margin: -10px -12px 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); background: white; }
.history-photo-strip { display: flex; gap: 7px; padding: 12px 16px 6px; overflow-x: auto; scroll-snap-type: x mandatory; }
.history-photo-strip img { width: 86%; min-width: 86%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; background: #dce4df; scroll-snap-align: start; }
.history-photo-strip img:only-child { width: 100%; min-width: 100%; }
.history-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 14px; padding: 18px 16px; }
.history-detail-grid > div { min-width: 0; }
.history-detail-grid > div.full { grid-column: 1 / -1; }
.history-detail-grid span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; }
.history-detail-grid strong { display: block; color: #35433c; font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.history-map-button { display: flex; width: calc(100% - 32px); height: 44px; align-items: center; justify-content: center; gap: 7px; margin: 0 16px; color: var(--forest-700); border: 1px solid #aec6ba; border-radius: 7px; background: var(--forest-50); font-weight: 700; }
.history-marker { background: var(--amber); }
.map-status.history-view .map-status-icon { background: var(--amber); }

.collection-marker-wrap { background: transparent; border: 0; }
.collection-marker {
  position: relative;
  display: block;
  width: 32px;
  height: 32px;
  border: 4px solid white;
  border-radius: 50% 50% 50% 5px;
  background: var(--forest-700);
  box-shadow: 0 5px 15px rgba(16,45,37,.3);
  transform: rotate(-45deg);
}
.collection-marker > span { position: absolute; inset: 8px; border-radius: 50%; background: #cfe4d5; }

@keyframes collector-spin { to { transform: rotate(360deg); } }

@media (min-width: 760px) {
  .map-header { right: auto; width: 410px; }
  .map-status { max-width: 380px; }
  .map-actions { right: auto; left: 50%; width: 430px; transform: translateX(-50%); }
  .photo-float { left: calc(50% - 215px); }
  .collection-sheet { top: 0; right: 0; bottom: 0; left: auto; width: min(460px, 42vw); max-height: none; border-radius: 0; transform: translateX(102%); }
  .collection-sheet.open { transform: translateX(0); }
  .history-sheet { height: auto; }
  .sheet-handle { display: none; }
  .sheet-header { min-height: 76px; padding-top: 14px; }
}

@media (max-width: 360px) {
  .map-header { right: 8px; left: 8px; }
  .map-status { left: 8px; }
  .map-actions { right: 8px; left: 8px; }
  .map-action { font-size: 10px; }
  .coordinate-grid, .field-grid { grid-template-columns: 1fr; }
}
