@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Spline+Sans+Mono:wght@400;500&display=swap');

:root {
  --encre: #18202b;
  --encre-douce: #5a6775;
  --trait: #dde3ea;
  --fond: #f6f7f9;
  --blanc: #ffffff;
  --marine: #1f4d7a;
  --marine-clair: #eaf1f8;
  --ambre: #a06a12;
  --ambre-clair: #fdf3e2;
  --vert: #1f6b4a;
  --vert-clair: #e7f3ec;
  --rouge: #a3302a;
  --rouge-clair: #fbeceb;
  --rayon: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 15px/1.55 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--marine); }

/* ---------------------------------------------------------------- en-tête */
.top {
  display: flex;
  align-items: center;
  gap: 28px;
  background: var(--blanc);
  border-bottom: 1px solid var(--trait);
  padding: 0 28px;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 17px;
  color: var(--encre);
  text-decoration: none;
}
.top nav { display: flex; gap: 20px; flex: 1; }
.top nav a {
  color: var(--encre-douce);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  padding: 19px 0;
  border-bottom: 2px solid transparent;
}
.top nav a:hover { color: var(--encre); }
.top nav a.on { color: var(--encre); border-bottom-color: var(--marine); }
.me { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.me a { color: var(--encre-douce); text-decoration: none; }
.me a:hover { color: var(--encre); }

main { max-width: 1060px; margin: 0 auto; padding: 32px 28px 80px; }

h1 { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; }
h2 { font-size: 18px; letter-spacing: -0.01em; margin: 0 0 14px; }
h3 { font-size: 16px; margin: 22px 0 8px; }
h4 { font-size: 14px; margin: 16px 0 6px; color: var(--encre-douce); }
p.sub { color: var(--encre-douce); margin: 0 0 24px; max-width: 70ch; }

.fil { font-size: 13px; color: var(--encre-douce); margin-bottom: 14px; }
.fil a { text-decoration: none; }
.fil span { margin: 0 6px; opacity: .5; }

.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.head-actions { display: flex; gap: 8px; }

/* ---------------------------------------------------------------- boutons */
button, .btn {
  font: inherit;
  font-weight: 500;
  font-size: 14px;
  background: var(--marine);
  color: #fff;
  border: 1px solid var(--marine);
  border-radius: var(--rayon);
  padding: 8px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .btn:hover { background: #1a4169; }
.btn-plat {
  background: var(--blanc);
  color: var(--encre);
  border: 1px solid var(--trait);
}
.btn-plat:hover { background: var(--fond); }
.btn-mini {
  font-size: 12px;
  padding: 4px 9px;
  background: var(--blanc);
  color: var(--encre-douce);
  border: 1px solid var(--trait);
}
.btn-mini:hover { background: var(--fond); color: var(--encre); }
button.danger, .btn-mini.danger { color: var(--rouge); border-color: #e8c8c6; background: var(--blanc); }
button.danger:hover { background: var(--rouge-clair); }
.inline { display: inline; }
.zone-danger { margin-top: 48px; padding-top: 18px; border-top: 1px solid var(--trait); }

/* ---------------------------------------------------------------- tableaux */
table.liste {
  width: 100%;
  border-collapse: collapse;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
  font-size: 14px;
}
table.liste th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--encre-douce);
  padding: 10px 14px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--trait);
}
table.liste td { padding: 12px 14px; border-bottom: 1px solid #eef2f6; vertical-align: top; }
table.liste tr:last-child td { border-bottom: 0; }
.lien-fort { font-weight: 600; text-decoration: none; }
.lien-fort:hover { text-decoration: underline; }
.mini { font-size: 12px; color: var(--encre-douce); display: block; }

table.fiche {
  border-collapse: collapse;
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  width: 100%;
  font-size: 14px;
  margin-bottom: 28px;
}
table.fiche th {
  text-align: left;
  font-weight: 500;
  color: var(--encre-douce);
  padding: 9px 14px;
  width: 190px;
  vertical-align: top;
  border-bottom: 1px solid #eef2f6;
}
table.fiche td { padding: 9px 14px; border-bottom: 1px solid #eef2f6; }
table.fiche tr:last-child th, table.fiche tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------------- étiquettes */
.tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--fond);
  color: var(--encre-douce);
  border: 1px solid var(--trait);
}
.tag.pret { background: var(--vert-clair); color: var(--vert); border-color: #c8e3d4; }
.tag.en_cours, .tag.en_attente, .tag.depot, .tag.attente { background: var(--ambre-clair); color: var(--ambre); border-color: #f0ddba; }
.tag.erreur { background: var(--rouge-clair); color: var(--rouge); border-color: #e8c8c6; }

/* ---------------------------------------------------------------- blocs */
.bloc {
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 22px 24px;
  margin-bottom: 24px;
}
.bloc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.bloc-head h2 { margin: 0; }
.vide {
  border: 1px dashed var(--trait);
  border-radius: var(--rayon);
  padding: 28px;
  color: var(--encre-douce);
  background: var(--blanc);
}
.vide p { margin: 0 0 8px; max-width: 62ch; }
.etat {
  background: var(--ambre-clair);
  border: 1px solid #f0ddba;
  color: var(--ambre);
  border-radius: var(--rayon);
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}
.etat.erreur { background: var(--rouge-clair); border-color: #e8c8c6; color: var(--rouge); }
.flash {
  border-radius: var(--rayon);
  padding: 11px 14px;
  font-size: 14px;
  margin-bottom: 20px;
  border: 1px solid var(--trait);
  background: var(--marine-clair);
  color: var(--marine);
  border-color: #cfe0f0;
}
.flash.ok { background: var(--vert-clair); color: var(--vert); border-color: #c8e3d4; }
.flash.erreur { background: var(--rouge-clair); color: var(--rouge); border-color: #e8c8c6; }
.compteur { font-size: 14px; color: var(--encre-douce); margin: 0 0 14px; }
.infos-conc { color: var(--encre-douce); max-width: 72ch; margin: -4px 0 22px; }

/* ---------------------------------------------------------------- mémoire */
.memoire { max-width: 76ch; font-size: 15px; }
.memoire h3 {
  font-size: 15px;
  margin: 26px 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--trait);
}
.memoire h3:first-child { margin-top: 0; }
.memoire p { margin: 0 0 11px; }
.memoire ul { margin: 0 0 13px; padding-left: 20px; }
.memoire li { margin-bottom: 5px; }
.memoire strong { font-weight: 600; }
.md-table {
  border-collapse: collapse;
  font-size: 13px;
  margin: 10px 0 16px;
  width: 100%;
}
.md-table th, .md-table td { border: 1px solid var(--trait); padding: 6px 10px; text-align: left; }
.md-table th { background: #fbfcfd; font-weight: 600; }
code {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 13px;
  background: var(--fond);
  padding: 1px 5px;
  border-radius: 3px;
}
.simu { margin-top: 32px; padding-top: 22px; border-top: 1px solid var(--trait); }
.simu h3 { margin-top: 0; font-size: 17px; }

/* ---------------------------------------------------------------- pages lues */
.pages { display: flex; flex-direction: column; gap: 4px; }
details.page {
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--blanc);
}
details.page summary {
  cursor: pointer;
  padding: 8px 13px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  gap: 10px;
  align-items: baseline;
}
details.page summary .mini { display: inline; }
details.page.erreur summary { color: var(--rouge); }
details.page.vide summary, details.page.attente summary { color: var(--encre-douce); font-weight: 400; }
.transcription {
  padding: 4px 16px 16px;
  font-size: 14px;
  color: #2b3542;
  max-width: 80ch;
  border-top: 1px solid #eef2f6;
}
.transcription p { margin: 8px 0; }

/* ---------------------------------------------------------------- formulaires */
label { display: block; font-size: 13px; font-weight: 500; color: var(--encre-douce); margin-bottom: 14px; }
label .hint { display: block; font-weight: 400; font-size: 12px; margin-top: 1px; }
input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  font: inherit;
  font-size: 14px;
  color: var(--encre);
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 8px 11px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--marine); outline-offset: -1px; border-color: var(--marine); }
textarea { resize: vertical; }

.form-large, .form-court {
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 24px;
}
.form-court { max-width: 400px; }
.grille { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.grille label.large { grid-column: 1 / -1; }

.depots { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 10px 0 20px; }
.depot {
  border: 1px dashed var(--trait);
  border-radius: var(--rayon);
  padding: 16px;
  background: #fbfcfd;
  margin: 0;
}
.depot-titre { display: block; font-size: 14px; color: var(--encre); font-weight: 600; }
.depot input[type=file] { margin-top: 10px; font-size: 13px; }
.actions-bas { display: flex; justify-content: flex-end; }
progress { width: 100%; height: 6px; margin-bottom: 14px; }

.choix { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 18px; }
.case {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 11px 13px;
  margin: 0;
  font-weight: 500;
  color: var(--encre);
  cursor: pointer;
}
.case input { width: auto; margin: 3px 0 0; }
.case.inactif { opacity: .5; cursor: default; }
.case:hover:not(.inactif) { border-color: var(--marine); }

dialog {
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: 0;
  max-width: 460px;
  width: calc(100% - 32px);
  box-shadow: 0 16px 48px rgba(24, 32, 43, .16);
}
dialog::backdrop { background: rgba(24, 32, 43, .38); }
.modal { padding: 24px; }
.modal h2 { margin-top: 0; }
.modal p { font-size: 14px; color: var(--encre-douce); }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------------------------------------------------------------- connexion */
body.plain { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.card-form {
  background: var(--blanc);
  border: 1px solid var(--trait);
  border-radius: 8px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
}
.card-form h1 { font-size: 21px; margin-bottom: 6px; }
.card-form button { width: 100%; margin-top: 6px; }
.ok-line { color: var(--vert); font-size: 14px; }

@media (max-width: 820px) {
  .grille, .depots, .choix { grid-template-columns: 1fr; }
  .top { padding: 0 16px; gap: 16px; overflow-x: auto; }
  main { padding: 24px 16px 60px; }
  .head-row { flex-direction: column; }
  table.fiche th { width: 130px; }
}

/* ---------------------------------------------------------------- onglets */
.onglets-barre {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--trait);
  margin-bottom: 18px;
}
.onglet {
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--encre-douce);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px;
  cursor: pointer;
}
.onglet:hover { background: var(--fond); color: var(--encre); }
.onglet.on { color: var(--encre); border-bottom-color: var(--marine); background: none; }
.memoire.large { max-width: none; }
.memoire.large .md-table { font-size: 13px; }
.memoire.large .md-table td:last-child,
.memoire.large .md-table th:last-child { text-align: right; white-space: nowrap; }
.col-action { text-align: right; white-space: nowrap; }
.sous-table { margin: 10px 0 0; }
