:root {
  --ink: #172b3a;
  --ink-2: #345062;
  --muted: #71818c;
  --line: #dce3e7;
  --panel: #ffffff;
  --canvas: #eef2f2;
  --accent: #dc6f45;
  --accent-dark: #bd5530;
  --accent-soft: #fff0e9;
  --teal: #1b8a7a;
  --shadow: 0 14px 38px rgba(23, 43, 58, .14);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
[hidden] { display: none !important; }
.auth-gate { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 20px; background: linear-gradient(135deg, #172b3a, #245364); }
.auth-card { width: min(420px, 100%); background: #fff; border-radius: 18px; padding: 30px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.auth-brand { color: var(--ink); margin-bottom: 26px; }.auth-brand .brand-mark { background: transparent; }.auth-brand .brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.auth-card h1 { font-size: 24px; margin: 0 0 7px; }.auth-card > p { color: var(--ink-2); font-size: 13px; line-height: 1.5; margin: 0 0 20px; }
.auth-form { display: grid; gap: 14px; }.auth-form .button { width: 100%; margin-top: 4px; }.auth-error { color: #a53f2c !important; background: #fff0ec; border-radius: 8px; padding: 10px; margin: 14px 0 0 !important; }.auth-switch { display: block; width: 100%; text-align: center; margin-top: 18px; }
.logout-button { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }
.current-user { color: #dce8ec; font-size: 12px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-users-button { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); }.admin-user-add { display: grid; gap: 8px; margin-top: 12px; }.admin-user-add input { border: 1px solid var(--line); border-radius: 7px; padding: 9px; }
.project-members-list { display: grid; gap: 8px; margin: 12px 0 16px; }.project-member-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 12px; }.project-member-row select { border: 1px solid var(--line); border-radius: 6px; padding: 5px; }.project-member-row button { border: 0; background: transparent; color: #a53f2c; cursor: pointer; }.member-add-row { display: grid; grid-template-columns: 1fr auto auto; gap: 7px; }.member-add-row input, .member-add-row select { min-width: 0; border: 1px solid var(--line); border-radius: 7px; padding: 9px; }
button, input, select { font: inherit; }
button, select, input[type="range"] { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .map:focus-visible {
  outline: 3px solid rgba(27, 138, 122, .32);
  outline-offset: 2px;
}

.topbar {
  height: 68px;
  background: var(--ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: relative;
  z-index: 20;
  box-shadow: 0 2px 14px rgba(0,0,0,.18);
}
.brand { display: flex; align-items: center; gap: 11px; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-mark svg { width: 23px; fill: #fff; }
.brand strong { display: block; font-size: 17px; line-height: 1.05; }
.brand small { display: block; color: #9eb2bd; font-size: 11px; margin-top: 4px; letter-spacing: .08em; text-transform: uppercase; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.sync-pill { border: 1px solid rgba(255,255,255,.16); color: #dce8ec; background: rgba(255,255,255,.05); border-radius: 999px; padding: 9px 12px; display: flex; align-items: center; gap: 7px; font-size: 11px; }
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #e1a62b; box-shadow: 0 0 0 4px rgba(225,166,43,.12); }
.sync-pill.ready .sync-dot { background: #62d7aa; box-shadow: 0 0 0 4px rgba(98,215,170,.13); }
.sync-pill.error .sync-dot { background: #ef8a67; box-shadow: 0 0 0 4px rgba(239,138,103,.13); }
.privacy-pill { border: 1px solid rgba(255,255,255,.18); color: #dce8ec; background: rgba(255,255,255,.06); border-radius: 999px; padding: 9px 13px; display: flex; align-items: center; gap: 8px; font-size: 13px; }
.privacy-pill:hover { background: rgba(255,255,255,.1); }
.privacy-dot { width: 8px; height: 8px; border-radius: 50%; background: #62d7aa; box-shadow: 0 0 0 4px rgba(98,215,170,.13); }
.privacy-popover { position: absolute; right: 190px; top: 58px; width: 310px; color: var(--ink); background: white; border-radius: 12px; box-shadow: var(--shadow); padding: 16px; border: 1px solid var(--line); z-index: 50; }
.privacy-popover strong { font-size: 14px; }
.privacy-popover p { font-size: 12.5px; line-height: 1.55; color: var(--ink-2); margin: 7px 0 0; }

.button { border: 0; border-radius: 9px; padding: 10px 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: .18s ease; }
.button svg { width: 17px; fill: currentColor; }
.button.primary { background: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(220,111,69,.24); }
.button.primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.button.secondary { background: #edf1f3; color: var(--ink); }
.button.secondary:hover { background: #e0e7ea; }

.workspace { height: calc(100% - 68px); display: grid; grid-template-columns: 316px minmax(0, 1fr); }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 23px 20px 18px; overflow-y: auto; position: relative; z-index: 5; }
.sidebar-heading, .section-row { display: flex; justify-content: space-between; align-items: center; }
.sidebar-heading label, .section-row h2 { font-size: 12px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; margin: 0; color: var(--ink-2); }
.project-count { font-size: 11px; color: var(--muted); }
.select-wrap { position: relative; margin-top: 9px; }
.project-select-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; margin-top: 9px; }
.project-select-row .select-wrap { margin-top: 0; }
.select-wrap select { width: 100%; appearance: none; border: 1px solid #ccd7dc; background: #f8fafb; border-radius: 10px; color: var(--ink); font-weight: 750; padding: 12px 38px 12px 12px; }
.select-wrap svg { width: 17px; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); fill: none; stroke: var(--ink-2); stroke-width: 1.8; pointer-events: none; }
.project-actions { display: flex; gap: 4px; }
.project-action { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink-2); font-size: 18px; line-height: 1; }
.project-action:hover { border-color: #9bc4bd; background: #eff9f5; color: #176955; }
.project-action.danger { color: #9c462b; font-size: 20px; }
.project-action.danger:hover { border-color: #e4b4a6; background: #fff5f1; color: #a63d24; }
.project-action:disabled { opacity: .45; cursor: not-allowed; }
.project-meta { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; margin: 13px 0 26px; }
.project-meta > div { background: #f2f5f6; border-radius: 9px; padding: 10px 11px; }
.meta-label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; display: block; margin-bottom: 4px; }
.project-meta strong { font-size: 12.5px; }
.icon-button { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; }
.icon-button:hover { background: #f3f6f7; }
.icon-button svg { width: 16px; fill: none; stroke: var(--ink-2); stroke-width: 1.7; }
.layer-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.layer-row { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 8px 9px; transition: .18s ease; }
.layer-row:hover { border-color: #a9bbc4; }
.layer-row.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px rgba(220,111,69,.15); }
.layer-main { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; }
.layer-visibility { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.layer-select { min-width: 0; border: 0; background: transparent; padding: 0; color: var(--ink); display: grid; grid-template-columns: 38px minmax(0,1fr) auto; gap: 10px; align-items: center; text-align: left; }
.layer-row:not(.visible) .layer-select { opacity: .58; }
.layer-actions { display: flex; align-items: center; gap: 4px; opacity: 0; pointer-events: none; transition: .16s ease; }
.layer-row:hover .layer-actions, .layer-row:focus-within .layer-actions { opacity: 1; pointer-events: auto; }
.layer-download, .layer-delete { width: 29px; height: 29px; border-radius: 7px; border: 1px solid transparent; display: grid; place-items: center; color: var(--ink-2); background: rgba(255,255,255,.75); transition: .16s ease; }
.layer-download { font-size: 8px; font-weight: 850; letter-spacing: -.02em; }
.layer-download:hover { border-color: #9bc4bd; color: #176955; background: #eff9f5; }
.layer-download:disabled { opacity: .55; cursor: wait; }
.layer-delete { width: 29px; height: 29px; border-radius: 7px; border: 1px solid transparent; display: grid; place-items: center; color: #8d5c50; background: rgba(255,255,255,.75); opacity: 0; pointer-events: none; transition: .16s ease; }
.layer-delete svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.65; }
.layer-actions .layer-delete { opacity: 1; pointer-events: auto; }
.layer-delete:hover { border-color: #e4b4a6; color: #a63d24; background: #fff5f1; }
.layer-thumb { width: 38px; height: 38px; border-radius: 7px; background: linear-gradient(145deg, #6f9366, #d3c899 52%, #887865); position: relative; overflow: hidden; }
.layer-thumb::after { content: ""; position: absolute; width: 50px; height: 6px; background: #d8d3c8; transform: rotate(-32deg); top: 15px; left: -6px; box-shadow: 0 0 0 1px #98978f; }
.layer-info strong { font-size: 12.5px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 165px; }
.layer-info span { color: var(--muted); font-size: 11px; display: block; margin-top: 3px; }
.layer-state { width: 8px; height: 8px; border-radius: 50%; background: #b7c4ca; }
.layer-row.active .layer-state { background: var(--accent); box-shadow: 0 0 0 4px rgba(220,111,69,.14); }
.layer-opacity-control { display: grid; grid-template-columns: auto minmax(0,1fr) 35px; align-items: center; gap: 7px; margin: 7px 1px 0 24px; color: var(--muted); font-size: 10px; }
.layer-opacity-control input { width: 100%; min-width: 0; }
.layer-opacity-control output { text-align: right; font-variant-numeric: tabular-nums; }
.layer-row:not(.visible) .layer-opacity-control { opacity: .42; }
.files-section-heading { margin-top: 25px; }
.file-add-button { border: 1px solid #cdd8dd; border-radius: 7px; padding: 6px 8px; background: #fff; color: var(--teal); font-size: 10px; font-weight: 800; }
.file-add-button:hover { background: #edf7f4; border-color: #9bc4bd; }
.project-file-list { display: grid; gap: 7px; margin-top: 11px; }
.project-file-empty { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0; }
.project-file-row { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 9px; padding: 7px; background: #fff; }
.project-file-row:hover { border-color: #a9bbc4; }
.file-type-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 7px; background: #fff0eb; color: var(--accent-dark); font-size: 9px; font-weight: 900; }
.file-type-mark.jpg { color: #176955; background: #ebf7f2; }
.project-file-info { min-width: 0; }
.project-file-info strong { display: block; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-file-info span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.project-file-actions { display: flex; gap: 4px; }
.project-file-action { width: 27px; height: 27px; border: 1px solid transparent; border-radius: 6px; background: #f2f6f6; color: var(--ink-2); font-size: 9px; font-weight: 850; }
.project-file-action:hover { border-color: #9bc4bd; background: #eff9f5; color: #176955; }
.project-file-action.danger { color: #9c462b; }
.project-file-action.danger:hover { border-color: #e4b4a6; background: #fff5f1; color: #a63d24; }
.geopackage-section-heading { margin-top: 25px; }
.geo-package-list { display: grid; gap: 8px; margin-top: 11px; }
.geo-package-empty { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 0; }
.geo-package-row { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 9px; transition: .18s ease; }
.geo-package-row:hover { border-color: #a9bbc4; }
.geo-package-row.loading { background: #f7fafb; }
.geo-package-main { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 8px; align-items: center; }
.geo-package-visibility { width: 16px; height: 16px; margin: 0; accent-color: var(--teal); }
.geo-package-info { min-width: 0; }
.geo-package-info strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.geo-package-info span { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.geo-package-actions { display: flex; gap: 4px; }
.geo-package-action { width: 27px; height: 27px; border: 1px solid transparent; border-radius: 6px; background: #f2f6f6; color: var(--ink-2); font-size: 10px; font-weight: 850; }
.geo-package-action:hover { border-color: #9bc4bd; background: #eff9f5; color: #176955; }
.geo-package-action.danger { color: #9c462b; }
.geo-package-action.danger:hover { border-color: #e4b4a6; background: #fff5f1; color: #a63d24; }
.geo-package-row:not(.visible) .geo-package-info { opacity: .58; }
.geo-package-status { margin: 7px 0 0 24px; color: var(--muted); font-size: 10px; }
.geo-package-style-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 9px; margin: 9px 0 0 24px; }
.geo-package-style-control { display: grid; grid-template-columns: auto minmax(0,1fr) 34px; gap: 6px; align-items: center; color: var(--muted); font-size: 9px; }
.geo-package-style-control input[type="range"] { width: 100%; min-width: 0; }
.geo-package-style-control output { text-align: right; font-variant-numeric: tabular-nums; }
.geo-package-color-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 9px; }
.geo-package-color-control input[type="color"] { width: 28px; height: 22px; padding: 2px; border: 1px solid #cdd8dd; border-radius: 6px; background: #fff; }
.geo-package-row:not(.visible) .geo-package-style-grid, .geo-package-row:not(.visible) .geo-package-color-control { opacity: .42; }
.sidebar-note { margin-top: 22px; padding: 12px; border-radius: 10px; background: #f3f7f8; color: var(--ink-2); display: flex; gap: 9px; align-items: flex-start; }
.sidebar-note p { margin: 0; font-size: 11.5px; line-height: 1.5; }
.note-icon { flex: 0 0 auto; width: 18px; height: 18px; border: 1px solid #9eb0b9; color: #6d818c; border-radius: 50%; font-size: 11px; display: grid; place-items: center; font-weight: 800; }

.map-panel { min-width: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; background: #cfd8d4; }
.map { position: relative; overflow: hidden; background: #d9e0dc; cursor: grab; user-select: none; touch-action: none; }
.map.dragging { cursor: grabbing; }
.map.measuring { cursor: crosshair; }
.tile-layer, .raster-layer, .comparison-layer { position: absolute; inset: 0; overflow: hidden; }
.tile-layer img { position: absolute; width: 256px; height: 256px; max-width: none; user-select: none; pointer-events: none; }
.raster-image, .comparison-image { position: absolute; max-width: none; pointer-events: none; filter: saturate(.94) contrast(1.03); }
.comparison-layer { z-index: 3; pointer-events: none; }
.raster-layer { z-index: 2; }
.geopackage-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 5; pointer-events: none; overflow: visible; }
.geopackage-feature-line { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.geopackage-feature-polygon { stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.geopackage-feature-point { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.map-grid { position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: .13; background-image: linear-gradient(rgba(23,43,58,.28) 1px, transparent 1px), linear-gradient(90deg, rgba(23,43,58,.28) 1px, transparent 1px); background-size: 80px 80px; }
.measurement-layer { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 7; pointer-events: none; overflow: visible; }
.measurement-layer.editing { pointer-events: auto; }
.measurement-line { fill: none; stroke: #f4a261; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; paint-order: stroke; }
.measurement-area { fill: rgba(244,162,97,.22); stroke: #f4a261; stroke-width: 3; stroke-linejoin: round; }
.measurement-point { fill: #fff; stroke: #d75f35; stroke-width: 2.5; }
.measurement-layer.editing .measurement-point.editing { pointer-events: all; cursor: grab; }
.measurement-layer.editing .measurement-point.editing.dragging { cursor: grabbing; }
.measurement-line.editing, .measurement-area.editing { stroke: #c9552f; }
.measurement-area.editing { fill: rgba(220,111,69,.3); }
.measurement-label-bg { fill: rgba(23,43,58,.92); }
.measurement-label { fill: #fff; font-size: 12px; font-weight: 750; text-anchor: middle; dominant-baseline: middle; }
.map::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 4; box-shadow: inset 0 0 120px rgba(15, 34, 39, .12); }
.map-toolbar { position: absolute; z-index: 8; display: flex; background: #fff; box-shadow: 0 5px 18px rgba(23,43,58,.16); border: 1px solid rgba(23,43,58,.13); border-radius: 10px; overflow: hidden; }
.top-left { top: 18px; left: 18px; flex-direction: column; }
.top-right { top: 18px; right: 18px; }
.map-toolbar button { border: 0; background: #fff; color: var(--ink); min-width: 38px; height: 38px; font-weight: 750; border-bottom: 1px solid var(--line); }
.map-toolbar button:last-child { border-bottom: 0; }
.map-toolbar button:hover { background: #f1f5f6; }
.map-toolbar button.active { background: var(--accent); color: #fff; }
.map-basemap-control { position: absolute; z-index: 9; top: 18px; right: 148px; display: flex; align-items: center; gap: 7px; padding: 6px 8px 6px 10px; border: 1px solid rgba(23,43,58,.14); border-radius: 9px; background: rgba(255,255,255,.96); box-shadow: 0 5px 18px rgba(23,43,58,.16); color: var(--ink-2); font-size: 10px; font-weight: 750; }
.map-basemap-control select { border: 1px solid #cdd8dd; border-radius: 6px; padding: 5px 7px; color: var(--ink); background: #fff; font-size: 11px; }
.map-toolbar button.toolbar-separator { border-top: 2px solid var(--line); }
.map-toolbar button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; vertical-align: middle; }
.segmented { flex-direction: row; padding: 3px; border-radius: 9px; }
.segmented button { height: 32px; padding: 0 13px; border: 0; border-radius: 7px; font-size: 12px; }
.segmented button.active { background: var(--ink); color: white; }
.measure-panel { position: absolute; z-index: 9; top: 18px; left: 70px; display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 11px; border: 1px solid rgba(23,43,58,.14); border-radius: 10px; background: rgba(255,255,255,.96); box-shadow: 0 5px 18px rgba(23,43,58,.16); }
.measure-panel[hidden] { display: none; }
.measure-panel > div { min-width: 150px; }
.measure-panel span { display: block; color: var(--muted); font-size: 10px; }
.measure-panel strong { display: block; margin-top: 2px; font-size: 13px; color: var(--ink); }
.measure-panel button { border: 0; border-radius: 7px; background: #edf1f3; color: var(--ink-2); padding: 8px 10px; font-size: 12px; font-weight: 750; }
.measure-panel button:hover { background: #dfe7ea; }
.measure-panel button.finish { background: var(--accent); color: #fff; }
.measure-panel button:disabled { opacity: .45; cursor: not-allowed; }
.measurements-list { position: absolute; right: 18px; bottom: 18px; z-index: 30; width: min(320px, calc(100% - 36px)); max-height: min(315px, calc(100% - 105px)); overflow: auto; padding: 12px; border: 1px solid rgba(23,43,58,.14); border-radius: 11px; background: rgba(255,255,255,.96); box-shadow: 0 8px 26px rgba(23,43,58,.2); pointer-events: auto; }
.measurements-list[hidden] { display: none; }
.measurements-list-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.measurements-list-header strong { display: block; margin-top: 2px; font-size: 13px; }
.measurement-edit-actions { display: flex; gap: 5px; }
.measurement-items { position: relative; z-index: 31; display: grid; gap: 7px; margin-top: 9px; pointer-events: auto; }
.measurement-item { display: grid; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.measurement-item.active { border-color: var(--accent); background: var(--accent-soft); }
.measurement-item-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.measurement-item-main > div { min-width: 0; }
.measurement-item-main strong { display: block; font-size: 11px; }
.measurement-item-main span:not(.measurement-type-mark) { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.measurement-type-mark { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 7px; color: var(--accent-dark); background: #fff1eb; font-weight: 900; }
.measurement-type-mark.area { color: #176955; background: #ebf7f2; }
.measurement-item-actions { position: relative; z-index: 32; display: flex; gap: 6px; justify-content: flex-end; pointer-events: auto; }
.measurement-action { border: 0; border-radius: 6px; padding: 6px 8px; font-size: 10px; font-weight: 800; cursor: pointer; pointer-events: auto; touch-action: manipulation; }
.measurement-action.secondary { color: var(--ink-2); background: #edf1f3; }
.measurement-action.secondary:hover { background: #dfe7ea; }
.measurement-action.primary { color: #fff; background: var(--accent); }
.measurement-action.primary:hover { background: var(--accent-dark); }
.measurement-action.danger { color: #a63d24; background: #fff0eb; }
.measurement-action.danger:hover { background: #f8dcd2; }
.coordinates { position: absolute; left: 18px; bottom: 18px; z-index: 8; background: rgba(23,43,58,.84); backdrop-filter: blur(8px); color: #e9f0f2; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 7px 9px; border-radius: 6px; }
.attribution { position: absolute; right: 8px; bottom: 5px; z-index: 8; background: rgba(255,255,255,.72); color: #526872; font-size: 9px; padding: 2px 4px; }
.layer-label { position: absolute; z-index: 8; bottom: 18px; background: rgba(255,255,255,.92); color: var(--ink); border-radius: 7px; padding: 7px 9px; font-size: 11px; font-weight: 750; box-shadow: 0 3px 10px rgba(23,43,58,.14); }
.layer-label.previous { left: 50%; transform: translateX(calc(-100% - 10px)); }
.layer-label.current { left: 50%; margin-left: 10px; }
.compare-divider { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(23,43,58,.3), 0 0 12px rgba(0,0,0,.35); z-index: 6; cursor: ew-resize; touch-action: none; }
.compare-divider span { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 34px; height: 34px; border-radius: 50%; background: white; box-shadow: 0 3px 12px rgba(23,43,58,.26); }
.compare-divider span::before { content: "↔"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink); font-weight: 800; }
.compare-divider:hover span, .compare-divider.dragging span { box-shadow: 0 3px 16px rgba(23,43,58,.38); }
.map-empty { position: absolute; inset: 0; z-index: 7; background: rgba(238,242,242,.86); display: grid; place-content: center; text-align: center; gap: 7px; }
.map-empty[hidden] { display: none; }
.map-empty strong { font-size: 18px; }
.map-empty span { color: var(--muted); font-size: 13px; }

.timeline-panel { background: rgba(255,255,255,.98); border-top: 1px solid var(--line); padding: 13px 22px 15px; position: relative; z-index: 10; }
.timeline-controls { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.date-summary span { display: block; color: var(--muted); text-transform: uppercase; font-size: 9px; letter-spacing: .1em; font-weight: 800; }
.date-summary strong { display: block; font-size: 14px; margin-top: 3px; }
.display-controls { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.opacity-control { display: grid; grid-template-columns: auto 110px 42px; gap: 9px; align-items: center; color: var(--ink-2); font-size: 11px; }
input[type="range"] { accent-color: var(--accent); }
.opacity-control output { color: var(--muted); font-variant-numeric: tabular-nums; }
.compare-pair-controls { display: flex; align-items: center; gap: 7px; }
.compare-select-control { display: grid; grid-template-columns: auto minmax(120px, 155px); align-items: center; gap: 5px; color: var(--ink-2); font-size: 10px; }
.compare-select-control select { min-width: 0; border: 1px solid #cdd8dd; border-radius: 7px; padding: 6px 7px; color: var(--ink); background: #fff; font-size: 10px; }
.compare-select-control select:focus { border-color: var(--teal); }
.switch-control { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 11px; font-weight: 700; cursor: pointer; }
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 35px; height: 20px; background: #c5d0d5; border-radius: 99px; position: relative; transition: .2s ease; }
.switch::after { content: ""; width: 14px; height: 14px; background: white; box-shadow: 0 1px 3px rgba(0,0,0,.22); border-radius: 50%; position: absolute; left: 3px; top: 3px; transition: .2s ease; }
.switch-control input:checked + .switch { background: var(--accent); }
.switch-control input:checked + .switch::after { transform: translateX(15px); }
.timeline { display: flex; position: relative; margin-top: 13px; padding: 0 8px; gap: 0; }
.timeline::before { content: ""; position: absolute; left: 18px; right: 18px; top: 8px; height: 2px; background: #d8e1e4; }
.timepoint { flex: 1 1 0; position: relative; padding-top: 19px; border: 0; background: transparent; color: var(--muted); font-size: 10px; text-align: center; min-width: 80px; }
.timepoint::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid #a8b8c0; position: absolute; top: 2.5px; left: 50%; transform: translateX(-50%); z-index: 1; transition: .18s ease; }
.timepoint:hover::before { border-color: var(--accent); transform: translateX(-50%) scale(1.15); }
.timepoint.active { color: var(--ink); font-weight: 800; }
.timepoint.active::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 5px rgba(220,111,69,.14); }
.upload-dialog { border: 0; border-radius: 16px; padding: 0; width: min(650px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 22px 70px rgba(23,43,58,.27); }
.upload-dialog::backdrop { background: rgba(15,29,38,.55); backdrop-filter: blur(3px); }
.upload-dialog form { padding: 25px; }
.file-upload-dialog { width: min(560px, calc(100vw - 32px)); }
.project-edit-dialog { width: min(520px, calc(100vw - 32px)); }
.file-drop-field { min-height: 135px; }
.selected-file-state { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafb; color: var(--muted); padding: 10px 11px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file-state.ready { border-color: #93c8b7; background: #f0f8f5; color: #176955; }
.delete-dialog { border: 0; border-radius: 15px; padding: 0; width: min(410px, calc(100vw - 32px)); color: var(--ink); box-shadow: 0 22px 70px rgba(23,43,58,.27); }
.delete-dialog::backdrop { background: rgba(15,29,38,.55); backdrop-filter: blur(3px); }
.delete-dialog form { padding: 25px; text-align: center; }
.delete-dialog h2 { margin: 12px 0 7px; font-size: 20px; }
.delete-dialog p { margin: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.55; }
.delete-icon { margin: 0 auto; width: 42px; height: 42px; border-radius: 50%; background: #fff0eb; color: var(--accent-dark); display: grid; place-items: center; }
.delete-icon svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.delete-actions { display: flex; justify-content: center; gap: 9px; margin-top: 20px; }
.button.danger { background: #b84c31; color: white; }
.button.danger:hover { background: #9f3e26; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; }
.eyebrow { color: var(--accent-dark); font-size: 10px; text-transform: uppercase; letter-spacing: .13em; font-weight: 850; }
.dialog-header h2 { font-size: 22px; margin: 4px 0 0; letter-spacing: -.02em; }
.dialog-close { border: 0; background: #edf2f3; color: var(--ink-2); width: 34px; height: 34px; border-radius: 50%; font-size: 23px; line-height: 1; }
.dialog-intro { color: var(--ink-2); font-size: 12.5px; line-height: 1.5; margin: 10px 0 20px; }
.form-grid, .bounds-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .bounds-fieldset legend { color: var(--ink-2); font-size: 11px; font-weight: 750; }
.field input, .field select { width: 100%; border: 1px solid #cdd8dd; border-radius: 8px; padding: 10px 11px; color: var(--ink); background: #fff; }
.field input:focus, .field select:focus { border-color: var(--teal); }
.drop-field { border: 1.5px dashed #aebfc7; border-radius: 11px; min-height: 102px; display: flex; align-items: center; justify-content: center; flex-direction: column; background: #f6f9f9; position: relative; transition: .2s ease; }
.drop-field:hover, .drop-field.dragover { background: #edf5f3; border-color: var(--teal); }
.drop-field input { position: absolute; inset: 0; opacity: 0; width: 100%; }
.drop-field svg { width: 24px; fill: none; stroke: var(--teal); stroke-width: 1.8; margin-bottom: 5px; }
.drop-field strong { font-size: 12px; }
.drop-field span { color: var(--muted); font-size: 10px; margin-top: 3px; }
.file-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.pair-file { min-width: 0; border: 1px solid var(--line); background: #f8fafb; border-radius: 8px; padding: 9px 10px; display: flex; align-items: center; gap: 9px; }
.pair-file > span { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .08em; border: 1px solid #c6d2d7; border-radius: 5px; padding: 3px 5px; }
.pair-file strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--ink-2); }
.pair-file.ready { border-color: #93c8b7; background: #f0f8f5; }
.pair-file.ready > span { color: #197561; border-color: #8bc3b1; }
.bounds-fieldset { margin: 17px 0 0; border: 1px solid var(--line); border-radius: 10px; padding: 13px; }
.bounds-fieldset legend { padding: 0 6px; }
.georef-fieldset { display: grid; grid-template-columns: 1fr 1.35fr; gap: 12px; align-items: end; }
.georef-status { min-height: 59px; border-radius: 8px; padding: 9px 10px; display: flex; align-items: flex-start; gap: 8px; background: #f2f5f6; color: var(--ink-2); }
.georef-status p { margin: 0; font-size: 10.5px; line-height: 1.45; }
.status-mark { flex: 0 0 auto; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 850; background: #dbe4e7; }
.georef-status.success { background: #ebf7f2; color: #176955; }
.georef-status.success .status-mark { background: #68bca2; color: white; }
.georef-status.error { background: #fff0ec; color: #9c462b; }
.georef-status.error .status-mark { background: var(--accent); color: white; }
.text-button { border: 0; background: transparent; color: var(--teal); padding: 9px 0 0; font-size: 11px; font-weight: 750; }
.dialog-footer { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 17px; display: flex; align-items: center; gap: 10px; }
.dialog-footer > span { margin-right: auto; color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 5px; }
.dialog-footer > span svg { width: 16px; fill: #5e9f87; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; background: var(--ink); color: white; border-radius: 10px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 12px; transform: translateY(25px); opacity: 0; pointer-events: none; transition: .25s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 250px minmax(0,1fr); }
  .sidebar { padding: 18px 14px; }
  .display-controls { gap: 12px; }
  .opacity-control { grid-template-columns: auto 75px 38px; }
}

@media (max-width: 680px) {
  html, body { overflow: auto; }
  .topbar { padding: 0 13px; position: sticky; top: 0; }
  .privacy-pill { font-size: 0; padding: 10px; }
  .sync-pill { font-size: 0; padding: 10px; }
  .privacy-dot { margin: 0; }
  .button { padding: 10px 12px; }
  .workspace { height: auto; min-height: calc(100vh - 68px); grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; max-height: 245px; }
  .project-meta, .sidebar-note { display: none; }
  .section-row { margin-top: 14px; }
  .layer-list { flex-direction: row; overflow-x: auto; padding-bottom: 3px; }
  .layer-row { min-width: 235px; }
  .layer-actions { opacity: 1; pointer-events: auto; }
  .layer-delete { opacity: 1; pointer-events: auto; }
  .map-panel { min-height: 650px; grid-template-rows: minmax(430px, 1fr) auto; }
  .timeline-controls { align-items: flex-start; }
  .display-controls { flex-direction: column; align-items: flex-end; gap: 8px; }
  .opacity-control { grid-template-columns: 70px 38px; }
  .opacity-control span { display: none; }
  .timeline-panel { padding: 12px 12px 15px; overflow: hidden; }
  .measure-panel { top: 64px; left: 12px; right: 12px; flex-wrap: wrap; }
  .map-basemap-control { top: 58px; right: 12px; }
  .measure-panel > div { flex: 1 1 130px; }
  .measurements-list { right: 12px; bottom: 12px; width: min(320px, calc(100% - 24px)); max-height: 285px; }
  .timeline { overflow-x: auto; justify-content: flex-start; }
  .timepoint { flex: 0 0 110px; }
  .form-grid, .bounds-grid { grid-template-columns: 1fr; }
  .georef-fieldset, .file-pair { grid-template-columns: 1fr; }
  .geo-package-style-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .dialog-footer { flex-wrap: wrap; }
  .dialog-footer > span { width: 100%; }
  .privacy-popover { right: 12px; width: min(310px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
