.chart-filters {
  position: relative;
}
.filter-control {
  position: relative;
}
.filter-trigger {
  border: 0;
  gap: 8px;
  line-height: 24px;
}
.filter-trigger > svg {
  width: 16px;
  height: 16px;
}
.filter-trigger:focus,
.birthday-trigger:focus {
  outline: none;
}
.filter-trigger:focus-visible,
.birthday-trigger:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 3px;
}
.filter-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 300px;
  max-width: calc(100vw - 32px);
  max-height: min(720px, calc(100dvh - var(--header-height) - 142px));
  z-index: 18;
  display: flex;
  flex-direction: column;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bar);
  color: var(--text);
  box-shadow: 0 5px 18px #0003;
}
.filter-panel--country {
  width: 360px;
}
.filter-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  flex: 0 0 auto;
  margin-bottom: 20px;
}
.filter-panel-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 28px;
}
.popover-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 2px;
  background: transparent;
}
.popover-close svg {
  width: 24px;
  height: 24px;
}
.popover-close:hover {
  background: var(--hover);
}
.filter-options {
  overflow-y: auto;
  overscroll-behavior: contain;
  max-height: 550px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 2px;
  cursor: pointer;
  font-size: 16px;
  line-height: 22px;
}
.filter-option-all {
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.filter-option-label {
  flex: 1;
  min-width: 0;
}
.filter-option:has(input:checked) .filter-option-label {
  font-weight: 700;
}
.filter-option input[type="radio"] {
  appearance: none;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
}
.filter-option input[type="radio"]:checked {
  border: 7px solid var(--blue);
  background: #fff;
}
.filter-option input[type="radio"]:focus-visible {
  outline: 2px solid var(--muted);
  outline-offset: 3px;
}
.device-badge {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 15px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
}
.filter-panel-footer {
  padding-top: 12px;
  flex: 0 0 auto;
}
.filter-apply {
  width: 100%;
  min-height: 36px;
  height: 36px;
  padding: 6px 12px;
  background: var(--text);
  color: var(--bg);
  font-size: 16px;
}
.filter-apply:disabled {
  opacity: 0.5;
}
.birthday-control {
  position: relative;
  min-width: 0;
}
.birthday-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 8px 10px;
  background: #232527;
  color: #f7f7f8;
  border: 1px solid #72757b;
  border-radius: 0;
  text-align: left;
  font-size: 16px;
  line-height: 22px;
  font-weight: 400;
}
.birthday-control:first-child .birthday-trigger {
  border-radius: 8px 0 0 8px;
}
.birthday-control:last-child .birthday-trigger {
  border-radius: 0 8px 8px 0;
}
.birthday-control + .birthday-control .birthday-trigger {
  border-left: 0;
}
.birthday-trigger .date-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.birthday-trigger svg {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}
.birthday-menu {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(240px, 80vw);
  max-height: 260px;
  padding: 4px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 15;
  background: #202227;
  color: #f7f7f8;
  border: 1px solid #72757b;
  border-radius: 5px;
  box-shadow: 0 6px 20px #0007;
  scrollbar-width: thin;
}
.birthday-option {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 0;
  text-align: left;
  background: transparent;
  color: inherit;
  font-size: 16px;
  line-height: 22px;
}
.birthday-option:hover,
.birthday-option:focus {
  outline: none;
  background: #393c45;
}
.birthday-option[aria-selected="true"] {
  background: #494d59;
  font-weight: 600;
}
@media (max-width: 600px) {
  .chart-filters .filter-control {
    position: static;
  }
  .chart-filters .filter-panel {
    left: 0;
    top: calc(100% + 6px);
    width: min(360px, calc(100vw - 32px));
  }
  .chart-filters .filter-panel--device {
    width: min(300px, calc(100vw - 32px));
  }
  .filter-panel {
    padding: 20px;
  }
  .filter-option {
    min-height: 50px;
  }
  .birthday-trigger {
    padding-left: 8px;
    padding-right: 8px;
    gap: 4px;
    font-size: 14px;
  }
  .birthday-trigger svg {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
  }
}
