/* Charte v3: presentation layer, shared by the three calculation methods. */
:root {
  --pdm-canvas: var(--pdm-brand-canvas, #f7f8fa);
  --pdm-surface: var(--pdm-brand-surface, #fff);
  --pdm-ink: var(--pdm-brand-ink, #20272b);
  --pdm-muted: var(--pdm-brand-muted, #52616b);
  --pdm-border: var(--pdm-brand-border, #cdd5dc);
  --pdm-soft: var(--pdm-brand-soft, #eef2f4);
  --pdm-teal: var(--pdm-brand-accent, #007e94);
  --pdm-action: var(--pdm-brand-action, #c94200);
  --pdm-danger: #9b3027;
}
[data-bs-theme=dark] {
  --pdm-canvas: var(--pdm-brand-canvas, #141a1e);
  --pdm-surface: var(--pdm-brand-surface, #1d252a);
  --pdm-ink: var(--pdm-brand-ink, #edf2f5);
  --pdm-muted: var(--pdm-brand-muted, #b9c6ce);
  --pdm-border: var(--pdm-brand-border, #50606a);
  --pdm-soft: var(--pdm-brand-soft, #26323a);
  --pdm-teal: var(--pdm-brand-accent, #6fd4e5);
  --pdm-action: var(--pdm-brand-action, #c94200);
  --pdm-danger: #ffb4aa;
}
body {
  background: var(--pdm-canvas);
  color: var(--pdm-ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
#body-container { max-width: 1280px; padding: 64px 24px 0; }
.header { margin-top: 0 !important; padding: 32px 0 22px; }
.header .logo { object-fit: contain; width: 76px; height: 76px; margin-bottom: 12px !important; }
#title { color: var(--pdm-brand-heading, var(--pdm-ink)); font-size: clamp(1.45rem, 3vw, 2rem); font-weight: 750; letter-spacing: -.035em; }
.header .lead { font-size: 1rem; color: var(--pdm-muted); margin-bottom: 12px; }
/* This warning remains visible; help is a separate dialog. */
.app-notice { max-width: 860px; margin: 16px auto 0; padding: 14px 18px; border: 1px solid var(--pdm-border); border-radius: 8px; background: var(--pdm-surface); color: var(--pdm-muted); font-size: .8rem; text-align: left; }
.app-notice h3 { font-size: .9rem; font-weight: 650; margin: 0 0 8px; }
.app-notice .disclamer { margin: 0 0 8px; }
#bug-report-button { display: none; }
.locale-switcher {
  position: absolute; top: 0; right: 0; width: 100%; min-height: 58px;
  justify-content: flex-end; gap: 8px; padding: 10px max(16px, calc((100vw - 1232px) / 2));
  border: 0; border-bottom: 1px solid var(--pdm-border); border-radius: 0;
  background: var(--pdm-surface); box-shadow: none; opacity: 1; z-index: 100;
}
.locale-switcher .btn, .locale-switcher select {
  border: 1px solid var(--pdm-border); border-radius: 999px; min-height: 36px;
  background: var(--pdm-surface); color: var(--pdm-muted); padding: 5px 12px; font-size: .8rem;
}
.locale-switcher .logoMenu { object-fit: contain; margin-right: auto; width: 24px; height: 28px; }
.locale-switcher .dropdown-menu { max-width: calc(100vw - 32px); }
#formulaire > .row { --bs-gutter-x: 24px; }
#formulaire > .row > [class*=col-] { min-width: 0; }
.card { border: 1px solid var(--pdm-border); border-radius: 8px; background: var(--pdm-surface); margin: 0 0 24px; box-shadow: none; color: var(--pdm-ink); }
.card-header { background: transparent; color: var(--pdm-brand-heading, var(--pdm-ink)); border-bottom: 1px solid var(--pdm-border); margin: 0 22px; padding: 20px 0 14px; font-size: 1.25rem; font-weight: 700; }
.card-body { padding: 20px 22px; color: var(--pdm-ink); }
.form-label, .wall-card-label { font-weight: 650; font-size: .85rem; margin: 12px 0 5px; color: var(--pdm-ink); }
.form-text { color: var(--pdm-muted); font-size: .78rem; line-height: 1.5; margin: 6px 0 12px; }
.form-control, .form-select, .input-group-text {
  min-height: 42px; border-color: var(--pdm-border); border-radius: 5px; font-size: .9rem;
  background-color: var(--pdm-surface); color: var(--pdm-ink); box-shadow: none;
}
.form-control:disabled, .form-control[readonly], .form-select:disabled { background-color: var(--pdm-soft); color: var(--pdm-muted); }
.input-group { margin: 0 0 10px; flex-wrap: wrap; align-items: stretch; }
.input-group-text { background: var(--pdm-surface); color: var(--pdm-muted); }
.input-group .form-check { align-self: center; margin: 0 0 0 12px; font-size: .8rem; }
.form-control:focus, .form-select:focus { border-color: var(--pdm-teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pdm-teal) 18%, transparent); }
:where(button,a,input,select,summary,[tabindex]):focus-visible { outline: 3px solid var(--pdm-teal); outline-offset: 3px; }
.btn { border-radius: 5px; font-weight: 600; font-size: .85rem; min-height: 36px; padding: 8px 14px; }
.btn-secondary, .btn-light, .btn-outline-secondary { background: var(--pdm-surface); border: 1px solid var(--pdm-border); color: var(--pdm-ink); }
.btn-secondary:hover, .btn-light:hover, .btn-outline-secondary:hover { background: var(--pdm-soft); color: var(--pdm-ink); border-color: var(--pdm-muted); }
#submit_button { background: var(--pdm-action); border-color: var(--pdm-action); color: var(--pdm-brand-action-ink, #fff); min-height: 46px; }
#submit_button:hover { background: var(--pdm-brand-action-hover, #a73500); border-color: var(--pdm-brand-action-hover, #a73500); }
.levelchose .card-body { padding: 18px 22px; }
.levelchose .card-body > .m-1 { margin: 0 !important; }
.levelchose select { display: block; margin: 6px 0 10px; width: 100%; max-width: 100%; padding: 6px 10px; border: 1px solid var(--pdm-border); border-radius: 5px; background: var(--pdm-surface); color: var(--pdm-ink); }
.levelchose p { font-size: .8rem; color: var(--pdm-muted); margin: 8px 0; }
.levelchose .form-switch { font-size: .78rem; margin-top: 12px; }
.form-building .card-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
.form-building .card-body > * { grid-column: 1 / -1; min-width: 0; }
.form-building .card-body > .livingvolume_manuel { grid-column: auto; }
.form-building .card-body > .form-label { margin-bottom: 5px; }
.form-location .nav-tabs { border: 0; gap: 8px; margin-bottom: 16px; }
.form-location .nav-link { border-radius: 999px; border: 1px solid var(--pdm-border); color: var(--pdm-muted); padding: 7px 12px; font-size: .85rem; }
.form-location .nav-link.active { color: var(--pdm-brand-accent, #a73500); background: var(--pdm-brand-tab-bg, #fff5ef); border-color: var(--pdm-brand-accent, #c94200); }
[data-bs-theme=dark] .form-location .nav-link.active { color: var(--pdm-brand-accent, #ffb585); background: var(--pdm-brand-tab-bg, #38271e); border-color: var(--pdm-brand-accent, #ffb585); }
#map, #temp-base-map-container { border-radius: 6px; overflow: hidden; }
#nav-carte p, #nav-cartenf p { color: var(--pdm-muted); font-size: .85rem; }
.location-note { background: var(--pdm-soft); border-left: 3px solid var(--pdm-teal); padding: 12px 14px; color: var(--pdm-muted); font-size: .8rem; border-radius: 5px; margin-top: 16px; }
.form-detail-building > .card-header { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0; padding: 20px 22px 16px; }
.form-detail-building > .card-header .input-group-text { border: 0; padding: 0; min-height: 0; background: transparent; font-weight: 650; font-size: .85rem; }
.form-detail-building > .card-header input { flex: 1 1 240px; }
.expert-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.expert-toolbar h4 { font-size: 1.25rem; font-weight: 700; margin: 0; }
.expert-toolbar p { margin: 6px 0 0; font-size: .85rem; color: var(--pdm-muted); }
.expert-table-scroll { overflow: visible; }
#tabke-level3-detail-building { display: block; width: 100%; margin: 0; }
#tabke-level3-detail-building > thead { display: none; }
#tabke-level3-detail-building > tbody { display: block; }
.pdm-wall-card { border: 1px solid var(--pdm-border); border-radius: 6px; margin: 0 0 14px; padding: 0 14px 12px; }
.pdm-wall-card[data-complete=true]:has(.wall-card-toggle[aria-expanded=true]) { border-color: var(--pdm-teal); }
/* Header actions do not consume a second row below the form fields. */
.wall-card-header { display: block; }
.wall-card-header > td { display: flex; align-items: center; gap: 14px; padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important; }
.wall-card-toggle { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 8px 10px; min-width: 0; border: 0; background: transparent; color: var(--pdm-ink); padding: 15px 0; text-align: left; font-size: .9rem; }
.wall-card-actions { display: flex; flex: 0 0 auto; gap: 8px; align-items: center; }
.wall-card-actions .btn { height: 36px; padding-block: 6px; }
.wall-card-name { font-weight: 700; overflow-wrap: anywhere; order: 1; }
.wall-card-meta { font-size: .78rem; color: var(--pdm-muted); order: 2; }
.wall-card-state { font-size: .75rem; font-weight: 650; padding: 3px 7px; border-radius: 4px; color: var(--pdm-muted); order: 3; }
.wall-card-chevron { margin-left: auto; font-size: 1.1rem; order: 4; }
.wall-card-toggle[aria-expanded=true] .wall-card-chevron { transform: rotate(180deg); }
.wall-card-status { width: 14px; height: 14px; flex: 0 0 14px; border-radius: 3px; border: 1px solid var(--pdm-muted); }
.pdm-wall-card[data-complete=true] .wall-card-status { border-color: #237747; background: #e8f5ed; }
.pdm-wall-card[data-complete=false] { border-color: var(--pdm-danger); }
.pdm-wall-card[data-complete=false] .wall-card-status { border-color: var(--pdm-danger); background: color-mix(in srgb, var(--pdm-danger) 15%, var(--pdm-surface)); }
.pdm-wall-card[data-complete=false] .wall-card-state { color: var(--pdm-danger); background: color-mix(in srgb, var(--pdm-danger) 12%, var(--pdm-surface)); }
.wall-card-feedback p { margin: 0 0 12px; padding: 10px 12px; border-left: 3px solid var(--pdm-danger); background: color-mix(in srgb, var(--pdm-danger) 8%, var(--pdm-surface)); color: var(--pdm-danger); font-size: .85rem; }
.pdm-wall-card[data-complete=true] .wall-card-feedback { display: none !important; }
.pdm-wall-card > .walls { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, .75fr) minmax(0, .5fr) minmax(0, .5fr) minmax(0, .8fr); gap: 12px; border-top: 1px solid var(--pdm-border); padding-top: 4px; }
.pdm-wall-card:not(.wall-card-manual-resistance):not(.wall-card-detailed) > .walls { grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(0, .75fr) minmax(0, .5fr) minmax(0, .5fr); }
.pdm-wall-card > .walls > td { min-width: 0; border: 0; padding: 0; box-shadow: none; background: transparent; }
.pdm-wall-card > .walls > td:first-child, .pdm-wall-card > .walls > td:last-child { display: none; }
/* Input DOM order is kept for URL/JSON compatibility. */
.pdm-wall-card > .walls > td:nth-child(2) { order: 1; }
.pdm-wall-card > .walls > td:nth-child(3) { order: 2; }
.pdm-wall-card > .walls > td:nth-child(7) { order: 3; }
.pdm-wall-card > .walls > td:nth-child(4) { order: 4; }
.pdm-wall-card > .walls > td:nth-child(5) { order: 5; }
.pdm-wall-card > .walls > td:nth-child(8) { order: 6; }
.pdm-wall-card > .walls > .wall-bridge-popup { order: 7; grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--pdm-soft); border-radius: 5px; cursor: pointer; }
.wall-bridge-popup .wall-card-label { margin: 0; }
.wall-rsi-rse-popup { cursor: pointer; }
.wall-rsi-rse-popup .wall-rse-val { display: flex; align-items: center; justify-content: center; min-height: 42px; border: 1px solid var(--pdm-border); border-radius: 5px; background: var(--pdm-surface); }
.wall-rsi-rse-popup .wall-rse-val .btn { border: 0; background: transparent; color: var(--pdm-ink); }
.pdm-wall-card:not(.wall-card-detailed) .wall-card-auto-resistance { display: none; }
.wall-card-label { display: block; text-align: left; margin-top: 6px; font-size: .78rem; }
.pdm-wall-card .form-control { width: 100%; min-width: 0; text-align: left !important; }
.pdm-wall-card .select2-container { width: 100% !important; min-width: 0; }
.pdm-wall-card > tr:not(.walls):not(.wall-card-header), .pdm-wall-card > tr:not(.wall-card-header) > td[colspan="9"] { display: block; border: 0; box-shadow: none; background: transparent; }
.pdm-wall-card .window-table { display: block; margin: 16px 0 0 !important; background: var(--pdm-soft); border-radius: 5px; padding: 10px !important; }
.window-table thead { display: none; }
.window-table tbody { display: block; }
.window-table tr.window-check { display: grid; grid-template-columns: 20px minmax(90px, 1fr) minmax(100px, 1.2fr) minmax(80px, .7fr) 36px; gap: 10px; align-items: end; }
.window-table tr.window-check > td { display: block; border: 0; padding: 0; box-shadow: none; background: transparent; min-width: 0; }
.window-table tr.window-check > th { display: none; }
.window-table tr.window-check > td:nth-child(2) { padding-bottom: 10px; }
.window-table tr[id^=addWindow] { display: block; margin-top: 10px; }
.window-table tr[id^=addWindow] > th { display: none; }
.window-table tr[id^=addWindow] > td { display: block; border: 0; background: transparent; box-shadow: none; }
.pdm-wall-card:not(.wall-card-detailed) .wall-card-detail { display: none; }
.pdm-wall-card.wall-card-closed { padding-bottom: 0; }
.pdm-wall-card.wall-card-closed > tr:not(.wall-card-header) { display: none !important; }
#addWallButton, #addWallButton > td { display: block; padding: 0; border: 0; box-shadow: none; }
#addWallButton .btn { margin-top: 4px; }
#resDeperditionMax { display: block; font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.2; color: var(--pdm-teal); margin-top: 8px; }
#deperdition { border-left: 3px solid var(--pdm-teal); padding: 12px 18px; margin-bottom: 20px; }
#result, #suggestion, #help { margin-top: 24px; }
.btns { gap: 12px 0; padding: 0 0 24px !important; }
.select2-container--default .select2-selection--single { min-height: 42px; border-color: var(--pdm-border); border-radius: 5px; background: var(--pdm-surface); }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 40px; color: var(--pdm-ink); padding-left: 12px; }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 40px; }
.select2-dropdown, .select2-search__field { border-color: var(--pdm-border); }
footer { margin: 28px 0 0 !important; padding: 24px 0 !important; font-size: .8rem; }
footer .list-inline-item { margin: 6px 10px; }
@media (max-width: 767px) {
  #body-container { padding: 64px 16px 0; }
  .header { padding-top: 24px; }
  .locale-switcher { gap: 5px; padding: 8px 12px; }
  .locale-switcher .btn, .locale-switcher select { padding: 5px 8px; font-size: .72rem; }
  .locale-switcher .logoMenu { display: none; }
  .card-header { margin: 0 16px; padding-top: 16px; }
  .card-body { padding: 16px; }
  .levelchose select { display: block; margin: 6px 0 0; width: 100%; }
  .form-building .card-body { column-gap: 12px; }
  .wall-card-header > td { flex-direction: column; align-items: stretch; gap: 0; }
  .wall-card-toggle { gap: 6px 10px; }
  .wall-card-meta { width: calc(100% - 24px); order: 5; margin-left: 24px; }
  .wall-card-actions { justify-content: flex-end; margin-bottom: 12px; }
  .pdm-wall-card { padding-inline: 10px; }
  .pdm-wall-card > .walls, .pdm-wall-card:not(.wall-card-manual-resistance):not(.wall-card-detailed) > .walls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdm-wall-card > .walls > td:nth-child(2), .pdm-wall-card > .walls > td:nth-child(3) { grid-column: 1 / -1; }
  .pdm-wall-card > .walls > td:nth-child(8) { order: 4; }
  .pdm-wall-card > .walls > td:nth-child(4) { order: 5; }
  .pdm-wall-card > .walls > td:nth-child(5) { order: 6; }
  .pdm-wall-card:not(.wall-card-manual-resistance):not(.wall-card-detailed) > .walls > td:nth-child(7) { grid-column: 1 / -1; }
  .form-detail-building > .card-header { padding: 16px; }
  .expert-table-scroll input[id^=wall-name-] { min-width: 0; }
  .window-table tr.window-check { grid-template-columns: 20px minmax(0, 1fr) 36px; margin-bottom: 12px; }
  .window-table tr.window-check > td:nth-child(3) { grid-column: 2 / -1; }
  .window-table tr.window-check > td:nth-child(4), .window-table tr.window-check > td:nth-child(5) { grid-column: 2 / 3; }
  .window-table tr.window-check > td:last-child { grid-column: 3; grid-row: 2 / 4; }
  .btns > [class*=col-] { width: 50%; }
  .btns > [class*=col-]:last-child { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto !important; } }
@media print {
  .locale-switcher, .expert-toolbar, .wall-card-header, .wall-card-details-toggle { display: none !important; }
  .pdm-wall-card.wall-card-closed > tr:not(.wall-card-header), .pdm-wall-card:not(.wall-card-detailed) .wall-card-detail, .pdm-wall-card:not(.wall-card-detailed) .wall-card-auto-resistance { display: block !important; }
  .pdm-wall-card.wall-card-closed > tr.walls { display: grid !important; }
}
.level3-settings > summary { cursor: pointer; font-size: .9rem; font-weight: 600; padding: 18px 22px; }
#result > .card-body { display: flex; flex-direction: column; }
#deperdition { order: -1; }
.locale-switcher .language-switcher select, .locale-switcher .unit-switcher select {
  height: 36px; font-size: .8rem; padding: 5px 24px 5px 10px; background-size: 10px; background-position: right 8px center;
}
.locale-switcher .language-switcher select { width: 108px; }
.locale-switcher .unit-switcher select { width: 142px; }
@media (max-width: 767px) {
  .locale-switcher .language-switcher select { width: 80px; font-size: .72rem; padding-left: 7px; padding-right: 18px; background-position: right 5px center; }
  .locale-switcher .unit-switcher select { width: 110px; font-size: .72rem; padding-left: 7px; padding-right: 18px; background-position: right 5px center; }
}
/* Consent controls stay above transient calculation alerts. */
#privacy-banner {
  left: 16px; right: 16px; bottom: 16px; width: calc(100% - 32px); max-width: 820px;
  margin: 0 auto; z-index: 1200; border: 1px solid var(--pdm-border); border-radius: 8px;
  background: var(--pdm-surface); color: var(--pdm-ink); padding: 20px;
  box-shadow: 0 8px 32px #0002; font-size: .85rem;
}
#privacy-banner h3 { font-size: 1rem; }
@media (max-width: 767px) { .locale-switcher { padding-inline: 8px; gap: 4px; } }
/* Keep the existing sortable opening handle visible. */
.window-table tr.window-check { grid-template-columns: 20px 20px minmax(90px, 1fr) minmax(100px, 1.2fr) minmax(80px, .7fr) 36px; }
.window-table tr.window-check > td:first-child { display: block; align-self: center; cursor: grab; text-align: center; }
@media (max-width: 767px) {
  .window-table tr.window-check { grid-template-columns: 16px 16px minmax(0, 1fr) 32px; gap: 8px; }
  .window-table tr.window-check > td:nth-child(3) { grid-column: 3 / -1; }
  .window-table tr.window-check > td:nth-child(4), .window-table tr.window-check > td:nth-child(5) { grid-column: 3 / 4; }
  .window-table tr.window-check > td:last-child { grid-column: 4; }
}
.card > .card-header { width: auto; }
.locale-switcher .language-switcher select, .locale-switcher .unit-switcher select { border-radius: 999px; }
.locale-switcher .language-switcher select { width: 70px; }
.ui-dialog { border: 1px solid var(--pdm-border); border-radius: 8px; background: var(--pdm-surface); color: var(--pdm-ink); }
.ui-dialog .ui-dialog-titlebar { background: var(--pdm-soft); color: var(--pdm-ink); border: 0; padding: 12px 42px 12px 16px; }
.ui-dialog .ui-dialog-titlebar-close { background: transparent; color: var(--pdm-ink); border: 0; width: 28px; height: 28px; min-height: 0; right: 10px; margin-top: -14px; padding: 0; }
.ui-dialog .ui-dialog-titlebar-close .ui-icon { display: none; }
.ui-dialog .ui-dialog-titlebar-close::after { content: '×'; font-size: 24px; line-height: 24px; }
@media (max-width: 767px) { .locale-switcher .language-switcher select { width: 60px; } }
.pdm-wall-card .delete-button svg, .window-table tr.window-check svg { fill: currentColor; }

.btns .btn { min-height: 46px; display: flex; align-items: center; justify-content: center; }
#interface-help-dialog h4 { font-size: 1rem; margin-top: 18px; }
#interface-help-dialog p { font-size: .9rem; line-height: 1.6; }

/* Child palettes are shipped in their existing Bootstrap overlay. */
.pdm-simple #body-container, .pdm-embedded #body-container { padding-top: 0; }
.pdm-embedded #body-container { max-width: none; }
@media (max-width: 767px) {
  #project-library .d-flex { flex-wrap: wrap; gap: 8px; }
  #project-library .d-flex > div { min-width: 0; max-width: 100%; }
  #project-library .btn { white-space: normal; overflow-wrap: anywhere; }
}

/* Avoid stacking introductory margins below the two section headings. */
.form-building > .card-body, .form-location > .card-body { padding-top: 12px; }
.form-building > .card-body > .form-text:first-child,
.form-location > .card-body > .location-note:first-child { margin-top: 0; }
/* Teaching reference: the certification concerns the training course. */
.afpma-training { display: flex; align-items: center; gap: 18px; width: fit-content; max-width: 100%; margin: 8px auto 24px; padding: 14px 18px; border: 1px solid var(--pdm-border); border-radius: 8px; background: var(--pdm-surface); color: var(--pdm-ink); text-align: left; text-decoration: none; }
.afpma-training:hover { border-color: var(--pdm-teal); color: var(--pdm-ink); }
.afpma-training img { object-fit: contain; flex: 0 0 72px; padding: 4px; border-radius: 5px; background: #fff; }
.afpma-training > span { min-width: 0; }
.afpma-training strong { display: block; max-width: 440px; font-size: .85rem; line-height: 1.5; }
.afpma-training span span { display: block; margin-top: 4px; color: var(--pdm-teal); font-size: .78rem; text-decoration: underline; text-underline-offset: 3px; }
.pdm-embedded .afpma-training, .pdm-simple .afpma-training { display: none; }
@media(max-width: 480px) { .afpma-training { gap: 12px; padding: 12px; } }
@media print { .afpma-training { display: none !important; } }
