.rn-consent,
.rn-consent-modal,
.rn-consent-revisit {
  --rnc-blue: #0161C5;
  --rnc-blue-dark: #064E9B;
  --rnc-ink: #17212B;
  --rnc-muted: #536170;
  --rnc-line: #D6DEE7;
  --rnc-soft: #F3F6F9;
  font-family: "Niwce Manrope", "Segoe UI", Arial, sans-serif;
  color: var(--rnc-ink);
  box-sizing: border-box;
}
.rn-consent *, .rn-consent-modal *, .rn-consent-revisit * { box-sizing: border-box; }
.rn-consent[hidden], .rn-consent-modal[hidden], .rn-consent-revisit[hidden] { display: none !important; }

/* Pierwsza warstwa */
.rn-consent {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 99998;
  width: min(460px, calc(100vw - 32px));
}
.rn-consent__bar {
  background: #fff;
  border: 1px solid var(--rnc-line);
  border-radius: 6px;
  box-shadow: 0 12px 40px rgba(23, 33, 43, .18);
  padding: 20px;
  max-height: 80dvh;
  overflow: auto;
}
.rn-consent__title { margin: 0 0 8px; font-size: 1rem; font-weight: 700; line-height: 1.35; }
.rn-consent__text { margin: 0; font-size: .875rem; line-height: 1.6; color: var(--rnc-muted); }
.rn-consent__text a { color: var(--rnc-blue); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.rn-consent__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rn-consent__btn {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--rnc-blue);
  border-radius: 3px;
  background: var(--rnc-blue);
  color: #fff;
  font: inherit;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}
.rn-consent__btn:hover { background: var(--rnc-blue-dark); border-color: var(--rnc-blue-dark); color: #fff; }
.rn-consent__btn--ghost { background: #fff; color: var(--rnc-blue); }
.rn-consent__btn--ghost:hover { background: var(--rnc-soft); color: var(--rnc-blue-dark); }

/* Panel ustawień */
.rn-consent-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(23, 33, 43, .45);
}
.rn-consent-modal__dialog {
  width: min(620px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(23, 33, 43, .3);
  outline: none;
}
.rn-consent-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--rnc-line);
}
.rn-consent-modal__head .rn-consent__title { margin: 0; font-size: 1.125rem; }
.rn-consent-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--rnc-ink);
  cursor: pointer;
}
.rn-consent-modal__close:hover { background: var(--rnc-soft); }
.rn-consent-modal__body { padding: 16px 20px; overflow: auto; }
.rn-consent-cat { padding: 14px 0; border-bottom: 1px solid var(--rnc-line); }
.rn-consent-cat:last-child { border-bottom: 0; }
.rn-consent-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; cursor: pointer; }
.rn-consent-cat__name { font-weight: 700; font-size: .9375rem; }
.rn-consent-cat__always { font-size: .8125rem; font-weight: 700; color: var(--rnc-blue); }
.rn-consent-cat__desc { margin: 6px 0 0; font-size: .8125rem; line-height: 1.55; color: var(--rnc-muted); }
.rn-consent-modal__actions { margin: 0; padding: 16px 20px; border-top: 1px solid var(--rnc-line); }

/* Przełącznik */
.rn-consent-switch { position: relative; display: inline-flex; flex: none; width: 44px; height: 24px; }
.rn-consent-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rn-consent-switch__track { width: 100%; height: 100%; border-radius: 999px; background: #B8C4D0; transition: background .15s; }
.rn-consent-switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.rn-consent-switch input:checked + .rn-consent-switch__track { background: var(--rnc-blue); }
.rn-consent-switch input:checked + .rn-consent-switch__track::after { transform: translateX(20px); }
.rn-consent-switch input:focus-visible + .rn-consent-switch__track { outline: 3px solid var(--rnc-ink); outline-offset: 2px; }

/* Stały przycisk ponownego otwarcia */
.rn-consent-revisit {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 99997;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--rnc-blue);
  color: #fff;
  box-shadow: 0 6px 20px rgba(23, 33, 43, .25);
  cursor: pointer;
}
.rn-consent-revisit:hover { background: var(--rnc-blue-dark); }

.rn-consent button:focus-visible,
.rn-consent a:focus-visible,
.rn-consent-modal button:focus-visible,
.rn-consent-modal a:focus-visible,
.rn-consent-revisit:focus-visible { outline: 3px solid var(--rnc-ink); outline-offset: 3px; }

html.rn-consent-lock, html.rn-consent-lock body { overflow: hidden; }

@media (max-width: 480px) {
  .rn-consent { left: 8px; bottom: 8px; width: calc(100vw - 16px); }
  .rn-consent__actions .rn-consent__btn { flex: 1 1 100%; }
  .rn-consent-revisit { left: 12px; bottom: 12px; width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .rn-consent-switch__track, .rn-consent-switch__track::after { transition: none; }
}
