/* ==================================================================
   GestErp — feuille de style applicative
   Charte : bleu #1176D1, or #D1B05E, navy #16212E
   Langage d'interface dense, inspiré des consoles de gestion.
   ================================================================== */

:root {
  --brand-blue:    #1176D1;
  --brand-blue-dk: #0B5AA5;
  --brand-gold:    #D1B05E;
  --brand-gold-dk: #B3902F;

  --shell:      #16212E;
  --shell-2:    #1E2E3F;
  --shell-text: #E4EBF2;
  --shell-mute: #8FA3B6;

  --bg:        #F2F5F8;
  --surface:   #FFFFFF;
  --surface-2: #F8FAFC;
  --border:    #D6DEE6;
  --border-2:  #E7EDF3;
  --text:      #1E2A36;
  --muted:     #5B6B7A;

  --ok:   #107E3E;
  --warn: #E9730C;
  --bad:  #BB0000;

  --font-ui:   system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-data: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;

  --radius: 4px;
  --shadow: 0 1px 2px rgba(30, 42, 54, .08), 0 2px 8px rgba(30, 42, 54, .06);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-blue); }

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

/* Libellé destiné aux lecteurs d'écran, retiré du flux visuel
   sans être retiré de l'arbre d'accessibilité. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------- Barre applicative ---------------- */

.shell {
  background: var(--shell);
  color: var(--shell-text);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  min-height: 56px;
  border-bottom: 2px solid var(--brand-gold);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.shell-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding-right: 15px;
  border-right: 1px solid rgba(228, 235, 242, .16);
  text-decoration: none;
  color: inherit;
}

.shell-brand .mark { display: block; flex-shrink: 0; }

.shell-title {
  font-weight: 640;
  font-size: 19px;
  letter-spacing: -.015em;
  white-space: nowrap;
  line-height: 1;
}

.shell-title span { color: var(--brand-gold); }

.entity-form { display: flex; align-items: center; }

.entity-select {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  background: var(--shell-2);
  color: var(--shell-text);
  border: 1px solid rgba(209, 176, 94, .35);
  border-radius: var(--radius);
  padding: 5px 9px;
  cursor: pointer;
}

.shell-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.shell-user {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--shell-mute);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--brand-gold);
}

.lien-shell {
  color: var(--shell-mute);
  text-decoration: none;
  font-size: 12.5px;
  padding: 5px 9px;
  border-radius: var(--radius);
}

.lien-shell:hover { background: var(--shell-2); color: var(--shell-text); }

/* ---------------- Structure ---------------- */

.app { display: grid; grid-template-columns: 232px 1fr; align-items: start; }

.rail {
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 56px);
  padding: 10px 0;
}

.rail-group {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  padding: 14px 16px 6px;
  font-weight: 600;
}

.rail a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
  border-left: 3px solid transparent;
}

.rail a .code {
  font-family: var(--font-data);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  padding: 0 4px;
  min-width: 26px;
  text-align: center;
}

.rail a:hover { background: var(--surface-2); }

.rail a.active {
  border-left-color: var(--brand-gold);
  background: color-mix(in srgb, var(--brand-blue) 8%, transparent);
  font-weight: 600;
}

.rail a.active .code { color: var(--brand-gold-dk); border-color: var(--brand-gold); }

.rail a.inactif { color: var(--muted); cursor: default; }
.rail a.inactif:hover { background: transparent; }

main { padding: 20px 22px 40px; min-width: 0; }

/* ---------------- En-tête de page ---------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.2px;
  text-wrap: balance;
}

.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }

.period {
  font-family: var(--font-data);
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 5px 10px;
}

.group-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  font-weight: 600;
}

.group-label::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------------- Tuiles ---------------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: 12px;
}

.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 13px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 110px;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s, transform .12s;
}

.tile:hover { border-color: var(--brand-blue); transform: translateY(-1px); }

.tile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.tile-name { font-size: 12.5px; color: var(--muted); font-weight: 500; }

.tile-mark {
  font-family: var(--font-data);
  font-size: 9.5px;
  letter-spacing: .04em;
  color: var(--brand-gold-dk);
  border: 1px solid var(--brand-gold);
  border-radius: 2px;
  padding: 0 3px;
  white-space: nowrap;
}

.tile-value {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.tile-value .unit { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.tile-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------------- Panneaux et tableaux ---------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; }
.panel-body { padding: 14px; }

.table-scroll { overflow-x: auto; }

table.data { border-collapse: collapse; width: 100%; }

table.data th,
table.data td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border-2); }

table.data th {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface);
}

table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }

/* Ligne de totaux : c'est une somme, pas un en-tête — on annule la casse
   et la graisse d'en-tête pour qu'elle se lise comme une valeur. */
table.data tfoot th {
  background: var(--surface-2);
  border-top: 2px solid var(--border);
  border-bottom: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  font-weight: 640;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ref { font-family: var(--font-data); font-size: 12px; color: var(--brand-blue); }
.sub { display: block; font-size: 11.5px; color: var(--muted); }

/* ---------------- Pastilles d'état ---------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 10px;
  padding: 2px 9px 2px 7px;
  white-space: nowrap;
}

.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pill.ok   { color: var(--ok);         background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.warn { color: var(--warn);       background: color-mix(in srgb, var(--warn) 14%, transparent); }
.pill.bad  { color: var(--bad);        background: color-mix(in srgb, var(--bad) 12%, transparent); }
.pill.info { color: var(--brand-blue); background: color-mix(in srgb, var(--brand-blue) 12%, transparent); }

/* ---------------- Boutons ---------------- */

.btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  padding: 8px 15px;
  border: 1px solid var(--brand-blue);
  background: var(--brand-blue);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.btn:hover { background: var(--brand-blue-dk); border-color: var(--brand-blue-dk); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn.ghost { background: transparent; color: var(--brand-blue); }
.btn.ghost:hover { background: color-mix(in srgb, var(--brand-blue) 10%, transparent); color: var(--brand-blue); }

.btn.bloc { width: 100%; text-align: center; }

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

.champ { margin-bottom: 15px; }

.champ label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

/* Tous les types de saisie, sauf les cases : viser les types un par un
   laissait number, tel, url et date au rendu natif du navigateur —
   d'où des hauteurs et des largeurs incohérentes dans un même formulaire. */
.champ input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
.champ select,
.champ textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  height: 38px;
}

.champ textarea { height: auto; min-height: 84px; resize: vertical; }

/* Les compteurs natifs des champs numériques déséquilibrent l'alignement
   des colonnes ; la saisie au clavier reste évidemment possible. */
.champ input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.champ input[type="number"]::-webkit-outer-spin-button,
.champ input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.champ input:focus,
.champ select:focus,
.champ textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 18%, transparent);
}

.aide { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------------- Messages ---------------- */

.flash {
  border-radius: var(--radius);
  padding: 10px 13px;
  margin-bottom: 13px;
  font-size: 13.5px;
  border-left: 3px solid;
}

.flash.succes { background: color-mix(in srgb, var(--ok) 9%, var(--surface));         border-color: var(--ok);         color: #0B5A2C; }
.flash.erreur { background: color-mix(in srgb, var(--bad) 9%, var(--surface));        border-color: var(--bad);        color: #8A0000; }
.flash.alerte { background: color-mix(in srgb, var(--warn) 11%, var(--surface));      border-color: var(--warn);       color: #8A4405; }
.flash.info   { background: color-mix(in srgb, var(--brand-blue) 9%, var(--surface)); border-color: var(--brand-blue); color: var(--brand-blue-dk); }

/* ---------------- Écran de connexion ---------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(150deg, #16212E 0%, #1E2E3F 55%, #101A24 100%);
}

.login-carte {
  width: 100%;
  max-width: 390px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
  overflow: hidden;
  border-top: 3px solid var(--brand-gold);
}

.login-entete { padding: 26px 26px 6px; text-align: center; }
.login-entete .mark { margin: 0 auto 12px; display: block; }

.login-entete .titre {
  font-size: 25px;
  font-weight: 640;
  letter-spacing: -.015em;
  line-height: 1;
}

.login-entete .titre span { color: var(--brand-gold-dk); }
.login-entete .sous { color: var(--muted); font-size: 12.5px; margin-top: 7px; }

.login-corps { padding: 20px 26px 26px; }

.login-pied {
  text-align: center;
  color: var(--shell-mute);
  font-size: 11.5px;
  margin-top: 16px;
}

/* ---------------- Barre de filtres ----------------
   Rattachée au haut du panneau qu'elle filtre, plutôt que flottante
   au-dessus : le lien entre les critères et le tableau est immédiat. */

.barre-filtres {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* La recherche absorbe l'espace libre ; les listes gardent leur largeur. */
.barre-filtres .bf-recherche { flex: 1 1 260px; min-width: 180px; display: flex; }

.barre-filtres input[type="search"],
.barre-filtres select {
  font: inherit;
  font-size: 13.5px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  height: 36px;
}

.barre-filtres input[type="search"] { width: 100%; }
.barre-filtres select { flex: 0 0 auto; max-width: 200px; }
.barre-filtres .btn { height: 36px; padding: 0 15px; white-space: nowrap; }

.barre-filtres input[type="search"]:focus,
.barre-filtres select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 18%, transparent);
}

@media (max-width: 720px) {
  .barre-filtres .bf-recherche { flex-basis: 100%; }
  .barre-filtres select { flex: 1 1 140px; max-width: none; }
}

/* ---------------- Mise en page des formulaires ---------------- */

.colonnes { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.colonnes > div { min-width: 0; }
.colonnes .panel { margin-bottom: 16px; }

.grille-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.grille-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 15px; }

.obligatoire { color: var(--bad); font-weight: 700; }

.case {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  font-size: 13.5px;
  cursor: pointer;
}

.case input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-blue);
  cursor: pointer;
}

.actions-collantes {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn.danger { background: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #8A0000; border-color: #8A0000; }

/* ---------------- Étiquettes et fil d'Ariane ---------------- */

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-gold-dk);
  background: color-mix(in srgb, var(--brand-gold) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-gold) 55%, transparent);
  border-radius: 3px;
  padding: 1px 6px;
  margin: 1px 3px 1px 0;
  white-space: nowrap;
}

.pill.neutre { color: var(--muted); background: var(--surface-2); }

.fil { margin: 0 0 5px; font-size: 12.5px; }
.fil a { color: var(--muted); text-decoration: none; }
.fil a:hover { color: var(--brand-blue); text-decoration: underline; }

.lien-action { font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; }

.panel-head .count { color: var(--muted); font-weight: 400; font-size: 12.5px; }

.vide { color: var(--muted); text-align: center; padding: 26px 14px; font-size: 13.5px; }

/* ---------------- Encart explicatif ---------------- */

.encart {
  background: color-mix(in srgb, var(--brand-blue) 6%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--brand-blue) 22%, transparent);
  border-left: 3px solid var(--brand-blue);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
  max-width: 90ch;
}

.encart strong { color: var(--text); }

/* Formule de calcul d'une taxe : lue comme une expression, donc en chasse fixe */
.formule {
  font-family: var(--font-data);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: 3px;
  padding: 1px 6px;
  white-space: nowrap;
  display: inline-block;
}

/* Formulaire disposé en ligne, pour une action courte au bas d'un panneau */
.ligne-form {
  display: flex;
  gap: 13px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.ligne-form .champ { margin-bottom: 0; flex: 0 1 210px; }
.ligne-form .btn { height: 38px; }

/* Tuile non cliquable : module annoncé mais pas encore déployé */
.tile.inerte { opacity: .62; cursor: default; }
.tile.inerte:hover { border-color: var(--border); transform: none; }

/* Jauge de remplissage : taux d'occupation d'une session, avancement d'un cours */
.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  overflow: hidden;
}

.meter i {
  display: block;
  height: 100%;
  background: var(--brand-blue);
  transition: width .25s ease;
}

/* ---------------- Lignes de devis ---------------- */

table.lignes-devis td { padding: 6px 8px; vertical-align: middle; }

table.lignes-devis input,
table.lignes-devis select {
  font: inherit;
  font-size: 13px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  height: 32px;
}

table.lignes-devis input[type="number"] { text-align: right; -moz-appearance: textfield; appearance: textfield; }
table.lignes-devis input[type="number"]::-webkit-outer-spin-button,
table.lignes-devis input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

table.lignes-devis input:focus,
table.lignes-devis select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-blue) 20%, transparent);
}

table.lignes-devis .total-ligne { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* Une ligne de titre structure le devis : elle ne porte ni prix ni quantité. */
table.lignes-devis tr.ligne[data-type="titre"] td:not(:first-child):not(:last-child) { visibility: hidden; }
table.lignes-devis tr.ligne-cout[data-type="titre"] { display: none; }
table.lignes-devis .saisie-titre { font-weight: 700; background: var(--surface-2); }

/* Le coût prévisionnel est une donnée interne : discrète, sous sa ligne. */
table.lignes-devis tr.ligne-cout td {
  border-bottom: 1px solid var(--border);
  padding: 2px 8px 8px 8px;
  background: var(--surface-2);
}

table.lignes-devis tr.ligne-cout label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

table.lignes-devis tr.ligne-cout input { width: 110px; height: 28px; }
table.lignes-devis .aide-inline { font-size: 11.5px; color: var(--muted); margin-left: 10px; }

table.lignes-devis tfoot td {
  background: var(--surface-2);
  border-top: 2px solid var(--border);
  font-size: 12.5px;
  color: var(--muted);
}

table.lignes-devis tfoot strong { font-size: 14px; color: var(--text); font-variant-numeric: tabular-nums; }

.btn-suppr {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--radius);
  width: 28px;
  height: 28px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.btn-suppr:hover { border-color: var(--bad); color: var(--bad); }

/* ---------------- Bloc des totaux ---------------- */

/* Aussi utilisée hors bloc de totaux, pour toute ligne « libellé / valeur ». */
.ligne-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 7px 0;
  font-size: 13.5px;
}

.ligne-total strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ligne-total .sub { display: block; }

.totaux .ligne-total { border-bottom: 1px solid var(--border-2); }
.totaux .ligne-total:last-child { border-bottom: 0; }

.totaux .total-final {
  border-top: 2px solid var(--brand-gold);
  border-bottom: 0;
  margin-top: 5px;
  padding-top: 11px;
  font-size: 15px;
}

.totaux .total-final strong { font-size: 19px; font-weight: 700; }
.totaux .marge { border-top: 1px dashed var(--border); margin-top: 8px; color: var(--muted); }
.totaux .marge strong { color: var(--ok); }

/* ---------------- Identité de l'entreprise ---------------- */

.identite-resume { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }

.bloc-logo {
  width: 130px;
  height: 90px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: grid;
  place-items: center;
  padding: 8px;
  overflow: hidden;
}

.bloc-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-absent { font-size: 11.5px; color: var(--muted); text-align: center; }

dl.donnees {
  flex: 1;
  min-width: 240px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 9px 18px;
}

dl.donnees > div { min-width: 0; }
dl.donnees dt { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; }
dl.donnees dd { margin: 1px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }

.apercu-logo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  min-height: 110px;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

.apercu-logo img { max-width: 100%; max-height: 160px; object-fit: contain; }
.apercu-logo.vide { color: var(--muted); font-size: 12.5px; }

/* Le sélecteur de fichier natif ne suit pas la hauteur des autres champs */
.champ input[type="file"] {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 7px 9px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.champ input[type="file"]:hover { border-color: var(--brand-blue); }

/* ---------------- Pagination ---------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.pagination .info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pagination .liens { display: flex; gap: 8px; }

/* ---------------- Adaptation aux petits écrans ---------------- */

@media (max-width: 1040px) {
  .colonnes { grid-template-columns: 1fr; }
  .actions-collantes { position: static; }
}

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { min-height: 0; border-right: 0; border-bottom: 1px solid var(--border); }
  main { padding: 16px 14px 32px; }
  .shell-user .nom { display: none; }
  .grille-2, .grille-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
