/* Administration du salon : charte des outils Experientiel (fond clair, Open Sans, l'or comme accent),
   reprise de l'éditeur Lieudit et de Balisia. La barre de navigation est le composant <xp-barre>. */

@font-face { font-family: 'Open Sans'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('/polices/OpenSans.woff2') format('woff2'); }

:root {
  --surface-100: #FFFFFF; --surface-200: #F4F2EE; --surface-300: #E7E3DB;
  --ink-900: #191715; --ink-600: #5B564F; --ink-400: #8B857A;
  --or: #f3bb44; --or-encre: #5C4400; --or-fond: #fdf6e3;
  --info: #3E6FA6; --succes: #3F7D4A; --alerte: #B8720F; --danger: #A63328; --danger-fond: #fbeeec;
  --font-sans: 'Open Sans', -apple-system, 'Segoe UI', sans-serif;
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px;
  --ombre: 0 2px 10px rgba(25, 23, 21, .08); --ombre-flottant: 0 8px 28px rgba(25, 23, 21, .14);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--surface-200); color: var(--ink-900); font-family: var(--font-sans); font-size: 15px; line-height: 22px; }
xp-barre:not(:defined) { display: block; min-height: 97px; background: #fff; border-bottom: 1px solid #E7E3DB; }
h1 { font-size: 26px; line-height: 32px; font-weight: 700; margin: 0 0 6px; }
h2 { font-size: 19px; line-height: 26px; font-weight: 700; margin: 28px 0 10px; }
h3 { font-size: 15px; line-height: 22px; font-weight: 600; margin: 18px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--info); }
:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
.sourdine { color: var(--ink-600); }
.pale { color: var(--ink-400); }
.petit { font-size: 13px; line-height: 18px; }
.etiquette { font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--ink-400); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- page ---------- */
.page { max-width: 1000px; margin: 0 auto; padding: 28px 20px 110px; }
.page-etroite { max-width: 720px; }
.chapeau { color: var(--ink-600); max-width: 70ch; margin-bottom: 20px; }
.section[hidden] { display: none !important; }

/* ---------- cartes ---------- */
.carte { background: var(--surface-100); border: 1px solid var(--surface-300); border-radius: var(--r-lg); box-shadow: var(--ombre); margin: 0 0 14px; }
.carte > .corps, .carte > .tete + .corps { padding: 16px 18px 18px; }
.carte > .tete, .carte > summary { display: flex; align-items: center; gap: 10px; padding: 14px 18px; font-weight: 600; list-style: none; cursor: pointer; }
.carte > summary::-webkit-details-marker { display: none; }
.carte > summary::before { content: '▸'; color: var(--ink-400); width: 1em; transition: transform .12s; }
.carte[open] > summary::before { transform: rotate(90deg); }
.carte[open] > summary { border-bottom: 1px solid var(--surface-300); }
.carte > .tete { cursor: default; border-bottom: 1px solid var(--surface-300); }
.tete .espace { flex: 1; }
.corps { padding: 16px 18px 18px; }
.carte-plate { background: transparent; box-shadow: none; border: 0; }
.grille { display: grid; gap: 14px; }
.grille-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grille-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* ---------- formulaires ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; color: var(--ink-900); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid #CFC9BD; border-radius: var(--r-md); background: #fff;
  font: inherit; color: inherit; min-height: 40px;
}
textarea { min-height: 72px; resize: vertical; line-height: 22px; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--or); outline-offset: 0; border-color: var(--or-encre); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--or-encre); flex: none; }
.aide { font-size: 13px; color: var(--ink-600); margin: 4px 0 8px; }
.rangee { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.rangee > * { flex: 1 1 200px; min-width: 0; }
.rangee > .fixe { flex: 0 0 auto; }
.ligne { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.ligne input[type=text] { flex: 1; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset:disabled { opacity: .6; }
fieldset:disabled .bouton, fieldset:disabled .bouton-icone { cursor: not-allowed; }

/* ---------- boutons ---------- */
.bouton, .bouton-icone {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 14px;
  border: 1px solid #CFC9BD; border-radius: var(--r-md); background: #fff; color: var(--ink-900);
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
}
.bouton:hover, .bouton-icone:hover { background: var(--surface-200); }
.bouton-principal { background: var(--or); border-color: var(--or); color: var(--or-encre); }
.bouton-principal:hover { background: #e9ae2a; }
.bouton-danger { color: var(--danger); border-color: #E3B5B0; }
.bouton-danger:hover { background: var(--danger-fond); }
.bouton[disabled], .bouton-icone[disabled] { opacity: .45; cursor: not-allowed; }
.bouton-icone { min-width: 40px; padding: 0 10px; font-weight: 500; }
.ajouter { border: 1px dashed #B8B2A4; background: transparent; border-radius: var(--r-md); min-height: 40px; padding: 0 14px; font: inherit; font-weight: 600; color: var(--ink-600); cursor: pointer; margin-top: 8px; }
.ajouter:hover { background: var(--surface-100); color: var(--ink-900); }
.lien-discret { background: none; border: 0; color: var(--info); font: inherit; cursor: pointer; padding: 4px 0; text-decoration: underline; }

/* ---------- puces, badges ---------- */
.puces { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.puces label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: 13px; border: 1px solid var(--surface-300); background: #fff; padding: 6px 10px; border-radius: 999px; cursor: pointer; }
.puces label.actif { border-color: var(--or-encre); background: var(--or-fond); }
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--surface-200); color: var(--ink-600); }
.badge-or { background: var(--or-fond); color: var(--or-encre); }
.badge-ok { background: #e6f2e8; color: var(--succes); }
.badge-alerte { background: #fdf0dc; color: var(--alerte); }
.badge-danger { background: var(--danger-fond); color: var(--danger); }

/* ---------- messages ---------- */
.bandeau { border: 1px solid var(--surface-300); border-left: 4px solid var(--or); background: var(--or-fond); border-radius: var(--r-md); padding: 10px 14px; margin: 0 0 16px; font-size: 14px; }
.bandeau-danger { border-left-color: var(--danger); background: var(--danger-fond); }
.bandeau-info { border-left-color: var(--info); background: #edf3fa; }
.message { min-height: 22px; font-size: 14px; color: var(--danger); margin: 0 0 10px; }
.message.ok { color: var(--succes); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 3000; max-width: min(92vw, 560px); padding: 12px 18px; border-radius: var(--r-md); background: var(--ink-900); color: #fff; font-weight: 600; box-shadow: var(--ombre-flottant); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--succes); }

/* ---------- connexion ---------- */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.bloc-connexion { width: min(100%, 400px); background: #fff; border: 1px solid var(--surface-300); border-radius: var(--r-lg); box-shadow: var(--ombre); padding: 28px 26px; }
.bloc-connexion .titre { font-size: 17px; font-weight: 700; margin: 14px 0 4px; }
.bloc-connexion .bouton { width: 100%; margin-top: 18px; }

/* ---------- tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; }
.tableau th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-400); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--surface-300); }
.tableau td { padding: 10px; border-bottom: 1px solid var(--surface-200); vertical-align: middle; }
.tableau tr:last-child td { border-bottom: 0; }
.defile { overflow-x: auto; }

/* ---------- éditeurs : questions, domaines, défis ---------- */
.effet { margin-top: 14px; border: 1px solid var(--surface-300); background: var(--surface-200); border-radius: var(--r-md); padding: 10px 12px; font-size: 13px; }
.effet .t { display: block; font-weight: 700; margin-bottom: 6px; }
.effet .aucun { color: var(--danger); }
.effet-ligne { display: grid; grid-template-columns: minmax(110px, 190px) 1fr 38px; align-items: center; gap: 10px; margin: 4px 0; }
.effet-ligne .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.piste { height: 10px; background: #E1DCCF; border-radius: 5px; overflow: hidden; }
.piste > i { display: block; height: 100%; border-radius: 5px; }
.effet-ligne .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.grille-poids { display: grid; grid-template-columns: 1fr 72px; gap: 6px 14px; align-items: center; max-width: 520px; }
.grille-poids input { min-height: 34px; padding: 5px 8px; }
.apercu-domaine { border: 2px solid var(--ink-900); border-radius: var(--r-md); padding: 14px 16px; margin: 10px 0 4px; color: var(--ink-900); }
.vignette { width: 160px; height: 120px; object-fit: cover; border: 1px solid var(--surface-300); border-radius: var(--r-md); background: var(--surface-200); display: block; }
.vignette-vide { display: grid; place-items: center; color: var(--ink-400); font-size: 13px; }
.choix-image { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-start; margin-top: 8px; }
.bibliotheque { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-top: 14px; }
.bibliotheque figure { margin: 0; }
.bibliotheque figcaption { font-size: 12px; color: var(--ink-600); word-break: break-all; margin: 4px 0 6px; }

/* simulateur */
.simu-rapide { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.simu-q { border-bottom: 1px solid var(--surface-200); padding: 12px 0; }
.simu-q:last-child { border-bottom: 0; }
.simu-texte { font-weight: 600; margin-bottom: 8px; }
.simu-echelle { display: flex; flex-wrap: wrap; gap: 6px; }
.simu-echelle button { min-height: 36px; padding: 0 12px; border: 1px solid #CFC9BD; border-radius: 999px; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.simu-echelle button.actif { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.simu-resultat { position: sticky; top: calc(var(--barre-h, 0px) + 8px); z-index: 5; background: #fff; border: 2px solid var(--ink-900); border-radius: var(--r-lg); padding: 14px 16px; margin: 0 0 18px; box-shadow: var(--ombre); }
.rang { display: grid; grid-template-columns: 1.4em minmax(110px, 190px) 1fr 44px; align-items: center; gap: 10px; margin: 5px 0; }
.rang:first-of-type { font-weight: 700; }
.rang .pc { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.simu-arche { margin-top: 8px; font-style: italic; color: var(--ink-600); }

/* statistiques */
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.chiffre { background: #fff; border: 1px solid var(--surface-300); border-radius: var(--r-lg); padding: 14px 16px; box-shadow: var(--ombre); }
.chiffre .val { font-size: 30px; line-height: 36px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chiffre .lib { font-size: 13px; color: var(--ink-600); }
.histo { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.histo .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; min-width: 0; }
.histo .col i { display: block; width: 100%; background: var(--or); border-radius: 3px 3px 0 0; min-height: 1px; }
.histo .col span { font-size: 10px; color: var(--ink-400); margin-top: 3px; }
.barres .ligne-barre { display: grid; grid-template-columns: minmax(120px, 260px) 1fr 54px; gap: 10px; align-items: center; margin: 6px 0; font-size: 14px; }
.barres .ligne-barre .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barres .ligne-barre .v { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

/* cartes de projet */
.carte-projet { display: flex; flex-direction: column; gap: 10px; border-top: 5px solid var(--accent, var(--or)); }
.carte-projet h2 { margin: 0; font-size: 20px; }
.carte-projet .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }

/* boîte de dialogue : liens publics et QR codes */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; box-shadow: var(--ombre-flottant); width: min(94vw, 720px); max-height: 92vh; }
dialog::backdrop { background: rgba(25, 23, 21, .45); }
.dlg-tete { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--surface-300); }
.dlg-tete h2 { margin: 0; flex: 1; }
.dlg-corps { padding: 18px 20px 22px; overflow: auto; max-height: calc(92vh - 70px); }
.qr-bloc { display: grid; grid-template-columns: 170px 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--surface-200); align-items: center; }
.qr-bloc:last-child { border-bottom: 0; }
.qr-bloc svg { width: 170px; height: 170px; display: block; background: #fff; border: 1px solid var(--surface-300); border-radius: var(--r-md); }
.qr-bloc .url { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; background: var(--surface-200); border-radius: var(--r-sm); padding: 6px 8px; margin: 6px 0 10px; }
@media (max-width: 560px) { .qr-bloc { grid-template-columns: 1fr; } .qr-bloc svg { margin: 0 auto; } }

/* mobile */
@media (max-width: 700px) {
  .page { padding: 18px 14px 100px; }
  h1 { font-size: 22px; line-height: 28px; }
  .effet-ligne { grid-template-columns: 1fr 1fr 34px; }
  .effet-ligne .n { grid-column: 1 / -1; }
  .rang { grid-template-columns: 1.4em 1fr 44px; } .rang .piste { grid-column: 2 / -1; }
  .barres .ligne-barre { grid-template-columns: 1fr 54px; } .barres .ligne-barre .piste { grid-column: 1 / -1; order: 3; }
}

.chiffre-grand { font-size: 44px; line-height: 48px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 6px 0 0; }

@media (max-width: 860px), (max-height: 760px) { .simu-resultat { position: static; } }
