html, body {
  width: 100%;
  min-height:  100%;
  margin: 0;
  font-family: "Lexia", Arial, sans-serif;
  background: #f4f4f2;
  color: #1f1f1f;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;

  overflow-x: hidden;
  overflow-y: auto;

}

.site-header {
  height: 88px;
  background: #ffffff;
  border-bottom: 1px solid #e5e2dd;
  position: relative;
  z-index: 20;
}

.site-header__inner {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-sizing: border-box;
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand__logo {
  height: 42px;
  width: auto;
  display: block;
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__eyebrow {
  font-size: 12px;
  color: #8a7c66;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brand__text h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
  color: #bb0f18;
}

.site-main {
  position: relative;
  flex: 1;
  min-height: 0;
}

#chartdiv {
  width: 100%;
  height: calc(100vh - 88px - 52px);
  background: #f4f4f2;
}

.country-panel {
  position: fixed;
  top: 88px;
  right: 0;
  width: 400px;
  max-width: 92vw;
  height: calc(100vh - 88px - 52px);
  background: #ffffff;
  border-left: 1px solid #e5e2dd;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  padding: 28px 24px 24px;
  box-sizing: border-box;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  z-index: 30;
}

.country-panel.open {
  transform: translateX(0);
}

.close-panel {
  position: absolute;
  top: 14px;
  right: 16px;
  border: 0;
  background: transparent;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  color: #8a7c66;
}

.close-panel:hover {
  color: #bb0f18;
}

#panel-content h2 {
  margin: 0 0 18px;
  font-size: 42px;
  line-height: 1.05;
  font-weight: 700;
  color: #1f1f1f;
  max-width: 85%;
}

#panel-content p {
  margin: 0 0 14px;
  line-height: 1.5;
  color: #333333;
}

.profile-row {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f0ece7;
}

.profile-label {
  display: block;
  font-size: 16px;
  margin-bottom: 5px;
}

.profile-value {
  font-size: 23px;
  line-height: 1.35;
  color: #1f1f1f;
  font-weight: bold
}

#legend {
  position: fixed;
  bottom: 82px;
  left: 20px;
  width: 260px;
  background: #ffffff;
  border: 1px solid #e5e2dd;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  padding: 20px 24px 18px;
  box-sizing: border-box;
  overflow-y: auto;
  transition: transform 0.3s ease;
  z-index: 29;
}

#legend .legend-content {
  height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  interpolate-size: allow-keywords;
  font-size: 0.8rem;
}

#legend.open .legend-content {
  height: auto;
}

#legend .toggle-legend {
  position: absolute;
  rotate: 180deg;
  top: 19px;
  right: 10px;
  height: 22px;
  padding: 5px;
  overflow: hidden;
  border: 0;
  background: transparent;
  font-size: 20px;
  font-weight: 900;
  font-family: monospace;
  line-height: 1;
  cursor: pointer;
  color: #8a7c66;
}

#legend.open .toggle-legend {
  rotate: 0deg;
}

#legend .toggle-legend:hover {
  color: #bb0f18;
}

#legend h2 {
  font-size: 1.2rem;
  font-weight: 500;
  margin: 0;
  cursor: pointer;
}

#legend p {
  padding-top: .5rem;
}

#legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

#legend li {
  margin-bottom: 5px;
}

#legend li span {
  display: inline-block;
  vertical-align: middle;
  width: 18px;
  height: 18px;
  border: solid 1px #e5e2dd;
}

#legend .legend-item-1 {
  background: #ED1350;
}
#legend .legend-item-2 {
  background: #F25821;
}
#legend .legend-item-3 {
  background: #8a7c66;
}
#legend .legend-item-4 {
  background: #CCC;
}

#welcome {
  position: fixed;
  bottom: 82px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 600px;
  min-width: 360px;
  max-height: 400px;
  background: #ffffff;
  border: 1px solid #e5e2dd;
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
  padding: 20px 34px 18px 24px;
  box-sizing: border-box;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 30;
}

#welcome.open {
  opacity: 1;
  visibility: visible;
}

#welcome .close-welcome {
  position: absolute;
  rotate: 180deg;
  top: 19px;
  right: 10px;
  height: 30px;
  padding: 5px;
  overflow: hidden;
  border: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 900;
  font-family: monospace;
  line-height: 1;
  cursor: pointer;
  color: #8a7c66;
}

#welcome .close-welcome:hover {
  color: #bb0f18;
}


.site-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  height: 52px;
  background: #ffffff;
  border-top: 1px solid #e5e2dd;
  position: relative;
  z-index: 20;
}

.site-footer__inner {
  height: 100%;
  padding: 0 24px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 13px;
  color: #8a7c66;
}
.profile-actions {
  margin-top: 24px;
}

.profile-button {
  display: inline-block;
  padding: 14px 18px;
  background: #ed1350;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  border: 2px solid #ed1350;
  transition: all 0.2s ease;
}

.profile-button:hover {
  background: #bb0f18;
  border-color: #bb0f18;
  color: #ffffff;
}
@media (max-width: 900px) {
  .brand__text h1 {
    font-size: 24px;
  }

  #chartdiv {
    height: calc(100dvh - 88px - 52px);
  }

  .country-panel {
    width: 100%;
    max-width: 100%;
  }

  #panel-content h2 {
    font-size: 34px;
  }

  .profile-value {
    font-size: 20px;
  }

  .site-footer__inner {
    font-size: 12px;
  }
}

.site-header__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-header__utility {
  margin-left: 20px;
}

.back-link {
  font-size: 1.1rem;
  text-decoration: none;
  font-weight: 700;
  color: #ed1350;
}

@media (max-width: 640px) {
  .back-link {
    font-size: 0.9rem;
  }
}

.back-link:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .site-header__inner,
  .site-footer__inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand {
    gap: 12px;
  }

  .brand__logo {
    height: 34px;
  }

  .brand__text h1 {
    font-size: 20px;
  }

  .brand__eyebrow {
    font-size: 10px;
  }
}
