:root {
  --navy: #00205c;
  --navy-deep: #061b45;
  --gold: #ffb600;
  --periwinkle: #2b3aa0;
  --lavender-15: #dfe2f1;
  --lavender-30: #c0c4e3;
  --ink: #17213a;
  --muted: #667188;
  --line: rgba(0, 32, 92, .14);
  --surface: rgba(255,255,255,.985);
  --green: #14835a;
  --amber: #b97600;
  --red: #bb3f45;
  --shadow: 0 22px 64px rgba(0, 22, 63, .22);
  --soft-shadow: 0 8px 28px rgba(0, 32, 92, .13);
  --header-h: 94px;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { overflow: hidden; background: var(--lavender-15); color: var(--ink); font-family: "Noto Sans", system-ui, sans-serif; }
button, input, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

.app { height: 100%; display: grid; grid-template-rows: var(--header-h) 1fr; }
.header {
  z-index: 30; display: grid; grid-template-columns: 245px minmax(300px, 1fr) minmax(360px, 650px);
  grid-template-areas: "brand instruction search";
  align-items: center; gap: 20px; padding: 10px 20px; background: #fff;
  border-top: 6px solid var(--navy); border-bottom: 1px solid var(--line); box-shadow: 0 3px 15px rgba(0,32,92,.07);
}
.brand { grid-area: brand; width: 215px; height: 58px; display: block; }
.brand img { width: 100%; height: 100%; display: block; object-fit: contain; object-position: left center; }
.search { grid-area: search; position: relative; justify-self: end; width: 100%; max-width: 650px; min-width: 0; }
.search input {
  width: 100%; height: 48px; border: 1.5px solid rgba(0,32,92,.18); border-radius: 15px;
  background: #f7f8fc; padding: 0 44px 0 46px; color: var(--navy); font-size: 15px; font-weight: 600;
  outline: 0; appearance: none; -webkit-appearance: none; transition: .18s ease;
}
.search input:focus { background: #fff; border-color: var(--periwinkle); box-shadow: 0 0 0 4px rgba(43,58,160,.12); }
.search input::placeholder { color: #7a8294; font-weight: 500; }
.search input::-webkit-search-decoration,
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-results-button,
.search input::-webkit-search-results-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search input::-ms-clear, .search input::-ms-reveal { display: none; width: 0; height: 0; }
.search svg { position: absolute; left: 16px; top: 13px; width: 22px; fill: none; stroke: var(--navy); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.clear-search { position: absolute; right: 8px; top: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: var(--lavender-15); color: var(--navy); font-size: 24px; line-height: 1; cursor: pointer; }
.map-instruction { grid-area: instruction; justify-self: start; max-width: 620px; margin: 0; color: #00205c; font-size: 15px; line-height: 1.35; font-weight: 700; text-align: left; }
.sites-toggle { display: none; min-height: 48px; padding: 0 18px; border: 0; border-radius: 16px; background: var(--navy); color: #fff; font-family: "Oswald", sans-serif; font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 6px 16px rgba(0,32,92,.16); transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
@media (hover: hover) { .sites-toggle:hover { background: var(--navy-deep); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(0,32,92,.22); } }
.sites-toggle:focus-visible { outline: 3px solid rgba(255,182,0,.62); outline-offset: 2px; }

.workspace { min-height: 0; display: grid; grid-template-columns: 306px 1fr; }
.sidebar { z-index: 22; min-height: 0; overflow: auto; background: rgba(255,255,255,.985); border-right: 1px solid var(--line); padding: 17px 11px 22px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 8px 13px; border-bottom: 1px solid var(--line); }
.sidebar-head p { margin: 0 0 5px; color: var(--periwinkle); font-family: "Oswald", sans-serif; font-size: 11px; font-weight: 700; letter-spacing: .12em; }
.sidebar-head h1 { margin: 0; color: var(--navy); font-family: "Oswald", sans-serif; font-size: 32px; line-height: 1; }
.sidebar-tools { display: flex; align-items: center; gap: 8px; }
.site-count { min-width: 40px; height: 30px; display: grid; place-items: center; border-radius: 999px; background: var(--lavender-15); color: var(--navy); font-weight: 800; font-size: 13px; }
.sidebar-close { display: none; width: 38px; height: 38px; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--navy); font-size: 25px; cursor: pointer; }
.site-list { display: grid; gap: 3px; margin-top: 8px; }
.site-list-empty { margin: 12px 8px; padding: 15px 13px; border: 1px solid var(--line); border-radius: 13px; background: #f7f8fc; color: var(--muted); font-size: 12px; line-height: 1.4; text-align: center; }
.site-row {
  position: relative; width: 100%; min-height: 62px; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px;
  padding: 7px 9px; border: 1px solid transparent; border-radius: 13px; background: transparent; text-align: left; cursor: pointer;
  transition: background .16s, border-color .16s, transform .16s, box-shadow .16s;
}
.site-row:hover { background: #f5f6fb; border-color: rgba(0,32,92,.10); transform: translateY(-1px); }
.site-row.selected { background: #fff; border-color: var(--gold); box-shadow: 0 7px 20px rgba(0,32,92,.13); }
.site-row.selected::before { content: ""; position: absolute; left: -3px; top: 10px; bottom: 10px; width: 4px; border-radius: 4px; background: var(--gold); }
.site-logo { width: 38px; height: 38px; border-radius: 50%; object-fit: contain; display: block; }
.site-copy { min-width: 0; }
.site-name { display: block; color: var(--navy); font-size: 12.7px; font-weight: 800; line-height: 1.22; }
.site-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 3px; color: var(--muted); font-size: 9.9px; line-height: 1.25; }

.map-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--lavender-15); }
#map { position: absolute; inset: 0; }
.vpp-marker-pulse-canvas { position: absolute; inset: 0; z-index: 4; pointer-events: none; width: 100%; height: 100%; }
.map-loading { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: linear-gradient(135deg,var(--lavender-15),var(--lavender-30)); color: var(--navy); font-weight: 800; text-align: center; padding: 24px; }
.map-error { max-width: 480px; padding: 17px 20px; border-radius: 15px; background: rgba(255,255,255,.95); box-shadow: var(--soft-shadow); }
.connector { position: absolute; inset: 0; z-index: 11; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.connector path { fill: none; stroke: rgba(0,32,92,.66); stroke-width: 2; stroke-linecap: round; filter: drop-shadow(0 1px 2px #fff); }


.profile {
  position: absolute; z-index: 16; top: 18px; right: 18px; bottom: 18px; width: min(390px, calc(100% - 36px)); max-width: calc(100vw - 36px); overflow-y: auto; overflow-x: hidden;
  border: 1px solid rgba(0,32,92,.14); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); animation: profile-in .22s ease both;
}
@keyframes profile-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.profile-close { position: absolute; top: 14px; left: 14px; right: auto; z-index: 5; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid rgba(0,32,92,.14); border-radius: 50%; background: rgba(255,255,255,.96); color: var(--navy); font-size: 27px; box-shadow: 0 6px 18px rgba(0,32,92,.18); cursor: pointer; }
.hero-block { width: 100%; overflow: hidden; border-radius: 23px 23px 0 0; background: var(--surface); }
.hero { position: relative; width: 100%; aspect-ratio: 2 / 1; overflow: hidden; margin: 0; border-radius: 23px 23px 0 0; background: var(--navy); }
.hero img { width: 100%; height: 100%; display: block; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 50% 0 0; background: linear-gradient(180deg,transparent,rgba(0,20,58,.48)); pointer-events: none; }
.capacity { position: absolute; z-index: 3; left: 15px; bottom: 15px; display: flex; align-items: center; gap: 9px; max-width: calc(100% - 76px); padding: 10px 13px; border: 1px solid rgba(255,182,0,.84); border-radius: 14px; background: rgba(0,32,92,.94); color: #fff; box-shadow: 0 10px 24px rgba(0,20,58,.33); }
.capacity svg { width: 25px; height: 25px; flex: 0 0 auto; fill: none; stroke: var(--gold); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.capacity strong { display: block; font-family: "Oswald", sans-serif; font-size: 21px; line-height: 1; white-space: nowrap; }
.capacity span { display: block; margin-top: 3px; color: var(--lavender-15); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.hero-block.has-vpp .hero { border-radius: 23px 23px 0 0; }
.vpp-event { display: grid; gap: 3px; width: 100%; margin: 0; padding: 10px 16px 11px; box-sizing: border-box; border: 1px solid #cfd3dc; border-radius: 0; background: transparent; color: var(--navy); box-shadow: none; }
.vpp-event::before { display: none; }
.vpp-event strong, .vpp-event span { display: block; min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.vpp-event strong { color: var(--navy); font-size: 10.6px; line-height: 1.28; font-weight: 800; letter-spacing: .002em; }
.vpp-event span { color: #687183; font-size: 9.7px; line-height: 1.35; font-weight: 550; }
.vpp-event span b { color: #4c5568; font-weight: 750; }
.profile-body { padding: 19px 22px 24px; width: 100%; min-width: 0; overflow-x: hidden; }
#profileContent { width: 100%; min-width: 0; overflow-x: hidden; }
.identity, .address, .summary, .system-statuses, .services, .service-chips, .actions { min-width: 0; max-width: 100%; }
.identity h2, .address span, .summary, .service-note { overflow-wrap: anywhere; }
.action { min-width: 0; white-space: normal; text-align: center; }
.identity { display: grid; grid-template-columns: 50px minmax(0,1fr); align-items: center; gap: 12px; }
.identity img { width: 50px; height: 50px; flex: 0 0 auto; border-radius: 50%; object-fit: contain; }
.profile h2 { margin: 0; color: var(--navy); font-family: "Oswald", sans-serif; font-size: clamp(24px,2.2vw,32px); line-height: 1.02; letter-spacing: -.02em; }
.address { display: flex; align-items: flex-start; gap: 9px; margin-top: 13px; color: var(--muted); font-size: 13.5px; line-height: 1.42; }
.address svg { width: 21px; height: 21px; flex: 0 0 auto; fill: none; stroke: var(--navy); stroke-width: 2; }
.summary { margin: 16px 0 0; color: #404b63; font-size: 13.5px; line-height: 1.62; }
.system-statuses { display: grid; gap: 10px; margin-top: 10px; }
.system-status-row { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.system-status-head { display: block; margin: 0 0 6px 2px; }
.status-kicker { color: var(--navy); font-size: 10px; font-weight: 850; letter-spacing: .075em; text-transform: uppercase; }
.site-status-heading { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; }
.status-special { font-size: 10px; font-weight: 900; letter-spacing: .075em; text-transform: uppercase; }
.status-under-construction { color: var(--gold); }
.state-track { display: grid; gap: 7px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.site-state { grid-template-columns: repeat(4,minmax(0,1fr)); }
.battery-state { grid-template-columns: repeat(2,minmax(0,1fr)); }
.state-option { min-width: 0; display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 32px; padding: 6px 7px; border: 1px solid #d4d8e2; border-radius: 10px; color: #7c8493; background: #fff; box-shadow: 0 1px 3px rgba(0,32,92,.025); font-size: 8.8px; line-height: 1.05; font-weight: 800; text-align: center; text-transform: uppercase; letter-spacing: .025em; }
.state-check { display: none; font-size: 10px; line-height: 1; }
.state-option.selected { border-color: rgba(20,131,90,.30); background: #e3f5ec; color: #0b6e48; box-shadow: 0 2px 8px rgba(20,131,90,.10); }
.state-option.selected .state-check { display: inline; }
.state-option.state-inactive.selected { background: #eef0f3; border-color: #cfd4dc; color: #626b7a; }
.state-option.state-unable-to-activate.selected { background: #fbe7e8; border-color: rgba(187,63,69,.22); color: #9b2e36; }
.state-option.state-not-operational.selected { background: #fbe7e8; border-color: rgba(187,63,69,.22); color: #9b2e36; }
.activation-hours { display: flex; align-items: baseline; justify-content: flex-start; gap: 5px; margin-top: 9px; padding: 9px 10px; border-radius: 8px; background: #fff; color: var(--navy); font-size: 13px; line-height: 1.35; }
.activation-hours-label { flex: 0 0 auto; color: var(--navy); font-size: 13px; font-weight: 850; }
.activation-hours-value { min-width: 0; color: #404b63; font-size: 13px; font-weight: 650; }
.services { margin-top: 10px; }
.services-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.services h3 { margin: 0; color: var(--navy); font-family: "Oswald", sans-serif; font-size: 17px; }
.services-head > span { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.service-chips { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: stretch; gap: 7px; }
.service-chip { min-width: 0; width: 100%; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 7px 8px; border: 1px solid rgba(0,32,92,.12); border-radius: 10px; background: #f7f8fc; color: var(--navy); font-size: 9.2px; line-height: 1.16; font-weight: 750; white-space: normal; }
.service-chip i { width: 8px; height: 8px; flex: 0 0 auto; border: 2px solid #9aa2b3; border-radius: 50%; background: #fff; }
.service-chip.available { border-color: rgba(20,131,90,.22); background: #eef9f4; color: #0b6e48; }
.service-chip.available i { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 3px rgba(20,131,90,.10); }
.service-chip.unavailable { color: #8a909d; background: #f2f3f6; text-decoration: line-through; }
.service-chip.unavailable i { border-color: #8f96a3; background: #8f96a3; }
.service-note { margin: 9px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.public-note { display: grid; gap: 3px; margin-top: 10px; padding: 9px 10px; border: 1px solid rgba(0,32,92,.12); border-radius: 10px; background: #f7f8fc; }
.public-note strong { color: var(--navy); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.public-note span { color: #404b63; font-size: 11px; line-height: 1.4; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 22px; }
.action { min-height: 46px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border: 1px solid rgba(0,32,92,.16); border-radius: 13px; background: #fff; color: var(--navy); text-decoration: none; font-size: 12px; font-weight: 800; }
.action.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.action svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.mapboxgl-ctrl-top-right { top: 12px; right: 12px; }
.mapboxgl-ctrl-group { overflow: hidden; border-radius: 13px !important; box-shadow: var(--soft-shadow) !important; }
.mapboxgl-ctrl-group button { width: 42px !important; height: 42px !important; }
.mapboxgl-popup-content { max-width: 280px; padding: 10px 12px !important; border-radius: 13px !important; color: var(--navy); font-family: "Noto Sans", sans-serif; font-size: 12px; font-weight: 800; box-shadow: var(--soft-shadow) !important; }
.site-hover-label { pointer-events: none; }
.site-hover-label .mapboxgl-popup-content { max-width: 220px; padding: 5px 8px !important; border: 1px solid rgba(0,32,92,.12); border-radius: 8px !important; background: rgba(255,255,255,.96); font-size: 10.5px; line-height: 1.2; font-weight: 700; box-shadow: 0 4px 14px rgba(0,32,92,.14) !important; }
.site-hover-label .mapboxgl-popup-tip { border-top-color: rgba(255,255,255,.96) !important; }

@media (max-width: 980px) {
  :root { --header-h: 116px; }
  .header {
    grid-template-columns: minmax(132px, 38vw) minmax(0, 1fr) auto;
    grid-template-rows: 52px 42px;
    grid-template-areas:
      "brand search search"
      "instruction instruction toggle";
    gap: 6px 9px;
    padding: 8px 12px 7px;
  }
  .brand { grid-area: brand; width: min(190px, 100%); height: 50px; align-self: center; }
  .search { grid-area: search; justify-self: stretch; max-width: none; min-width: 0; }
  .search input { height: 44px; padding: 0 36px 0 40px; border-radius: 14px; font-size: clamp(12px,2.3vw,14px); }
  .search svg { left: 13px; top: 11px; width: 21px; }
  .clear-search { right: 6px; top: 7px; width: 30px; height: 30px; font-size: 21px; }
  .map-instruction {
    display: block;
    grid-area: instruction;
    justify-self: start;
    align-self: center;
    max-width: none;
    margin: 0;
    color: #4f5c74;
    font-size: 13.5px;
    line-height: 1.23;
    font-weight: 700;
    text-align: left;
    white-space: normal;
  }
  .sites-toggle {
    display: block;
    grid-area: toggle;
    justify-self: end;
    align-self: center;
    min-height: 40px;
    padding: 0 17px;
    border-radius: 999px;
    font-size: 18px;
    box-shadow: 0 5px 14px rgba(0,32,92,.16);
  }
  .workspace { display: block; position: relative; }
  .sidebar { position: absolute; left: 12px; top: 12px; bottom: 12px; width: min(360px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); transform: translateX(calc(-100% - 30px)); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .map-stage { height: 100%; }
  .profile { top: auto; left: 10px; right: 10px; bottom: 10px; width: auto; max-height: calc(100% - 20px); border-radius: 22px; animation-name: sheet-in; overscroll-behavior: contain; }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  .connector { display: none; }
}

@media (max-width: 560px) {
  :root { --header-h: 114px; }
  .header {
    grid-template-columns: minmax(126px, 39vw) minmax(0,1fr) auto;
    grid-template-rows: 50px 40px;
    gap: 6px 8px;
    padding: 8px 10px 6px;
  }
  .brand { width: min(178px,100%); height: 48px; }
  .map-instruction { font-size: 12.8px; line-height: 1.2; }
  .sites-toggle { min-height: 38px; padding: 0 14px; font-size: 17px; }
  .search input { height: 42px; padding: 0 33px 0 37px; border-radius: 13px; font-size: clamp(11.5px,3.3vw,13px); }
  .search svg { left: 12px; top: 10px; width: 20px; }
  .clear-search { right: 5px; top: 6px; width: 29px; height: 29px; }
  .mapboxgl-ctrl-top-right { top: 10px; right: 10px; }
  .mapboxgl-ctrl-group button { width: 40px !important; height: 40px !important; }
  .profile { left: 8px; right: 8px; bottom: 8px; max-height: calc(100% - 16px); }
  .hero { aspect-ratio: 2 / 1; }
  .capacity { left: 12px; bottom: 12px; max-width: calc(100% - 70px); padding: 9px 10px; border-radius: 12px; }
  .vpp-event { margin: 0; padding: 9px 12px 10px; }
  .vpp-event strong { font-size: 9.8px; }
  .vpp-event span { font-size: 8.9px; }
  .system-statuses { gap: 9px; margin-top: 9px; }
  .system-status-head { margin-bottom: 6px; }
  .state-track { gap: 5px; }
  .state-option { min-height: 30px; padding: 5px 4px; font-size: 7.8px; letter-spacing: 0; }
  .service-chips { gap: 5px; }
  .service-chip { min-height: 38px; padding: 6px 7px; font-size: 8.6px; }
  .capacity svg { width: 22px; height: 22px; }
  .capacity strong { font-size: 17px; }
  .capacity span { font-size: 8px; }
  .profile-body { padding: 17px 18px 22px; }
  .identity { grid-template-columns: 46px minmax(0,1fr); gap: 10px; }
  .identity img { width: 46px; height: 46px; }
  .profile h2 { font-size: 25px; }
  .summary { font-size: 13px; }
  .actions { grid-template-columns: 1fr; }
}

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

@media (max-width: 380px) {
  :root { --header-h: 112px; }
  .header { grid-template-columns: minmax(118px, 38vw) minmax(0,1fr) auto; padding-left: 8px; padding-right: 8px; gap: 5px 7px; }
  .map-instruction { font-size: 12px; }
  .sites-toggle { padding: 0 12px; font-size: 16px; }
  .search input { font-size: 11.5px; }
}
