/* Outil « Quotes-parts de copropriété (tantièmes) » — styles propres (ne modifie pas site.css). */
.qp-tool { max-width: 1120px; }
.qp-tool [hidden] { display: none !important; }
.qp-privacy { margin: 0 0 .8rem; font-size: .9rem; color: var(--muted); }
.qp-restored { margin: 0 0 .8rem; font-size: .9rem; font-weight: 600; color: var(--g-text); }
.qp-restored:empty { display: none; }
.qp-formbox { gap: 1.4rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.qp-intro { margin: 0; font-size: .92rem; }
.qp-fs { border: 1px solid var(--line) !important; border-radius: 14px; padding: 1rem 1.1rem 1.2rem !important; display: grid; gap: .9rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.qp-fs > legend { padding: 0 .4rem; font-size: 1rem; font-weight: 700; color: var(--text); }
.qp-sub { border: 1px dashed var(--line) !important; border-radius: 12px; padding: .7rem .8rem .9rem !important; display: grid; gap: .6rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.qp-sub > legend { font-size: .9rem; padding: 0 .3rem; margin: 0; }
.qp-sub2 { display: grid; gap: .6rem; max-width: 22rem; }
.qp-field { display: grid; gap: .4rem; min-width: 0; align-content: start; }
.qp-field .hint { margin: 0; }
.qp-field > label { display: block; }
.qp-grid3, .qp-grid4, .qp-grid6 { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.qp-grid4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.qp-grid6 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr)); }
.qp-tool .form input[type=radio] { width: 18px; height: 18px; padding: 0; margin: .15rem 0 0; flex: none; accent-color: var(--green); }
.qp-tool .form .btn.ghost { border: 1px solid currentColor; background: transparent; color: var(--text); }
.qp-radios { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.qp-radios .qp-radio { border-radius: 12px; align-items: flex-start; padding: .7rem .9rem; }
.qp-radio small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.qp-opts { display: flex; flex-wrap: wrap; gap: .5rem; }
.qp-opts .chk { max-width: 100%; }
.qp-opts .chk span { overflow-wrap: anywhere; }
.qp-conv { margin: 0; padding: .7rem .9rem; border-radius: 10px; background: var(--sand); color: var(--text); font-size: .9rem; border-inline-start: 4px solid var(--copper-ink); }
.qp-req { color: var(--copper-ink); }
.qp-err, .qp-cerr { margin: 0; font-size: .85rem; font-weight: 600; color: #b3261e; }
.qp-cerr { font-size: .78rem; }
.qp-err::before, .qp-cerr::before { content: "⚠ "; }
.qp-form [aria-invalid="true"] { border-color: #b3261e !important; border-width: 2px !important; }
.qp-errsum { margin: 0; font-weight: 600; color: #b3261e; border-inline-start: 3px solid currentColor; padding-inline-start: .8rem; }
.qp-errsum p { margin: 0 0 .4rem; }
.qp-errsum ul { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: .2rem; font-weight: 500; }
.qp-errsum a { color: inherit; }
:root[data-theme="dark"] .qp-err, :root[data-theme="dark"] .qp-cerr, :root[data-theme="dark"] .qp-errsum { color: #ffb4ab; }
:root[data-theme="dark"] .qp-form [aria-invalid="true"] { border-color: #ffb4ab !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .qp-err, :root:not([data-theme="light"]) .qp-cerr, :root:not([data-theme="light"]) .qp-errsum { color: #ffb4ab; }
  :root:not([data-theme="light"]) .qp-form [aria-invalid="true"] { border-color: #ffb4ab !important; }
}
.qp-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.qp-actions .btn { cursor: pointer; font: inherit; font-weight: 650; }
.qp-tool .btn:focus-visible, .qp-tool button:focus-visible, .qp-tool a:focus-visible, .qp-tool summary:focus-visible, .qp-tool [tabindex]:focus-visible, .qp-tool input:focus-visible, .qp-tool select:focus-visible, .qp-tool textarea:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
.qp-danger { color: #b3261e !important; }
:root[data-theme="dark"] .qp-danger { color: #ffb4ab !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qp-danger { color: #ffb4ab !important; } }
.qp-empty { margin: 0; font-size: .9rem; color: var(--muted); font-style: italic; }
.qp-gmsg, .qp-genmsg, .qp-impmsg, .qp-count, .qp-pdfmsg { margin: 0; font-size: .9rem; font-weight: 600; color: var(--g-text); }
.qp-gmsg:empty, .qp-genmsg:empty, .qp-impmsg:empty, .qp-pdfmsg:empty { display: none; }
.qp-count { color: var(--text); }

/* Groupes */
.qp-groups { display: grid; gap: .8rem; }
.qp-group { border: 1px dashed var(--line) !important; border-radius: 12px; padding: .7rem .9rem 1rem !important; display: grid; gap: .7rem; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.qp-group > legend { font-size: .92rem; padding: 0 .3rem; margin: 0; overflow-wrap: anywhere; }
.qp-gsel { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); align-items: end; }
.qp-gsel .btn { justify-self: start; }

/* Génération, import */
.qp-gen, .qp-imp { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .9rem; background: var(--paper); }
.qp-gen summary, .qp-imp summary { cursor: pointer; font-weight: 650; }
.qp-genbox { display: grid; gap: .8rem; padding-top: .8rem; }
.qp-genbox .hint { margin: 0; }
.qp-imp textarea { font-family: var(--mono); font-size: .85rem !important; }

/* Tableau des lots (édition) */
.qp-tablewrap { position: relative; overflow-x: auto; max-width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.qp-lots { border-collapse: collapse; width: 100%; font-size: .9rem; }
.qp-lots th, .qp-lots td { padding: .35rem .35rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.qp-lots thead th { font-size: .78rem; color: var(--muted); font-weight: 700; white-space: nowrap; position: sticky; top: 0; background: var(--paper); }
.qp-lots thead th small { display: block; font-weight: 500; }
.qp-lots thead th.qp-n { font-family: var(--sans); white-space: normal; }
.qp-lots .qp-n { color: var(--muted); font-family: var(--mono); font-size: .8rem; text-align: center; padding-top: .7rem; }
.qp-tool .form .qp-lots input:not([type=checkbox]), .qp-tool .form .qp-lots select { padding: .42rem .5rem; font-size: .9rem; border-radius: 8px; }
.qp-lots .qp-c-txt input { min-width: 6.5rem; }
.qp-lots .qp-c-num input, .qp-lots .qp-c-int input, .qp-lots .qp-c-lvl input { min-width: 5.2rem; font-family: var(--mono); }
.qp-lots .qp-c-int input, .qp-lots .qp-c-lvl input { min-width: 3.6rem; }
.qp-lots .qp-c-nat select { min-width: 8rem; }
.qp-gcell { display: flex; gap: .35rem; align-items: center; }
.qp-gcell input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--green); flex: none; margin: .4rem .2rem; }
.qp-lots .qp-util { min-width: 3.8rem; max-width: 5rem; font-family: var(--mono); }
.qp-lots .qp-util:disabled { opacity: .5; }
.qp-rowbtns { display: flex; gap: .25rem; }
.qp-ib { display: inline-grid; place-items: center; font: 600 .95rem var(--sans); min-width: 2.1rem; min-height: 2.1rem; padding: 0 .3rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.qp-ib:hover:not(:disabled) { border-color: var(--text); }
.qp-ib:disabled { opacity: .4; cursor: default; }

/* Budget */
.qp-brows { display: grid; gap: .7rem; }
.qp-brow { display: grid; gap: .6rem .8rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: end; padding-bottom: .7rem; border-bottom: 1px dashed var(--line); }
@media (max-width: 760px) { .qp-brow { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .qp-brow .qp-field:first-child { grid-column: 1 / -1; } }
@media (max-width: 420px) { .qp-brow { grid-template-columns: minmax(0, 1fr); } }
.qp-brow .qp-ib { justify-self: start; }

/* Résultat */
.qp-out:empty { display: none; }
.qp-out { margin-top: 1.6rem; }
.qp-result { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.qp-result > * { min-width: 0; }
.qp-h { margin: 0; font-size: 1.5rem; }
.qp-h:focus { outline: none; }
.qp-result h3 { margin: 0 0 .5rem; font-size: 1.05rem; }
.qp-result ul { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .35rem; }
.qp-tag { font: 700 .72rem var(--sans); border: 1px solid currentColor; border-radius: 999px; padding: .05rem .45rem; margin-inline-start: .3rem; vertical-align: middle; white-space: nowrap; }
.qp-card { background: var(--ink); color: #eeecff; border-radius: 14px; padding: 1.4rem 1.6rem; }
.qp-kv { margin: 0; display: grid; gap: .9rem 1.4rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.qp-kv > div { min-width: 0; }
.qp-kv dt { font-size: .8rem; color: rgba(236, 234, 255, .8); }
.qp-kv dd { margin: .15rem 0 0; font-family: var(--mono); font-size: 1.05rem; overflow-wrap: anywhere; }
.qp-kv dd.qp-txt { font-family: var(--sans); font-weight: 650; }
.qp-kv dd.qp-big { font-size: 1.35rem; color: #fff; }
.qp-kv small { display: block; font-size: .74rem; color: rgba(236, 234, 255, .8); font-family: var(--sans); margin-top: .15rem; }
.qp-warn, .qp-info, .qp-ok, .qp-how, .qp-help, .qp-exports { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.3rem; }
.qp-warn { border-inline-start: 4px solid #b3261e; }
.qp-warn h3::before { content: "⚠ "; }
.qp-ok { border-inline-start: 4px solid var(--g-text); }
.qp-ok h3::before { content: "✓ "; }
.qp-ok p { margin: 0; }
.qp-info { border-inline-start: 4px solid var(--n-text); }
.qp-how { border-inline-start: 4px solid var(--copper-ink); }
.qp-help { background: var(--sand); }
.qp-help p { margin: 0 0 .9rem; }
.qp-exports .qp-actions { margin-bottom: .3rem; }
.qp-result .note { margin: 0; }
.qp-block { display: grid; gap: .5rem; min-width: 0; }
.qp-block .hint { margin: 0; }

.qp-res { border-collapse: collapse; width: 100%; font-size: .88rem; }
.qp-res th, .qp-res td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
.qp-res thead th { font-size: .78rem; color: var(--muted); vertical-align: bottom; }
.qp-res thead th small { display: block; font-weight: 500; }
.qp-res td { font-family: var(--mono); }
.qp-res td:not(.qp-num) { font-family: var(--sans); }
.qp-res .qp-num { text-align: end; }
.qp-res .qp-strong { font-weight: 700; }
.qp-res tfoot th, .qp-res tfoot td { font-weight: 700; border-top: 2px solid var(--text); background: var(--sand); }
@media (max-width: 600px) {
  .qp-tablewrap:has(.qp-res) { border: 0; background: transparent; overflow: visible; }
  .qp-res { min-width: 0; }
  .qp-res thead { display: none; }
  .qp-res tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .2rem .8rem; padding: .6rem .2rem; border-bottom: 1px solid var(--line); }
  .qp-res th, .qp-res td { border: 0; padding: .1rem 0; white-space: normal; overflow-wrap: anywhere; text-align: start !important; }
  .qp-res th[scope=row] { grid-column: 1 / -1; font-size: 1rem; }
  .qp-res td::before { content: attr(data-h); display: block; font: 600 .72rem var(--sans); color: var(--muted); }
  .qp-res td:empty { display: none; }
  .qp-res tfoot tr { background: var(--sand); border-radius: 10px; }
  .qp-res tfoot th, .qp-res tfoot td { background: transparent; border: 0; }
}

/* Graphique en barres */
.qp-chart { margin: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; min-width: 0; }
.qp-chart figcaption { margin-bottom: .7rem; }
.qp-chart figcaption .hint { display: block; margin: .2rem 0 0; font-weight: 400; }
.qp-chart ul { list-style: none; padding: 0 !important; margin: 0; display: grid; gap: .3rem !important; }
.qp-chart li { display: grid; grid-template-columns: minmax(3rem, 6rem) minmax(0, 1fr) auto; gap: .6rem; align-items: center; font-size: .85rem; }
.qp-bl { font-family: var(--mono); overflow-wrap: anywhere; }
.qp-bar { display: block; height: .95rem; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.qp-bar span { display: block; height: 100%; background: var(--copper); }
.qp-bv { font-family: var(--mono); white-space: nowrap; }
@media (max-width: 420px) { .qp-chart li { grid-template-columns: minmax(2.5rem, 4rem) minmax(0, 1fr); } .qp-bv { grid-column: 2; font-size: .78rem; } }

.qp-print-only { display: none; }
@media (prefers-reduced-motion: reduce) { .qp-tool * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
.a11y-rm .qp-tool * { transition: none !important; animation: none !important; }

/* Impression : seulement le résultat */
@media print {
  body:has(.qp-tool) .top, body:has(.qp-tool) .foot, body:has(.qp-tool) .page-head, body:has(.qp-tool) .skip, body:has(.qp-tool) main > *:not(.qp-sec), body:has(.qp-tool) .a11y { display: none !important; }
  .qp-form, .qp-privacy, .qp-restored, .qp-exports, .qp-help .qp-actions { display: none !important; }
  .qp-sec { padding: 0 !important; }
  .qp-out { margin: 0; }
  .qp-print-only { display: block; font-weight: 700; margin: 0; }
  .qp-card { background: #fff !important; color: #000 !important; border: 1px solid #000; }
  .qp-kv dt, .qp-kv small, .qp-kv dd.qp-big { color: #000 !important; }
  .qp-tablewrap { overflow: visible !important; border: 0; }
  .qp-res { font-size: 8.5pt; }
  .qp-res thead { display: table-header-group !important; }
  .qp-res tr { display: table-row !important; }
  .qp-res th, .qp-res td { display: table-cell !important; white-space: normal; padding: .2rem .35rem; }
  .qp-res td::before { content: none !important; }
  .qp-chart, .qp-warn, .qp-info, .qp-ok, .qp-how, .qp-help { break-inside: avoid; background: #fff !important; }
  .qp-bar span { background: #555 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .qp-result a { color: #000; }
}

/* Petits écrans et texte agrandi : marges intérieures réduites pour garder de la place au contenu */
@media (max-width: 640px) {
  .qp-tool .qp-formbox { padding: .9rem .7rem; }
  .qp-fs { padding: .8rem .6rem .9rem !important; border-radius: 10px; }
  .qp-group, .qp-sub { padding: .6rem .5rem .8rem !important; }
  .qp-gen, .qp-imp { padding: .5rem .6rem; }
  .qp-card, .qp-warn, .qp-info, .qp-ok, .qp-how, .qp-help, .qp-exports, .qp-chart { padding: .9rem .8rem; }
}
