:root {
  --ink: #162033;
  --muted: #667085;
  --line: #d9e2ee;
  --panel: #fff;
  --bg: #f5f8fc;
  --blue: #2563eb;
  --amber: #b45309;
  --shadow: 0 16px 38px rgba(22, 32, 51, .14);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }

.app {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 410px;
}

.map-shell {
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
  background: #dbeafe;
}

.brand {
  position: absolute;
  z-index: 350;
  top: 16px;
  left: 16px;
  width: min(420px, calc(100% - 32px));
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(217,226,238,.92);
  border-radius: 8px;
  padding: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.disclaimer {
  position: absolute;
  z-index: 350;
  left: 16px;
  bottom: 16px;
  width: min(680px, calc(100% - 32px));
  background: rgba(255,255,255,.95);
  border: 1px solid #f3d08a;
  border-left: 5px solid var(--amber);
  border-radius: 8px;
  padding: 10px 12px;
  color: #78350f;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.map-legend {
  position: absolute;
  z-index: 350;
  left: 16px;
  bottom: 84px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: min(680px, calc(100% - 32px));
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(217,226,238,.92);
  border-radius: 8px;
  padding: 9px 10px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  color: #334155;
  font-size: 12px;
  font-weight: 760;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.primary-zone { background: #16a34a; }
.hospitality-zone { background: #ea580c; }
.northern-primary-zone { background: #2563eb; }

.side {
  overflow: auto;
  min-width: 0;
  padding: 14px;
  background: #fbfdff;
  border-left: 1px solid var(--line);
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #334155;
  cursor: pointer;
  font-size: 13px;
  font-weight: 780;
  line-height: 1.18;
}

.tab.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.tab:focus-visible,
.primary:focus-visible,
.input:focus-visible,
.select:focus-visible,
.suggestion:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .35);
  outline-offset: 2px;
}

.panel {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 8px 24px rgba(22,32,51,.06);
}

.panel.active { display: block; }

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  position: relative;
}

label {
  font-size: 13px;
  font-weight: 840;
  color: var(--ink);
}

.input,
.select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c7d2e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
}

.suggestions {
  display: none;
  position: static;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: -2px;
}

.suggestions.open {
  display: block;
}

.suggestion {
  width: 100%;
  min-height: 42px;
  display: grid;
  gap: 2px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  color: var(--ink);
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
}

.suggestion:hover,
.suggestion.active {
  background: #eff6ff;
}

.suggestion-main {
  font-size: 13px;
  font-weight: 800;
}

.suggestion-sub {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.primary {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 780;
}

.primary {
  width: 100%;
  border: 0;
  color: #fff;
  background: var(--blue);
}

.result {
  min-height: 132px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 860;
  line-height: 1.35;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #94a3b8;
  flex: 0 0 auto;
}

.note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.48;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2ff;
  color: #27346a;
  font-size: 12px;
  font-weight: 760;
}

.small-source {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.data-status {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #dbe4ef;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.data-status strong,
.data-status span,
.data-status a {
  display: block;
}

.data-status strong {
  color: var(--ink);
  margin-bottom: 3px;
}

.data-status a {
  margin-top: 5px;
  font-weight: 760;
}

.feedback-slot,
.advice-slot {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px rgba(22,32,51,.06);
}

.feedback-slot strong,
.advice-slot strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.feedback-slot p,
.advice-slot p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.feedback-slot a,
.advice-slot a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0 11px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.legal-page {
  min-height: 100%;
  background: #f5f8fc;
}

.legal-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.legal-shell h1 {
  margin-top: 14px;
  font-size: 30px;
}

.legal-shell h2 {
  margin: 26px 0 8px;
  font-size: 18px;
}

.legal-shell p,
.legal-shell li {
  color: #344054;
  font-size: 15px;
  line-height: 1.65;
}

.legal-shell ul {
  padding-left: 22px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 780;
}

.leaflet-control-layers,
.leaflet-control-zoom {
  border: 0 !important;
  box-shadow: var(--shadow) !important;
}


.leaflet-popup-pane {
  z-index: 760 !important;
}

.leaflet-popup-content {
  margin: 12px 14px;
  color: var(--ink);
  font: 13px/1.45 Inter, ui-sans-serif, system-ui, sans-serif;
}

.leaflet-popup-content-wrapper {
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .16) !important;
}

.leaflet-popup-tip {
  box-shadow: var(--shadow) !important;
}

.map-popup {
  min-width: 270px;
  max-width: 340px;
  padding: 2px 0 1px;
}

.map-popup-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.map-popup-code {
  display: grid;
  gap: 3px;
  color: #1e3a8a;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .02em;
}

.map-popup-code > span:first-child {
  font-size: 15px;
  font-weight: 820;
}

.map-popup-code strong {
  color: #0f2f7a;
  font-size: 22px;
  font-weight: 840;
  line-height: 1.05;
}

.map-popup-badges {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 230px;
  gap: 6px;
}

.map-popup-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid #d6e4f5;
  border-radius: 6px;
  padding: 0 8px;
  background: #edf4ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 820;
}

.map-popup-main {
  margin-top: 6px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 780;
  line-height: 1.28;
}

.map-popup-detail {
  margin-top: 8px;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}

.map-popup-foot {
  margin-top: 10px;
  border-top: 1px solid #e2e8f0;
  padding-top: 8px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 980px) {
  .app {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .map-shell {
    height: 62vh;
    min-height: 500px;
  }

  .side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

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

  .brand {
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
    padding: 10px;
  }

  .map-legend {
    top: 76px;
    bottom: auto;
    left: 12px;
    width: calc(100% - 24px);
    max-height: 118px;
    overflow: auto;
  }

  .disclaimer {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 96px;
    overflow: auto;
    z-index: 720;
  }
}
