/*
 * Mnémosyne — feuille de style unique.
 * Charte : cahier des charges, section 4.7 (fond ivoire, gris chauds, titres en serif,
 * accent terre cuite). Polices libres servies en local. Aucun style en ligne.
 */

/* ---- Polices ---------------------------------------------------------------------------- */

@font-face {
	font-family: "Inter";
	font-style: normal;
	font-weight: 100 900;
	font-display: swap;
	src: url("../polices/inter-latin-wght-normal.woff2") format("woff2");
}

@font-face {
	font-family: "Inter";
	font-style: italic;
	font-weight: 100 900;
	font-display: swap;
	src: url("../polices/inter-latin-wght-italic.woff2") format("woff2");
}

@font-face {
	font-family: "Source Serif 4";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../polices/source-serif-4-latin-400-normal.woff2") format("woff2");
}

@font-face {
	font-family: "Source Serif 4";
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url("../polices/source-serif-4-latin-500-normal.woff2") format("woff2");
}

@font-face {
	font-family: "JetBrains Mono";
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url("../polices/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}

/* ---- Jetons ----------------------------------------------------------------------------- */

:root {
	--fond: #faf9f5;
	--fond-2: #f5f4ed;
	--surface: #ffffff;
	--bordure: #f0eee6;
	--bordure-forte: #dedcd1;
	--texte: #141413;
	--texte-2: #5e5d59;
	--texte-3: #87867f;
	--accent: #d97757;
	--accent-survol: #c6613f;
	--erreur: #bf4d43;
	--succes: #629987;
	--info: #6a9bcc;
	--secondaire-fond: #e8e6dc;
	--secondaire-texte: #4d4c48;
	/* Teintes des pastilles (« teintes » des modèles) : fond, puis texte (contraste ≥ 5:1) */
	--teinte-gris: #e8e6dc;
	--teinte-gris-texte: #4d4c48;
	--teinte-brun: #eadccd;
	--teinte-brun-texte: #6b4a2f;
	--teinte-orange: #f6dcc8;
	--teinte-orange-texte: #8c4517;
	--teinte-ambre: #f3e5b5;
	--teinte-ambre-texte: #6f5513;
	--teinte-vert: #d6e6dc;
	--teinte-vert-texte: #2c5a47;
	--teinte-bleu: #d7e4f0;
	--teinte-bleu-texte: #2b5279;
	--teinte-violet: #e3ddf0;
	--teinte-violet-texte: #523f7d;
	--teinte-rose: #f3d9e1;
	--teinte-rose-texte: #86344f;
	--teinte-rouge: #f6d4cf;
	--teinte-rouge-texte: #93271d;
	--ombre: 0 4px 20px rgba(0, 0, 0, .04);
	--rayon-carte: 14px;
	--rayon: 8px;
	--rayon-petit: 4px;
	--police-texte: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--police-titres: "Source Serif 4", Georgia, "Times New Roman", serif;
	--police-code: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
	--largeur-panneau: 280px;
	--hauteur-barre: 56px;
}

/* ---- Base ------------------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--fond);
	color: var(--texte);
	font-family: var(--police-texte);
	font-size: 15px;
	line-height: 1.5;
	font-feature-settings: "cv11", "ss01";
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-family: var(--police-titres);
	font-weight: 500;
	line-height: 1.25;
	margin: 1.6em 0 .5em;
}

h1 {
	font-size: 32px;
	font-weight: 400;
	margin-top: 0;
}

h2 {
	font-size: 24px;
}

h3 {
	font-size: 19px;
}

h4,
h5,
h6 {
	font-size: 16px;
}

p,
ul,
ol,
dl,
table,
pre,
blockquote {
	margin: 0 0 1em;
}

a {
	color: var(--texte);
	text-decoration: underline;
	text-decoration-color: var(--accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

a:hover {
	text-decoration-color: var(--accent-survol);
	text-decoration-thickness: 2px;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

code,
kbd,
samp,
pre {
	font-family: var(--police-code);
	font-size: 13px;
}

:not(pre) > code {
	background: var(--fond-2);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon-petit);
	padding: .1em .35em;
}

pre {
	background: var(--fond-2);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	padding: 12px 16px;
	overflow-x: auto;
	line-height: 1.45;
}

blockquote {
	border-left: 3px solid var(--bordure-forte);
	color: var(--texte-2);
	padding: 0 0 0 16px;
	margin-left: 0;
}

hr {
	border: 0;
	border-top: 1px solid var(--bordure-forte);
	margin: 2em 0;
}

img {
	max-width: 100%;
	height: auto;
}

mark {
	background: #f3dccf;
	color: var(--texte);
	border-radius: 2px;
	padding: 0 .1em;
}

.visuellement-cache {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.discret {
	color: var(--texte-2);
}

.indication {
	color: var(--texte-3);
	font-size: 13px;
}

.chemin {
	font-family: var(--police-code);
	font-size: 12.5px;
	color: var(--texte-2);
}

/* ---- Mise en page ----------------------------------------------------------------------- */

.bascule-panneau {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.barre {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 12px;
	height: var(--hauteur-barre);
	padding: 0 16px;
	background: var(--fond);
	border-bottom: 1px solid var(--bordure);
}

.bouton-panneau {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: var(--rayon);
	color: var(--texte-2);
	cursor: pointer;
}

.bouton-panneau:hover,
.bascule-panneau:focus-visible + .barre .bouton-panneau {
	background: var(--fond-2);
	color: var(--texte);
}

.bascule-panneau:focus-visible + .barre .bouton-panneau {
	outline: 2px solid var(--accent);
}

.marque {
	font-family: var(--police-titres);
	font-size: 20px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}

.recherche-rapide {
	flex: 1;
	max-width: 420px;
	margin-left: 12px;
}

.recherche-rapide input {
	width: 100%;
}

.compte {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-left: auto;
	font-size: 14px;
	color: var(--texte-2);
	white-space: nowrap;
}

.compte form {
	margin: 0;
}

.compte-nom {
	color: var(--texte);
	font-weight: 500;
}

.cadre {
	display: grid;
	grid-template-columns: var(--largeur-panneau) minmax(0, 1fr);
	min-height: calc(100vh - var(--hauteur-barre));
}

.ecran-simple .cadre,
.cadre:not(:has(.panneau)) {
	grid-template-columns: minmax(0, 1fr);
}

.bascule-panneau:checked ~ .cadre {
	grid-template-columns: minmax(0, 1fr);
}

.bascule-panneau:checked ~ .cadre .panneau {
	display: none;
}

.panneau {
	position: sticky;
	top: var(--hauteur-barre);
	align-self: start;
	height: calc(100vh - var(--hauteur-barre));
	overflow-y: auto;
	padding: 16px 12px 32px;
	background: var(--fond-2);
	border-right: 1px solid var(--bordure);
	font-size: 13px;
}

.panneau h2 {
	font-family: var(--police-texte);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--texte-3);
	margin: 20px 8px 6px;
}

.panneau h2:first-child {
	margin-top: 4px;
}

.panneau ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

/*
 * Arbre : chaque ligne commence par une case de symbole de largeur fixe (--case-symbole) —
 * triangle d'un dossier, icône d'une page —, puis le texte. Les éléments d'un même niveau
 * commencent donc au même endroit ; un niveau plus bas se décale d'une case, sous le texte
 * de son parent.
 */
.panneau {
	--case-symbole: 1.5em;
}

.panneau ul ul {
	padding-left: var(--case-symbole);
}

.panneau a {
	display: block;
	padding: 3px 8px;
	border-radius: var(--rayon-petit);
	text-decoration: none;
	color: var(--texte);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/*
 * Dossier : une ligne avec le bouton de pliage (le <summary>, qui ne contient que le triangle)
 * dans la case de symbole, puis le lien. Le contenu du dossier, qui suit la ligne, est masqué
 * quand le <details> est fermé.
 */
.panneau .ligne {
	display: flex;
	align-items: baseline;
	padding-left: 6px;
	border-radius: var(--rayon-petit);
}

.panneau .ligne details {
	flex: none;
}

.panneau summary {
	display: block;
	width: var(--case-symbole);
	padding: 3px 0;
	border-radius: var(--rayon-petit);
	text-align: center;
	cursor: pointer;
	list-style: none;
}

.panneau summary::-webkit-details-marker {
	display: none;
}

.panneau summary::before {
	content: "▸";
	display: inline-block;
	color: var(--texte-3);
	transition: transform .15s;
}

.panneau details[open] > summary::before {
	transform: rotate(90deg);
}

.panneau .ligne > a {
	flex: 1 1 auto;
	min-width: 0;
	padding-left: 0;
}

.panneau li:has(> .ligne details:not([open])) > ul {
	display: none;
}

/* Emoji du type de la page (« icone » du modèle) */
.icone-type {
	display: inline-block;
	width: 1.5em;
	text-align: center;
	font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
	font-style: normal;
	line-height: 1;
}

.vue td:first-child .icone-type {
	margin-right: 2px;
}

.panneau .icone-type {
	width: var(--case-symbole);
}

/* Page : son icône dans la case de symbole ; sans icône, la case reste vide */
.panneau li > a {
	padding-left: 6px;
}

.panneau li > a:not(:has(.icone-type)) {
	padding-left: calc(6px + var(--case-symbole));
}

.panneau a:hover,
.panneau .ligne:hover {
	background: var(--bordure);
}

.panneau .ligne > a:hover {
	background: none;
}

/* Page affichée, ou dossier d'une page affichée hors de l'arbre (aria-current="location") */
.panneau a[aria-current],
.panneau .ligne:has(> a[aria-current]) {
	background: var(--surface);
	box-shadow: inset 2px 0 0 var(--accent);
}

.panneau .ligne > a[aria-current] {
	background: none;
	box-shadow: none;
}

/* Listes de récents : titre-lien vers la page complète, bouton − / + à droite (panneau.js) */
.panneau .titre-section {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	margin: 20px 4px 6px 8px;
}

.panneau .titre-section h2 {
	margin: 0;
	min-width: 0;
}

.panneau h2 a {
	display: inline;
	padding: 0;
	border-radius: 0;
	color: inherit;
}

.panneau h2 a:hover {
	background: none;
	text-decoration: underline;
	text-decoration-color: var(--accent);
}

.panneau .replier {
	flex: none;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: var(--rayon-petit);
	background: none;
	color: var(--texte-3);
	font: 600 15px/1 var(--police-texte);
	cursor: pointer;
}

.panneau .replier:hover {
	background: var(--bordure);
	color: var(--texte);
}

.panneau .replier::before {
	content: "−";
}

[data-recents-masques~="procedures"] [data-replier="procedures"]::before,
[data-recents-masques~="consultees"] [data-replier="consultees"]::before,
[data-recents-masques~="modifiees"] [data-replier="modifiees"]::before {
	content: "+";
}

[data-recents-masques~="procedures"] #liste-procedures,
[data-recents-masques~="consultees"] #recents-consultees,
[data-recents-masques~="modifiees"] #recents-modifiees {
	display: none;
}

/* Projet d'une page récente, après son titre */
.panneau .contexte {
	color: var(--texte-3);
}

.panneau .vide-recents {
	padding: 3px 8px 3px calc(6px + var(--case-symbole));
	color: var(--texte-3);
}

/* Poignée du bord droit (panneau.js) : fixe, car le panneau défile */
.poignee-panneau {
	position: fixed;
	z-index: 5;
	top: var(--hauteur-barre);
	bottom: 0;
	left: calc(var(--largeur-panneau) - 4px);
	width: 8px;
	cursor: col-resize;
	touch-action: none;
}

.poignee-panneau::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 3px;
	width: 2px;
	background: transparent;
	transition: background .15s;
}

.poignee-panneau:hover::after,
.poignee-panneau:focus-visible::after,
.redimensionnement .poignee-panneau::after {
	background: var(--accent);
}

.poignee-panneau:focus-visible {
	outline: 0;
}

.redimensionnement {
	cursor: col-resize;
	user-select: none;
}

.panneau .actions-panneau {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0 4px 12px;
}

.contenu {
	min-width: 0;
	width: 100%;
	max-width: 920px;
	padding: 28px 48px 64px;
}

.contenu-large .contenu,
.contenu.contenu-large {
	max-width: none;
}

.ecran-simple .contenu {
	max-width: 440px;
	margin: 10vh auto 0;
	padding: 16px;
}

.ariane ol {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	list-style: none;
	margin: 0 0 16px;
	padding: 0;
	font-size: 13px;
	color: var(--texte-2);
}

.ariane li + li::before {
	content: "/";
	margin-right: 4px;
	color: var(--texte-3);
}

.ariane a {
	color: var(--texte-2);
	text-decoration: none;
}

.ariane a:hover {
	color: var(--texte);
	text-decoration: underline;
	text-decoration-color: var(--accent);
}

/* ---- Composants ------------------------------------------------------------------------- */

.bouton,
button,
input[type="submit"] {
	font: inherit;
}

.bouton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 36px;
	padding: 6px 14px;
	border: 1px solid transparent;
	border-radius: var(--rayon);
	background: var(--secondaire-fond);
	color: var(--secondaire-texte);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}

.bouton:hover {
	background: var(--bordure-forte);
	color: var(--texte);
}

.bouton-principal {
	background: var(--texte);
	color: var(--fond);
}

.bouton-principal:hover {
	background: #3d3d3a;
	color: var(--fond);
}

.bouton-danger {
	background: transparent;
	border-color: var(--bordure-forte);
	color: var(--erreur);
}

.bouton-danger:hover {
	background: #f6e3e0;
	color: var(--erreur);
}

.bouton-discret {
	background: transparent;
	color: var(--texte-2);
}

.bouton-discret:hover {
	background: var(--fond-2);
}

.lien-bouton {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: inherit;
	text-decoration: underline;
	text-decoration-color: var(--bordure-forte);
	text-underline-offset: 3px;
	cursor: pointer;
}

.lien-bouton:hover {
	color: var(--texte);
	text-decoration-color: var(--accent);
}

.carte {
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon-carte);
	padding: 24px;
	margin-bottom: 24px;
}

.carte > :last-child {
	margin-bottom: 0;
}

.carte-connexion h1 {
	margin-bottom: 4px;
}

.message {
	border-radius: var(--rayon);
	padding: 10px 14px;
	margin: 0 0 16px;
	border: 1px solid;
	font-size: 14px;
}

.message-succes {
	background: #ecf3f0;
	border-color: #c7dbd3;
}

.message-erreur {
	background: #f8e9e7;
	border-color: #e7c3be;
}

.message-info {
	background: #ebf1f8;
	border-color: #c9d9eb;
}

.encadre-erreur {
	background: #f8e9e7;
	border: 1px solid #e7c3be;
	border-left: 3px solid var(--erreur);
	border-radius: var(--rayon);
	padding: 10px 14px;
	margin: 0 0 1em;
	font-size: 14px;
}

.encadre-erreur code {
	background: transparent;
	border: 0;
}

.puce {
	display: inline-block;
	padding: 1px 8px;
	border-radius: 999px;
	background: var(--secondaire-fond);
	color: var(--texte);
	font-size: 13px;
	line-height: 1.5;
	text-decoration: none;
	white-space: nowrap;
}

a.puce:hover {
	text-decoration: underline;
	text-decoration-color: var(--accent);
}

.teinte-gris {
	background: var(--teinte-gris);
	color: var(--teinte-gris-texte);
}

.teinte-brun {
	background: var(--teinte-brun);
	color: var(--teinte-brun-texte);
}

.teinte-orange {
	background: var(--teinte-orange);
	color: var(--teinte-orange-texte);
}

.teinte-ambre {
	background: var(--teinte-ambre);
	color: var(--teinte-ambre-texte);
}

.teinte-vert {
	background: var(--teinte-vert);
	color: var(--teinte-vert-texte);
}

.teinte-bleu {
	background: var(--teinte-bleu);
	color: var(--teinte-bleu-texte);
}

.teinte-violet {
	background: var(--teinte-violet);
	color: var(--teinte-violet-texte);
}

.teinte-rose {
	background: var(--teinte-rose);
	color: var(--teinte-rose-texte);
}

.teinte-rouge {
	background: var(--teinte-rouge);
	color: var(--teinte-rouge-texte);
}

/* Un lien dans une pastille teintée garde la couleur de la pastille */
[class*="teinte-"] a {
	color: inherit;
}

.puces {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

/* ---- Formulaires ------------------------------------------------------------------------ */

input[type="text"],
input[type="search"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
	width: 100%;
	min-height: 36px;
	padding: 6px 10px;
	border: 1px solid var(--bordure-forte);
	border-radius: var(--rayon);
	background: var(--surface);
	color: var(--texte);
	font: inherit;
	font-size: 14px;
}

textarea {
	min-height: 120px;
	resize: vertical;
}

textarea.code,
input.code {
	font-family: var(--police-code);
	font-size: 13px;
}

input:focus,
select:focus,
textarea:focus {
	outline: 2px solid var(--accent);
	outline-offset: -1px;
	border-color: var(--accent);
}

input[type="checkbox"] {
	accent-color: var(--texte);
	width: 16px;
	height: 16px;
}

.formulaire {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.formulaire label,
.champ > label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 14px;
	font-weight: 500;
}

.formulaire label.case,
label.case {
	flex-direction: row;
	align-items: center;
	gap: 8px;
	font-weight: 400;
}

.formulaire .aide {
	font-weight: 400;
	color: var(--texte-3);
	font-size: 13px;
}

.formulaire-ligne {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 10px;
}

.formulaire-ligne > label {
	flex: 1 1 160px;
}

.boutons {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.champ-erreur input,
.champ-erreur select,
.champ-erreur textarea {
	border-color: var(--erreur);
}

.erreur-champ {
	color: var(--erreur);
	font-size: 13px;
	font-weight: 400;
}

.requis::after {
	content: " *";
	color: var(--accent);
}

/* ---- Pages ------------------------------------------------------------------------------ */

.entete-page {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: 20px;
}

.entete-page h1 {
	margin: 0;
	overflow-wrap: anywhere;
}

.entete-page .boutons form {
	margin: 0;
}

.fiche {
	display: grid;
	grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
	gap: 6px 20px;
	padding: 16px 20px;
	margin: 0 0 28px;
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon-carte);
	font-size: 14px;
}

.fiche dt {
	color: var(--texte-2);
}

.fiche dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.fiche .vide {
	color: var(--texte-3);
}

.prose {
	overflow-wrap: break-word;
}

.prose table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
	font-size: 14px;
}

.prose th,
.prose td {
	border: 1px solid var(--bordure-forte);
	padding: 6px 10px;
	text-align: left;
	vertical-align: top;
}

.prose th {
	background: var(--fond-2);
	font-weight: 600;
}

.prose li > p {
	margin: 0;
}

.prose ul.contains-task-list,
.prose ul:has(> li > input[type="checkbox"]) {
	list-style: none;
	padding-left: 4px;
}

.prose li > input[type="checkbox"] {
	margin: 0 6px 0 0;
	vertical-align: -2px;
}

.prose h1,
.prose h2,
.prose h3 {
	scroll-margin-top: calc(var(--hauteur-barre) + 12px);
}

.lien-casse {
	color: var(--erreur);
	text-decoration-color: var(--erreur);
	text-decoration-style: dashed;
}

.lien-casse::after {
	content: " ⚠";
	font-size: .8em;
}

.lien-ambigu {
	text-decoration-style: dotted;
}

pre.mermaid {
	background: var(--surface);
	text-align: center;
	font-family: var(--police-texte);
}

pre.mermaid[data-processed] {
	position: relative;
	border-color: var(--bordure);
	cursor: zoom-in;
}

/* ---- Procédures : bloc « prompt » (procedure.js) ---------------------------------------- */

.procedure {
	display: flex;
	flex-direction: column;
	gap: 18px;
	margin: 1.5em 0;
	padding: 20px;
}

.procedure .encadre-erreur {
	margin: 0;
}

.procedure .encadre-erreur ul {
	margin: 6px 0 0;
}

.procedure .champ {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.procedure .champ > label:not(.case) {
	flex-direction: row;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 10px;
}

.prompt-outils {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
	margin-bottom: 8px;
}

.prompt-outils .bouton {
	margin-left: auto;
}

.prompt-etat {
	color: var(--texte-2);
	font-size: 13px;
}

.prompt-texte {
	max-height: 60vh;
	margin: 0;
	overflow: auto;
	white-space: pre-wrap;
}

.prompt-modele summary {
	color: var(--texte-2);
	font-size: 14px;
	cursor: pointer;
}

.prompt-modele pre {
	max-height: 60vh;
	margin: 10px 0 0;
	overflow: auto;
	white-space: pre-wrap;
}

/* ---- Diagramme agrandi (diagramme-agrandi.js) ------------------------------------------- */

.bouton-agrandir {
	position: absolute;
	top: 8px;
	right: 8px;
	min-width: 32px;
	min-height: 32px;
	padding: 0 6px;
	border: 1px solid var(--bordure-forte);
	border-radius: var(--rayon-petit);
	background: var(--surface);
	color: var(--texte-2);
	font: 18px/1 var(--police-texte);
	cursor: zoom-in;
	opacity: 0;
	transition: opacity .15s;
}

pre.mermaid:hover .bouton-agrandir,
.bouton-agrandir:focus-visible {
	opacity: 1;
}

/* Écran tactile : pas de survol, le bouton reste visible */
@media (hover: none) {
	.bouton-agrandir {
		opacity: 1;
	}
}

.agrandi {
	width: 95vw;
	height: 90vh;
	max-width: none;
	max-height: none;
	padding: 0;
	border: 1px solid var(--bordure-forte);
	border-radius: var(--rayon-carte);
	background: var(--surface);
	box-shadow: var(--ombre);
	overflow: hidden;
}

.agrandi[open] {
	display: flex;
	flex-direction: column;
}

.agrandi::backdrop {
	background: rgba(20, 20, 19, .55);
}

.agrandi-outils {
	display: flex;
	justify-content: flex-end;
	gap: 6px;
	padding: 8px;
	border-bottom: 1px solid var(--bordure);
	background: var(--fond-2);
}

.agrandi-outils .bouton {
	min-width: 36px;
	padding: 4px 10px;
}

.agrandi-scene {
	position: relative;
	flex: 1;
	overflow: hidden;
	cursor: grab;
	touch-action: none;
	user-select: none;
}

.agrandi-scene.deplacement {
	cursor: grabbing;
}

.agrandi-contenu {
	position: absolute;
	top: 0;
	left: 0;
	transform-origin: 0 0;
}

.agrandi-contenu svg {
	display: block;
}

.liens-retour {
	margin-top: 48px;
	padding-top: 16px;
	border-top: 1px solid var(--bordure-forte);
	font-size: 14px;
}

.liens-retour h2 {
	font-size: 16px;
	margin: 0 0 8px;
}

.liens-retour ul {
	margin: 0;
	padding-left: 18px;
}

.pied-page {
	margin-top: 24px;
	color: var(--texte-3);
	font-size: 12.5px;
}

/* ---- Listes : dossiers, récents, recherche ---------------------------------------------- */

.liste {
	list-style: none;
	margin: 0 0 24px;
	padding: 0;
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon-carte);
	overflow: hidden;
}

.liste > li {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	padding: 10px 16px;
	border-top: 1px solid var(--bordure);
}

.liste > li:first-child {
	border-top: 0;
}

.liste .titre-element {
	font-weight: 500;
}

.liste .meta {
	margin-left: auto;
	color: var(--texte-3);
	font-size: 13px;
}

.liste .icone {
	color: var(--texte-3);
}

.resultats > li {
	display: block;
}

.resultats .extrait {
	margin: 4px 0 0;
	color: var(--texte-2);
	font-size: 14px;
}

.filtres {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 10px;
	margin-bottom: 20px;
}

.filtres label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: 13px;
	color: var(--texte-2);
}

.filtres .recherche-principale {
	flex: 1 1 260px;
}

/* ---- Vues en tableau -------------------------------------------------------------------- */

.vue {
	margin: 0 0 1.5em;
}

.vue-outils {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 8px;
}

.vue-outils input[type="search"] {
	max-width: 260px;
	min-height: 32px;
	font-size: 13px;
}

.vue-outils .compte-lignes {
	color: var(--texte-3);
	font-size: 13px;
}

.vue-tableau {
	overflow-x: auto;
	border: 1px solid var(--bordure);
	border-radius: var(--rayon);
	background: var(--surface);
}

.vue table {
	display: table;
	width: 100%;
	margin: 0;
	border-collapse: collapse;
	font-size: 14px;
}

.vue th,
.vue td {
	border: 0;
	border-bottom: 1px solid var(--bordure);
	padding: 7px 12px;
	text-align: left;
	vertical-align: top;
}

.vue tr:last-child td {
	border-bottom: 0;
}

.vue th {
	background: var(--fond-2);
	font-weight: 600;
	white-space: nowrap;
}

.vue th button {
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.vue th button::after {
	content: "↕";
	margin-left: 6px;
	color: var(--texte-3);
	font-weight: 400;
}

.vue th[aria-sort="ascending"] button::after {
	content: "↑";
	color: var(--accent);
}

.vue th[aria-sort="descending"] button::after {
	content: "↓";
	color: var(--accent);
}

.vue tbody tr:hover {
	background: var(--fond);
}

/* Titre de la page : souligné seulement au survol */
.vue td:first-child a {
	font-weight: 500;
	text-decoration: none;
}

.vue td:first-child a:hover {
	text-decoration: underline;
	text-decoration-color: var(--accent);
}

.vue td time,
.vue td .discret {
	white-space: nowrap;
}

.vue .vide-vue {
	color: var(--texte-3);
	font-style: italic;
}

/* ---- Édition ---------------------------------------------------------------------------- */

.edition {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.edition fieldset {
	margin: 0;
	padding: 16px 20px 20px;
	background: var(--surface);
	border: 1px solid var(--bordure);
	border-radius: var(--rayon-carte);
}

.edition legend {
	padding: 0 6px;
	font-family: var(--police-titres);
	font-size: 17px;
	font-weight: 500;
}

.grille-champs {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 14px 18px;
}

.grille-champs .champ-large {
	grid-column: 1 / -1;
}

/* Sans JavaScript, la zone de texte reste utilisable seule */
.zone-editeur > textarea {
	min-height: 60vh;
	border-color: var(--bordure);
	border-radius: var(--rayon-carte);
	font-family: var(--police-code);
	font-size: 13.5px;
	line-height: 1.55;
	padding: 16px;
}

/*
 * markdown-text-editor 1.9.0 : ses couleurs sont des variables CSS rangées dans une couche
 * (@layer theme) ; nos déclarations hors couche l'emportent. Ses classes utilitaires (marges,
 * texte transparent de la zone de saisie) sont hors couche et plus spécifiques que nos styles
 * d'éléments : on ne les annule pas, sinon la zone de texte du mode hybride ne se superpose plus
 * à la couche colorée. Seuls les styles de focus et de hauteur de nos champs y sont neutralisés.
 */
.markdown-editor-wrapper {
	--color-base: #ffffff;
	--color-on-base: #141413;
	--color-primary: #c6613f;
	--color-on-primary: #ffffff;
	--color-secondary: #3d3d3a;
	--color-on-secondary: #faf9f5;
	--color-accent: #4f7ea8;
	--color-on-accent: #ffffff;
	--color-neutral: #141413;
	--color-on-neutral: #faf9f5;
	--color-info: #6a9bcc;
	--color-success: #629987;
	--color-error: #bf4d43;
	--color-warning: #d97757;
	--radius-btn: 6px;
	--radius-input: 8px;
	--radius-menu: 8px;
	--radius-popover: 8px;
	--radius-modal: 14px;
	font-family: var(--police-texte);
	font-size: 15px;
	line-height: 1.6;
	border-radius: var(--rayon-carte);
}

.markdown-editor-wrapper textarea.editor-textarea,
.markdown-editor-wrapper textarea.editor-textarea:focus,
.markdown-editor-wrapper textarea.editor-textarea:focus-visible {
	min-height: 0;
	border-radius: 0;
	outline: none;
	box-shadow: none;
}

.markdown-editor-wrapper .preview-content {
	font-size: 15px;
}

.page-edition .contenu {
	max-width: 1120px;
}

.barre-enregistrement {
	position: sticky;
	bottom: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	padding: 12px 0;
	background: var(--fond);
	border-top: 1px solid var(--bordure);
}

.brouillon {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.brouillon[hidden] {
	display: none;
}

.conflit {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.conflit h2 {
	font-size: 19px;
	margin-top: 0;
}

.conflit pre {
	max-height: 70vh;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	background: var(--surface);
}

.conflit .colonne-brouillon pre {
	border-color: var(--accent);
}

/* ---- Administration --------------------------------------------------------------------- */

.tableau-admin {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}

.tableau-admin th,
.tableau-admin td {
	padding: 8px 10px;
	border-bottom: 1px solid var(--bordure);
	text-align: left;
	vertical-align: middle;
}

.tableau-admin th {
	color: var(--texte-2);
	font-weight: 500;
	font-size: 13px;
}

.tableau-admin form {
	display: inline-flex;
	gap: 6px;
	margin: 0;
}

.tableau-admin select,
.tableau-admin input {
	min-height: 30px;
	width: auto;
	font-size: 13px;
	padding: 3px 8px;
}

.tableau-admin .bouton {
	min-height: 30px;
	padding: 3px 10px;
	font-size: 13px;
}

.jeton-unique {
	display: block;
	padding: 12px;
	background: var(--fond-2);
	border: 1px dashed var(--accent);
	border-radius: var(--rayon);
	font-family: var(--police-code);
	font-size: 13px;
	overflow-wrap: anywhere;
	user-select: all;
}

/* ---- Écrans étroits --------------------------------------------------------------------- */

@media (max-width: 900px) {
	.cadre {
		grid-template-columns: minmax(0, 1fr);
	}

	.panneau {
		display: none;
		position: fixed;
		z-index: 15;
		left: 0;
		top: var(--hauteur-barre);
		width: min(86vw, 320px);
		box-shadow: var(--ombre);
	}

	.bascule-panneau:checked ~ .cadre .panneau {
		display: block;
	}

	.poignee-panneau {
		display: none;
	}

	.agrandi {
		width: 100vw;
		height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	.contenu {
		padding: 20px 16px 48px;
	}

	.recherche-rapide {
		margin-left: 0;
	}

	.compte {
		gap: 10px;
	}

	.compte-nom,
	.compte a {
		display: none;
	}

	.conflit {
		grid-template-columns: minmax(0, 1fr);
	}

	.fiche {
		grid-template-columns: minmax(0, 1fr);
		gap: 2px;
	}

	.fiche dd {
		margin-bottom: 8px;
	}

	h1 {
		font-size: 27px;
	}
}

@media (max-width: 520px) {
	.marque {
		display: none;
	}
}

@media print {
	.barre,
	.panneau,
	.ariane,
	.entete-page .boutons,
	.vue-outils {
		display: none !important;
	}

	.cadre {
		display: block;
	}

	.contenu {
		max-width: none;
		padding: 0;
	}
}
