/* Compatibility chart (page publique /compatibility/). Couleurs par niveau definies pour les deux themes ;
   chaque niveau porte aussi un symbole, la couleur n'est jamais la seule information. */
:root {
  --cc-surface: rgba(15, 23, 42, .55);
  --cc-input: rgba(9, 17, 29, .7);
  --cc-confirmed-bg: rgba(52, 211, 153, .2);  --cc-confirmed-fg: #6ee7b7; --cc-confirmed-bd: rgba(52, 211, 153, .55);
  --cc-anecdotal-bg: rgba(96, 165, 250, .16); --cc-anecdotal-fg: #93c5fd; --cc-anecdotal-bd: rgba(96, 165, 250, .5);
  --cc-do_not_work-bg: rgba(245, 158, 11, .2); --cc-do_not_work-fg: #fcd34d; --cc-do_not_work-bd: rgba(245, 158, 11, .6);
  --cc-do_not_mix-bg: rgba(244, 63, 94, .24); --cc-do_not_mix-fg: #fda4af; --cc-do_not_mix-bd: rgba(244, 63, 94, .65);
  --cc-none-bg: transparent; --cc-none-fg: #64748b; --cc-none-bd: rgba(148, 163, 184, .18);
  --cc-to_confirm-bg: rgba(167, 139, 250, .14); --cc-to_confirm-fg: #c4b5fd; --cc-to_confirm-bd: rgba(167, 139, 250, .6);
}
html[data-theme=light] {
  --cc-surface: #f8fafc;
  --cc-input: #fff;
  --cc-confirmed-bg: #d1fae5;  --cc-confirmed-fg: #065f46; --cc-confirmed-bd: #34d399;
  --cc-anecdotal-bg: #dbeafe; --cc-anecdotal-fg: #1e3a8a; --cc-anecdotal-bd: #93b4f5;
  --cc-do_not_work-bg: #fef3c7; --cc-do_not_work-fg: #854d0e; --cc-do_not_work-bd: #e6b647;
  --cc-do_not_mix-bg: #fee2e2; --cc-do_not_mix-fg: #991b1b; --cc-do_not_mix-bd: #f87171;
  --cc-none-bg: transparent; --cc-none-fg: #64748b; --cc-none-bd: rgba(51, 65, 85, .16);
  --cc-to_confirm-bg: #f3efff; --cc-to_confirm-fg: #5b21b6; --cc-to_confirm-bd: #a78bfa;
}

.cc-page { min-width: 0; }
.cc-page > * { min-width: 0; }
.cc-head { display: grid; gap: .5rem; }
.cc-head h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.4rem); }
.cc-head p { margin: 0; color: var(--text-muted); line-height: 1.55; max-width: 75ch; }
/* Les deux encarts occupent toute la largeur du cadre ; seul le texte courant reste limite a 75ch. */
.cc-head .cc-disclaimer, .cc-head .cc-source { max-width: none; }
.cc-disclaimer { padding: .7rem .85rem; border: 1px solid var(--cc-do_not_work-bd); border-radius: .7rem; background: var(--cc-do_not_work-bg); color: var(--text); line-height: 1.5; }
.cc-disclaimer strong { color: var(--cc-do_not_work-fg); }
.cc-section { display: grid; gap: .8rem; padding: 1.1rem 1.25rem; min-width: 0; }
.cc-section > header h2 { margin: 0; font-size: 1.1rem; }
.cc-section > header p { margin: .3rem 0 0; color: var(--text-muted); line-height: 1.5; }
.cc-muted { color: var(--text-muted); }
.cc-small { font-size: .85rem; }

/* Champs */
.cc-field { display: grid; gap: .3rem; font-size: .9rem; color: var(--text-soft); min-width: 0; }
.cc-field > span { font-weight: 600; }
.cc-field small { color: var(--text-muted); }
.cc-page input[type=search], .cc-page input[type=text], .cc-page select, .cc-page textarea {
  width: 100%; min-height: 2.6rem; padding: .5rem .75rem; border: 1px solid var(--border); border-radius: .65rem;
  color: var(--text); background: var(--cc-input); font: inherit;
}
.cc-page textarea { min-height: 4.5rem; resize: vertical; }
.cc-page input:focus-visible, .cc-page select:focus-visible, .cc-page textarea:focus-visible, .cc-page button:focus-visible, .cc-cell:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.cc-button { display: inline-flex; align-items: center; gap: .4rem; min-height: 2.5rem; padding: 0 1rem; border: 1px solid var(--border-strong);
  border-radius: .65rem; color: var(--text); background: var(--accent-soft); font: inherit; font-weight: 600; cursor: pointer; }
.cc-button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme=light] .cc-button.primary { background: var(--accent) !important; color: #fff !important; }
.cc-button[disabled] { opacity: .55; cursor: not-allowed; }
.cc-link { border: 0; padding: 0; background: none !important; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* Selecteur de produits */
.cc-picker { position: relative; display: grid; gap: .5rem; min-width: 0; }
.cc-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cc-chips:empty { display: none; }
.cc-chip { display: inline-flex; align-items: center; gap: .35rem; max-width: 100%; padding: .25rem .3rem .25rem .65rem; border: 1px solid var(--border-strong);
  border-radius: 999px; background: var(--accent-soft); font-size: .88rem; overflow-wrap: anywhere; }
.cc-chip button { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; }
.cc-chip button:hover { background: rgba(148, 163, 184, .25); }
.cc-options { position: absolute; z-index: 20; top: 100%; left: 0; right: 0; margin: .25rem 0 0; padding: .3rem; list-style: none; max-height: 16rem; overflow: auto;
  border: 1px solid var(--border-strong); border-radius: .65rem; background: var(--bg); box-shadow: var(--shadow); }
html[data-theme=light] .cc-options { background: #fff; }
.cc-options[hidden] { display: none; }
.cc-options li { padding: .5rem .6rem; border-radius: .5rem; cursor: pointer; overflow-wrap: anywhere; }
.cc-options li[aria-selected=true], .cc-options li:hover { background: var(--accent-soft); }
.cc-options li.cc-empty { cursor: default; color: var(--text-muted); background: none; }

/* Niveaux */
.cc-level { display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .5rem; border: 1px solid var(--cc-none-bd); border-radius: 999px;
  font-size: .8rem; font-weight: 700; white-space: nowrap; color: var(--cc-none-fg); background: var(--cc-none-bg); }
.cc-level .cc-mark, .cc-cell .cc-mark { font-weight: 800; }
[data-level=confirmed] { --lv-bg: var(--cc-confirmed-bg); --lv-fg: var(--cc-confirmed-fg); --lv-bd: var(--cc-confirmed-bd); }
[data-level=anecdotal] { --lv-bg: var(--cc-anecdotal-bg); --lv-fg: var(--cc-anecdotal-fg); --lv-bd: var(--cc-anecdotal-bd); }
[data-level=do_not_work] { --lv-bg: var(--cc-do_not_work-bg); --lv-fg: var(--cc-do_not_work-fg); --lv-bd: var(--cc-do_not_work-bd); }
[data-level=do_not_mix] { --lv-bg: var(--cc-do_not_mix-bg); --lv-fg: var(--cc-do_not_mix-fg); --lv-bd: var(--cc-do_not_mix-bd); }
[data-level=to_confirm] { --lv-bg: var(--cc-to_confirm-bg); --lv-fg: var(--cc-to_confirm-fg); --lv-bd: var(--cc-to_confirm-bd); }
/* « To be confirmed » : bordure pointillee en plus de la couleur et du « ? ». */
.cc-level[data-level=to_confirm], .cc-verdict[data-level=to_confirm], .cc-cell[data-level=to_confirm] { border-style: dashed; }
.cc-cell[data-list=dont_mix] small { color: var(--cc-do_not_mix-fg); }
.cc-cell[data-list=safe] small { color: var(--cc-confirmed-fg); }
.cc-level[data-level]:not([data-level=none]), .cc-verdict[data-level]:not([data-level=none]) { background: var(--lv-bg); color: var(--lv-fg); border-color: var(--lv-bd); }
.cc-legend { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0; padding: 0; list-style: none; }

/* Verdict d'un melange */
.cc-verdict { display: grid; gap: .25rem; padding: .8rem 1rem; border: 1px solid var(--cc-none-bd); border-radius: .8rem; background: var(--cc-surface); }
.cc-verdict strong { font-size: 1.1rem; }
.cc-verdict p { margin: 0; color: var(--text); line-height: 1.5; }
.cc-pairs { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.cc-pairs li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .75rem; padding: .5rem .65rem;
  border: 1px solid var(--border); border-radius: .6rem; background: var(--cc-surface); }
.cc-pairs .cc-names { font-weight: 600; overflow-wrap: anywhere; }
.cc-pairs .cc-counts { color: var(--text-muted); font-size: .85rem; }
.cc-pairs .cc-note { flex-basis: 100%; color: var(--text-soft); font-size: .85rem; }

/* Matrice */
.cc-chart-tools { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; justify-content: space-between; }
.cc-chart-tools .cc-field { flex: 1 1 16rem; max-width: 24rem; }
.cc-matrix-wrap { max-width: 100%; max-height: 75vh; overflow: auto; border: 1px solid var(--border); border-radius: .8rem; background: var(--cc-surface); }
.cc-matrix { border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.cc-matrix th { position: sticky; z-index: 2; background: var(--bg); color: var(--text-soft); font-weight: 600; }
html[data-theme=light] .cc-matrix th { background: #fff; }
.cc-matrix thead th { top: 0; vertical-align: bottom; padding: .4rem .15rem; height: 9rem; }
.cc-matrix thead th span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); max-height: 8.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-matrix thead td { position: sticky; top: 0; left: 0; z-index: 3; background: var(--bg); }
html[data-theme=light] .cc-matrix thead td { background: #fff; }
.cc-matrix tbody th { left: 0; padding: .25rem .6rem; text-align: right; white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); }
.cc-cell { min-width: 2.4rem; height: 2.2rem; padding: 0 .2rem; text-align: center; border: 1px solid var(--cc-none-bd); color: var(--cc-none-fg); cursor: default; white-space: nowrap; }
.cc-cell[data-level] { cursor: pointer; background: var(--lv-bg); color: var(--lv-fg); border-color: var(--lv-bd); }
.cc-cell[data-level]:hover { filter: brightness(1.15); }
.cc-cell.cc-self { background: repeating-linear-gradient(45deg, transparent 0 4px, rgba(148, 163, 184, .12) 4px 8px); }
.cc-cell.is-active { outline: 2px solid var(--text); outline-offset: -2px; }
.cc-cell.is-new { box-shadow: inset 0 0 0 3px var(--accent); animation: cc-pulse 1.4s ease-in-out 3; }
.cc-cell small { margin-left: .15rem; font-weight: 600; }
@keyframes cc-pulse { 50% { box-shadow: inset 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .cc-cell.is-new { animation: none; } }

.cc-details { display: grid; gap: .6rem; padding: .9rem 1rem; border: 1px solid var(--border-strong); border-radius: .8rem; background: var(--cc-surface); }
.cc-details h3 { margin: 0; font-size: 1rem; overflow-wrap: anywhere; }
.cc-details table { border-collapse: collapse; font-size: .88rem; }
.cc-details td { padding: .2rem .8rem .2rem 0; }
.cc-details td:last-child { text-align: right; font-weight: 700; }
.cc-details ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; }

/* Formulaire */
.cc-form { display: grid; gap: .9rem; }
.cc-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .9rem; }
.cc-honeypot { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.cc-actions { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.cc-status { margin: 0; min-height: 1.4em; line-height: 1.5; }
.cc-status.error { color: var(--cc-do_not_mix-fg); }
.cc-status.success { color: var(--cc-confirmed-fg); }
.cc-explain { margin: 0; padding-left: 1.2rem; display: grid; gap: .4rem; line-height: 1.55; color: var(--text-soft); }

@media (max-width: 700px) {
  .cc-section { padding: .9rem; }
  .cc-form-grid { grid-template-columns: minmax(0, 1fr); }
  .cc-matrix tbody th { max-width: 8.5rem; }
  .cc-matrix thead th { height: 7rem; }
  .cc-matrix thead th span { max-height: 6.5rem; }
}

/* Liste partagee et produits never mix */
.cc-source { padding: .75rem .9rem; border: 1px dashed var(--cc-to_confirm-bd); border-radius: .7rem; background: var(--cc-to_confirm-bg); color: var(--text); line-height: 1.55; }
.cc-source strong { color: var(--cc-to_confirm-fg); }
.cc-never { display: grid; gap: .35rem; padding: .7rem .9rem; border: 1px solid var(--cc-do_not_mix-bd); border-radius: .7rem; background: var(--cc-do_not_mix-bg); }
.cc-never[hidden] { display: none; }
.cc-never strong { color: var(--cc-do_not_mix-fg); }
.cc-never ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .2rem; }
.cc-never .cc-names { font-weight: 700; }
