/* Mes rapports (reports.js), signature (signature-pad.js), paramétrage (report-settings.js). Palette de la charte (style.css). */
.rp-status { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: .8rem; font-weight: 600; background: var(--brand-soft); color: var(--brand); }
.rp-st-draft { background: #eeece6; color: var(--muted); }
.rp-st-sent { background: #dcecfa; color: #1d5f9c; }
.rp-st-warn { background: var(--warn-bg); color: var(--warn); }
.rp-st-review { background: #efe6fa; color: #5b3ea8; }
.rp-st-ok { background: var(--ok-bg); color: var(--ok); }
.rp-st-closed { background: var(--brand); color: var(--on-brand); }
.rp-tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: var(--radius-pill); font-size: .75rem; background: #eeece6; color: var(--muted); }
.rp-tag-bad { background: var(--bad-bg); color: var(--bad); }
.rp-tag-watch { background: var(--ok-bg); color: var(--ok); }
.rp-watch-note { margin: 0 0 8px; }
.rw-cats legend, .rw-sites legend { font-weight: 600; }
.rw-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; justify-content: space-between; }
.rw-sensitive { border-left: 3px solid var(--bad); padding-left: 10px; }
.rp-warn { color: var(--bad); }

.rp-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.rp-template { display: flex; align-items: center; gap: 12px; }
.rp-template .stack-sm { flex: 1; }
.rp-template h3 { margin: 0; font-size: 1rem; }
.rp-template-ico { color: var(--sage); }

.rp-row { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 12px 14px; }
.rp-row:hover, .rp-row:focus-visible { border-color: var(--sage); }
.rp-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rp-row-main p { margin: 0; overflow-wrap: anywhere; }
.rp-row-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rp-row-title { font-weight: 600; }
.rp-urgent { border-left: 4px solid var(--bad); }

.rp-back { align-self: flex-start; }
/* En-tête de la fiche d'un rapport : la règle « .rp-head » de la feuille commune (frise des projets) la rendait collante et couvrait la fiche sur téléphone. */
.card.rp-head { position: static; z-index: auto; min-height: 0; background: var(--surface); border-top: 1px solid var(--line); }
.rp-head h2 { margin: 6px 0 10px; font-size: 1.25rem; color: var(--brand); }
.rp-sub { color: var(--sage); font-weight: 500; font-size: 1rem; }
.rp-head-top { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.rp-meta { display: grid; grid-template-columns: 150px 1fr; gap: 4px 12px; margin: 0; }
.rp-meta dt { color: var(--muted); font-size: .85rem; }
.rp-meta dd { margin: 0; overflow-wrap: anywhere; }
.rp-intro { color: var(--muted); font-size: .92rem; }

.rp-section > summary { cursor: pointer; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 10px; list-style: none; }
.rp-section > summary::-webkit-details-marker { display: none; }
.rp-section > summary::after { content: '▾'; margin-left: auto; color: var(--sage); }
.rp-section:not([open]) > summary::after { content: '▸'; }
.rp-step { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-size: .85rem; }
.rp-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-top: 12px; }
.rp-wide, .rp-fields .rp-info, .rp-fields fieldset { grid-column: 1 / -1; }
.rp-field textarea { min-height: 140px; width: 100%; }
.rp-field input, .rp-field select { width: 100%; }
.rp-field legend { font-weight: 600; }
.rp-nature { margin-left: 8px; font-size: .72rem; font-weight: 600; padding: 1px 6px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); vertical-align: middle; }
.rp-help { margin: 0 0 4px; }
.rp-info { margin: 0; padding: 8px 12px; border-radius: var(--radius-sm); background: #eff3ed; color: var(--brand); font-size: .9rem; }
.req { color: var(--bad); }
.rp-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.rp-att-list { margin: 4px 0; padding-left: 18px; }

.rp-read { display: grid; gap: 0; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.rp-kv { display: grid; grid-template-columns: 240px 1fr; border-top: 1px solid var(--line); }
.rp-kv:first-child { border-top: 0; }
.rp-k { background: #eff3ed; padding: 8px 10px; font-weight: 600; font-size: .86rem; color: var(--brand); }
.rp-v { padding: 8px 10px; overflow-wrap: anywhere; }
.rp-kv-long { grid-template-columns: 1fr; }
.rp-text { white-space: pre-wrap; }

.rp-actions { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; box-shadow: 0 -2px 8px rgba(32, 42, 37, .08); }
.rp-actions .row { gap: 8px; }
.rp-save { min-height: 1.2em; }
.rp-missing { padding-left: 18px; }

.rp-sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rp-sig { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 4px; }
.rp-sig p { margin: 0; }
.rp-sig.done { border-color: var(--sage); background: #f6f8f4; }
.rp-sig.refused { border-color: var(--bad); }
.rp-comments { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.rp-c { border-left: 3px solid var(--line-strong); padding: 4px 10px; }
.rp-c p { margin: 0; }
.rp-c-request { border-left-color: var(--warn); }
.rp-c-decision, .rp-c-observation { border-left-color: var(--brand); }
.rp-versions, .rp-history { padding-left: 18px; }

/* Signature */
.sig-dialog .dlg { max-width: 560px; }
.sig-wrap { position: relative; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: #fff; width: 100%; }
.sig-canvas { display: block; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; margin: 0; }
.sig-line { position: absolute; left: 16px; right: 16px; bottom: 36px; border-bottom: 1px solid var(--line); pointer-events: none; }
.sig-saved { max-width: 100%; max-height: 120px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.sig-meta p { margin: 0 0 2px; }

/* Paramétrage */
.rt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rt-section > summary { cursor: pointer; font-weight: 700; color: var(--brand); display: flex; align-items: center; gap: 8px; }
.rt-field { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; display: grid; gap: 8px; background: #fcfbf8; }
.rt-field-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rt-tools { margin-left: auto; display: flex; gap: 4px; }
.rt-preview { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 8px 0; }
.rr-table { width: 100%; }

@media (max-width: 720px) {
  .rp-fields { grid-template-columns: 1fr; }
  .rp-meta { grid-template-columns: 1fr; }
  .rp-meta dt { margin-top: 6px; }
  .rp-kv { grid-template-columns: 1fr; }
  .rp-row { flex-wrap: wrap; }
  .rp-actions { padding: 10px; }
  .rp-actions .row > * { flex: 1 1 auto; }
  .rr-table { display: block; overflow-x: auto; }
}
.rw-meta { display: block; font-weight: 400; }
.rw-rights .check { align-items: flex-start; }

/* Tous les rapports : résumé du périmètre réellement autorisé */
.rw-summary { background: var(--surface-2, #F4F2EC); border-radius: 10px; padding: 12px 14px; }
.rw-summary h4 { margin: 0; }
.rw-summary-list { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 4px 14px; margin: 0; font-size: .92rem; }
.rw-summary-list dt { color: var(--muted, #5b625d); }
.rw-summary-list dd { margin: 0; }
.rw-scope-list { margin: 0; padding-left: 18px; }
@media (max-width: 560px) { .rw-summary-list { grid-template-columns: 1fr; } .rw-summary-list dd { margin-bottom: 6px; } }

/* Rapports reçus : rapport non lu */
.rp-row.rp-unread { border-left: 4px solid var(--badge, #C0362C); }
.rp-row.rp-unread .rp-row-title { font-weight: 700; }
.rp-tag-new { background: var(--badge, #C0362C); color: #fff; }
.rp-filter-note { font-size: .88rem; }

/* Signatures demandées, suivi des signatures, transmission (PR rapports multisignatures) */
.rp-tag-sign { background: var(--warn-bg, #fdf3dc); color: var(--warn, #8a5a00); font-weight: 600; }
.rp-st-bad { background: var(--bad-bg, #fbe7e5); color: var(--bad, #b02e26); }
.rp-signer-list, .rp-track { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rp-signer, .rp-track-item { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.rp-signer > span:first-child, .rp-track-name { flex: 1 1 180px; min-width: 0; }
.rp-track-head { align-items: center; gap: 10px; }
.rp-track-head h3 { margin: 0; }
.rp-pick-list { max-height: 46vh; overflow: auto; }
.rp-pick-off { opacity: .65; }
.rp-pick-off .rp-tag { margin-left: 6px; }
.rp-dl { gap: 6px; }
.rp-dl .nav-ico, .rp-dl svg { width: 16px; height: 16px; }
.rp-sign-note { border-left: 4px solid var(--brand); }

/* Rôles d'une personne sur un rapport (15/11) : destinataire principal, signataire, validateur, copie automatique — compacts, lisibles sur téléphone. */
.rp-role { margin-left: 0; margin-right: 4px; }
.rp-row-head .rp-role, .rp-meta .rp-role { margin-left: 4px; margin-right: 0; }
.rp-role-main { background: #e7eefb; color: #1f4d8f; font-weight: 600; }
.rp-role-sign { background: var(--warn-bg, #fdf3dc); color: var(--warn, #8a5a00); }
.rp-role-valid { background: #efe7f8; color: #5b2f8f; }
#rp-addressee-list .rp-tag { margin-left: 0; }

/* « Destinataires du rapport » (création, brouillon) : multisélection + personnes choisies, retirables. */
.rp-to { display: flex; flex-direction: column; gap: 6px; }
.rp-to .ms, .rp-to .ms-btn { width: 100%; max-width: 520px; }
.rp-to-chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rp-to-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.rp-to-chip > span { overflow-wrap: anywhere; }
.rp-to-none { padding: 2px 0; }

/* Accueil simplifié (refonte finale du 21/11/2026) : trois entrées, sans sous-menus supplémentaires. */
.rp-home { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.rp-home-tile { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; padding: 12px 14px; text-align: left; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; min-height: 64px; }
.rp-home-tile:hover { border-color: var(--brand); }
.rp-home-tile.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--brand-soft); }
.rp-home-tile:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.rp-home-label { font-weight: 700; }
.rp-home-n { grid-row: span 2; align-self: center; min-width: 28px; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--surface-2); text-align: center; font-weight: 700; }
.rp-home-hint { grid-column: 1; }
.rp-todo { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.rp-todo-sign, .rp-todo-validate { background: var(--warn-bg, #fdf3dc); color: var(--warn, #8a5a00); }

/* Écran unique « Nouveau rapport » */
.rp-compose .rt-field { width: 100%; }
.rp-compose .rt-area { max-height: 70vh; overflow-y: auto; }
.rp-compose #rp-title { width: 100%; font-size: 1.05rem; }
.rp-actions-field { border: 0; padding: 0; margin: 0; min-width: 0; }
.rp-actions-field legend { font-weight: 600; margin-bottom: 4px; }
.rp-action-opt { align-items: flex-start; }
.rp-identity-missing p { margin: 0 0 4px; }
.rp-identity-ok { margin: 0; }
.rp-advanced > summary { cursor: pointer; font-weight: 600; }
.rp-advanced[open] > summary { margin-bottom: 10px; }
.rp-free-body .rt-view { max-width: 72ch; }
.rp-action-list { display: grid; gap: 4px; }

/* Nouveau rapport (largeur d'affichage, 21/11/2026) : une colonne, puis sur grand écran la rédaction à gauche et les réglages d'envoi à
   droite, pour ne pas étirer l'éditeur sur toute la largeur. La page A4 de l'aperçu est le PDF lui-même : ses proportions ne changent pas. */
.rp-compose-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 1200px) {
  .rp-compose-card { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 28px; align-items: start; }
  .rp-compose-side { padding-left: 24px; border-left: 1px solid var(--line); }
}
