:root {
  --ink: #10283f;
  --muted: #5e7080;
  --line: #d9e3ea;
  --paper: #f7fbfd;
  --panel: #ffffff;
  --navy: #0b3a66;
  --navy-2: #14517f;
  --gold: #f5b51b;
  --gold-soft: #fff5d7;
  --teal: #2b7a86;
  --rose: #b95b5b;
  --green: #4f7f59;
  --shadow: 0 18px 50px rgba(16, 40, 63, .14);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #f7fbfd 0%, #eef6fa 48%, #fff9e6 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--navy-2); }
button, input, select, textarea { font: inherit; }
button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  padding: 10px 13px;
  color: #fff;
  background: var(--navy);
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
  line-height: 1.2;
}
button:hover,
.button:hover { background: var(--navy-2); }
button.ghost,
.button.ghost {
  border: 1px solid var(--line);
  color: var(--navy);
  background: #fff;
}
button.ghost:hover,
.button.ghost:hover { background: #eef7fb; }
button.subtle { color: #607383; background: rgba(255,255,255,.72); }
button.danger-outline { color: #9e342f; border-color: #efc4c0; }
button:disabled { opacity: .55; cursor: not-allowed; }

.atlas-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns .28s ease;
}
.atlas-shell.sidebar-collapsed { grid-template-columns: minmax(0, 1fr) 0; }
.map-wrap { position: relative; min-width: 0; min-height: 0; background: #dce8eb; }
#map { height: 100%; width: 100%; background: #dce8eb; }
.leaflet-container { font-family: inherit; }
.leaflet-control-layers,
.leaflet-bar { border: 0 !important; box-shadow: 0 10px 28px rgba(16,40,63,.18) !important; }
.leaflet-top.leaflet-left { left: auto; right: 16px; }
.leaflet-control-attribution { color: #456173; background: rgba(255,255,255,.86) !important; }
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 20px 46px rgba(16, 40, 63, .24);
}
.leaflet-popup-content { margin: 0; }

.side {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: rgba(247, 251, 253, .96);
  transition: opacity .22s ease, transform .22s ease, border-color .22s ease;
}
.atlas-shell.sidebar-collapsed .side {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  border-left-color: transparent;
}
.sidebar-toggle {
  position: absolute;
  top: 86px;
  right: 440px;
  z-index: 850;
  width: 34px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
  padding: 0;
  color: var(--navy);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 28px rgba(16, 40, 63, .16);
  transition: right .28s ease, background .18s ease, color .18s ease;
}
.sidebar-toggle:hover {
  color: #fff;
  background: var(--navy);
}
.sidebar-toggle span {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  transform: translateY(-1px);
}
.atlas-shell.sidebar-collapsed .sidebar-toggle {
  right: 14px;
  border-radius: 8px;
}
.header { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.brand-logo {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: 132px;
  object-fit: contain;
  object-position: left center;
  margin: 0 0 14px;
  padding: 4px 0;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.8rem, 2.5vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: 0;
}
.subtitle { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.smbi-home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 14px;
  border: 1px solid rgba(11, 58, 102, .18);
  border-radius: 7px;
  padding: 9px 12px;
  color: var(--navy);
  background: linear-gradient(180deg, #fff 0%, #f4f9fc 100%);
  box-shadow: 0 8px 18px rgba(16, 40, 63, .08);
  font-size: .86rem;
  font-weight: 900;
  text-decoration: none;
}
.smbi-home-button:hover,
.smbi-home-button:focus-visible {
  color: #fff;
  background: var(--navy);
  outline: none;
}
.scroll { padding: 16px 16px 24px; }

.controls,
.about-panel,
.legend,
.stats,
.records,
.panel,
.duplicate-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 12px 28px rgba(16, 40, 63, .08);
}
.about-panel { margin-bottom: 14px; padding: 15px; color: var(--muted); line-height: 1.5; }
.about-panel p { margin: 8px 0 0; }
.legend { margin-bottom: 14px; padding: 14px; }
.legend .records-head { padding: 0 0 10px; border-bottom: 0; }
.legend-note { margin: -2px 0 11px; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.legend-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.legend-button {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  width: 100%;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px;
  color: #31465a;
  background: transparent;
  text-align: left;
  font-weight: 500;
}
.legend-button:hover,
.legend-button.active {
  color: var(--navy);
  border-color: #cbd9e2;
  background: #fff;
}
.legend-button em {
  min-width: 24px;
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--navy);
  background: #eef7fb;
  font-style: normal;
  font-size: .76rem;
  text-align: center;
}
.legend-desc {
  display: block;
  margin-top: 3px;
  color: #637182;
  font-size: .75rem;
  line-height: 1.3;
}
.dot {
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(24,32,43,.24);
}
.all-dot {
  background: conic-gradient(#0b3a66, #b95b5b, #f5b51b, #2b7a86, #0b3a66);
}
.section-title { margin: 0; color: var(--navy); font-size: 1rem; line-height: 1.2; }
.journey-title {
  margin: 10px 0 6px;
  color: var(--navy);
  font-size: 1rem;
  line-height: 1.25;
}
.journey-impact {
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 10px 11px;
  background: var(--gold-soft);
  color: var(--navy);
  font-weight: 850;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
  padding: 14px;
}
.field { display: grid; gap: 6px; }
.field.wide { grid-column: 1 / -1; }
label {
  color: #294a62;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}
.field-help { margin: -1px 0 2px; color: #687b8a; font-size: .86rem; line-height: 1.36; }
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbdbe4;
  border-radius: 7px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fff;
}
textarea { min-height: 118px; resize: vertical; line-height: 1.45; }
input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(245,181,27,.26);
  border-color: var(--gold);
}
.button-row,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}
.button-row { grid-column: 1 / -1; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-bottom: 14px;
  overflow: hidden;
}
.stat { padding: 13px; background: #fff; }
.stat strong { display: block; color: var(--navy); font-size: 1.35rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .82rem; }

.records { overflow: hidden; }
.records-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}
.small { color: var(--muted); font-size: .8rem; }
.record-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 12px;
  list-style: none;
}
.record {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-left: 6px solid var(--navy);
  border-radius: 8px;
  padding: 13px 14px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 10px 22px rgba(16, 40, 63, .06);
}
.record:hover { border-color: #b9c8d2; box-shadow: 0 9px 22px rgba(16,40,63,.12); }
.record h2 { margin: 0 0 5px; color: var(--navy); font-size: .98rem; line-height: 1.25; letter-spacing: 0; }
.record p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.meta,
.keyword-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pill {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(11,58,102,.16);
  border-radius: 999px;
  padding: 4px 9px;
  color: #27465e;
  background: #eef7fb;
  font-size: .76rem;
  line-height: 1.25;
  white-space: normal;
}
.pill.gold { border-color: rgba(245,181,27,.34); background: var(--gold-soft); }

.empty { display: none; padding: 18px; color: var(--muted); }
.empty.visible { display: grid; gap: 4px; }
.empty strong { color: var(--navy); }

.map-banner {
  position: absolute;
  right: 16px;
  bottom: 18px;
  z-index: 700;
  max-width: min(430px, calc(100% - 32px));
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 12px 30px rgba(16,40,63,.18);
}
.map-banner strong { display: block; font-size: .92rem; }
.map-banner span { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; line-height: 1.35; }
.map-style-control {
  position: absolute;
  z-index: 720;
  left: 16px;
  bottom: 18px;
  display: grid;
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16,40,63,.18);
}
.map-style-control button {
  width: 34px;
  min-height: 30px;
  border-radius: 0;
  padding: 0;
  color: var(--navy);
  background: #fff;
  font-size: .72rem;
}
.map-style-control button.active { color: #fff; background: var(--navy); }

.marker-pin {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--marker-color, var(--navy));
  box-shadow: 0 2px 10px rgba(16,40,63,.32), 0 0 0 1px rgba(16,40,63,.25);
}

.popup-card {
  width: min(410px, calc(100vw - 64px));
  max-height: min(620px, 72vh);
  overflow-y: auto;
  background: #fff;
  border-radius: 8px;
}
.popup-hero {
  position: relative;
  min-height: 145px;
  border-radius: 8px 8px 0 0;
  overflow: hidden;
  background: linear-gradient(135deg, #eef6fb, #fff4d5);
}
.popup-hero img {
  display: block;
  width: 100%;
  height: 170px;
  object-fit: cover;
  object-position: top center;
  background: #fff;
}
.homepage-preview img { border-bottom: 1px solid var(--line); }
.visual-fallback {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 18px;
  background: linear-gradient(135deg, #fff, #eef7fb 58%, #fff5d7);
}
.visual-fallback img { width: min(260px, 100%); height: auto; object-fit: contain; border: 0; }
.visual-fallback span { color: var(--muted); font-size: .82rem; }
.popup-content { padding: 16px 17px 18px; }
.popup-content h2 { margin: 5px 0 7px; color: var(--navy); font-size: 1.2rem; line-height: 1.2; }
.popup-kicker {
  margin: 0;
  color: var(--gold);
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.popup-subtitle {
  margin: 0 0 12px;
  color: #365469;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.35;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 12px 0 13px;
}
.detail {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 9px;
  background: #f8fbfd;
}
.detail.wide { grid-column: 1 / -1; }
.detail strong {
  display: block;
  color: #446075;
  font-size: .7rem;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.detail span { display: block; margin-top: 4px; color: var(--ink); font-size: .85rem; line-height: 1.35; }
.focus-section {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.focus-section h3 {
  margin: 0;
  color: var(--navy);
  font-size: .84rem;
  line-height: 1.2;
}
.focus-section .keyword-list { margin-top: 8px; }
.profile-section { margin-top: 12px; }
.profile-section h3 { margin: 0 0 5px; color: var(--navy); font-size: .9rem; }
.profile-section p { margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.48; }
.popup-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.popup-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 7px;
  padding: 8px 10px;
  color: #fff;
  background: var(--navy);
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
}

.admin-page { min-height: 100%; height: auto; background: #f4f8fb; }
.admin-page.locked { min-height: 100%; }
.admin-page.locked .admin-shell { display: none; }
.password-gate {
  display: none;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(11,58,102,.08), rgba(245,181,27,.12)),
    #f4f8fb;
}
.admin-page.locked .password-gate { display: grid; }
.gate-card {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}
.gate-card img {
  display: block;
  width: min(320px, 100%);
  height: auto;
  margin-bottom: 18px;
}
.gate-card h1 { margin: 4px 0 8px; color: var(--navy); font-size: 1.65rem; line-height: 1.15; }
.gate-card p { margin: 0 0 16px; color: var(--muted); line-height: 1.48; }
.gate-form { display: grid; gap: 8px; }
.gate-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.gate-row input { min-height: 42px; }
.admin-shell { max-width: 1280px; margin: 0 auto; padding: 22px; }
.admin-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.admin-title { display: grid; grid-template-columns: 310px minmax(0, 1fr); gap: 18px; align-items: center; }
.admin-logo { width: 100%; max-width: 310px; height: auto; }
.admin-logo {
  max-height: 118px;
  object-fit: contain;
  object-position: left center;
}
.lede { margin: 8px 0 0; color: var(--muted); line-height: 1.5; }
.admin-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 12px; color: var(--navy); font-size: 1.1rem; }
.panel hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}
.storage-status,
.save-status {
  margin-top: 10px;
  border-radius: 7px;
  padding: 10px 11px;
  color: #365469;
  background: #eef7fb;
  font-size: .9rem;
  line-height: 1.35;
}
.storage-status:empty,
.save-status:empty { display: none; }
.admin-help h3 { margin: 0 0 8px; color: var(--navy); font-size: .95rem; }
.admin-help ol { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { margin-top: 14px; }
.duplicate-panel { margin-top: 12px; padding: 12px; background: #fff9e8; }
.duplicate-panel strong { display: block; color: var(--navy); }
.duplicate-panel span { display: block; margin: 5px 0 10px; color: var(--muted); }
.review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.review-head h2 { margin: 0; }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--navy);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.review-card h3 { margin: 0 0 5px; color: var(--navy); font-size: .98rem; line-height: 1.25; }
.review-card p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.38; }
.review-card .actions { margin-top: 10px; }
.review-card button { min-height: 34px; padding: 7px 10px; font-size: .82rem; }
.review-card.needs-work { border-left-color: var(--gold); }

@media (max-width: 980px) {
  .atlas-shell { grid-template-columns: 1fr; grid-template-rows: 58vh auto; height: auto; min-height: 100vh; overflow: visible; }
  .atlas-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar-toggle { display: none; }
  .atlas-shell.sidebar-collapsed .side { opacity: 1; transform: none; pointer-events: auto; border-left-color: var(--line); }
  .side { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .map-wrap { min-height: 58vh; }
  .admin-top { display: grid; }
  .admin-title { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .review-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .controls,
  .form-grid,
  .detail-grid { grid-template-columns: 1fr; }
  .field.wide { grid-column: auto; }
  .stats { grid-template-columns: 1fr; }
  .map-banner { display: none; }
  .admin-shell { padding: 12px; }
}
