/* Minimal, accessible CMP */
#cmp-banner, #cmp-settings {
  position: fixed; inset: auto 0 0 0; z-index: 99999; font-family: system-ui, sans-serif;
  color: #111; background: #fff; border-top: 1px solid #ddd; box-shadow: 0 -4px 16px rgba(0,0,0,.15);
}
#cmp-banner { padding: 14px 16px; }
#cmp-banner .cmp-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
#cmp-banner .cmp-copy { flex: 1 1 420px; font-size: 14px; line-height: 1.5; }
#cmp-banner .cmp-actions { display: flex; gap: 8px; flex: 0 0 auto; }
#cmp-banner .btn {
  appearance: none; padding: 10px 14px; border-radius: 8px; font-size: 14px; line-height: 1; cursor: pointer;
  border: 1px solid #222; background: #fff; color: #111; min-width: 120px; text-align: center;
}
#cmp-banner .btn.primary { background: #111; color: #fff; border-color: #111; }
#cmp-banner .btn:focus, #cmp-settings .btn:focus { outline: 2px solid #2684ff; outline-offset: 2px; }

#cmp-settings {
  inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center;
}
#cmp-settings .panel {
  width: min(680px, 92vw); max-height: 82vh; overflow: auto; background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
#cmp-settings h2 { margin: 0 0 6px; font-size: 18px; }
#cmp-settings p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; color: #333; }
#cmp-settings .row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-top: 1px solid #eee; }
#cmp-settings .row:first-of-type { border-top: 0; }
#cmp-settings label { font-weight: 600; }
#cmp-settings .hint { font-weight: 400; color: #555; }
/* CMP switch — single source of truth */
#cmp-settings .switch{
  position: relative;
  width: 52px;
  height: 28px;
  overflow: hidden;             /* keep knob inside pill */
  box-sizing: border-box;
}
#cmp-settings .switch input{
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;                   /* invisible but clickable */
  cursor: pointer;
  z-index: 2;
}
#cmp-settings .switch .slider{
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #3a3f4b;
  transition: background .2s ease;
}
#cmp-settings .switch .slider::after{
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transition: transform .2s ease;
}
#cmp-settings .switch input:checked + .slider{ background: #3774ff; }
#cmp-settings .switch input:checked + .slider::after{ transform: translateX(24px); }
/* disabled look */
#cmp-settings .switch[aria-disabled="true"] .slider{ opacity:.5; cursor:not-allowed; }

#cmp-settings .panel .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
#cmp-settings .btn { appearance: none; padding: 10px 14px; border-radius: 8px; font-size: 14px; border: 1px solid #222; background: #fff; color: #111; cursor: pointer; }
#cmp-settings .btn.primary { background: #111; color: #fff; border-color: #111; }

/* Persistent “Change settings” link (small, non-sticky layout) */
#cmp-change-link {
  position: fixed; right: 12px; bottom: 12px; z-index: 99998; font: 12px system-ui; background: #000; color: #fff;
  padding: 8px 10px; border-radius: 999px; text-decoration: none; opacity: .82;
}
#cmp-change-link:focus { outline: 2px solid #2684ff; outline-offset: 2px; }

/* CMP switch — make input cover the pill so clicks register */
#cmp-settings .switch {
  position: relative;
  width: 52px;
  height: 28px;
}
#cmp-settings .switch input {
  position: absolute;
  inset: 0;          /* stretch to fill */
  margin: 0;
  opacity: 0;        /* invisible but clickable */
  cursor: pointer;
  z-index: 2;        /* above the slider */
}
#cmp-settings .switch .slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #3a3f4b;
  transition: background .2s ease;
}
#cmp-settings .switch .slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s ease;
}

/* visual ON state */
#cmp-settings .switch input:checked + .slider {
  background: #3774ff;
}
#cmp-settings .switch input:checked + .slider::after {
  transform: translateX(24px);
}

/* disabled look for the “Functional (required)” switch */
#cmp-settings .switch[aria-disabled="true"] .slider {
  opacity: .5;
  cursor: not-allowed;
}

/* Banner: fixed white bar across bottom */
#cmp-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 999999; /* above overlays */
  background: #fff;
  color: #111;
  border-top: 1px solid rgba(0,0,0,.1);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}
#cmp-banner .cmp-row {
  max-width: 1200px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
}
#cmp-banner .cmp-copy a, 
#cmp-banner .cmp-copy button { color: #0a66c2; text-decoration: underline; }
#cmp-banner .cmp-actions { display: flex; gap: 10px; }
#cmp-banner .btn { padding: 8px 14px; border-radius: 8px; border: 1px solid #ccc; background:#f6f6f6; }
#cmp-banner .btn.primary { border-color: #0a66c2; background:#0a66c2; color:#fff; }

/* Settings modal */
#cmp-settings { 
  display: none; /* default closed */
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000000; /* above banner */
  align-items: center; justify-content: center;
}
#cmp-settings .panel {
  background: #fff; color: #111;
  width: min(640px, 92vw); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 18px;
}
#cmp-settings .actions { display:flex; justify-content:flex-end; gap:12px; margin-top: 14px; }
#cmp-settings .btn { padding: 8px 14px; border-radius: 8px; border: 1px solid #ccc; background:#f6f6f6; }
#cmp-settings .btn.primary { border-color:#0a66c2; background:#0a66c2; color:#fff; }

/* Optional: save room so the bar never overlaps bottom clicks */
html:has(#cmp-banner) body { padding-bottom: 64px; }
@supports not selector(:has(*)) {
  /* fallback: keep your pages usable if older browser */
  body[data-cmp-banner="on"] { padding-bottom: 64px; }
}
