:root {
  color-scheme: light;
  --ink: #10201d;
  --muted: #63726f;
  --line: #dce6e2;
  --surface: #ffffff;
  --surface-strong: #f6faf8;
  --brand: #0b6b57;
  --brand-dark: #0a4038;
  --brand-soft: #dff4ec;
  --ok: #168a53;
  --warn: #c47a08;
  --bad: #c83d32;
  --unknown: #73808a;
  --info: #2764b8;
  --shadow: 0 20px 55px rgba(21, 44, 39, 0.13);
  --radius: 8px;
  --workspace-panel-height: clamp(620px, calc(100vh - 104px), 760px);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 4%, rgba(38, 124, 97, 0.16), transparent 31rem),
    radial-gradient(circle at 86% 0%, rgba(39, 100, 184, 0.11), transparent 28rem),
    linear-gradient(180deg, #f7fbf9 0%, #eef6f3 34%, #f8faf8 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1680px, 100%);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px clamp(16px, 3vw, 34px);
  background: rgba(247, 251, 249, 0.91);
  border-bottom: 1px solid rgba(190, 210, 203, 0.7);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
  min-width: 210px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--brand), #153d6f);
  border-radius: 8px;
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.search {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 8px 7px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(14, 52, 43, 0.06);
}

.search svg,
button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
}

.search button,
.primary-button,
.secondary-button,
.ghost-button,
.link-button,
.icon-button,
.chip,
.segmented button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.search button,
.primary-button {
  color: white;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  padding: 0 16px;
  font-weight: 800;
}

.secondary-button,
.ghost-button {
  color: var(--brand-dark);
  background: white;
  border-color: var(--line);
  padding: 0 16px;
  font-weight: 750;
}

.account-button {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 0 13px 0 8px;
  color: var(--brand-dark);
  background: #eef8f3;
  border: 1px solid #cfe4dc;
  border-radius: 8px;
  font-weight: 850;
}

.account-button span:first-child {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  color: white;
  background: var(--brand);
  border-radius: 7px;
  font-size: 0.82rem;
}

.ghost-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.search button:hover,
.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.chip:hover,
.segmented button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

main {
  padding: 22px clamp(16px, 3vw, 34px) 34px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.48fr);
  gap: 24px;
  align-items: stretch;
  min-height: 280px;
  margin-bottom: 22px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 5vw, 56px);
  color: white;
  background:
    linear-gradient(115deg, rgba(9, 58, 50, 0.97), rgba(11, 65, 83, 0.9)),
    url("data:image/svg+xml,%3Csvg width='900' height='520' viewBox='0 0 900 520' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.16'%3E%3Cpath d='M98 416C220 240 296 270 390 160s198-70 300-38'/%3E%3Cpath d='M122 470c102-96 189-104 260-178 112-116 198-88 386-170'/%3E%3Cpath d='M78 108c170 60 292 48 388-34 78-66 166-72 290-6'/%3E%3C/g%3E%3Cg fill='%23ffffff' fill-opacity='.7'%3E%3Ccircle cx='180' cy='368' r='7'/%3E%3Ccircle cx='392' cy='160' r='5'/%3E%3Ccircle cx='704' cy='122' r='8'/%3E%3Ccircle cx='522' cy='260' r='6'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: #7ce0c1;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 18px;
  font-size: clamp(2.2rem, 6vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-text {
  max-width: 720px;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.hero-actions .secondary-button {
  color: white;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

.hero-dashboard {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
}

.metric {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 26px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(210, 225, 220, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(19, 56, 48, 0.08);
}

.metric span {
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 900;
  line-height: 1;
}

.metric small {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 750;
}

.workspace {
  display: grid;
  grid-template-columns: 292px minmax(420px, 1fr) 390px;
  gap: 16px;
  align-items: stretch;
}

.control-panel,
.map-panel,
.results-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(19, 56, 48, 0.08);
  height: var(--workspace-panel-height);
}

.control-panel,
.results-panel {
  position: sticky;
  top: 86px;
  overflow: auto;
}

.panel-block {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-block:last-child {
  border-bottom: 0;
}

.block-heading {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.block-heading h2,
.map-toolbar h2,
.dialog-head h2 {
  margin: 0;
  font-size: 1.04rem;
}

.block-heading p,
.map-toolbar p,
.results-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.link-button {
  min-height: 32px;
  padding: 0 4px;
  color: var(--brand);
  background: transparent;
  border: 0;
  font-weight: 850;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: #edf4f1;
  border-radius: 8px;
}

.segmented button {
  min-height: 34px;
  color: var(--muted);
  background: transparent;
  font-size: 0.86rem;
  font-weight: 800;
}

.segmented button.active {
  color: var(--ink);
  background: white;
  box-shadow: 0 4px 16px rgba(27, 64, 55, 0.1);
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 36px;
  color: var(--ink);
  font-weight: 650;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  padding: 0 11px;
  color: var(--brand-dark);
  background: #edf6f2;
  border-color: #cfe4dc;
  font-size: 0.84rem;
  font-weight: 800;
}

.chip.active {
  color: white;
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.map-provider {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: #f3f7f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 850;
}

.trust-block p {
  color: var(--muted);
  font-size: 0.91rem;
  line-height: 1.55;
}

.score-legend {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
}

.ok {
  background: var(--ok);
}

.warn {
  background: var(--warn);
}

.bad {
  background: var(--bad);
}

.map-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.map-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  padding: 0;
  place-items: center;
  color: var(--brand-dark);
  background: white;
  border-color: var(--line);
}

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    linear-gradient(rgba(10, 76, 67, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(10, 76, 67, 0.07) 1px, transparent 1px),
    linear-gradient(145deg, #eef8f3, #d9e8ec);
  background-size: 44px 44px, 44px 44px, auto;
}

#leafletMap {
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #e5eee9;
}

.leaflet-container {
  font: inherit;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(19, 56, 48, 0.18);
}

.leaflet-popup-content {
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.45;
}

.cluster-marker {
  background: transparent;
  border: 0;
}

.cluster-marker span {
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--brand-dark), #153d6f);
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 10px 28px rgba(10, 64, 56, 0.28);
  font-size: 0.82rem;
  font-weight: 900;
}

.location-marker {
  background: transparent;
  border: 0;
}

.location-marker > div {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  overflow: hidden;
  color: white;
  background: var(--unknown);
  border: 3px solid white;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 10px 24px rgba(16, 32, 29, 0.28);
  transform: rotate(-45deg);
}

.location-marker.selected > div {
  width: 42px;
  height: 42px;
  box-shadow: 0 0 0 4px rgba(11, 107, 87, 0.18), 0 14px 34px rgba(16, 32, 29, 0.34);
}

.location-marker.ok > div {
  background: var(--ok);
}

.location-marker.warn > div {
  background: var(--warn);
}

.location-marker.bad > div {
  background: var(--bad);
}

.location-marker img,
.location-marker span {
  transform: rotate(45deg);
}

.location-marker img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  padding: 3px;
  background: white;
  border-radius: 50%;
}

.location-marker span {
  font-size: 0.72rem;
  font-weight: 950;
}

.map-popup {
  display: grid;
  gap: 10px;
  min-width: 260px;
}

.map-popup-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.map-popup-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  color: var(--brand-dark);
  background: #eef8f3;
  border: 1px solid #d6e6df;
  border-radius: 8px;
  font-weight: 950;
}

.map-popup-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: white;
}

.map-popup strong,
.map-popup small {
  display: block;
}

.map-popup strong {
  line-height: 1.25;
}

.map-popup small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.map-popup-status,
.map-popup dl {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.map-popup-status span:not(.status-pill),
.map-popup dl div {
  padding: 5px 8px;
  color: var(--muted);
  background: #f2f7f5;
  border: 1px solid #dfeae6;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.map-popup dl {
  margin: 0;
}

.map-popup dt,
.map-popup dd {
  display: inline;
  margin: 0;
}

.map-popup dt {
  color: var(--muted);
}

.map-popup dd {
  color: var(--ink);
  font-weight: 900;
}

.map-popup p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

#mapCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map-empty {
  position: absolute;
  inset: 18px;
  z-index: 500;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed #b9ccc5;
  border-radius: 8px;
}

.map-empty[hidden] {
  display: none;
}

.results-panel {
  padding: 18px;
}

.results-heading {
  align-items: start;
}

select {
  min-height: 38px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-weight: 750;
}

.location-list {
  display: grid;
  gap: 10px;
}

.load-more-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  color: var(--brand-dark);
  background: #eef8f3;
  border: 1px solid #cfe4dc;
  border-radius: 8px;
  font-weight: 900;
}

.load-more-button[hidden] {
  display: none;
}

.location-card {
  padding: 14px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.location-card.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.12);
}

.location-top {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.location-title {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  min-width: 0;
}

.brand-logo {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  color: var(--brand-dark);
  background: linear-gradient(145deg, #eef8f3, #dcece6);
  border: 1px solid #d6e6df;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 900;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6px;
  background: white;
}

.brand-logo.has-logo {
  background: white;
}

.location-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.address {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 7px 9px;
  color: white;
  border-radius: 8px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.ok {
  background: var(--ok);
}

.status-pill.warn {
  background: var(--warn);
}

.status-pill.bad {
  background: var(--bad);
}

.status-pill.unknown {
  background: var(--unknown);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 12px 0;
}

.meta-chip {
  padding: 5px 8px;
  color: var(--muted);
  background: #f2f7f5;
  border: 1px solid #dfeae6;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 800;
}

.meta-chip.strong {
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-color: #c0dfd3;
}

.meta-chip.payout {
  color: #334155;
  background: #eef3f8;
  border-color: #d8e4ef;
}

.confidence {
  display: grid;
  gap: 6px;
}

.confidence-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.bar {
  height: 8px;
  overflow: hidden;
  background: #edf2f0;
  border-radius: 999px;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--brand);
}

.bar span.ok {
  background: var(--ok);
}

.bar span.warn {
  background: var(--warn);
}

.bar span.bad {
  background: var(--bad);
}

.bar span.unknown {
  background: var(--unknown);
}

.muted-confidence .bar {
  background: #e8edeb;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.card-actions button {
  min-height: 36px;
  border-radius: 8px;
  font-weight: 850;
}

.report-button {
  color: white;
  background: var(--brand-dark);
  border: 1px solid var(--brand-dark);
}

.details-button {
  color: var(--brand-dark);
  background: white;
  border: 1px solid var(--line);
}

.report-dialog {
  width: min(560px, calc(100vw - 24px));
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.report-dialog::backdrop {
  background: rgba(3, 22, 20, 0.54);
  backdrop-filter: blur(4px);
}

.dialog-head,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 22px 0;
  border: 0;
}

.status-options legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--muted);
  font-weight: 850;
}

.status-options label {
  display: grid;
  gap: 8px;
  align-items: center;
  justify-items: center;
  min-height: 118px;
  padding: 13px 10px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 800;
  text-align: center;
}

.status-options input {
  position: absolute;
  opacity: 0;
  accent-color: var(--brand);
}

.status-options label:has(input:checked) {
  color: var(--brand-dark);
  background: #e8f7f1;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.12);
}

.option-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: white;
  background: var(--brand-dark);
  border-radius: 8px;
}

.option-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
  color: var(--muted);
  font-weight: 850;
}

textarea {
  width: 100%;
  resize: vertical;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.field input[type="text"] {
  width: 100%;
  min-height: 46px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
}

.field input[type="text"]:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(11, 107, 87, 0.12);
}

.account-copy {
  margin: 18px 0;
  color: var(--muted);
  line-height: 1.55;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.dialog-actions {
  margin: 20px 0 0;
  padding: 0;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: 360px;
  padding: 13px 15px;
  color: white;
  background: var(--brand-dark);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .search {
    grid-column: 1 / -1;
    order: 3;
  }

  .top-actions {
    justify-content: flex-end;
  }

  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero-dashboard {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto;
  }

  .control-panel,
  .results-panel {
    position: static;
    height: 680px;
    max-height: none;
  }

  .map-panel {
    height: 680px;
  }
}

@media (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  .brand {
    min-width: 0;
  }

  .ghost-button {
    width: 100%;
  }

  .search {
    grid-template-columns: 20px 1fr;
  }

  .search button {
    grid-column: 1 / -1;
  }

  main {
    padding-inline: 12px;
  }

  .hero-copy {
    padding: 26px 20px;
  }

  .hero-dashboard {
    grid-template-columns: 1fr;
  }

  .metric {
    padding: 18px;
  }

  .map-panel {
    height: 540px;
    min-height: 0;
  }

  .control-panel,
  .results-panel {
    height: 540px;
  }

  .map-wrap,
  #leafletMap,
  #mapCanvas {
    min-height: 0;
    height: 100%;
  }

  .status-options {
    grid-template-columns: 1fr;
  }

  .card-actions,
  .dialog-actions {
    grid-template-columns: 1fr;
  }
}
