/* QG Pro -- « Services et prix », direction B (le registre), lecture seule.
   Gabarit : client/templates/maison/services_prix_qgpro.html.
   Jetons --qgv-* seulement ; tout est prefixe .mm-sp (feuille chargee partout). */

.mm-sp-outils { display: flex; align-items: center; justify-content: space-between; gap: var(--qgv-s3); flex-wrap: wrap; margin-bottom: var(--qgv-s3); }
.mm-sp-lecture { display: inline-flex; align-items: center; gap: 6px; font-size: var(--qgv-t-sm); color: var(--qgv-text-3); }
.mm-sp-lecture svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.mm-sp-grille { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--qgv-s4); align-items: start; }

/* ---- Le registre ---- */
.mm-sp .mm-sp-reg { padding: 6px 18px 10px; }
.mm-sp-table { table-layout: fixed; }
.mm-sp-table thead th { font: 500 11px var(--qgv-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--qgv-text-3); padding: 10px 10px 6px 0; border-bottom: 1px solid var(--qgv-line); background: transparent; }
.mm-sp-table thead th:first-child { padding-left: 0; }
.mm-sp-table thead th:nth-child(2), .mm-sp-table thead th:nth-child(3) { width: 128px; }
.mm-sp-table thead th.mm-sp-c-etat { width: 92px; text-align: right; padding-right: 0; }
.mm-sp-table tbody[hidden], .mm-sp-table tr[hidden] { display: none !important; }

.mm-sp-table tr.mm-sp-groupe:hover { background: transparent; }
.mm-sp-table tr.mm-sp-groupe th { padding: 14px 0 6px; border-bottom: 1px solid var(--qgv-line); text-align: left; background: transparent; }
.mm-sp-groupe h2 { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--qgv-text); letter-spacing: 0; text-transform: none; }
.mm-sp-groupe em { font: 400 11px var(--qgv-font-mono); font-style: normal; color: var(--qgv-text-3); margin-left: 6px; }

.mm-sp-table tr.mm-sp-ligne td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--qgv-line-soft); vertical-align: middle; }
.mm-sp-table tr.mm-sp-ligne:hover { background: color-mix(in srgb, var(--qgv-text) 4%, transparent); }
.mm-sp-table tbody tr.mm-sp-ligne:last-child td { border-bottom: 0; }
.mm-sp-c-nom { min-width: 0; }
.mm-sp-nom { font-weight: 600; color: var(--qgv-text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mm-sp-desc { margin: 2px 0 0; color: var(--qgv-text-3); font-size: var(--qgv-t-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mm-sp-mont { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; width: 100%; height: 34px; padding: 0 10px; border-radius: var(--qgv-r-btn); background: var(--qgv-canvas); box-shadow: inset 0 0 0 1px var(--qgv-line); font-weight: 600; color: var(--qgv-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mm-sp-mont i, .mm-sp-val i { font-style: normal; font-weight: 400; color: var(--qgv-text-3); font-size: var(--qgv-t-sm); }
.mm-sp-table td.mm-sp-c-etat { text-align: right; padding-right: 0; white-space: nowrap; }
.mm-sp-sans { color: var(--qgv-text-3); }

.mm-sp-ligne.is-off .mm-sp-nom, .mm-sp-ligne.is-off .mm-sp-desc, .mm-sp-ligne.is-off .mm-sp-mont { opacity: .45; }

.mm-sp-vide td { padding: var(--qgv-s5) 0; text-align: center; color: var(--qgv-text-3); font-size: var(--qgv-t-sm); }
.mm-sp-vide b { display: block; color: var(--qgv-text); font-size: var(--qgv-t-base); margin-bottom: 2px; }

.mm-sp-table tfoot tr.mm-sp-total th, .mm-sp-table tfoot tr.mm-sp-total td { padding: 12px 10px 6px 0; border-top: 1px solid var(--qgv-line-strong); border-bottom: 0; font-weight: 700; color: var(--qgv-text); font-variant-numeric: tabular-nums; white-space: nowrap; background: transparent; }
.mm-sp-table tfoot tr.mm-sp-total th { text-align: left; white-space: normal; font-family: inherit; font-size: var(--qgv-t-base); letter-spacing: 0; text-transform: none; }
.mm-sp-table tfoot tr.mm-sp-total td:nth-child(2), .mm-sp-table tfoot tr.mm-sp-total td:nth-child(3) { padding-right: 20px; }
.mm-sp-total small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: var(--qgv-t-xs); color: var(--qgv-text-3); margin-top: 2px; }
.mm-sp-table tfoot tr:hover { background: transparent; }

/* ---- Les reglages communs, a droite ---- */
.mm-sp-cote { display: grid; gap: var(--qgv-s4); align-content: start; }
.mm-sp .mm-sp-carte h2 { margin: 0 0 2px; font-size: var(--qgv-t-h3); font-weight: 700; }
.mm-sp-dit { margin: 0; color: var(--qgv-text-2); font-size: var(--qgv-t-sm); }
.mm-sp-mult { display: grid; grid-template-columns: minmax(0, 1fr) 78px 78px; gap: 6px var(--qgv-s2); align-items: center; margin-top: var(--qgv-s3); font-size: 13px; }
.mm-sp-mult .qgv-eyebrow { font-size: 10px; text-align: right; padding-right: 8px; margin: 0; }
.mm-sp-mult b { color: var(--qgv-text); }
.mm-sp-mult small { display: block; color: var(--qgv-text-3); font-size: var(--qgv-t-xs); }
.mm-sp-val { display: flex; align-items: center; justify-content: flex-end; gap: 4px; height: 34px; padding: 0 10px; border-radius: var(--qgv-r-btn); background: var(--qgv-canvas); box-shadow: inset 0 0 0 1px var(--qgv-line); font-weight: 600; color: var(--qgv-text); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }
.mm-sp-mult .mm-sp-val { justify-content: space-between; padding: 0 8px; height: 32px; }
.mm-sp-paire { display: grid; grid-template-columns: 1fr 1fr; gap: var(--qgv-s2); margin-top: var(--qgv-s3); }
.mm-sp-champ { display: grid; gap: 4px; min-width: 0; }
.mm-sp-champ .qgv-eyebrow { margin: 0; white-space: nowrap; }

.mm-sp-code { padding: var(--qgv-s3) var(--qgv-s4); border-radius: var(--qgv-r); box-shadow: inset 0 0 0 1px var(--qgv-line); border: 1px dashed transparent; font-size: var(--qgv-t-sm); color: var(--qgv-text-2); }
.mm-sp-code b { display: block; color: var(--qgv-text); margin-bottom: 2px; }
.mm-sp-code p { margin: 0 0 var(--qgv-s2); }
.mm-sp-code a { color: var(--qgv-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--qgv-line-strong); }
.mm-sp-code a:hover { text-decoration-color: currentColor; }

@media (max-width: 1100px) {
  .mm-sp-grille { grid-template-columns: minmax(0, 1fr); }
  .mm-sp-cote { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}

/* ---- Telephone : chaque ligne devient une fiche (nom + etat, puis les deux montants) ---- */
@media (max-width: 760px) {
  .mm-sp .mm-sp-reg { padding: 4px 14px 8px; }
  .mm-sp-table, .mm-sp-table tbody, .mm-sp-table tfoot { display: block; }
  .mm-sp-table thead { display: none; }
  .mm-sp-table tr.mm-sp-groupe { display: block; }
  .mm-sp-table tr.mm-sp-groupe th { display: block; }
  .mm-sp-table tr.mm-sp-ligne, .mm-sp-table tr.mm-sp-total { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; grid-template-areas: "nom nom etat" "inst mois mois"; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--qgv-line-soft); }
  .mm-sp-table tr.mm-sp-total { grid-template-areas: "nom nom nom" "inst mois mois"; border-bottom: 0; }
  .mm-sp-table tr.mm-sp-ligne td, .mm-sp-table tr.mm-sp-total th, .mm-sp-table tr.mm-sp-total td { display: block; padding: 0 !important; border: 0; }
  .mm-sp-table tr.mm-sp-total { border-top: 1px solid var(--qgv-line-strong); }
  .mm-sp-table tr > :nth-child(1) { grid-area: nom; }
  .mm-sp-table tr > :nth-child(2) { grid-area: inst; text-align: left; }
  .mm-sp-table tr > :nth-child(3) { grid-area: mois; text-align: left; }
  .mm-sp-table tr > :nth-child(4) { grid-area: etat; align-self: start; }
  .mm-sp-table tr.mm-sp-total > :nth-child(4) { display: none; }
  .mm-sp-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 4px; font: 500 10.5px var(--qgv-font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--qgv-text-3); font-weight: 500; }
  .mm-sp-mont { height: 44px; }
  .mm-sp-desc { white-space: normal; }
  .mm-sp-vide { display: block; }
  .mm-sp-vide[hidden] { display: none !important; }
  .mm-sp-vide tr, .mm-sp-vide td { display: block; }
  .mm-sp-cote { grid-template-columns: minmax(0, 1fr); }
  .mm-sp-mult { grid-template-columns: minmax(0, 1fr) 72px 72px; }
  .mm-sp-mult .mm-sp-val, .mm-sp-val { height: 44px; }
  .mm-sp-mult .mm-sp-val { height: 40px; }
}

@media (prefers-reduced-motion: no-preference) {
  .mm-sp-table tr.mm-sp-ligne { transition: background var(--qgv-dur-fast) var(--qgv-ease); }
}

/* ---- Mode editeur (13 novembre 2026) -------------------------------------------------
   Lecture seule par defaut (.mm-sp-in cache) ; .is-edition sur .mm-sp montre les champs a
   la place des montants, la barre « Annuler / Enregistrer » collee en bas de l'ecran. */
.mm-sp-mode { display: inline-flex; align-items: center; gap: var(--qgv-s3); }
.mm-sp-mode .qgv-btn svg, .mm-sp-lecture.is-ed svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mm-sp-lecture.is-ed { color: var(--qgv-text); font-weight: 600; }
.mm-sp-si-ed, .mm-sp-in { display: none !important; }
.mm-sp.is-edition .mm-sp-si-lu { display: none !important; }
.mm-sp.is-edition .mm-sp-si-ed { display: inline-flex !important; }
.mm-sp.is-edition .mm-sp-barre.mm-sp-si-ed { display: flex !important; }
.mm-sp.is-edition .mm-sp-in { display: block !important; }
.mm-sp.is-edition :is(.mm-sp-mont, .mm-sp-val) { display: none; }
.mm-sp-cel { display: block; min-width: 0; }

.mm-sp-in {
  width: 100%; min-width: 0; max-width: 120px; margin-left: auto; height: 34px; padding: 0 10px;
  text-align: right; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: box-shadow var(--qgv-dur-fast) var(--qgv-ease), background var(--qgv-dur-fast) var(--qgv-ease);
}
.mm-sp-mult .mm-sp-in, .mm-sp-champ .mm-sp-in { max-width: none; height: 32px; }
.mm-sp-in.is-change { box-shadow: inset 0 0 0 1.5px var(--qgv-text); background: var(--qgv-surface-2); }
.mm-sp.is-edition .mm-sp-c-montant { position: relative; }
.mm-sp-c-montant, .mm-sp-cel, .mm-sp-champ { position: relative; }
/* Le point « modifie » : ce montant n'est plus celui d'origine. */
.mm-sp-modifie {
  position: absolute; top: 50%; right: -9px; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%;
  background: var(--qgv-text);
}
.mm-sp-champ .mm-sp-modifie { top: 6px; right: 0; margin: 0; }
.mm-sp.is-edition .mm-sp-modifie { display: none; }

.mm-sp-barre {
  position: sticky; bottom: calc(var(--qgv-tabbar-space, 0px) + var(--qgv-s3)); z-index: 20;
  align-items: center; justify-content: space-between; gap: var(--qgv-s3); flex-wrap: wrap;
  margin: 0 0 var(--qgv-s3); padding: 10px 12px 10px var(--qgv-s4);
  border-radius: var(--qgv-r-lg); background: var(--qgv-surface); box-shadow: inset 0 0 0 1px var(--qgv-text), var(--qgv-e3);
  order: 99;
}
.mm-sp-barre p { margin: 0; min-width: 0; flex: 1 1 260px; font-size: var(--qgv-t-sm); color: var(--qgv-text-2); }
.mm-sp-barre-btns { display: flex; gap: var(--qgv-s2); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .mm-sp.is-edition .mm-sp-barre { animation: mm-sp-barre .28s var(--qgv-ease) both; }
  .mm-sp.is-edition .mm-sp-in { animation: mm-sp-in .22s var(--qgv-ease) both; }
}
@keyframes mm-sp-barre { from { opacity: 0; transform: translateY(8px); } }
@keyframes mm-sp-in { from { opacity: 0; } }

.mm-sp-code form { margin: 0 0 var(--qgv-s2); }
.mm-sp-origine {
  padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--qgv-text); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--qgv-line-strong);
}
.mm-sp-origine:hover { text-decoration-color: currentColor; }

@media (max-width: 760px) {
  .mm-sp-mode { width: 100%; justify-content: space-between; }
  .mm-sp-in { height: 44px; font-size: 16px; max-width: none; }
  .mm-sp-mult .mm-sp-in, .mm-sp-champ .mm-sp-in { height: 40px; font-size: 16px; }
  .mm-sp-barre-btns { width: 100%; }
  .mm-sp-barre-btns .qgv-btn { flex: 1; min-height: 44px; justify-content: center; }
}
