:root {
  --encre: #202c28;
  --sable: #d8c7ad;
  --terre: #a55b3f;
  --fond: #faf8f3;
  --papier: #fffefa;
  --discret: #536159;
  --ligne: #c9c4b8;
}
* { box-sizing: border-box; }
html { scrollbar-color: var(--sable) var(--fond); }
body { margin: 0; color: var(--encre); background: var(--fond); font: 1rem/1.6 system-ui, sans-serif; }
header, main, footer { max-width: 76rem; margin-inline: auto; padding-inline: 2.5rem; }
header { padding-top: 1.5rem; border-bottom: 1px solid var(--ligne); }
.masthead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-size: 1.25rem; font-weight: 750; letter-spacing: .08em; text-decoration: none; }
.brand img { width: 2.75rem; height: 2.75rem; }
.masthead form { margin: 0; }
.masthead button { margin: 0; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; }
.site-nav a { display: block; padding: .8rem .25rem; border-bottom: 3px solid transparent; text-decoration: none; }
.site-nav a:hover { border-bottom-color: var(--sable); }
.site-nav a[aria-current=page] { font-weight: 700; border-bottom-color: var(--terre); }
main { min-height: 65vh; padding-block: 2.5rem 4rem; }
main > h1 { max-width: 34ch; margin: 0 0 1.5rem; font-size: clamp(2rem, 3vw, 2.75rem); font-weight: 650; letter-spacing: -.025em; }
h1, h2, h3 { line-height: 1.25; overflow-wrap: anywhere; }
h2 { margin: 2.5rem 0 1rem; font-size: 1.5rem; font-weight: 650; }
h3 { margin: .25rem 0 .75rem; font-size: 1.125rem; font-weight: 650; }
p, li, dd { max-width: 75ch; overflow-wrap: anywhere; }
p { margin-block: .75rem; }
a { color: var(--encre); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { color: var(--terre); text-decoration-thickness: 2px; }
ul { padding-left: 1.3rem; }
li + li { margin-top: .45rem; }
form { margin-block: 1.25rem; }
label { display: block; margin-top: 1rem; margin-bottom: .35rem; font-weight: 600; }
input, select, textarea, button { font: inherit; max-width: 100%; min-height: 2.9rem; padding: .65rem .8rem; border: 1px solid #727d74; border-radius: .2rem; }
input:not([type=checkbox]):not([type=hidden]), textarea, select { display: block; width: 100%; max-width: 38rem; background: var(--papier); color: var(--encre); caret-color: var(--terre); }
input[type=checkbox] { min-height: auto; width: 1.2rem; height: 1.2rem; margin: 0 .4rem 0 0; vertical-align: middle; accent-color: var(--encre); }
input::placeholder, textarea::placeholder { color: var(--discret); opacity: 1; }
input:invalid:not(:placeholder-shown):focus { border-color: var(--terre); }
textarea { min-height: 8rem; resize: vertical; }
button, .button { display: inline-block; color: var(--papier); background: var(--encre); border: 1px solid var(--encre); cursor: pointer; margin-top: 1rem; padding: .65rem 1rem; font-weight: 600; text-align: center; text-decoration: none; }
button:hover, .button:hover { color: var(--papier); background: #3c4c42; text-decoration: underline; }
button.secondary, .button.secondary { color: var(--encre); background: transparent; }
button.secondary:hover, .button.secondary:hover { background: #eae3d6; }
button:disabled { color: var(--discret); background: #e8e3d8; border-color: var(--ligne); cursor: wait; }
:focus-visible { outline: 3px solid var(--terre); outline-offset: 4px; }
::selection { background: var(--sable); color: var(--encre); }
.skip { position: absolute; z-index: 5; left: 1rem; top: -6rem; background: var(--papier); padding: .8rem; }
.skip:focus { position: relative; display: block; top: 0; left: 0; width: fit-content; margin: .75rem 1.25rem; }
article { padding-block: 1.5rem; border-bottom: 1px solid var(--ligne); }
article > :last-child { margin-bottom: 0; }
blockquote { max-width: 75ch; margin: 1rem 0; padding: 1.25rem 1.5rem; background: #eee5d7; overflow-wrap: anywhere; }
dt { font-weight: 650; }
dd { margin-left: 0; margin-bottom: 1rem; }
dl { margin-block: 1.5rem; }
[role=alert], [role=status] { max-width: 75ch; padding: 1rem 1.25rem; background: #eee7db; }
[role=alert] { border: 1px solid var(--terre); background: #f5ebe4; }
[hidden] { display: none !important; }
mark { color: var(--encre); background: var(--sable); }
footer { border-top: 1px solid var(--ligne); padding-block: 1.5rem 2rem; color: var(--discret); }
.tag { display: inline-block; padding: .2rem .55rem; border: 1px solid currentColor; color: var(--encre); font-weight: 600; }
.tag-bleu { background: #e0e9ed; } .tag-vert { background: #e0e9dc; }
.tag-ocre { background: #efe3c5; } .tag-rose { background: #f1e0dc; }
.tag-violet { background: #e9e2ed; } .tag-gris { background: #e6e5df; }
article[class*=tag-] { padding-inline: 1rem; }
.stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 2rem; }
.stages section { padding-top: 1rem; border-top: 1px solid var(--ligne); }
.table-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: thin; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
caption { text-align: left; font-weight: 600; padding-block: 1rem; }
td, th { text-align: left; padding: .9rem .75rem; border-bottom: 1px solid var(--ligne); overflow-wrap: anywhere; vertical-align: top; }
th { background: #eee7db; font-weight: 650; }
.amount { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
fieldset { min-width: 0; max-width: 64rem; margin: 1.5rem 0; padding: 1rem 1.25rem 1.25rem; border: 1px solid var(--ligne); }
legend { padding-inline: .4rem; font-weight: 650; }
summary { width: fit-content; max-width: 100%; min-height: 2.9rem; padding-block: .65rem; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: .22em; }
details { margin-block: 1rem; }
details[open] > summary { margin-bottom: .75rem; }
nav[aria-label^=Pages] { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-block: 2rem; }
nav[aria-label^=Pages] a { min-height: 2.9rem; padding-block: .65rem; }
#suggestions:not(:empty) { max-width: 38rem; border: 1px solid var(--ligne); padding: .5rem 1rem; background: var(--papier); }
#suggestions a { display: block; padding-block: .4rem; }
.htmx-request button { cursor: progress; }
.login { max-width: 38rem; }
.login button { width: 100%; }
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.5rem; max-width: 64rem; }
.results { margin-block: 1rem 2rem; }
.section-links { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; margin-block: 1.5rem; }
.section-links a { padding-block: .4rem; }
.secondary-section { margin-top: 2.5rem; border-top: 1px solid var(--ligne); padding-top: 1rem; }
.secondary-section > summary { font-size: 1.5rem; line-height: 1.25; font-weight: 650; }
.empty { padding-block: 1.5rem; border-block: 1px solid var(--ligne); color: var(--discret); }
@media (min-width: 48rem) {
  .facts { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr); gap: .5rem 2rem; }
  .facts dd { margin: 0; }
}
@media (max-width: 42rem) {
  header, main, footer { padding-inline: 1.25rem; }
  header { padding-top: 1rem; }
  .masthead { gap: .75rem; padding-bottom: .75rem; }
  .brand { font-size: 1.125rem; }
  .brand img { width: 2.25rem; height: 2.25rem; }
  .masthead button { padding-inline: .65rem; font-weight: 500; }
  .site-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; }
  .site-nav a { min-width: 0; padding-block: .6rem; overflow-wrap: anywhere; }
  main { padding-block: 2rem 3rem; }
  h2 { margin-top: 2rem; }
  button, .button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .filters { grid-template-columns: minmax(0, 1fr); }
  fieldset { padding-inline: .8rem; }
  blockquote { padding: 1rem; }
  td, th { padding: .7rem .5rem; }
}
@media print {
  .skip, header, footer, form, .site-nav { display: none; }
  body { color: #202c28; background: white; }
  main { max-width: none; padding: 0; }
  a { color: inherit; }
}

.auth-page main { max-width: 43rem; }
.service-state { color: var(--discret); }
.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); grid-template-areas: "summary actions" "details actions"; gap: 2.5rem 3.5rem; }
.project-summary { grid-area: summary; min-width: 0; }
.project-summary > h2:first-child, .project-actions > h2:first-child { margin-top: 0; }
.project-details { grid-area: details; min-width: 0; }
.project-actions { grid-area: actions; min-width: 0; border-left: 1px solid var(--ligne); padding-left: 2rem; }
.project-actions h3 { margin-top: 2rem; }
.project-actions form { margin-block: 1rem 1.5rem; }
.project-actions input, .project-actions select, .project-actions button { width: 100%; }
.project-actions input[type=checkbox], .project-actions input[type=hidden] { width: auto; }
.project-actions label { font-weight: 500; }
.project-actions .tag-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.project-actions .tag-list li { margin: 0; }
.private-note { margin-block: 1.5rem; }
@media (max-width: 54rem) {
  .project-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "summary" "actions" "details"; }
  .project-actions { border-left: 0; padding-left: 0; border-top: 1px solid var(--ligne); padding-top: 1.5rem; }
}

.search-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-top: .75rem; }
.search-actions button { margin-top: 0; }
.filters-panel { max-width: 64rem; margin-block: 1.5rem; border-block: 1px solid var(--ligne); padding-block: .25rem; }
.search-form > input { max-width: 64rem; }
.result-selection { margin: 0 0 .6rem; width: fit-content; font-weight: 400; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.metadata { display: flex; flex-wrap: wrap; gap: .4rem .6rem; margin-block: .75rem 1rem; color: var(--discret); }
.metadata span { padding: .1rem .5rem; border: 1px solid var(--ligne); border-radius: .2rem; }
.service-state[role=status] { background: transparent; padding: .5rem 0; color: var(--discret); }

/* Dispositions validées avec l’utilisateur : une liste principale et un suivi latéral. */
h2 a, h3 a, li a, td a { text-decoration: none; }
h2 a:hover, h3 a:hover, li a:hover, td a:hover,
h2 a:focus-visible, h3 a:focus-visible, li a:focus-visible, td a:focus-visible,
.site-nav a:hover, .site-nav a:focus-visible { text-decoration: underline; }
h1, h2, h3 { overflow-wrap: break-word; }
.mobile-menu { display: none; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem); gap: 3.5rem; margin-top: 2rem; }
.home-layout > section > h2:first-child, .home-sidebar section:first-child h2 { margin-top: 0; }
.home-sidebar { padding-left: 2rem; border-left: 1px solid var(--ligne); }
.home-sidebar h2 { font-size: 1.25rem; }
.home-sidebar section + section { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--ligne); }
.home-sidebar section + section h2 { margin-top: 0; }
.home-sidebar article { padding-top: .5rem; border-bottom: 0; }
.home-sidebar button { font-weight: 500; }
.alert-count { font-size: 2rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.tag-list { list-style: none; padding: 0; }
.tag-list .tag { background: var(--sable); }
.item-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.section-links .button { margin-top: 0; }
@media (max-width: 54rem) {
  .home-layout { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .home-sidebar { border-left: 0; padding-left: 0; border-top: 1px solid var(--ligne); padding-top: 2rem; }
}
@media (max-width: 42rem) {
  .desktop-nav { display: none; }
  .mobile-menu { display: block; margin: 0; }
  .mobile-menu > summary { width: 100%; padding-block: .8rem; }
  .mobile-menu .site-nav { padding-bottom: .75rem; }
}
