:root {
  color-scheme: light;
  --ink: #102b27;
  --ink-soft: #334640;
  --muted: #6a7771;
  --muted-soft: #84908a;
  --line: #e1e8e4;
  --line-strong: #d3ddd7;
  --canvas: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f6f9f7;
  --green: #0b654a;
  --green-dark: #084a38;
  --green-soft: #e9f3ee;
  --amber: #a46d12;
  --red: #ad4545;
  --shadow: 0 14px 38px rgba(18, 43, 35, .11);
  --shadow-small: 0 4px 16px rgba(18, 43, 35, .09);
  --radius: 12px;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-height: 0; margin: 0; }
body { overflow: hidden; background: var(--canvas); color: var(--ink); font-family: var(--font-ui); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
button, input, select, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(11, 101, 74, .24); outline-offset: 2px; }
a { color: inherit; }
.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; }
.app-shell { display: flex; width: 100%; height: 100dvh; min-height: 0; flex-direction: column; }

.topbar { position: relative; z-index: 800; display: grid; height: 78px; flex: none; grid-template-columns: 202px minmax(320px, 730px) auto; align-items: center; gap: clamp(16px, 2.1vw, 32px); padding: 0 26px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.brand-mark { display: block; width: 40px; height: 46px; flex: none; object-fit: contain; }
.brand-lockup { display: grid; gap: 2px; white-space: nowrap; }
.brand-lockup strong, .brand-name { color: var(--ink); font-size: 19px; font-weight: 760; letter-spacing: -.055em; line-height: 1; }
.brand-lockup small { color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: -.005em; }
.topbar-actions { display: flex; justify-content: flex-end; }
.free-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.free-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

.map-search-shell { position: relative; z-index: 850; width: 100%; min-width: 0; }
.map-search-row { display: flex; align-items: center; gap: 10px; }
.search-form { position: relative; min-width: 0; flex: 1; }
.search-form input, .select-control, .field-control { width: 100%; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); font-size: 13px; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.search-form input { height: 46px; padding: 0 42px 0 42px; }
.search-form input::placeholder { color: var(--muted-soft); font-weight: 450; }
.search-form input:hover, .select-control:hover, .field-control:hover { border-color: #b7c7be; }
.search-form input:focus, .select-control:focus, .field-control:focus { border-color: var(--green); outline: 0; box-shadow: 0 0 0 3px rgba(11, 101, 74, .1); }
.search-icon { position: absolute; top: 13px; left: 14px; z-index: 2; width: 20px; height: 20px; fill: none; stroke: var(--ink-soft); stroke-linecap: round; stroke-width: 1.8; pointer-events: none; }
.clear-search { position: absolute; top: 8px; right: 8px; display: grid; width: 30px; height: 30px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 19px; line-height: 1; }
.clear-search:hover { background: var(--surface-soft); color: var(--ink); }
.search-results { position: absolute; top: calc(100% + 8px); right: 0; left: 0; z-index: 1000; display: none; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.search-results.open { display: block; }
.search-result { display: block; width: 100%; border: 0; border-bottom: 1px solid #edf1ee; background: var(--surface); color: var(--ink); padding: 12px 14px; text-align: left; font-size: 12px; line-height: 1.45; }
.search-result:last-child { border-bottom: 0; }
.search-result:hover { background: #f7faf8; }
.search-result small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.filter-details { position: relative; flex: none; }
.filter-details summary { display: flex; min-width: 112px; height: 46px; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink-soft); cursor: pointer; font-size: 12px; font-weight: 620; list-style: none; transition: border-color .16s ease, background .16s ease; }
.filter-details summary::-webkit-details-marker { display: none; }
.filter-details summary:hover, .filter-details[open] summary { border-color: #bacbc1; background: var(--surface-soft); }
.filter-details summary > svg:first-child { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.filter-details .summary-chevron { width: 15px; height: 15px; margin-left: auto; fill: none; stroke: var(--muted); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; transition: transform .16s ease; }
.filter-details[open] .summary-chevron { transform: rotate(180deg); }
.filter-fields { position: absolute; top: calc(100% + 8px); right: 0; display: grid; width: 286px; gap: 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.field-label { display: block; margin: 10px 0 5px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.filter-fields .field-label:first-child { margin-top: 0; }
.select-control { height: 39px; padding: 0 10px; background-color: #fff; }

.workspace { display: grid; min-height: 0; flex: 1; grid-template-columns: 186px minmax(360px, 1fr) 364px; }
.sidebar { position: relative; z-index: 10; display: flex; min-height: 0; flex-direction: column; overflow-y: auto; padding: 23px 12px 14px; border-right: 1px solid var(--line); background: var(--surface); }
.primary-nav { display: grid; gap: 4px; }
.nav-item { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 11px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); text-align: left; font-size: 12px; font-weight: 590; transition: background .16s ease, color .16s ease; }
.nav-item:hover { background: #f4f7f5; color: var(--ink); }
.nav-item.active { background: var(--green-soft); color: var(--green-dark); font-weight: 680; }
.nav-icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.privacy-note { display: grid; grid-template-columns: 20px 1fr; gap: 10px; margin-top: auto; padding: 13px 11px; border-radius: 9px; background: #f4f8f5; color: var(--ink-soft); }
.privacy-icon { width: 19px; height: 19px; fill: none; stroke: var(--green); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.6; }
.privacy-note strong { display: block; margin-bottom: 4px; color: var(--ink); font-size: 11px; font-weight: 680; }
.privacy-note p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.reset-button { margin: 13px 2px 0; padding: 5px 0; border: 0; background: transparent; color: var(--muted-soft); font-size: 10px; text-align: left; }
.reset-button:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #e9f0ed; }
.map-canvas, .leaflet-container { width: 100%; height: 100%; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 9px !important; }
.map-toolbar { position: absolute; right: 18px; bottom: 22px; z-index: 500; display: grid; gap: 6px; }
.map-button { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid rgba(218, 228, 222, .96); border-radius: 9px; background: rgba(255,255,255,.98); box-shadow: 0 2px 8px rgba(22, 45, 37, .07); color: var(--ink); transition: background .14s ease, border-color .14s ease, transform .14s ease; }
.map-button:hover { transform: translateY(-1px); border-color: #b7c9be; background: #f7faf8; }
.map-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.map-status { position: absolute; top: 16px; right: 18px; z-index: 450; display: none; }
.map-status strong { font-size: 12px; }
.map-status span { color: var(--muted); font-size: 10px; }
.map-empty-state { position: absolute; bottom: 70px; left: 18px; z-index: 400; display: flex; max-width: min(340px, calc(100% - 72px)); align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid rgba(222, 231, 225, .96); border-radius: 9px; background: rgba(255,255,255,.96); box-shadow: 0 3px 12px rgba(25, 48, 39, .07); pointer-events: none; }
.empty-pin { width: 25px; height: 27px; flex: none; object-fit: contain; }
.map-empty-state h1 { margin: 0; color: var(--ink); font-size: 12px; font-weight: 670; line-height: 1.35; letter-spacing: -.02em; }
.map-empty-state p { margin: 2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.map-legend { position: absolute; bottom: 18px; left: 18px; z-index: 400; display: flex; align-items: center; gap: 14px; padding: 8px 10px; border: 1px solid rgba(222, 231, 225, .96); border-radius: 8px; background: rgba(255,255,255,.96); box-shadow: 0 2px 8px rgba(25,48,39,.06); color: var(--muted); font-size: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.opportunity-dot { background: #16815c; }
.followup-dot { background: #c58719; }
.respect-dot { background: #bb4d4d; }
.report-dot { background: #16815c; }
.selected-dot { background: var(--ink); }
.map-credit { position: absolute; right: 7px; bottom: 3px; z-index: 400; color: #586963; font-size: 9px; pointer-events: none; }
.report-marker { display: grid; width: 28px; height: 28px; place-items: center; border: 2px solid #fff; border-radius: 50% 50% 50% 4px; background: var(--marker-color, var(--green)); box-shadow: 0 2px 7px rgba(20, 45, 37, .24); color: #fff; font-size: 11px; transform: rotate(-45deg); }
.report-marker span { transform: rotate(45deg); }
.report-cluster { display: grid; width: 36px; height: 36px; place-items: center; border: 2px solid white; border-radius: 50%; background: var(--ink); box-shadow: 0 2px 7px rgba(20,45,37,.2); color: #fff; font-size: 11px; font-weight: 700; }

.detail-panel { min-width: 0; min-height: 0; overflow: auto; border-left: 1px solid var(--line); background: var(--surface); }
.panel-empty, .panel-content { padding: 26px 24px; }
.panel-empty { display: flex; min-height: 100%; flex-direction: column; justify-content: center; }
.panel-empty-icon { width: 43px; height: 46px; margin-bottom: 16px; object-fit: contain; }
.detail-panel h2 { margin: 4px 0 8px; color: var(--ink); font-size: 23px; font-weight: 730; line-height: 1.12; letter-spacing: -.05em; }
.detail-panel p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.58; }
.primary-button, .secondary-button { display: inline-flex; width: 100%; min-height: 44px; align-items: center; justify-content: center; border-radius: 8px; padding: 11px 14px; font-size: 12px; font-weight: 680; transition: transform .14s ease, background .14s ease, border-color .14s ease; }
.primary-button { margin-top: 20px; border: 1px solid var(--green); background: var(--green); color: #fff; }
.primary-button:hover { transform: translateY(-1px); border-color: var(--green-dark); background: var(--green-dark); }
.secondary-button { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: #bdcbc3; background: #f7faf8; }
.panel-close { float: right; display: grid; width: 32px; height: 32px; place-items: center; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 21px; line-height: 1; }
.panel-close:hover { background: var(--surface-soft); color: var(--ink); }
.location-label { margin-top: 12px !important; color: var(--ink) !important; font-size: 13px !important; font-weight: 650; line-height: 1.5 !important; }
.location-subline { margin-top: 4px !important; color: var(--muted) !important; font-size: 11px !important; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 19px 0 12px; }
.summary-item { padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.summary-item strong { display: block; color: var(--ink); font-size: 15px; font-weight: 700; }
.summary-item span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.form-stack { display: grid; gap: 13px; margin-top: 20px; }
.form-stack label { display: grid; gap: 6px; color: var(--ink-soft); font-size: 12px; font-weight: 640; }
.optional-label { color: var(--muted-soft); font-size: 11px; font-weight: 450; }
.field-control { min-height: 46px; padding: 10px 11px; font-size: 14px; }
textarea.field-control { min-height: 91px; resize: vertical; line-height: 1.5; }
.form-warning { padding: 11px 12px; border-left: 2px solid #b78229; border-radius: 3px 7px 7px 3px; background: #fbf7ed; color: #775b2c; font-size: 11px; line-height: 1.55; }
.form-error { color: var(--red) !important; font-size: 11px !important; }
.report-card { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.report-card + .report-card { margin-top: 13px; padding-top: 13px; }
.report-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.report-outcome { display: inline-flex; align-items: center; border-radius: 5px; padding: 5px 7px; background: var(--green-soft); color: var(--green-dark); font-size: 10px; font-weight: 650; }
.report-date { color: var(--muted-soft); font-size: 10px; }
.report-meta { margin-top: 8px !important; font-size: 10px !important; }
.report-notes { margin-top: 8px !important; color: var(--ink-soft) !important; font-size: 12px !important; line-height: 1.55 !important; }
.activity-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #edf1ee; }
.activity-row:first-child { border-top: 1px solid var(--line); }
.activity-row span { color: var(--muted); font-size: 11px; }
.activity-row strong { color: var(--ink); font-size: 12px; }
.empty-copy { margin-top: 18px !important; padding: 13px 14px; border-radius: 7px; background: var(--surface-soft); font-size: 11px !important; }
.followup-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; padding: 9px 10px; border-radius: 7px; background: #fbf6eb; color: var(--amber); font-size: 10px; font-weight: 650; }
.followup-line.is-done { background: var(--green-soft); color: var(--green-dark); }
.followup-line button, .text-action { border: 0; background: none; color: var(--green-dark); cursor: pointer; font-size: 10px; font-weight: 650; text-decoration: underline; text-decoration-color: #a3c3b1; text-underline-offset: 3px; }
.followup-address { margin: 10px 0 0; color: var(--ink); font-size: 13px; font-weight: 650; line-height: 1.45; }
.followup-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.followup-actions .primary-button, .followup-actions .secondary-button { min-height: 40px; margin: 0; padding: 8px; font-size: 10px; }
.report-outcome.is-overdue { background: #fbefee; color: var(--red); }
.text-action { margin-top: 12px; padding: 0; }
.local-note { margin-top: 20px !important; padding-top: 13px; border-top: 1px solid var(--line); color: var(--muted-soft) !important; font-size: 10px !important; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 2000; max-width: 340px; transform: translateY(8px); border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 11px 14px; background: var(--ink); box-shadow: var(--shadow-small); color: #fff; font-size: 12px; font-weight: 570; opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.mobile-nav { display: none; }

@media (max-width: 1120px) {
  .topbar { grid-template-columns: 182px minmax(250px, 1fr) auto; gap: 18px; padding: 0 18px; }
  .workspace { grid-template-columns: 168px minmax(300px, 1fr) 328px; }
  .sidebar { padding-right: 10px; padding-left: 10px; }
  .brand-lockup small { display: none; }
}

@media (max-width: 760px) {
  body { overflow: hidden; }
  .topbar { height: 67px; grid-template-columns: 122px minmax(0, 1fr); gap: 9px; padding: 0 11px; }
  .brand { gap: 3px; }
  .brand-mark { width: 34px; height: 40px; }
  .brand-lockup strong, .brand-name { font-size: 15px; }
  .brand-lockup small, .topbar-actions { display: none; }
  .map-search-row { gap: 6px; }
  .search-form input { height: 42px; padding-left: 35px; font-size: 11px; }
  .search-icon { top: 11px; left: 10px; width: 18px; height: 18px; }
  .clear-search { top: 6px; right: 5px; width: 29px; height: 29px; }
  .filter-details summary { min-width: 40px; width: 40px; height: 42px; justify-content: center; padding: 0; }
  .filter-details summary > span, .filter-details .summary-chevron { display: none; }
  .filter-details summary > svg:first-child { width: 18px; height: 18px; }
  .filter-fields { right: 0; width: min(300px, calc(100vw - 22px)); }
  .workspace { position: relative; display: block; height: calc(100dvh - 67px); }
  .sidebar { display: none; }
  .map-stage { width: 100%; height: 100%; }
  .map-empty-state { bottom: 76px; left: 10px; max-width: calc(100% - 70px); gap: 7px; padding: 8px 10px; }
  .empty-pin { width: 21px; height: 23px; }
  .map-empty-state h1 { font-size: 11px; }
  .map-empty-state p { font-size: 9px; }
  .map-toolbar { right: 10px; bottom: 78px; gap: 5px; }
  .map-button { width: 35px; height: 35px; }
  .map-legend { display: none; }
  .map-credit { right: 5px; bottom: 57px; font-size: 8px; }
  .detail-panel { position: absolute; right: 7px; bottom: 7px; left: 7px; z-index: 700; display: none; max-height: min(78dvh, 690px); border: 1px solid var(--line); border-radius: 17px 17px 12px 12px; box-shadow: 0 12px 40px rgba(12, 35, 27, .17); }
  .detail-panel.open { display: block; }
  .detail-panel::before { display: block; width: 34px; height: 4px; margin: 9px auto 2px; border-radius: 999px; background: #d6ded9; content: ""; }
  .panel-empty, .panel-content { padding: 15px 18px 20px; }
  .panel-empty { min-height: 0; }
  .panel-empty-icon { width: 37px; height: 39px; margin-bottom: 9px; }
  .detail-panel h2 { font-size: 21px; }
  .form-stack { gap: 11px; margin-top: 15px; }
  .form-stack label { gap: 5px; font-size: 12px; }
  .field-control { min-height: 44px; padding: 9px 10px; font-size: 14px; }
  textarea.field-control { min-height: 68px; }
  .form-warning { padding: 9px 10px; font-size: 11px; }
  .primary-button, .secondary-button { min-height: 42px; }
  .mobile-nav { position: absolute; right: 9px; bottom: 8px; left: 9px; z-index: 650; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid rgba(221, 230, 224, .98); border-radius: 10px; background: rgba(255,255,255,.97); box-shadow: 0 3px 12px rgba(20,45,37,.08); }
  .mobile-nav .nav-item { min-height: 42px; justify-content: center; gap: 6px; padding: 4px; font-size: 10px; }
  .mobile-nav .nav-icon { width: 16px; height: 16px; }
  .detail-panel.open ~ .mobile-nav { display: none; }
  .toast { right: 10px; bottom: 76px; left: 10px; max-width: none; }
}

@media (max-width: 370px) {
  .topbar { grid-template-columns: 105px minmax(0, 1fr); gap: 6px; padding: 0 8px; }
  .brand-mark { width: 30px; height: 36px; }
  .brand-lockup strong, .brand-name { font-size: 14px; }
  .search-form input { padding-right: 31px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
