/* Backdrop via ::backdrop (native to <dialog>) */
.consent-dialog::backdrop {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
}

.consent-dialog {
  font-size: 16px;
  border: none;
  padding: 0;
  width: 100%;
  max-width: 520px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  color: #0f172a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  animation: consent-pop 0.25s ease-out;
}
@keyframes consent-pop {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.consent-inner { display: flex; flex-direction: column; }

.consent-header { position: relative; padding: 1.5rem 1.5rem .75rem; text-align: center; }
.consent-icon   { font-size: 2.25rem; margin-bottom: .5rem; }
.consent-title  { margin: 0; font-size: 1.25em; font-weight: 600; }

.consent-back {
  position: absolute; left: 1rem; top: 1.25rem;
  width: 32px; height: 32px; border: none; border-radius: 8px;
  background: #f1f5f9; color: #0f172a; cursor: pointer; font-size: 1rem;
}
.consent-back:hover { background: #e2e8f0; }

.consent-body        { padding: .5rem 1.5rem 1rem; }
.consent-body-scroll { max-height: 50vh; overflow-y: auto; }
.consent-text        { margin: 0 0 .75rem; color: #475569; font-size: .9em; line-height: 1.55; }
.consent-link        { color: #2563eb; font-size: .85rem; text-decoration: none; font-weight: 500; }
.consent-link:hover  { text-decoration: underline; }

.consent-footer {
  display: flex; flex-wrap: wrap; gap: .5rem;
  padding: 1rem 1.5rem 1.5rem; border-top: 1px solid #f1f5f9;
}
.consent-footer-detailed { justify-content: space-between; }

.consent-btn {
  flex: 1 1 auto; min-width: 100px; padding: .7rem 1rem;
  border-radius: 10px; font-size: .9rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: all .15s ease;
}
.consent-btn-primary   { background: #2563eb; color: #fff; }
.consent-btn-primary:hover   { background: #1d4ed8; }
.consent-btn-secondary { background: #f1f5f9; color: #0f172a; }
.consent-btn-secondary:hover { background: #e2e8f0; }
.consent-btn-ghost     { flex-basis: 100%; background: transparent; color: #475569; border-color: #e2e8f0; }
.consent-btn-ghost:hover     { background: #f8fafc; }
.consent-btn:focus-visible   { outline: 2px solid #2563eb; outline-offset: 2px; }

.category-row    { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid #f1f5f9; }
.category-row:last-child { border-bottom: none; }
.category-info   { flex: 1; }
.category-label-row { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.category-label  { font-weight: 600; font-size: .9rem; }
.category-badge  { font-size: .7rem; font-weight: 500; padding: .15rem .45rem; border-radius: 6px; background: #dbeafe; color: #1e40af; }
.category-desc   { margin: 0; font-size: .8rem; color: #64748b; line-height: 1.45; }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; margin-top: .15rem; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: background .2s; cursor: pointer; }
.slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: #2563eb; }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { outline: 2px solid #2563eb; outline-offset: 2px; }
.switch.disabled .slider { background: #93c5fd; cursor: not-allowed; }

html.consent-open, html.consent-open body { overflow: hidden; }

@media (max-width: 520px) {
  .consent-dialog {
    position: fixed; inset: auto 0 0 0; margin: 0;
    max-width: 100%; border-radius: 16px 16px 0 0;
    animation: consent-slide-up .25s ease-out;
  }
  @keyframes consent-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .consent-footer { flex-direction: column-reverse; }
  .consent-btn { width: 100%; }
}