:root {
  --map-bg: #cce8f5;
  --map-sea: #a8d4eb;
  --state-fill: #4eb8d8;
  --state-stroke: #ffffff;
  --accent-orange: #E87722;
  --accent-green: #2E8B57;
  --navy: #003366;
  --navy-mid: #0a4a8a;
  --text-dark: #1a2b45;
  --text-mid: #4a6080;
  --text-light: #8aa0bc;
  --border: #c8dde8;
  --panel-bg: #f4f8fb;
  --white: #ffffff;
  --red-accent: #c0392b;
}

/* â”€â”€ LAYOUT â”€â”€ */
.layout {
  display: flex;
  width: 100%;
  height: 122vh;
  flex-direction: row
}

/* Mobile: column */
@media(max-width:768px) {
  .layout {
    flex-direction: column;
    overflow: auto;
    height: auto;
    min-height: 100vh
  }

  .map-col {
    width: 100% !important;
    height: 55vw;
    min-height: 280px;
    max-height: 420px;
    position: relative
  }

  .panel-col {
    width: 100% !important;
    height: auto;
    max-height: none
  }

  .popup-box {
    width: 92vw;
    max-width: 340px;
    left: 50% !important;
    top: auto !important;
    bottom: 12px !important;
    transform: translateX(-50%)
  }

  .header-stats {
    display: none
  }
}

/* â”€â”€ MAP COL (70%) â”€â”€ */
.map-col {
  width: 70%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: linear-gradient(160deg, #b8dff0 0%, #cceaf7 40%, #d4eef8 70%, #c5e2f0 100%);
  flex-shrink: 0;
}

.map-col svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: block
}

svg path {
  fill: #5bbdd6;
  transition: fill 0.2s ease, opacity 0.2s;
  cursor: pointer;
  stroke: #ffffff !important;
  stroke-width: 1.2px !important;
}

svg path:hover {
  opacity: 0.82
}

/* Top bar on map */
.map-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--accent-orange);
  box-shadow: 0 2px 12px rgba(0, 51, 102, .12);
}

.map-logo {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
  flex-shrink: 0
}

.map-brand {
  color: var(--navy)
}

.map-brand-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--navy)
}

.map-brand-sub {
  font-size: 10px;
  color: var(--text-mid);
  margin-top: 1px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  gap: 4px;
  margin-left: auto
}

.hstat {
  background: var(--navy);
  border-radius: 4px;
  padding: 5px 12px;
  text-align: center;
  min-width: 58px
}

.hstat-n {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  line-height: 1
}

.hstat-l {
  font-size: 8px;
  color: rgba(255, 255, 255, .7);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 2px;
  font-weight: 500;
}

.map-topbar-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 4px;
}

/* Legend â€” reference image style: top-right corner, small icon+label rows */
.map-legend-vert {
  position: absolute;
  top: 68px;
  right: 14px;
  z-index: 30;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px 9px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(0, 51, 102, .1);
  min-width: 160px;
}

.map-legend-title {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.leg {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 500;
  padding: 3px 0
}

.leg-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}

.leg-status-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border)
}

.leg-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--text-mid)
}

.leg-ongoing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #1D9E75;
  flex-shrink: 0
}

.leg-done-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  border: 2.5px solid #2B7FD4;
  flex-shrink: 0
}

@media(max-width:768px) {
  .map-legend-vert {
    top: auto;
    bottom: 8px;
    right: 8px;
    min-width: 110px;
    padding: 8px 10px
  }

  .leg {
    font-size: 10px;
    gap: 6px
  }

  .leg-dot {
    width: 14px;
    height: 14px;
  }
}

/* MAP POPUP */
.popup-box {
  position: absolute;
  z-index: 100;
  background: #fff;
  border-radius: 4px;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent-orange);
  box-shadow: 0 8px 32px rgba(0, 51, 102, .18);
  width: 280px;
  max-height: 70vh;
  overflow: auto;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  transition: opacity .18s, transform .18s;
  pointer-events: none;
  display: none;
}

.popup-box.vis {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  display: block
}

.popup-img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 0;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: rgba(255, 255, 255, .5)
}

.popup-body {
  padding: 12px 14px 14px
}

.popup-type-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 2px;
  margin-bottom: 6px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.popup-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.35;
  margin-bottom: 9px;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.popup-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-size: 11px;
  margin-bottom: 10px
}

.popup-lbl {
  color: var(--text-light);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.popup-val {
  color: var(--text-dark);
  font-weight: 500
}

.popup-desc {
  font-size: 11px;
  color: var(--text-mid);
  line-height: 1.6;
  padding-top: 9px;
  border-top: 1px solid var(--border)
}

.popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: rgba(255, 255, 255, .85);
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  transition: all .15s
}

.popup-close:hover {
  background: #fff;
  color: var(--navy)
}

.popup-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.popup-status::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor
}

/* â”€â”€ PANEL COL (30%) â”€â”€ */
.panel-col {
  width: 30%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border-left: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

/* Panel header */
.panel-hdr {
  background: var(--navy);
  padding: 12px 16px;
  flex-shrink: 0;
  border-bottom: 3px solid var(--accent-orange);
}

.panel-hdr-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px
}

.panel-logo {
  width: 40px;
  height: 40px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.panel-sub {
  font-size: 9.5px;
  color: rgba(255, 255, 255, .65);
  margin-top: 1px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 400;
}

.panel-stats {
  display: flex;
  gap: 5px
}

.pstat {
  flex: 1;
  background: rgba(255, 255, 255, .1);
  border-radius: 3px;
  padding: 6px 5px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, .12);
}

.pstat-n {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-family: 'Barlow Condensed', sans-serif;
}

.pstat-l {
  font-size: 7.5px;
  color: rgba(255, 255, 255, .6);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-top: 2px;
  font-weight: 500;
}

/* Filter tabs */
.filter-area {
  padding: 10px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0
}

.filter-tabs-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 6px
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px
}

.ftab {
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 2px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-mid);
  cursor: pointer;
  transition: all .14s;
  display: flex;
  align-items: center;
  gap: 5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 10.5px;
}

.ftab .fdot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0
}

.ftab:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: #eef4ff
}

.ftab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff
}

.filter-row2 {
  display: flex;
  gap: 8px
}

.fsel-wrap {
  flex: 1
}

.fsel-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .8px;
  margin-bottom: 4px
}

.fsel {
  width: 100%;
  font-family: 'Barlow', sans-serif;
  font-size: 11.5px;
  padding: 6px 9px;
  border-radius: 2px;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--text-dark);
  cursor: pointer;
  outline: none;
  transition: border-color .15s
}

.fsel:focus {
  border-color: var(--navy)
}

/* Project list */
.proj-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px
}

.proj-list::-webkit-scrollbar {
  width: 3px
}

.proj-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px
}

.state-grp {
  margin-bottom: 12px
}

.state-grp-hdr {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--border);
}

.state-bar {
  width: 4px;
  height: 14px;
  border-radius: 1px;
  flex-shrink: 0
}

.state-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
}

.state-cnt {
  font-size: 10px;
  color: var(--text-light);
  margin-left: auto;
  background: #e8eef5;
  padding: 1px 7px;
  border-radius: 2px;
  font-weight: 600;
}

.pcard {
  background: #fff;
  border-radius: 3px;
  padding: 9px 11px;
  margin-bottom: 5px;
  border-left: 3px solid #ccc;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 1px 3px rgba(0, 51, 102, .06);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.pcard:hover {
  background: #f0f6ff;
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(0, 51, 102, .1)
}

.pcard.active {
  background: #fff8ec;
  box-shadow: 0 0 0 2px var(--accent-orange)
}

.pcard-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 3px
}

.pcard-info {
  flex: 1;
  min-width: 0
}

.pcard-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.35;
  margin-bottom: 4px;
  font-family: 'Barlow', sans-serif;
}

.pcard-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center
}

.pcard-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pcard-loc {
  font-size: 10px;
  color: var(--text-light)
}

.no-res {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light)
}

.no-res-icon {
  font-size: 38px;
  margin-bottom: 10px
}

.no-res-text {
  font-size: 12px;
  font-weight: 500
}

/* Milestones section at bottom of panel */
.milestones-section {
  flex-shrink: 0;
  background: #fff;
  border-top: 2px solid var(--accent-orange);
  padding: 10px 14px 12px;
  max-height: 180px;
  overflow-y: auto;
}

.milestones-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.milestone-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 11px;
  color: var(--text-mid);
  line-height: 1.45;
}

.milestone-bullet {
  width: 6px;
  height: 6px;
  background: var(--accent-orange);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}

.milestones-section::-webkit-scrollbar {
  width: 3px;
}

.milestones-section::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Pulse animation */
@keyframes mk-pulse {
  0% {
    opacity: .5
  }

  70% {
    opacity: 0
  }

  100% {
    opacity: 0
  }
}

.mk-pulse {
  animation: mk-pulse 2.4s ease-out infinite;
  transform-origin: center
}

/* Tooltip */
#svgTip {
  position: absolute;
  background: var(--navy);
  color: #fff;
  padding: 5px 10px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
  white-space: nowrap;
  z-index: 80;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  font-family: 'Barlow', sans-serif;
  border-left: 3px solid var(--accent-orange);
}

#svgTip.vis {
  opacity: 1
}

/* Responsive tweaks */
@media(max-width:900px) {

  .map-brand-sub,
  .hstat-l {
    display: none
  }

  .hstat-n {
    font-size: 14px
  }
}


.map-section .csp-s1 {
  background-color: #cce8f5
}

.map-section .csp-s2 {
  font-variation-settings: normal;
  stroke: rgb(0, 0, 0);
  filter: none
}

.map-section .csp-s7 {
  font-variation-settings: normal;
  fill: none;
  stroke: none;
  pointer-events: visible;
  display: none
}

.map-section .csp-s10 {
  font-variation-settings: normal;
  stroke: rgb(0, 0, 0)
}

.map-section .csp-s15 {
  font-variation-settings: normal;
  opacity: 1;
  vector-effect: none;
  stroke: rgb(0, 0, 0);
  stroke-width: 1px;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
  stroke-dasharray: none;
  stroke-dashoffset: 0px;
  stroke-opacity: 1;
  stop-color: rgb(0, 0, 0);
  stop-opacity: 1;
  filter: none
}

.map-section .csp-s28 {
  font-variation-settings: normal;
  vector-effect: none;
  stroke: rgb(0, 0, 0);
  stroke-width: 0.99943px;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
  stroke-dasharray: none;
  stroke-dashoffset: 0px;
  stroke-opacity: 1;
  stop-color: rgb(0, 0, 0);
  filter: none
}

.map-section .csp-s43 {
  font-variation-settings: normal;
  opacity: 1;
  vector-effect: none;
  stroke: #000;
  stroke-width: 1;
  stroke-linecap: butt;
  stroke-linejoin: miter;
  stroke-miterlimit: 4;
  stroke-dasharray: none;
  stroke-dashoffset: 0;
  stroke-opacity: 1;
  -inkscape-stroke: none;
  stop-color: #000;
  stop-opacity: 1
}

.map-section .csp-s72 {
  background: #E87722;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s73 {
  background: #1D6FB8;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s74 {
  background: #7A5FBF;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s75 {
  background: #A0522D;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s76 {
  background: #17A2B8;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s77 {
  background: #D4AC0D;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s78 {
  background: #2E8B57;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center
}

.map-section .csp-s79 {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block
}

.map-section .csp-s80 {
  background: #E87722
}

.map-section .csp-s81 {
  background: #1D6FB8
}

.map-section .csp-s82 {
  background: #7A5FBF
}

.map-section .csp-s83 {
  background: #A0522D
}

.map-section .csp-s84 {
  background: #17A2B8
}

.map-section .csp-s85 {
  background: #D4AC0D
}

.map-section .csp-s86 {
  background: #2E8B57
}

.map-section .csp-s87 {
  margin-top: 8px
}

/* ---- rules moved out of map.js (CSP) ---- */
.ftab-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex: 0 0 auto
}

.popup-icon-in {
  font-size: 40px;
  opacity: .6
}

.popup-icon-world {
  font-size: 38px;
  opacity: .75
}

.no-res-hint {
  font-size: 11px;
  margin-top: 4px;
  color: #aaa
}

.pcard-badge.pcard-badge-state {
  background: #F1F5F9;
  color: #334155
}