/* ---- Plan de masse (DP2 / PCMI2) : formes prédéfinies, cotes et longueurs sur la carte ---- */

/* palette des formes prédéfinies (fenêtre modale) */
.pf-overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(13, 34, 71, .45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px 12px; }
.pf-overlay[hidden] { display: none; }
/* en-tête et pied toujours visibles, seules les tuiles défilent */
.pf-dialog { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(13, 34, 71, .35); width: 100%; max-width: 760px; max-height: calc(100vh - 4vh - 12px); max-height: calc(100dvh - 4vh - 12px); padding: 16px 20px 14px; }
.pf-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -8px; padding: 0 8px 4px; }
.pf-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 4px; }
.pf-head h2 { margin: 0; font-size: 1.15rem; }
.pf-intro { font-size: .86rem; color: var(--ink-soft); line-height: 1.45; margin: 6px 0 2px; }
.pf-grp { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--blue-700); margin: 14px 0 8px; }
.pf-grp-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin: 14px 0 8px; }
.pf-grp-row .pf-grp { margin: 0; }
.pf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.pf-tile { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; padding: 10px 6px 9px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.pf-tile:hover { border-color: var(--blue-400); background: var(--blue-050); }
.pf-tile:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }
.pf-pic { display: block; width: 48px; height: 36px; flex-shrink: 0; }
.pf-name { font-size: .82rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.pf-dim { font-size: .74rem; color: var(--ink-soft); line-height: 1.3; }
.pf-foot { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.pf-foot .pm-toggle, .pf-grp-row .pm-toggle { cursor: pointer; }
.pf-dialog .btn:focus-visible, .pf-dialog select:focus-visible, .pf-dialog input:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }
@media (max-width: 480px) {
  .pf-overlay { padding: 8px; }
  .pf-dialog { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 12px 12px 10px; }
  .pf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .pf-tile { padding: 7px 4px 6px; }
  .pf-pic { width: 40px; height: 30px; }
  .pf-intro { font-size: .8rem; }
}

/* barre d'outils : message temporaire de Mr Permis (pose, forme libre, alignement) */
.pm-tools .hint.pf-note { color: var(--blue-700); font-weight: 600; }
.pm-tools .btn:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }

/* panneau de la forme sélectionnée : cotes, orientation, distances aux limites */
.pf-sec { border-top: 1px solid var(--line); padding-top: 12px; margin: 4px 0 14px; }
.pf-sec h3 { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: .95rem; margin-bottom: 8px; }
.pf-sec h3 small { font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.pf-sec .hint { font-size: .78rem; color: var(--ink-soft); margin-top: 6px; line-height: 1.4; }
.pf-cotes { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 14px; }
.pf-schema { flex: 0 0 auto; display: block; width: 150px; max-width: 100%; height: auto; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.pf-fields { flex: 1 1 160px; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 12px; min-width: 0; }
.pf-f { min-width: 0; }
.pf-lims { grid-template-columns: 1fr; }
.pf-lims .pf-in { max-width: 220px; }
.pf-f label { display: block; font-size: .8rem; font-weight: 700; line-height: 1.3; margin-bottom: 3px; }
.pf-f label small { font-weight: 400; color: var(--ink-soft); }
.pf-in { display: flex; align-items: center; gap: 6px; }
.pf-in input { flex: 1 1 auto; min-width: 0; width: 100%; padding: 7px 9px; font-size: .92rem; }
.pf-in i { font-style: normal; font-size: .82rem; color: var(--ink-soft); }
.pf-in input[aria-invalid="true"] { border-color: var(--red-600); }
.pf-in input.pf-flash { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(36, 112, 221, .3); }
.pf-let { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 1.05em; color: var(--blue-700); }
.pf-rot { max-width: 180px; margin-bottom: 8px; }
.pf-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.pf-btns .btn:focus-visible, .pm-panel .btn:focus-visible { outline: 3px solid var(--blue-500); outline-offset: 2px; }
.pf-err { background: var(--red-050); color: var(--red-600); border: 1px solid #efc3bd; border-radius: 8px; padding: 7px 10px; font-size: .82rem; line-height: 1.4; margin-top: 8px; }
.pf-err[hidden] { display: none; }

/* schéma coté (lettres L, l, a, b, c, d ; point plein = coin d'origine) */
.pf-sch-shape { fill: rgba(36, 112, 221, .16); stroke: #1a56b8; stroke-width: 1.4; stroke-linejoin: round; }
.pf-sch-box { fill: none; stroke: #94a3b8; stroke-width: .8; stroke-dasharray: 3 2; }
.pf-sch-ext { stroke: #94a3b8; stroke-width: .6; }
.pf-sch-dim { stroke: #334155; stroke-width: .9; }
.pf-sch-tk { stroke: #334155; stroke-width: 1.1; }
.pf-sch-let { font: italic 700 11px Georgia, "Times New Roman", serif; fill: #1d4ed8; }
.pf-sch-o { fill: #1d4ed8; stroke: #fff; stroke-width: 1; }

/* carte : longueur de chaque côté (cliquable), saisie directe, distances aux limites, coin d'origine */
.pm-side-mk, .pm-tag-mk { width: auto !important; height: auto !important; background: none; border: none; }
.pm-side-c { transform: translate(-50%, -50%); }
.pm-side { display: block; margin: 0; padding: 2px 7px; border: 1px solid #374151; border-radius: 6px; background: #fff; color: #111827; font: 700 11.5px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.pm-side:hover { background: var(--blue-050); border-color: var(--blue-600); color: var(--blue-700); }
.pm-side:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 1px; }
.pm-side-c input.pm-side-in { width: 84px; padding: 4px 6px; font-size: 13px; font-weight: 700; border: 2px solid var(--blue-500); border-radius: 6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.pm-dist { transform: translate(-50%, -50%); padding: 1px 5px; border: 1px dashed #1a56b8; border-radius: 5px; background: rgba(255, 255, 255, .92); color: #1a56b8; font: 600 10.5px/1.25 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; white-space: nowrap; }
.pm-handle.pm-handle-o { border-radius: 2px; background: #c1121f; }
@media (pointer: coarse) {
  .pm-side { padding: 5px 9px; font-size: 13px; }
}
