/* Texte enrichi : éditeur commun (rt-field) et affichage commun (rt-view). Couleurs : palette fermée, mêmes teintes que lib/rich-text.js et les PDF. */
.rt-c-red { color: #b42318; }
.rt-c-blue { color: #1d5f9c; }
.rt-c-green { color: #14633b; }
.rt-c-orange { color: #b45309; }
.rt-c-purple { color: #6b3fa0; }
.rt-c-gray { color: #5f6b5c; }

/* Affichage : retours à la ligne, listes, mots longs et liens collés sans débordement horizontal (mobile compris). */
.rt-view { overflow-wrap: anywhere; word-break: normal; max-width: 100%; line-height: 1.5; }
.rt-view.rt-plain { white-space: pre-wrap; }
.rt-view p { margin: 0; min-height: 1.5em; white-space: pre-wrap; }
.rt-view ul, .rt-view ol, .rt-area ul, .rt-area ol { margin: .25em 0; padding-left: 1.5em; }
.rt-view li, .rt-area li { margin: .1em 0; white-space: pre-wrap; }
.rt-view ul ul, .rt-area ul ul { list-style-type: circle; }
.rt-view strong, .rt-area strong, .rt-area b { font-weight: 700; }
.rt-view em, .rt-area em, .rt-area i { font-style: italic; }
.rt-view u, .rt-area u { text-decoration: underline; }
/* Titres (zones qui les acceptent : contenu d'un rapport) — mêmes proportions que le PDF. */
.rt-view h2, .rt-area h2 { margin: .9em 0 .3em; font-size: 1.18em; font-weight: 700; color: var(--brand, #3e4d3e); line-height: 1.3; }
.rt-view h3, .rt-area h3 { margin: .7em 0 .25em; font-size: 1.05em; font-weight: 700; color: var(--brand, #3e4d3e); line-height: 1.3; }
.rt-view > h2:first-child, .rt-view > h3:first-child, .rt-area > h2:first-child, .rt-area > h3:first-child { margin-top: 0; }
.rt-heads .rt-btn { font-size: .82em; }

/* Éditeur */
.rt-field { border: 1px solid var(--line, #cfd6cc); border-radius: 8px; background: #fff; max-width: 100%; position: relative; }
.rt-field:focus-within { border-color: var(--brand, #2f6b3a); box-shadow: 0 0 0 2px rgba(47, 107, 58, .15); }
.rt-toolbar { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 4px 6px; border-bottom: 1px solid var(--line, #e3e7e0); background: #f7f8f5; border-radius: 8px 8px 0 0; }
.rt-group { display: inline-flex; gap: 2px; align-items: center; position: relative; }
.rt-btn { min-width: 34px; height: 34px; padding: 0 6px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #202a25; font: inherit; font-size: .95em; line-height: 1; cursor: pointer; }
.rt-btn:hover { background: #e8ece4; }
.rt-btn:focus-visible { outline: 2px solid var(--brand, #2f6b3a); outline-offset: 1px; }
.rt-btn[aria-pressed="true"] { background: #dfe7da; border-color: #b9c7b2; }
.rt-bold { font-weight: 700; }
.rt-italic { font-style: italic; font-family: Georgia, serif; }
.rt-underline { text-decoration: underline; }
.rt-color { font-weight: 700; text-decoration: underline; text-decoration-color: #b42318; text-decoration-thickness: 3px; }
.rt-plain[data-cmd="plain"] { font-size: .85em; }
.rt-palette { position: absolute; top: 38px; left: 0; z-index: 30; display: grid; grid-template-columns: repeat(7, 30px); gap: 4px; padding: 6px; background: #fff; border: 1px solid #cfd6cc; border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.rt-palette[hidden] { display: none; }
.rt-swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #b8c0b4; cursor: pointer; padding: 0; }
.rt-swatch:focus-visible { outline: 2px solid #202a25; }
.rt-sw-default { background: #202a25; }
.rt-sw-red { background: #b42318; }
.rt-sw-blue { background: #1d5f9c; }
.rt-sw-green { background: #14633b; }
.rt-sw-orange { background: #b45309; }
.rt-sw-purple { background: #6b3fa0; }
.rt-sw-gray { background: #5f6b5c; }
.rt-area { padding: 8px 10px; outline: none; overflow-wrap: anywhere; line-height: 1.5; max-height: 60vh; overflow-y: auto; color: #202a25; -webkit-user-modify: read-write; }
.rt-area p, .rt-area div { margin: 0; min-height: 1.5em; }
.rt-area.is-empty::before { content: attr(data-placeholder); color: #8a948a; pointer-events: none; position: absolute; }
.rt-count { display: block; text-align: right; padding: 0 8px 4px; }
.rt-count.over { color: #b42318; font-weight: 600; }
.rt-preview-tag { display: inline-block; margin: 0 0 8px; padding: 2px 8px; border-radius: 10px; background: #fde9d3; color: #8a4a0c; font-size: .85em; font-weight: 600; }
.rt-preview { border: 1px dashed #cfd6cc; border-radius: 8px; padding: 10px 12px; margin: 8px 0 12px; }
@media (max-width: 640px) {
  .rt-toolbar { gap: 2px 6px; }
  .rt-btn { min-width: 38px; height: 38px; }
  .rt-palette { grid-template-columns: repeat(4, 34px); }
  .rt-swatch { width: 34px; height: 34px; }
}
