.analytics-consent {
  position: fixed;
  z-index: 1000;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  width: min(33rem, calc(100vw - 2rem));
  max-height: min(75vh, 36rem);
  overflow: auto;
  padding: 1.25rem;
  color: #15212c;
  background: #fff;
  border: 1px solid #a9bac7;
  border-radius: 0.65rem;
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 25%);
}

.analytics-consent[hidden] {
  display: none;
}

.analytics-consent.is-docked {
  position: relative;
  right: auto;
  bottom: auto;
  margin: 1rem auto 0;
}

.analytics-consent__confirmation {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.analytics-consent__title,
.analytics-settings__title {
  margin: 0 0 0.5rem;
  color: inherit;
  font-size: 1.25rem;
  line-height: 1.3;
}

.analytics-consent__description,
.analytics-settings__description,
.analytics-consent__status,
.analytics-consent__notice,
.analytics-settings__essential,
.analytics-settings__notice {
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.analytics-consent__notice,
.analytics-settings__notice {
  color: #4b3720;
  font-weight: 600;
}

.analytics-consent__actions,
.analytics-settings__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.analytics-consent__button {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  color: #15212c;
  font: inherit;
  font-weight: 600;
  background: #f2f6f8;
  border: 2px solid #41576a;
  border-radius: 0.35rem;
  cursor: pointer;
}

.analytics-consent__button--primary {
  color: #fff;
  background: #174b66;
  border-color: #174b66;
}

.analytics-consent__button--text {
  background: transparent;
}

.analytics-consent__button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.analytics-consent__button:focus-visible,
.analytics-settings__label:focus-within,
.analytics-consent__privacy:focus-visible {
  outline: 3px solid #c25226;
  outline-offset: 3px;
}

.analytics-consent__privacy,
.analytics-consent a.analytics-consent__privacy {
  color: #174b66;
  font-weight: 600;
}

.analytics-settings {
  width: min(32rem, calc(100vw - 2rem));
  max-height: min(85vh, 40rem);
  overflow: auto;
  padding: 1.5rem;
  color: #15212c;
  background: #fff;
  border: 1px solid #a9bac7;
  border-radius: 0.65rem;
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 25%);
}

.analytics-settings::backdrop {
  background: rgb(9 21 31 / 65%);
}

.analytics-settings__label {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin: 1rem 0 1.25rem;
  font-weight: 600;
}

.analytics-settings__label input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: #174b66;
}

@media (prefers-color-scheme: dark) {
  .analytics-consent,
  .analytics-settings {
    color: #f2f4f5;
    background: #17232d;
    border-color: #7f99aa;
  }

  .analytics-consent__button {
    color: #f2f4f5;
    background: #243542;
    border-color: #a9bac7;
  }

  .analytics-consent__button--primary {
    color: #fff;
    background: #176388;
    border-color: #6aa8c5;
  }

  .analytics-consent__privacy,
  .analytics-consent a.analytics-consent__privacy {
    color: #9ad4ef;
  }

  .analytics-consent__notice,
  .analytics-settings__notice {
    color: #ffe0b6;
  }
}

@media (max-width: 30rem) {
  .analytics-consent {
    right: 0.5rem;
    bottom: 0.5rem;
    width: calc(100vw - 1rem);
    padding: 1rem;
  }

  .analytics-consent__actions > * {
    flex: 1 1 auto;
  }
}

/* On phones the first-visit panel is compact so it does not hide the page. */
@media (max-width: 40rem) {
  .analytics-consent:not(.is-docked) {
    padding: 0.75rem 0.85rem;
    font-size: 0.875rem;
    line-height: 1.4;
    max-height: 45vh;
  }

  .analytics-consent:not(.is-docked) .analytics-consent__title {
    margin-bottom: 0.25rem;
    font-size: 1rem;
  }

  .analytics-consent:not(.is-docked) :is(.analytics-consent__description, .analytics-consent__status, .analytics-consent__notice) {
    margin-bottom: 0.5rem;
  }

  .analytics-consent:not(.is-docked) .analytics-consent__actions {
    gap: 0.4rem;
  }

  .analytics-consent:not(.is-docked) .analytics-consent__button {
    min-height: 2.75rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .analytics-consent *,
  .analytics-settings * {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.analytics-report {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(1rem, 4vw, 3rem);
}

.analytics-report__form {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin: 1.5rem 0;
}

.analytics-report__field {
  display: grid;
  gap: 0.4rem;
}

.analytics-report__field input {
  min-height: 2.75rem;
  padding: 0.45rem;
  font: inherit;
}

.analytics-report__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 1.5rem;
}

.analytics-report__status {
  min-height: 1.5em;
  font-weight: 600;
}

.analytics-report__table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 1rem 0 2rem;
}

.analytics-report table {
  width: 100%;
  border-collapse: collapse;
}

.analytics-report th,
.analytics-report td {
  padding: 0.65rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid #a9bac7;
}

.analytics-report th {
  font-weight: 700;
}

.analytics-report__disclaimer {
  padding: 1rem;
  border-inline-start: 0.3rem solid #c25226;
}
