html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background: #f3f6f8;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#topbar {
  height: 68px;
  min-height: 68px;
  padding: 0 18px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgb(228, 228, 228);
  border-bottom: 1px solid #d8e0e6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  z-index: 1000;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar-left h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  background: linear-gradient(90deg, rgb(6, 85, 130), rgb(147, 196, 72));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.2px;
}

#topbar-logos {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-logo {
  width: auto;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}

.topbar-logo-maisr {
  height: 42px;
}

.topbar-logo-imafir {
  height: 42px;
}

#map-shell {
  position: relative;
  flex: 1;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
}

#selector-widget {
  position: absolute;
  top: 80px;
  left: 10px;
  width: 140px;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(207, 217, 226, 0.95);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(6px);
  z-index: 900;
}

.widget-title {
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1f2a33;
}

#pivo-select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid #c7d0d9;
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  font-size: 12px;
  color: #22303a;
}

#chart-widget {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  height: 260px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(207, 217, 226, 0.95);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(6px);
  z-index: 900;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#chart-widget.hidden {
  display: none;
}

.widget-header {
  min-height: 52px;
  padding: 10px 14px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e4eaef;
}

.chart-header-info {
  min-width: 0;
  flex: 1;
}

.widget-header h2 {
  margin: 0;
  font-size: 15px;
  color: #1f2a33;
}

#selected-pivo-label {
  display: inline-block;
  margin-top: 3px;
  font-size: 13px;
  color: #5b6b78;
}

#chart-filter-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  margin-right: 2px;
}

#chart-filter-inline input[type="month"] {
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c7d0d9;
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #22303a;
  box-sizing: border-box;
}

.chart-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: #eef3f6;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1f2a33;
  transition: background 0.15s ease, transform 0.15s ease;
  padding: 0;
}

.icon-btn:hover {
  background: #e2e9ee;
}

.icon-btn:active {
  transform: scale(0.97);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.csv-btn {
  width: auto;
  min-width: 64px;
  padding: 0 10px;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}

.csv-btn span {
  line-height: 1;
}

.close-btn {
  font-size: 22px;
  line-height: 1;
}

.filter-btn {
  height: 32px;
  padding: 0 10px;
  border: 1px solid #c7d0d9;
  border-radius: 8px;
  background: #eef3f6;
  font-size: 12px;
  font-weight: 700;
  color: #22303a;
  cursor: pointer;
}

.filter-btn:hover {
  background: #e2e9ee;
}

.filter-btn.primary {
  background: #dfeee2;
  border-color: #b8d8be;
}

.filter-btn.primary:hover {
  background: #d2e7d6;
}

.widget-body {
  flex: 1;
  min-height: 0;
  padding: 10px 14px 14px 14px;
  box-sizing: border-box;
}

#series-chart {
  width: 100%;
  height: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .widget-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
  }

  #chart-filter-inline {
    order: 3;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {
  #topbar {
    padding: 0 12px;
  }

  .topbar-left h1 {
    font-size: 17px;
  }

  #selector-widget {
    top: 54px;
    left: 10px;
    right: auto;
    width: 220px;
  }

  #chart-widget {
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: 220px;
  }

  #chart-filter-inline input[type="month"] {
    min-width: 120px;
  }
}