/* Panel d'administration Mesturo */
:root {
  --p-bg: #f3f5f8;
  --p-side: #141c27;
  --p-side-2: #1d2734;
  --p-ink: #1b2430;
  --p-mute: #6b7684;
  --p-line: #dfe4ea;
  --p-card: #fff;
  --p-tag: #ffd23f;
  --p-ok: #1f6f4a;
  --p-ok-soft: #e3f1e9;
  --p-ko: #c8372d;
  --p-ko-soft: #fbe7e5;
  --p-info: #2563a8;
  --p-info-soft: #e5eef8;
  --p-warn-soft: #fff4d1;
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --sans: 'Barlow', system-ui, sans-serif;
}
* { box-sizing: border-box; }
body.panel { margin: 0; font-family: var(--sans); color: var(--p-ink); background: var(--p-bg); font-size: 15px; line-height: 1.45; }
a { color: var(--p-info); }
:focus-visible { outline: 3px solid var(--p-info); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--cond); font-weight: 700; line-height: 1.1; margin: 0 0 .5em; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }

.p-shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.p-side { background: var(--p-side); color: #c8d0da; padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.p-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-family: var(--cond); font-weight: 800; font-size: 22px; padding: 0 8px; }
.p-brand svg { width: 30px; height: 30px; }
.p-brand small { font-family: var(--sans); font-weight: 600; font-size: 11px; background: var(--p-tag); color: var(--p-ink); padding: 2px 7px; border-radius: 999px; }
.p-nav { display: grid; gap: 2px; }
.p-nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #c8d0da; text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.p-nav a:hover { background: var(--p-side-2); color: #fff; }
.p-nav a[aria-current="page"] { background: var(--p-side-2); color: #fff; box-shadow: inset 3px 0 0 var(--p-tag); }
.p-count { background: var(--p-tag); color: var(--p-ink); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.p-side-foot { margin-top: auto; font-size: 13px; padding: 0 8px; display: grid; gap: 8px; }
.p-side-foot a, .p-side-foot button { color: #9aa6b4; background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; text-decoration: none; }
.p-side-foot a:hover, .p-side-foot button:hover { color: #fff; }

.p-main { padding: 26px 32px 60px; min-width: 0; }
.p-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.p-top p { margin: 0; color: var(--p-mute); }
.p-card { background: var(--p-card); border: 1px solid var(--p-line); border-radius: 12px; padding: 18px 20px; }
.p-card + .p-card { margin-top: 16px; }
.p-grid { display: grid; gap: 16px; }
.p-g2 { grid-template-columns: 1fr 1fr; }
.p-g3 { grid-template-columns: 2fr 1fr; }
.p-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.p-kpi { background: var(--p-card); border: 1px solid var(--p-line); border-radius: 12px; padding: 14px 16px; text-decoration: none; color: var(--p-ink); }
a.p-kpi:hover { border-color: var(--p-ink); }
.p-kpi .v { font-family: var(--cond); font-weight: 800; font-size: 32px; line-height: 1.05; display: block; }
.p-kpi .l { color: var(--p-mute); font-size: 13px; }
.p-kpi.alerte { border-color: var(--p-tag); background: #fffbe8; }

.p-flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 10px; border-left: 4px solid; }
.p-flash-ok { background: var(--p-ok-soft); border-color: var(--p-ok); }
.p-flash-erreur { background: var(--p-ko-soft); border-color: var(--p-ko); }
.p-flash-info { background: var(--p-info-soft); border-color: var(--p-info); }

.p-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--p-ink); background: var(--p-ink); color: #fff; padding: 8px 14px; border-radius: 8px; font: 600 14px var(--sans); cursor: pointer; text-decoration: none; white-space: nowrap; }
.p-btn:hover { background: #33404f; color: #fff; }
.p-btn.ghost { background: #fff; color: var(--p-ink); border-color: var(--p-line); }
.p-btn.ghost:hover { border-color: var(--p-ink); }
.p-btn.ok { background: var(--p-ok); border-color: var(--p-ok); }
.p-btn.ko { background: #fff; color: var(--p-ko); border-color: #e9b6b1; }
.p-btn.ko:hover { background: var(--p-ko-soft); }
.p-btn.sm { padding: 5px 10px; font-size: 13px; }
.p-link { background: none; border: 0; padding: 0; font: inherit; color: var(--p-info); cursor: pointer; text-decoration: underline; }
.p-link.ko { color: var(--p-ko); }
form.inline { display: inline; }

.p-filtres { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=color], select, textarea {
  border: 1px solid var(--p-line); border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; color: var(--p-ink);
}
input[type=color] { padding: 2px; width: 44px; height: 36px; }
textarea { width: 100%; min-height: 70px; }
label { font-weight: 600; font-size: 13px; display: block; margin-bottom: 4px; }

.p-table-wrap { overflow-x: auto; }
table.p-table { width: 100%; border-collapse: collapse; }
.p-table th { text-align: left; font-size: 12px; color: var(--p-mute); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--p-line); white-space: nowrap; }
.p-table td { padding: 10px; border-bottom: 1px solid var(--p-line); vertical-align: middle; }
.p-table tr:hover td { background: #fafbfc; }
.p-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-table .sub { display: block; color: var(--p-mute); font-size: 12.5px; }
.p-pag { display: flex; gap: 6px; margin-top: 14px; align-items: center; }

.p-badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef1f4; color: #3a4655; white-space: nowrap; }
.p-badge.ok { background: var(--p-ok-soft); color: var(--p-ok); }
.p-badge.ko { background: var(--p-ko-soft); color: var(--p-ko); }
.p-badge.warn { background: var(--p-warn-soft); color: #8a6400; }
.p-badge.info { background: var(--p-info-soft); color: var(--p-info); }
.p-badge.dark { background: var(--p-ink); color: #fff; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

.p-jauge { position: relative; height: 8px; width: 110px; background: #eef1f4; border-radius: 4px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.p-jauge span { display: block; height: 100%; border-radius: 4px; background: #e8b400; }
.p-jauge.ok span { background: #2f9a68; }
.p-jauge i { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--p-ink); }

.p-chart { width: 100%; height: auto; display: block; }
.p-chart .ax { font: 11px var(--sans); fill: var(--p-mute); }
.p-legend { display: flex; gap: 14px; font-size: 13px; color: var(--p-mute); margin-top: 6px; }
.p-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.p-barlist { list-style: none; padding: 0; margin: 0; }
.p-barlist li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 7px 0; font-size: 14px; }
.p-barlist .b { grid-column: 1 / -1; height: 6px; background: #eef1f4; border-radius: 3px; overflow: hidden; }
.p-barlist .b span { display: block; height: 100%; background: var(--p-ink); border-radius: 3px; }
.p-feed { list-style: none; margin: 0; padding: 0; }
.p-feed li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--p-line); align-items: center; font-size: 14px; }
.p-feed li:last-child { border-bottom: 0; }
.p-feed .ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.ic-inscription { background: var(--p-info-soft); color: var(--p-info); }
.ic-facture { background: var(--p-warn-soft); color: #8a6400; }
.ic-message { background: #efe7fb; color: #5b3a96; }
.p-feed time { color: var(--p-mute); font-size: 12.5px; white-space: nowrap; }

.p-dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 14px; margin: 0; }
.p-dl dt { color: var(--p-mute); font-size: 13px; }
.p-dl dd { margin: 0; }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.p-apercu { width: 100%; height: 640px; border: 1px solid var(--p-line); border-radius: 10px; background: #fff; }
.p-apercu-img { max-width: 100%; border: 1px solid var(--p-line); border-radius: 10px; }
.p-reglage { display: grid; grid-template-columns: 1fr 140px; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--p-line); }
.p-reglage:last-child { border-bottom: 0; }
.p-reglage .lab { font-weight: 500; }
.p-reglage input[type=number] { width: 100%; }
.switch { position: relative; width: 46px; height: 26px; display: inline-block; justify-self: end; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfd6df; border-radius: 13px; transition: background .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .2s; }
.switch input:checked + span { background: var(--p-ok); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid var(--p-info); outline-offset: 2px; }
.p-inline-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.p-msg { white-space: pre-wrap; }

.p-login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(800px 500px at 20% 0%, #2c3d53, var(--p-side)); padding: 20px; }
.p-login-box { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 400px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.5); }
.p-login-box input { width: 100%; margin-bottom: 14px; }
.p-login-box .p-btn { width: 100%; justify-content: center; padding: 11px; }

.p-menu-toggle { display: none; }
@media (max-width: 960px) {
  .p-shell { grid-template-columns: 1fr; }
  .p-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 10px; }
  .p-nav { display: flex; flex-wrap: wrap; width: 100%; }
  .p-side-foot { margin: 0; display: flex; gap: 14px; }
  .p-main { padding: 18px 16px 50px; }
  .p-g2, .p-g3 { grid-template-columns: 1fr; }
  .p-dl { grid-template-columns: 1fr; }
}
.p-grid > .p-card + .p-card { margin-top: 0; }
.p-grid { align-items: start; }

/* Doublons et fusion */
.doublon { margin-bottom: 16px; }
.doublon-tete { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.doublon tr.garde td { background: #f0faf4; }
.doublon tr.exclu td { opacity: .45; }
.doublon input[type=checkbox], .doublon input[type=radio], [data-fusion-liste] input[type=checkbox], [data-fusion-liste] input[type=radio] { width: 18px; height: 18px; accent-color: var(--p-ok); cursor: pointer; }
.doublon-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--p-line); }
.barre-fusion { position: sticky; bottom: 12px; margin-top: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--p-side); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5); animation: monte .2s ease; }
.barre-fusion input[type=text] { flex: 1; min-width: 220px; }
@keyframes monte { from { transform: translateY(10px); opacity: 0; } }
[data-fusion-liste] tr.coche td { background: #f0faf4; }
.p-btn[disabled] { opacity: .5; cursor: not-allowed; }
[hidden] { display: none !important; }

/* Doublons : une question à la fois */
.dbl-progres { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--p-mute); margin-bottom: 12px; }
.dbl-score { font-weight: 600; color: var(--p-ink); }
.dbl { background: #fff; border: 1px solid var(--p-line); border-radius: 16px; padding: 24px; }
.dbl-question { font-family: var(--cond); font-weight: 800; font-size: 30px; text-align: center; margin: 0 0 18px; }
.dbl-duo { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: stretch; }
.dbl-vs { align-self: center; font-family: var(--cond); font-weight: 800; font-size: 34px; color: var(--p-mute); }
.dbl-carte { border: 2px solid var(--p-line); border-radius: 14px; padding: 18px; background: #fafbfc; animation: dblin .25s ease both; }
.dbl-carte:last-child { animation-delay: .05s; }
@keyframes dblin { from { opacity: 0; transform: translateY(6px); } }
.dbl-carte h2 { font-size: 26px; margin: 4px 0 12px; }
.dbl-rayon { font-size: 13px; color: var(--p-mute); }
.dbl-carte dl { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; margin: 0 0 12px; font-size: 14px; }
.dbl-carte dt { color: var(--p-mute); }
.dbl-carte dd { margin: 0; font-weight: 500; }
.dbl-lib { font-size: 13px; color: var(--p-mute); font-weight: 400 !important; }
.dbl-voir { font-size: 13px; }
.dbl-choix { display: grid; gap: 12px; margin-top: 20px; }
.dbl-oui { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; background: #f0faf4; border-radius: 12px; padding: 14px; }
.dbl-oui span { font-weight: 600; }
.dbl-oui .p-btn { padding: 11px 16px; font-size: 15px; max-width: 100%; white-space: normal; text-align: left; }
.dbl-non { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dbl-aide { text-align: center; color: var(--p-mute); font-size: 13px; margin: 16px 0 0; }
.dbl-aide kbd { border: 1px solid var(--p-line); border-radius: 4px; padding: 0 5px; font: 600 12px var(--sans); background: #fff; }
.dbl-fini { text-align: center; padding: 40px 20px; }
.proche { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--p-line); }
.proche .sub { display: block; color: var(--p-mute); font-size: 12.5px; }
@media (max-width: 760px) { .dbl-duo { grid-template-columns: 1fr; } .dbl-vs { justify-self: center; } }

/* Étiquettes de profil */
.p-etiq { --c: #2563a8; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font: 600 13px var(--sans);
  background: color-mix(in srgb, var(--c) 13%, #fff); color: color-mix(in srgb, var(--c) 82%, #000); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); white-space: nowrap; }
.p-etiq.petit { font-size: 11.5px; padding: 1px 8px; }
.p-etiq small { font-weight: 500; opacity: .7; }
.p-etiq.retirable { cursor: pointer; }
.p-etiq.retirable span { font-size: 15px; line-height: 1; opacity: .5; }
.p-etiq.retirable:hover { border-color: var(--p-ko); }
.p-etiq.retirable:hover span { opacity: 1; color: var(--p-ko); }
.etiq-membre { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.etiq-membre > strong { margin-right: 6px; }
.etiq-ajout { margin-left: auto; }
.etiq-ligne { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--p-line); flex-wrap: wrap; }
