/* ============================================================================
   consent.css — bandeau de consentement auto-hébergé, thémable par variables.
   Aucune requête tierce. À charger dans le <head>.
   ========================================================================== */

.cns-root {
  --cns-bg: #14161a;
  --cns-fg: #e8e6e1;
  --cns-muted: #a9aeb8;
  --cns-accent: #f4efe5;
  --cns-accent-fg: #14161a;
  --cns-line: #2e323d;
  --cns-radius: 12px;
  --cns-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --cns-max: 460px;
  --cns-panel-max: 660px;
  --cns-shadow: 0 18px 50px rgba(0, 0, 0, .55);
  --cns-gap: 10px;
  font-family: var(--cns-font);
}

/* ---------- bandeau ---------- */
.cns-banner {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 2147483000;
  width: min(var(--cns-max), calc(100vw - 40px));
  box-sizing: border-box;
  background: var(--cns-bg);
  color: var(--cns-fg);
  border: 1px solid var(--cns-line);
  border-radius: var(--cns-radius);
  box-shadow: var(--cns-shadow);
  padding: 20px 20px 18px;
  font-size: 14px;
  line-height: 1.5;
}
.cns-banner[hidden] { display: none !important; }

.cns-banner h2 {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--cns-accent);
}
.cns-banner p { margin: 0 0 10px; color: var(--cns-muted); }
.cns-banner p:last-of-type { margin-bottom: 14px; }
.cns-banner a { color: var(--cns-accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- boutons : accepter et refuser de même poids ---------- */
.cns-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--cns-gap);
  margin-top: 4px;
}
.cns-btn {
  appearance: none;
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid var(--cns-line);
  background: transparent;
  color: var(--cns-fg);
  cursor: pointer;
  text-align: center;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.cns-btn:hover { border-color: var(--cns-accent); }
.cns-btn:focus-visible { outline: 2px solid var(--cns-accent); outline-offset: 2px; }
.cns-btn--primary {
  background: var(--cns-accent);
  border-color: var(--cns-accent);
  color: var(--cns-accent-fg);
}
.cns-btn--primary:hover { background: #fff; }
.cns-btn--link {
  grid-column: 1 / -1;
  border: 0;
  background: none;
  color: var(--cns-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 6px 2px 0;
  font-weight: 500;
  font-size: 13px;
}
.cns-btn--link:hover { color: var(--cns-accent); }

/* ---------- panneau de préférences ---------- */
.cns-prefs {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: grid;
  place-items: center;
  background: rgba(6, 7, 9, .72);
  padding: 20px;
}
.cns-prefs[hidden] { display: none !important; }

.cns-panel {
  width: min(var(--cns-panel-max), 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  background: var(--cns-bg);
  color: var(--cns-fg);
  border: 1px solid var(--cns-line);
  border-radius: var(--cns-radius);
  box-shadow: var(--cns-shadow);
  padding: 24px;
  box-sizing: border-box;
}
.cns-panel h2 { margin: 0 0 6px; font-size: 17px; color: var(--cns-accent); }
.cns-panel > p { margin: 0 0 18px; color: var(--cns-muted); font-size: 13.5px; }

.cns-cat {
  border: 1px solid var(--cns-line);
  border-radius: 10px;
  padding: 13px 14px;
  margin-bottom: 10px;
}
.cns-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.cns-cat-name { font-weight: 600; font-size: 14px; }
.cns-cat-desc { margin: 6px 0 0; color: var(--cns-muted); font-size: 12.8px; line-height: 1.45; }

/* interrupteur sobre, état lisible au clavier */
.cns-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
}
.cns-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.cns-switch span {
  position: absolute;
  inset: 0;
  pointer-events: none;   /* sinon la piste visuelle avale le clic destiné à l'input */
  border-radius: 999px;
  background: #2a2f38;
  border: 1px solid var(--cns-line);
  transition: background-color .18s ease;
}
.cns-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--cns-muted);
  transition: transform .18s ease, background-color .18s ease;
}
.cns-switch input:checked + span { background: var(--cns-accent); border-color: var(--cns-accent); }
.cns-switch input:checked + span::after { transform: translateX(20px); background: var(--cns-accent-fg); }
.cns-switch input:focus-visible + span { outline: 2px solid var(--cns-accent); outline-offset: 2px; }
.cns-switch input:disabled + span { opacity: .55; cursor: not-allowed; }

.cns-panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--cns-gap);
  margin-top: 18px;
}
.cns-panel-actions .cns-btn { font-size: 13px; padding: 10px 8px; }


/* ---------- onglets ---------- */
.cns-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--cns-line);
  margin: 4px 0 16px;
}
.cns-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--cns-muted);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 10px 12px;
  cursor: pointer;
  margin-bottom: -1px;
}
.cns-tab:hover { color: var(--cns-fg); }
.cns-tab.is-on { color: var(--cns-accent); border-bottom-color: var(--cns-accent); }
.cns-tab:focus-visible { outline: 2px solid var(--cns-accent); outline-offset: -2px; }

.cns-pane[hidden] { display: none !important; }

/* ---------- tableau des témoins ---------- */
.cns-details { margin-top: 10px; border-top: 1px solid var(--cns-line); padding-top: 8px; }
.cns-details summary {
  cursor: pointer;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cns-muted);
  list-style: none;
  padding: 4px 0;
}
.cns-details summary::-webkit-details-marker { display: none; }
.cns-details summary::after { content: " ▾"; }
.cns-details[open] summary::after { content: " ▴"; }
.cns-details summary:hover { color: var(--cns-accent); }
.cns-details summary:focus-visible { outline: 2px solid var(--cns-accent); outline-offset: 2px; }

.cns-tablewrap { margin-top: 8px; overflow-x: auto; }
.cns-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  border: 1px solid var(--cns-line);
  border-radius: 8px;
  font-size: 12.2px;
  line-height: 1.45;
}
.cns-table th {
  text-align: left;
  font-weight: 600;
  color: var(--cns-accent);
  background: rgba(255, 255, 255, .03);
  padding: 8px 9px;
  border-bottom: 1px solid var(--cns-line);
  white-space: nowrap;
}
.cns-table td {
  padding: 8px 9px;
  border-bottom: 1px solid var(--cns-line);
  color: var(--cns-muted);
  vertical-align: top;
}
.cns-table th:nth-child(1), .cns-table td:nth-child(1) { width: 27%; }
.cns-table th:nth-child(2), .cns-table td:nth-child(2) { width: 20%; }
.cns-table th:nth-child(3), .cns-table td:nth-child(3) { width: 13%; }
.cns-table th:nth-child(4), .cns-table td:nth-child(4) { width: 42%; }
.cns-table td:nth-child(1) code { word-break: normal; overflow-wrap: anywhere; }
.cns-table tr:last-child td { border-bottom: 0; }
.cns-table code { color: var(--cns-fg); font-size: 11.5px; }
.cns-host { display: block; opacity: .7; font-size: 11.5px; }

/* ---------- divers ---------- */
.cns-req {
  display: inline-block;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--cns-accent);
  border: 1px solid var(--cns-line);
  border-radius: 999px;
  padding: 2px 8px;
  margin: 6px 0 0 !important;
}
.cns-contact { margin-top: 14px !important; }
.cns-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 560px) {
  .cns-table thead { display: none; }
  .cns-table, .cns-table tbody, .cns-table tr, .cns-table td { display: block; width: 100%; }
  .cns-table tr {
    border-bottom: 1px solid var(--cns-line);
    padding: 8px 0;
  }
  .cns-table tr:last-child { border-bottom: 0; }
  .cns-table td { border: 0; padding: 3px 9px; }
  .cns-table td::before {
    content: attr(data-l) " : ";
    color: var(--cns-accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
}

/* ---------- lien permanent de retrait ---------- */
.cns-manage {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  opacity: .8;
  cursor: pointer;
  text-decoration: none;
  border-bottom: 1px solid rgba(244, 239, 229, .3);
}
.cns-manage:hover { opacity: 1; border-bottom-color: currentColor; }

/* ---------- mobile ---------- */
@media (max-width: 560px) {
  .cns-banner {
    left: 0; right: 0; bottom: 0;
    width: 100%;
    border-radius: var(--cns-radius) var(--cns-radius) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding: 18px 16px 16px;
  }
  .cns-actions { grid-template-columns: 1fr; }
  .cns-panel-actions { grid-template-columns: 1fr; }
  .cns-panel { max-height: 92vh; }
}

@media (prefers-reduced-motion: reduce) {
  .cns-btn, .cns-switch span, .cns-switch span::after { transition: none; }
}
