:where(.consent-panel button) {
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.consent-layer[hidden], .consent-bar-spacer[hidden], .consent-tabs[hidden],
.consent-content [hidden], .consent-actions [hidden], .consent-error[hidden] { display: none; }

.consent-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}

.consent-panel {
  --consent-blue: #0864e8;
  --consent-blue-dark: #064eb9;
  --consent-border: #ded9d4;
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  flex-direction: column;
  width: min(900px, calc(100vw - 16px));
  max-height: min(85dvh, calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 16px));
  transform: translate(-50%, -50%);
  overflow: hidden;
  border: 1px solid var(--consent-border);
  border-radius: 18px;
  background: #f8f5f2;
  box-shadow: 0 18px 70px rgba(0, 0, 0, .32);
  color: #302e2d;
  color-scheme: light;
  font-family: Inter, Arial, sans-serif;
  pointer-events: auto;
}

.consent-brand {
  position: relative;
  display: flex;
  align-items: center;
  flex: none;
  padding: 17px 24px;
  border-bottom: 1px solid var(--consent-border);
}
.consent-brand-mark {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 144px; height: 36px; overflow: hidden;
}
.consent-brand-mark img { display: block; width: 132px; height: auto; }
.consent-back { display: none; }
.consent-panel--details .consent-back {
  position: absolute; top: 50%; right: 16px; display: block; min-height: 44px;
  transform: translateY(-50%); padding: 0 8px; color: var(--consent-blue-dark);
  font-family: Inter, Arial, sans-serif; font-size: 26px; font-weight: 400;
}

.consent-mobile-copy, .consent-mobile-label,
.consent-settings-copy, .consent-settings-allow-all, .consent-settings-heading,
.consent-always-active, .consent-mobile-nav { display: none; }

.consent-tabs { display: grid; flex: none; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--consent-border); }
.consent-tabs button { min-height: 48px; border-bottom: 2px solid transparent; font-size: 14px; font-weight: 650; }
.consent-tabs button[aria-selected="true"] { border-color: var(--consent-blue); color: var(--consent-blue-dark); }
.consent-tabs button:focus-visible, .consent-panel button:focus-visible, .consent-panel a:focus-visible,
.consent-switch input:focus-visible + span { outline: 2px solid var(--consent-blue); outline-offset: -3px; }
.consent-content { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 26px 24px; }
@media (hover: hover) and (pointer: fine) {
  .consent-content::-webkit-scrollbar { width: 5px; }
  .consent-content::-webkit-scrollbar-track { background: transparent; }
  .consent-content::-webkit-scrollbar-thumb { border-radius: 999px; background: #aaa5a1; }
  .consent-content::-webkit-scrollbar-thumb:hover { background: #817d79; }
  .consent-content::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
}
.consent-intro { min-height: 96px; }
.consent-intro h2 { font-size: 17px; font-weight: 700; line-height: 1.4; }
.consent-detail-link { display: block; min-height: 44px; margin-top: 12px; color: var(--consent-blue-dark); font-size: 14px; text-align: left; }
.consent-detail-link span { margin-left: 4px; font-size: 20px; vertical-align: -1px; }
.consent-about { display: grid; gap: 16px; color: #5f5b58; font-size: 14px; line-height: 1.6; }
.consent-about h2, .consent-categories h2 { color: #302e2d; font-size: 17px; font-weight: 700; }
.consent-about a, .consent-mobile-copy a, .consent-settings-copy a { color: var(--consent-blue-dark); text-decoration: underline; }
.consent-actions { display: flex; flex: none; gap: 12px; padding: 16px 24px calc(16px + env(safe-area-inset-bottom)); border-top: 1px solid var(--consent-border); }
.consent-actions button { min-height: 48px; flex: 1; border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 700; }
.consent-actions button:disabled, .consent-settings-allow-all:disabled { cursor: not-allowed; opacity: .5; }
.consent-actions .consent-primary, .consent-settings-allow-all {
  background: var(--consent-blue); color: #fff;
}
.consent-actions .consent-primary:hover, .consent-settings-allow-all:hover { background: var(--consent-blue-dark); }
.consent-actions .consent-secondary { border: 1px solid var(--consent-blue); background: #fff; color: var(--consent-blue-dark); }
.consent-actions .consent-secondary:hover { background: #eaf2ff; }
.consent-secondary [aria-hidden="true"] { font-size: 20px; line-height: 0; margin-left: 4px; vertical-align: -1px; }
.consent-actions-scroll-indicator { display: none; }
.consent-error { padding: 0 24px 12px; color: #9a3412; font-size: 13px; }
.consent-category { padding: 14px 0 16px; border-bottom: 1px solid var(--consent-border); }
.consent-categories h2 + .consent-category { padding-top: 20px; }
.consent-category-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.consent-category-expand { display: flex; align-items: center; min-height: 44px; gap: 7px; font-size: 16px; font-weight: 700; text-align: left; }
.consent-category-expand > span:first-child { width: 18px; font-size: 24px; font-weight: 400; }
.consent-count { color: #77716d; font-size: 13px; font-weight: 500; }
.consent-category > p { padding-left: 25px; color: #68635f; font-size: 12px; line-height: 1.5; }
.consent-switch { display: flex; flex: none; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.consent-switch input { position: absolute; opacity: 0; }
.consent-switch span { position: relative; display: block; width: 42px; height: 25px; border-radius: 99px; background: #858585; }
.consent-switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.consent-switch input:checked + span { background: var(--consent-blue); }
.consent-switch input:checked + span::after { transform: translateX(17px); }
.consent-switch input:disabled + span { opacity: .65; }
.consent-providers { display: grid; gap: 10px; margin: 14px 0 0 25px; }
.consent-providers > p { color: #68635f; font-size: 13px; }
.consent-provider { padding: 12px 14px; border: 1px solid var(--consent-border); border-radius: 10px; background: #fff; font-size: 13px; }
.consent-provider summary { min-height: 44px; padding-top: 10px; cursor: pointer; font-weight: 700; }
.consent-provider summary span { color: #77716d; font-weight: 400; }
.consent-provider > a { display: inline-block; min-height: 44px; padding-top: 12px; color: var(--consent-blue-dark); text-decoration: underline; }
.consent-provider details p { margin: 6px 0 12px; color: #5f5b58; line-height: 1.6; }
.consent-measurement-note { color: #5f5b58; font-size: 13px; line-height: 1.6; }
.consent-cookie { margin-top: 8px; padding: 12px; border-radius: 8px; background: #f1eeeb; line-height: 1.6; }
.consent-cookie p { margin-top: 4px; color: #5f5b58; }
.consent-updated { padding-top: 20px; color: #77716d; font-size: 12px; }

@media (max-width: 767px) {
  .consent-panel {
    /* Keep the content box steady while Chrome's bottom controls retract on scroll. */
    position: fixed;
    top: auto; bottom: calc(8px + env(safe-area-inset-bottom, 0px) - env(safe-area-max-inset-bottom, 0px)); left: 50%; right: auto;
    width: min(420px, calc(100vw - 16px));
    max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) + env(safe-area-max-inset-bottom, 0px));
    padding-bottom: env(safe-area-max-inset-bottom, 0px);
    transform: translateX(-50%);
    border: 1px solid #e1e1e1; border-radius: 9px;
    background: #fff; box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
  }
  .consent-panel:not(.consent-panel--details) .consent-brand {
    min-height: 52px; padding: 8px 15px;
  }
  .consent-panel:not(.consent-panel--details) .consent-content { flex: 0 1 auto; padding: 18px 15px 24px; }
  .consent-panel:not(.consent-panel--details) .consent-intro { min-height: 0; }
  .consent-panel:not(.consent-panel--details) .consent-detail-link { display: none; }
  .consent-panel:not(.consent-panel--details) .consent-intro h2 {
    margin: 0 0 12px; font-size: 14px; line-height: 1.4;
  }
  .consent-panel:not(.consent-panel--details) .consent-mobile-copy {
    display: block; margin: 0; color: #5f5b58; font-size: 13px; line-height: 1.5;
  }
  .consent-panel:not(.consent-panel--details) .consent-actions {
    flex-direction: column-reverse; gap: 8px; border: 0;
    padding: 0 15px 15px;
  }
  .consent-mobile-label { display: inline; }
  .consent-desktop-label { display: none; }
  .consent-actions button { flex: none; width: 100%; min-height: 46px; border-radius: 4px; font-size: 14px; }
  .consent-panel--details {
    top: calc(8px + env(safe-area-inset-top));
    bottom: calc(8px + env(safe-area-inset-bottom, 0px) - env(safe-area-max-inset-bottom, 0px));
    left: 8px; right: 8px; width: auto; height: auto; max-height: none;
    transform: none; border-radius: 10px;
  }
  .consent-panel--details .consent-brand {
    min-height: 58px; padding: 10px 56px 10px 16px;
  }
  .consent-panel--details .consent-tabs { display: grid; }
  .consent-panel--details .consent-tabs button { min-height: 54px; font-size: 16px; }
  .consent-panel--details .consent-content {
    padding: 0 16px 18px; scrollbar-color: #242424 #ededed; scrollbar-width: thin;
  }
  .consent-panel--details .consent-content::-webkit-scrollbar { width: 5px; }
  .consent-panel--details .consent-content::-webkit-scrollbar-track { background: #ededed; }
  .consent-panel--details .consent-content::-webkit-scrollbar-thumb { border-radius: 999px; background: #242424; }
  .consent-panel--details .consent-intro { padding: 18px 0; }
  .consent-panel--details .consent-intro h2 { margin: 0 0 12px; font-size: 16px; }
  .consent-panel--details .consent-mobile-copy { display: block; font-size: 14px; line-height: 1.55; }
  .consent-panel--details .consent-detail-link { display: block; }
  .consent-panel--details .consent-categories h2 { display: none; }
  .consent-panel--details .consent-settings-copy,
  .consent-panel--details .consent-settings-allow-all,
  .consent-panel--details .consent-settings-heading,
  .consent-panel--details .consent-mobile-nav { display: none; }
  .consent-panel--details .consent-categories:not([hidden]) {
    display: flex; flex-direction: column; min-height: calc(100dvh + 80px);
  }
  .consent-panel--details .consent-category {
    padding: 16px 0 22px; border-bottom: 1px solid #e0e0e0; background: #fff;
  }
  .consent-panel--details .consent-category-head { min-height: 46px; gap: 8px; }
  .consent-panel--details .consent-category-expand {
    min-width: 0; flex: 1; gap: 10px; color: #191919; font-size: 16px; font-weight: 700;
  }
  .consent-panel--details .consent-category-expand > span:first-child {
    width: 22px; flex: none; font-size: 0;
  }
  .consent-panel--details .consent-category-expand > span:first-child::after {
    content: '⌄'; font-size: 25px; font-weight: 400; line-height: 1;
  }
  .consent-panel--details .consent-category-expand[aria-expanded="true"] > span:first-child::after { content: '⌃'; }
  .consent-panel--details .consent-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; min-height: 22px; padding: 0 5px;
    border-radius: 999px; background: #e4e4e4; color: #333;
    font-size: 12px; font-weight: 700;
  }
  .consent-panel--details .consent-category > p {
    display: block; margin: 8px 0 0; padding: 0;
    color: #3f3f3f; font-size: 15px; line-height: 1.55;
  }
  .consent-panel--details .consent-providers { margin: 16px 0 0; }
  .consent-panel--details .consent-always-active { display: none; }
  .consent-panel--details .consent-switch { min-width: 54px; }
  .consent-panel--details .consent-switch span { width: 54px; height: 31px; }
  .consent-panel--details .consent-switch span::after { width: 25px; height: 25px; }
  .consent-panel--details .consent-switch input:checked + span::after { transform: translateX(23px); }
  .consent-panel--details .consent-switch input:disabled + span { opacity: 1; }
  .consent-panel--details .consent-updated { margin-top: auto; padding: 24px 0 0; font-size: 13px; }
  .consent-panel--details .consent-about { padding: 18px 0; }
  .consent-panel--details .consent-about h2 { font-size: 18px; }
  .consent-panel--details .consent-actions {
    flex-direction: column; padding: 12px 16px; background: #fff;
  }
  .consent-panel--details .consent-actions button { min-height: 52px; font-size: 15px; }
  .consent-panel--details:has(#privacy-details:not([hidden])) .consent-actions {
    height: 74px; padding: 10px 16px; gap: 12px;
    overflow-y: scroll; overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .consent-panel--details:has(#privacy-details:not([hidden])) .consent-actions::-webkit-scrollbar { display: none; }
  .consent-panel--details:has(#privacy-details:not([hidden])) .consent-actions-scroll-indicator {
    position: absolute; right: 5px; bottom: 8px;
    display: block; width: 4px; height: 58px;
    border-radius: 999px; background: #ededed; pointer-events: none;
  }
  .consent-actions-scroll-indicator > span {
    position: absolute; top: 0; left: 0; width: 100%;
    border-radius: inherit; background: #181818;
  }
}

@media (min-width: 768px) and (min-height: 600px) {
  .consent-bar-spacer { height: 176px; }
  .consent-panel--bar {
    top: auto; bottom: 0; left: 0; width: 100%; max-height: none; min-height: 176px;
    display: grid; grid-template-columns: 1fr 2fr 1fr;
    align-items: center; gap: 24px; transform: none; border-radius: 0; padding: 18px 24px;
  }
  .consent-panel--bar .consent-brand { border: none; padding: 0; }
  .consent-panel--bar .consent-content { padding: 0; overflow: visible; }
  .consent-panel--bar .consent-intro { min-height: 0; }
  .consent-panel--bar .consent-actions { flex-direction: column-reverse; padding: 0; border: none; }
  .consent-panel--bar .consent-actions button { flex: none; }
}

/* Samtykke after Tilpas: the start choice as a centred card on every width. */
.consent-panel.consent-panel--card {
  position: fixed;
  top: 50%; bottom: auto; left: 50%; right: auto;
  width: min(420px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  padding-bottom: 0;
  transform: translate(-50%, -50%);
  border: 1px solid #e1e1e1; border-radius: 9px;
  background: #fff; box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
}
.consent-panel.consent-panel--card .consent-brand { min-height: 64px; padding: 12px 20px; border-bottom: 1px solid #e1e1e1; }
.consent-panel.consent-panel--card .consent-content { flex: 0 1 auto; padding: 0; overflow-y: auto; }
.consent-panel.consent-panel--card .consent-intro { display: flex; flex-direction: column; min-height: 0; padding: 0; }
.consent-panel.consent-panel--card .consent-intro h2 { margin: 0; padding: 24px 20px 8px; font-size: 16px; line-height: 1.4; }
.consent-panel.consent-panel--card .consent-mobile-copy {
  display: block; margin: 0; padding: 0 20px 24px; border-bottom: 1px solid #e1e1e1;
  color: #5f5b58; font-size: 14px; line-height: 1.5;
}
.consent-panel.consent-panel--card .consent-detail-link {
  display: block; align-self: flex-end; margin: 8px 12px 0 0; padding: 0 8px;
  font-size: 15px; font-weight: 600; text-align: right;
}
.consent-panel.consent-panel--card .consent-actions {
  flex-direction: column-reverse; gap: 8px; padding: 8px 20px 20px; border: 0; background: #fff;
}
.consent-panel.consent-panel--card .consent-actions button { flex: none; width: 100%; min-height: 48px; border-radius: 4px; font-size: 15px; }
.consent-card-chevron { display: none; }
.consent-panel--card .consent-card-chevron { display: inline; }
