/* =====================================================================
   Bural'ERP — feuille de style unique
   Direction : outil de pilotage d'echeances. Sobriete partout, une seule
   liberte formelle : le ruban d'echeances du tableau de bord.
   ===================================================================== */

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

:root {
  --paper:       #F5F6F4;
  --surface:     #FFFFFF;
  --surface-alt: #FAFBFA;
  --ink:         #161B21;
  --ink-soft:    #5C6873;
  --ink-faint:   #8A939C;
  --line:        #E4E7E4;
  --line-strong: #CFD5CF;

  --accent:      #1F7A5C;
  --accent-dark: #17604A;
  --accent-soft: #E8F1ED;

  /* Ces quatre couleurs sont reservees aux niveaux d'alerte.
     Elles n'apparaissent nulle part ailleurs, pour qu'un point rouge
     signifie toujours la meme chose. */
  --level-info:    #2C6EAB;
  --level-watch:   #A9791C;
  --level-urgent:  #C2410C;
  --level-overdue: #9F1239;
  --level-info-soft:    #E7EFF7;
  --level-watch-soft:   #F7EFDF;
  --level-urgent-soft:  #FAEAE1;
  --level-overdue-soft: #F9E4E9;

  --radius:    6px;
  --radius-lg: 10px;
  --rail:      232px;

  --font-ui:   -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter Tight", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "IBM Plex Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-pop: 0 6px 24px rgba(22, 27, 33, .12);
}

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

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 21px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p  { margin: 0 0 10px; }

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* Identifiants manipules toute la journee : plaques, matricules, numeros
   de contrat. La chasse fixe les rend comparables d'un coup d'oeil. */
.ident {
  font-family: var(--font-mono);
  font-size: .92em;
  letter-spacing: .02em;
}

.muted     { color: var(--ink-soft); }
.faint     { color: var(--ink-faint); }
.small     { font-size: 12.5px; }
.strong    { font-weight: 600; }
.nowrap    { white-space: nowrap; }
.right     { text-align: right; }
.center    { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.hidden { display: none !important; }

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

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--ink);
  color: #C9D1D6;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.rail__brand {
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 10px;
  align-items: start;
}
.rail__brand-link { color: #fff; display: grid; grid-template-columns: 40px 1fr; grid-column: 1 / -1; column-gap: 10px; align-items: center; }
.rail__brand-link:hover { text-decoration: none; }
.rail__mark { width: 42px; height: 42px; display: block; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; box-sizing: border-box; }
.rail__logo {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.02em;
  color: #fff;
}
.rail__logo em { font-style: normal; color: #6FBFA0; }
.rail__company {
  font-size: 11.5px;
  color: #8A959D;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail__nav { flex: 1; padding: 12px 10px; overflow-y: auto; }

.rail__section {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #6B757D;
  padding: 14px 10px 6px;
}

.rail__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: #C9D1D6;
  font-size: 13.5px;
  margin-bottom: 1px;
}
.rail__link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.rail__link--active { background: var(--accent); color: #fff; font-weight: 550; }
.rail__link--active:hover { background: var(--accent); }
.rail__link--soon { color: #6B757D; cursor: default; }
.rail__link--soon:hover { background: none; color: #6B757D; }

.rail__tag {
  margin-left: auto;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,.08);
  color: #8A959D;
}
.rail__count {
  margin-left: auto;
  min-width: 20px;
  text-align: center;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 20px;
  background: var(--level-urgent);
  color: #fff;
  font-weight: 600;
}

.rail__foot {
  border-top: 1px solid rgba(255,255,255,.09);
  padding: 12px 14px;
  font-size: 12.5px;
}
.rail__user { color: #fff; font-weight: 550; }
.rail__role { color: #8A959D; font-size: 11.5px; }
.rail__logout {
  margin-top: 8px;
  background: none;
  border: 1px solid rgba(255,255,255,.16);
  color: #C9D1D6;
  padding: 5px 10px;
  border-radius: var(--radius);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  width: 100%;
}
.rail__logout:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 14px 26px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar__title { flex: 1; min-width: 0; }
.topbar__crumb { font-size: 12px; color: var(--ink-faint); margin-bottom: 1px; }
.topbar__lede {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink-soft);
  max-width: 44rem;
}
.topbar__actions { display: flex; gap: 8px; align-items: center; }

.radio {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.radio__label {
  font-size: 11px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.radio .btn.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.input--narrow {
  width: 7rem;
  text-align: right;
}
.order-review__totals .dl__desc { font-variant-numeric: tabular-nums; }

.page-guide,
.order-howto {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  margin-bottom: 18px;
}
.page-guide__summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--accent-dark);
  list-style: none;
}
.page-guide__summary::-webkit-details-marker { display: none; }
.page-guide__summary::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 8px;
  vertical-align: middle;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  opacity: .55;
  transition: transform .15s;
}
.page-guide:not([open]) .page-guide__summary::after { transform: rotate(-90deg); }
.page-guide[open] { padding-bottom: 14px; }
.page-guide__body { margin-top: 10px; }
.page-guide__lede,
.order-howto__lede { margin: 0 0 12px; max-width: 52rem; line-height: 1.45; }
.page-guide__section {
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.page-guide__section--warn { color: var(--level-watch); }
.page-guide__steps,
.order-howto__steps {
  margin: 0 0 4px;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  max-width: 52rem;
}
.page-guide__steps li,
.order-howto__steps li { margin-bottom: 8px; line-height: 1.4; }
.page-guide__warnings {
  margin: 0;
  padding-left: 1.2rem;
  max-width: 52rem;
  color: var(--level-watch);
}
.page-guide__warnings li { margin-bottom: 6px; line-height: 1.4; }

/* --- Requetes internes (bouton triangle) ----------------------------- */

.request-pop { position: relative; flex: 0 0 auto; margin-left: 8px; }
.request-pop__toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid #ECC0CB;
  background: var(--level-overdue-soft);
  color: var(--level-overdue);
  cursor: pointer;
}
.request-pop__toggle:hover { filter: brightness(0.97); }
.request-pop__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--level-overdue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.request-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 560px;
  width: calc(100% - 32px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(20, 40, 30, .18);
}
.request-dialog::backdrop { background: rgba(20, 30, 25, .35); }
.request-dialog__form { padding: 18px 20px 16px; }
.request-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.request-dialog__head h2 { margin: 0; font-size: 17px; }

.changelog-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(20, 40, 30, .18);
}
.changelog-dialog::backdrop { background: rgba(20, 30, 25, .35); }
.changelog-dialog__inner { padding: 18px 20px 16px; }
.changelog-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.changelog-dialog__head h2 { margin: 0; font-size: 17px; }
.changelog-list { list-style: none; margin: 0; padding: 0; }
.changelog-list__item {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.changelog-list__item:first-child { border-top: 0; padding-top: 0; }
.changelog-list__version {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
}
.changelog-list__when {
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
}
.changelog-list__summary {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.order-queue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.order-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.order-card__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.order-card__date { font-size: 12px; color: var(--ink-faint); }
.order-card__ref { font-size: 22px; margin: 0; letter-spacing: .02em; }
.order-card__client { margin: 0; }
.order-card__meta {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--ink-soft);
  font-size: 13px;
}
.order-card__total { margin: 4px 0 8px; font-size: 20px; font-variant-numeric: tabular-nums; }
.order-card__total span { font-size: 12px; color: var(--ink-faint); font-weight: 500; }
.order-card .btn { align-self: flex-start; }

.order-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .02em;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-alt);
}
.order-chip--review { background: var(--level-watch-soft); border-color: #E7D5AE; color: var(--level-watch); }
.order-chip--validated { background: var(--accent-soft); border-color: #C6DDD3; color: var(--accent-dark); }
.order-chip--prep { background: var(--level-info-soft); border-color: #C9DBEC; color: var(--level-info); }
.order-chip--cancelled { background: var(--level-overdue-soft); border-color: #ECC0CB; color: var(--level-overdue); }

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}
.chips--quick { margin: 0; }
.chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.chip:hover { background: var(--accent-soft); border-color: #C6DDD3; text-decoration: none; }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip--soft {
  pointer-events: none;
  max-width: min(280px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-cat {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 0 0 16px;
}
.scope-cat__pick {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.scope-cat__label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}
.scope-cat__select {
  min-width: 200px;
  max-width: min(360px, 100%);
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
}
.scope-cat__select:focus {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
  border-color: var(--accent);
}
html[data-theme="dark"] .scope-cat__select {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.cat-analytics { margin: 0 0 16px; }
.cat-analytics__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}
.cat-analytics__toggle { font-size: 13px; font-weight: 600; }
.cat-analytics__tree { padding: 14px 16px; }
.cat-analytics__tree > summary {
  cursor: pointer;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
}
.cat-analytics__tree > summary::-webkit-details-marker { display: none; }
.cat-analytics__tree-body {
  margin-top: 12px;
  max-height: min(420px, 55vh);
  overflow: auto;
  display: grid;
  gap: 2px;
  padding-right: 4px;
}
.cat-analytics__tree-body .combo__filter {
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.cat-analytics__node {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px 6px calc(8px + (var(--depth, 0) * 14px));
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.cat-analytics__node:hover { background: var(--accent-soft); }
.cat-analytics__node input { margin-top: 2px; flex: 0 0 auto; }
.cat-analytics__total td {
  border-top: 2px solid var(--line-strong);
  background: var(--accent-soft);
}
.cat-share { padding: 14px 16px; }
.cat-share--row { padding: 0; margin-top: 6px; }
.cat-share__label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.cat-share__track {
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.cat-share--row .cat-share__track { height: 6px; }
.cat-share__sel {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  min-width: 0;
}
.cat-share__meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 600;
}

.cat-analytics__sel-band {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid #C9D7E8;
  background:
    linear-gradient(135deg, rgba(44, 110, 171, .08), rgba(44, 110, 171, .02) 42%, transparent 70%),
    var(--surface);
}
.cat-analytics__sel-band .section-heading { margin-bottom: 12px; }
.cat-analytics__sel-band .section-heading h2 { color: #1A4A75; }
.cat-analytics__sel-band .section-heading > span { color: #5A7390; }
.kpi--sel {
  background: #F3F7FB;
  border-color: #C9D7E8;
  box-shadow: none;
}
.kpi--sel .kpi__label { color: #2C6EAB; }
.kpi--sel .kpi__value { color: #163A5C; }
.kpi--sel .kpi__sub { color: #5A7390; }
html[data-theme="dark"] .cat-analytics__sel-band {
  border-color: rgba(122, 168, 214, .28);
  background:
    linear-gradient(135deg, rgba(44, 110, 171, .22), rgba(22, 27, 33, .2) 50%, transparent 80%),
    var(--surface);
}
html[data-theme="dark"] .cat-analytics__sel-band .section-heading h2 { color: #B7D0EA; }
html[data-theme="dark"] .cat-analytics__sel-band .section-heading > span { color: #8AA0B8; }
html[data-theme="dark"] .kpi--sel {
  background: rgba(44, 110, 171, .14);
  border-color: rgba(122, 168, 214, .28);
}
html[data-theme="dark"] .kpi--sel .kpi__label { color: #9EC0E0; }
html[data-theme="dark"] .kpi--sel .kpi__value { color: #E7EEF6; }
html[data-theme="dark"] .kpi--sel .kpi__sub { color: #8AA0B8; }

.prep-board__meta { margin: 0 0 16px; color: var(--ink-soft); }
.prep-card__actions { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.prep-action { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 240px; }
.prep-action input[type="text"] {
  flex: 1 1 160px;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  font: inherit;
}

.recipe { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.recipe__item { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.recipe__item:last-child { border-bottom: none; }
.recipe__item p { margin: 4px 0 0; }

.order-steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0 0 16px;
}
.order-steps li {
  flex: 1 1 140px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.order-steps li.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 650;
}
.order-steps li.is-done { border-color: #C6DDD3; color: var(--accent-dark); }
.order-steps__hint { display: block; font-size: 11px; font-weight: 500; color: var(--ink-faint); margin-top: 2px; }

.order-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.order-actions__item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.order-actions__hint {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.player-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 24px;
}
.player {
  width: min(360px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.player__kicker {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 6px;
}
.player__title { font-size: 22px; margin-bottom: 8px; }

.rail-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  font: inherit;
}

.content { padding: 22px 26px 60px; max-width: 1440px; width: 100%; }

/* --- Cartes ---------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.card__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.card__head h2 { flex: 1; min-width: 0; }
.card__hint { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; font-weight: 400; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

/* --- Cartes indicateurs ---------------------------------------------- */

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 15px 17px;
}
.kpi__label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--ink-soft);
}
.kpi__value {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -.02em;
  margin-top: 5px;
  line-height: 1.15;
}
.kpi__value--sm { font-size: 21px; }
.kpi__sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 5px; }
.kpi__delta { font-weight: 600; }
.kpi__delta--up   { color: var(--level-urgent); }
.kpi__delta--down { color: var(--accent); }

/* --- Tableaux -------------------------------------------------------- */

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

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-soft);
  font-weight: 600;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  white-space: nowrap;
}
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--ink); text-decoration: none; }
.table th .sort { color: var(--accent); }
.table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  height: 40px;
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface-alt); }
.table tbody tr:last-child td { border-bottom: none; }
.table--compact td { padding: 7px 14px; height: 34px; }

.person { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 650;
}
.avatar--lg { width: 46px; height: 46px; flex-basis: 46px; font-size: 16px; }
.person__name { font-weight: 550; }
.person__meta { font-size: 12px; color: var(--ink-soft); }

/* --- Badges ---------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--ok   { background: var(--accent-soft); color: var(--accent-dark); border-color: #C6DDD3; }
.badge--warn { background: var(--level-watch-soft); color: var(--level-watch); border-color: #E7D5AE; }
.badge--info { background: var(--level-info-soft); color: var(--level-info); border-color: #C9DBEC; }
.badge--danger { background: var(--level-overdue-soft); color: var(--level-overdue); border-color: #ECC0CB; }
.badge--neutral { background: var(--surface-alt); color: var(--ink-soft); border-color: var(--line); }

.avatar--tone-danger { background: var(--level-overdue-soft); color: var(--level-overdue); }
.avatar--tone-warn { background: var(--level-watch-soft); color: var(--level-watch); }
.avatar--tone-ok { background: var(--accent-soft); color: var(--accent-dark); }
.avatar--tone-muted { background: var(--surface-alt); color: var(--ink-soft); }

.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-select__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12.5px;
  cursor: pointer;
}
.chip-select__item:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chip-select__item input { margin: 0; }
.row--slip td { background: color-mix(in srgb, var(--level-watch-soft) 35%, transparent); }
.plain-list { margin: 0; padding-left: 1.2em; }
.plain-list li + li { margin-top: 4px; }
.code-block {
  margin: 0; padding: 12px 14px; overflow: auto; max-height: 320px;
  font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-word;
  background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius);
}

.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: none; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn--danger { color: var(--level-overdue); border-color: #ECC0CB; }
.btn--danger:hover { background: var(--level-overdue-soft); }
.btn--sm { padding: 4px 10px; font-size: 12.5px; }
.btn--link { border: none; background: none; color: var(--accent-dark); padding: 4px 6px; }
.btn--link:hover { background: var(--accent-soft); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

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

.cron-box {
  border-color: #C6DDD3;
  background: var(--accent-soft);
}
.cron-box .card__head,
.cron-box .card__body { background: transparent; }
.cron-box__url {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  word-break: break-all;
  user-select: all;
}

.sync-meter {
  height: 8px;
  background: var(--surface-alt);
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 6px;
}
.sync-meter > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width .4s ease;
}
.sync-steps {
  list-style: none;
  margin: 16px 0 12px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 14px;
}
.sync-steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.sync-steps__mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
  flex: 0 0 8px;
}
.sync-steps .is-done { color: var(--accent-dark); }
.sync-steps .is-done .sync-steps__mark { background: var(--accent); }
.sync-steps .is-running { color: var(--ink); font-weight: 600; }
.sync-steps .is-running .sync-steps__mark {
  background: var(--level-info);
  box-shadow: 0 0 0 4px var(--level-info-soft);
}
.sync-steps .is-waiting { color: var(--ink); }
.sync-steps .is-waiting .sync-steps__mark { background: var(--level-watch); }

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

.fieldset { border: none; margin: 0 0 26px; padding: 0; }
.fieldset__legend {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-soft);
  font-weight: 650;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  width: 100%;
}

.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field--wide { grid-column: span 2; }
.field--full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.field__req { color: var(--level-urgent); }
.field__hint { font-size: 12px; color: var(--ink-soft); }
.field__error { font-size: 12px; color: var(--level-overdue); font-weight: 550; }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="search"],
select, textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  min-height: 34px;
}
input:hover, select:hover, textarea:hover { border-color: #B6BEB6; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { min-height: 76px; resize: vertical; }
.field--invalid input, .field--invalid select, .field--invalid textarea {
  border-color: var(--level-overdue);
  background: #FFFBFC;
}

.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13.5px; }
.check input { width: auto; min-height: 0; margin-top: 3px; }

.combo { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.combo__list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  max-height: 240px;
  overflow: auto;
  box-shadow: 0 8px 20px rgba(20, 30, 24, .1);
}
.combo__item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
}
.combo__item:hover,
.combo__item.is-active { background: var(--accent-soft); }
.combo__item-hint { display: block; font-size: 12px; color: var(--ink-soft); }
.state-picks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 14px;
  max-height: 220px;
  overflow: auto;
  padding: 4px 0 8px;
}

/* --- Barre de filtres ------------------------------------------------ */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.filters .field { min-width: 148px; }
.filters .field--search { flex: 1; min-width: 220px; }

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

.flash {
  padding: 11px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.flash--success { background: var(--accent-soft); border-color: #C6DDD3; color: var(--accent-dark); }
.flash--error   { background: var(--level-overdue-soft); border-color: #ECC0CB; color: var(--level-overdue); }
.flash--warning { background: var(--level-watch-soft); border-color: #E7D5AE; color: var(--level-watch); }
.flash--info    { background: var(--level-info-soft); border-color: #C9DBEC; color: var(--level-info); }

.empty { padding: 40px 24px; text-align: center; color: var(--ink-soft); }
.empty__title { font-weight: 600; color: var(--ink); margin-bottom: 4px; font-size: 14.5px; }
.empty__hint { font-size: 13px; max-width: 460px; margin: 0 auto 14px; }

/* --- Ruban d'echeances (element signature) ---------------------------- */

.ribbon {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px 12px;
  margin-bottom: 18px;
}
.ribbon__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.ribbon__head h2 { flex: 1; }
.ribbon__legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-soft); flex-wrap: wrap; }
.ribbon__legend span { display: inline-flex; align-items: center; gap: 5px; }
.ribbon__key { width: 8px; height: 8px; border-radius: 2px; }

.ribbon__grid { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 4px; }

.ribbon__month {
  flex: 1 1 0;
  min-width: 62px;
  border-radius: var(--radius);
  padding: 6px 6px 8px;
  background: var(--surface-alt);
  border: 1px solid transparent;
}
.ribbon__month--current { background: var(--accent-soft); border-color: #C6DDD3; }
.ribbon__label {
  font-size: 11px;
  text-align: center;
  color: var(--ink-soft);
  margin-bottom: 6px;
  text-transform: capitalize;
}
.ribbon__year { font-size: 9.5px; color: var(--ink-faint); display: block; }

.ribbon__lane { min-height: 22px; display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; align-content: flex-start; padding: 2px 0; }
.ribbon__lane + .ribbon__lane { border-top: 1px dashed var(--line-strong); }

.tick {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: block;
  border: none;
  padding: 0;
  cursor: pointer;
}
.tick--info    { background: var(--level-info); }
.tick--watch   { background: var(--level-watch); }
.tick--urgent  { background: var(--level-urgent); }
.tick--overdue { background: var(--level-overdue); }

.ribbon__foot {
  display: flex;
  gap: 3px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--ink-faint);
}
.ribbon__lane-label {
  writing-mode: horizontal-tb;
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* --- Onglets --------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}
.tabs a {
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.is-active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.tabs__count { font-size: 11px; color: var(--ink-faint); margin-left: 4px; }

/* --- En-tete de fiche ------------------------------------------------ */

.record-head {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 18px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.record-head__main { flex: 1; min-width: 220px; display: flex; gap: 14px; align-items: center; }
.record-head__name { font-size: 19px; font-weight: 650; letter-spacing: -.015em; }
.record-head__meta { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.record-head__facts { display: flex; gap: 26px; flex-wrap: wrap; }
.fact__label { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.fact__value { font-size: 14px; font-weight: 600; margin-top: 2px; }

/* --- Listes de definitions ------------------------------------------- */

.dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 22px; }
.dl--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dl__term { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); }
.dl__desc { font-size: 14px; margin-top: 2px; }

/* --- Panneau depliant (formulaires secondaires) ---------------------- */

.disclosure { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; background: var(--surface); }
.disclosure > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before { content: "+"; color: var(--accent); font-weight: 700; }
.disclosure[open] > summary::before { content: "–"; }
.disclosure[open] > summary { border-bottom: 1px solid var(--line); }
.disclosure__body { padding: 16px; }

/* --- Chronologie ----------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 16px 20px;
  border-left: 1px solid var(--line-strong);
  margin-left: 5px;
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.timeline li.is-current::before { background: var(--accent); }
.timeline__date { font-size: 11.5px; color: var(--ink-faint); }
.timeline__title { font-weight: 600; font-size: 13.5px; }
.timeline__body { font-size: 13px; color: var(--ink-soft); }

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

.pagination { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.pagination a, .pagination span {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 12.5px;
  background: var(--surface);
  color: var(--ink);
}
.pagination a:hover { background: var(--surface-alt); text-decoration: none; }
.pagination .is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pagination .is-disabled { opacity: .4; }

/* --- Page de connexion ----------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--ink);
}
.auth__card {
  width: 100%;
  max-width: 372px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 30px 28px;
  box-shadow: var(--shadow-pop);
}
.auth__brand { font-size: 22px; font-weight: 650; letter-spacing: -.02em; }
.auth__brand em { font-style: normal; color: var(--accent); }
.auth__intro { color: var(--ink-soft); font-size: 13.5px; margin: 4px 0 22px; }
.auth__fields { display: flex; flex-direction: column; gap: 14px; }
.auth .btn { width: 100%; margin-top: 4px; padding: 9px; }
.auth__note { margin-top: 18px; font-size: 12px; color: var(--ink-faint); text-align: center; }

/* --- Page d'erreur --------------------------------------------------- */

.error-page { padding: 60px 24px; text-align: center; max-width: 520px; margin: 0 auto; }
.error-page__code { font-size: 46px; font-weight: 700; color: var(--line-strong); letter-spacing: -.03em; }
.error-page__title { font-size: 18px; font-weight: 650; margin: 4px 0 8px; }

/* --- Etat vide de module non encore livre ---------------------------- */

.module-note {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 22px;
  text-align: center;
  color: var(--ink-soft);
  background: var(--surface-alt);
}

/* --- Adaptation tablette et mobile ----------------------------------- */

@media (max-width: 1180px) {
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
  }
  .rail__nav { display: none; padding: 8px 10px 14px; }
  .rail__nav.is-open { display: block; }
  .rail__foot { display: flex; align-items: center; gap: 12px; }
  .rail__logout { width: auto; margin-top: 0; margin-left: auto; }
  .rail-toggle { display: inline-flex; }
  .content { padding: 16px 14px 48px; }
  .topbar { padding: 12px 14px; }
  .grid--4, .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .form-grid, .form-grid--2 { grid-template-columns: 1fr; }
  .field--wide { grid-column: span 1; }
  .state-picks { grid-template-columns: 1fr; }
  .dl, .dl--2 { grid-template-columns: 1fr; }
  .ribbon__month { min-width: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html.motion-ok .content:not(.is-ready) > *,
  html.motion-ok .content > *,
  .chart__line,
  .chart__area,
  .chart__bar,
  .chart__point {
    opacity: 1 !important;
    transform: none !important;
    stroke-dashoffset: 0 !important;
  }
}

@media print {
  .rail, .topbar__actions, .filters, .btn, .pagination, .page-guide { display: none !important; }
  body { background: #fff; }
  .card { break-inside: avoid; border-color: #999; }
}

/* --- Calendrier mensuel des absences --------------------------------- */

.calendar { border-collapse: collapse; font-size: 12.5px; width: 100%; }

.calendar th, .calendar td { border: 1px solid var(--line); padding: 0; }

.calendar__name {
  text-align: left;
  padding: 6px 10px;
  min-width: 168px;
  background: var(--surface);
  position: sticky;
  left: 0;
  z-index: 2;
  font-weight: 550;
  border-right: 2px solid var(--line-strong);
}
.calendar thead .calendar__name { background: var(--surface-alt); }

.calendar__day {
  width: 26px;
  min-width: 26px;
  padding: 4px 0;
  text-align: center;
  background: var(--surface-alt);
  font-weight: 500;
  line-height: 1.25;
}
.calendar__weekday { display: block; font-size: 9.5px; color: var(--ink-faint); text-transform: uppercase; }
.calendar__number { display: block; font-size: 11.5px; }

.calendar__cell { height: 30px; text-align: center; vertical-align: middle; }

.calendar__day.is-off, .calendar__cell.is-off { background: #EDEFEC; }
.calendar__day.is-holiday, .calendar__cell.is-holiday {
  background: repeating-linear-gradient(45deg, #E7E9E6, #E7E9E6 3px, #F2F3F1 3px, #F2F3F1 6px);
}
.calendar__day.is-today, .calendar__cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); }

.calendar__mark {
  display: block;
  width: 100%;
  height: 20px;
  margin: 0 auto;
  border-radius: 3px;
}
.calendar__mark--half {
  width: 50%;
  margin-left: 0;
  border-radius: 3px 0 0 3px;
}

.calendar__total {
  text-align: right;
  padding: 4px 10px;
  min-width: 52px;
  background: var(--surface-alt);
  font-weight: 600;
  border-left: 2px solid var(--line-strong);
}

/* Sur petit ecran le calendrier reste lisible en defilement horizontal,
   la colonne des noms restant collee a gauche. */
@media (max-width: 900px) {
  .calendar__name { min-width: 128px; font-size: 12px; }
  .calendar__day { width: 22px; min-width: 22px; }
}

/* --- Jauge de solde --------------------------------------------------- */

.gauge {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
  margin-top: 5px;
}
.gauge__fill { height: 100%; background: var(--accent); border-radius: 3px; }
.gauge__fill--watch { background: var(--level-watch); }
.gauge__fill--over  { background: var(--level-overdue); }

/* --- Graphiques SVG tableau de bord ---------------------------------- */

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 18px;
}
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}
.chart {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface-alt);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  position: relative;
}
.chart__label {
  fill: var(--ink-faint);
  font-size: 10px;
  font-family: var(--font-ui);
}
.chart__empty {
  fill: var(--ink-soft);
  font-size: 12px;
  font-family: var(--font-ui);
}
.chart__line {
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.chart__area {
  opacity: 0;
  transition: opacity .35s ease;
}
.chart.is-drawn .chart__area { opacity: 1; }
.chart__bar {
  transform-box: fill-box;
  transform-origin: bottom center;
  transform: scaleY(0.001);
  transition: transform .35s cubic-bezier(.22, .7, .3, 1);
  cursor: pointer;
}
.chart.is-drawn .chart__bar { transform: scaleY(1); }
.chart__point {
  opacity: 0;
  transition: opacity .2s ease, r .15s ease;
  cursor: pointer;
}
.chart.is-drawn .chart__point { opacity: 1; }
.chart__point:hover,
.chart__point.is-active { r: 5; }
.chart__bar:hover,
.chart__bar.is-active { filter: brightness(1.08); }
.chart-tip {
  position: fixed;
  z-index: 80;
  pointer-events: none;
  padding: 6px 10px;
  border-radius: 7px;
  background: #183c31;
  color: #f0f5f1;
  font-size: 12px;
  line-height: 1.35;
  box-shadow: 0 6px 18px #183c3128;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
  max-width: 220px;
}
.chart-tip.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.mb-1 { margin-bottom: 8px; }

/* --- Motion douce (entrée contenu, micro-interactions) --------------- */

html.motion-ok .content:not(.is-ready) > * {
  opacity: 0;
  transform: translateY(6px);
}
html.motion-ok .content.is-ready > * {
  opacity: 1;
  transform: none;
  transition: opacity .22s ease, transform .22s ease;
}
html.motion-ok .content.is-ready > *:nth-child(1) { transition-delay: 0ms; }
html.motion-ok .content.is-ready > *:nth-child(2) { transition-delay: 35ms; }
html.motion-ok .content.is-ready > *:nth-child(3) { transition-delay: 70ms; }
html.motion-ok .content.is-ready > *:nth-child(4) { transition-delay: 105ms; }
html.motion-ok .content.is-ready > *:nth-child(5) { transition-delay: 140ms; }
html.motion-ok .content.is-ready > *:nth-child(6) { transition-delay: 175ms; }
html.motion-ok .content.is-ready > *:nth-child(7) { transition-delay: 210ms; }
html.motion-ok .content.is-ready > *:nth-child(8) { transition-delay: 245ms; }
html.motion-ok .content.is-ready > *:nth-child(9) { transition-delay: 280ms; }
html.motion-ok .content.is-ready > *:nth-child(10) { transition-delay: 315ms; }
html.motion-ok .content.is-ready > *:nth-child(11) { transition-delay: 350ms; }
html.motion-ok .content.is-ready > *:nth-child(n+12) { transition-delay: 385ms; }

.flash {
  transition: border-color .15s ease, box-shadow .15s ease, transform .22s ease, opacity .22s ease;
}
html.motion-ok .content:not(.is-ready) > .flash {
  transform: translateY(6px) translateX(-4px);
}

.card {
  transition: border-color .15s ease, box-shadow .18s ease;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 14px #203b3308;
}

.kpi {
  transition: border-color .15s ease, box-shadow .18s ease, transform .18s ease;
}
.kpi:hover {
  border-color: var(--line-strong);
  box-shadow: 0 4px 12px #203b3308;
}

.table tbody tr {
  transition: background .12s ease;
}
/* Boutons : hover leger — voir regle .btn plus bas (identite visuelle). */

/* Identité visuelle : surfaces ivoire, navigation forêt, rythme aéré. */
:root {
  --paper: #f5f6f2; --surface-alt: #f8f9f6; --ink: #203b33;
  --ink-soft: #5e6f67; --ink-faint: #718078; --line: #e4e9e1;
  --line-strong: #cdd7ce; --accent: #236a50; --accent-dark: #19553f;
  --accent-soft: #eaf2e8; --radius: 9px; --radius-lg: 16px; --rail: 250px;
}
body { -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1 { font-size: 23px; letter-spacing: -.035em; }
h2 { letter-spacing: -.025em; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 10px; left: 12px; transform: translateY(-180%); padding: 12px 20px; background: white; z-index: 100; border-radius: 8px; }
.skip-link:focus { transform: none; }
.rail { background: var(--rail-bg, #183c31); color: #d4e2d7; }
.rail__brand {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 10px;
  align-items: start;
  padding: 25px 21px;
}
.rail__brand-link { display: grid; grid-template-columns: 40px 1fr; grid-column: 1 / -1; column-gap: 10px; align-items: center; }
.rail__mark { width: 42px; height: 42px; display: block; align-self: start; object-fit: contain; background: #fff; border-radius: 12px; padding: 4px; box-sizing: border-box; }
.rail__brand-text { display: flex; flex-direction: column; min-width: 0; }
.rail__logo { font-size: 21px; line-height: 1.2; }
.rail__logo em { color: #d7edb5; }
.rail__company { display: block; color: #b1c7ba; font-size: 11px; margin: 2px 0 0; }
.rail__version,
.auth__version {
  display: inline-flex;
  align-self: flex-start;
  margin: 0;
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: #d7edb5;
  color: #183c31;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.4;
  cursor: pointer;
}
.rail__version { grid-column: 2; justify-self: start; margin-top: 7px; }
.rail__version:hover,
.auth__version:hover { filter: brightness(1.06); }
.rail__version:focus-visible,
.auth__version:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rail__nav { padding: 2px 12px 20px; scrollbar-width: thin; scrollbar-color: #537365 transparent; }
.rail__section { color: #a7bcad; font-size: 10px; letter-spacing: .14em; padding: 24px 12px 9px; }
.rail__link { min-height: 40px; padding: 9px 12px; font-size: 12.5px; color: #d2e0d6; margin-bottom: 3px; border-radius: 9px; transition: background .15s; }
.rail__link--active, .rail__link--active:hover { background: #d7edb5; color: #183c31; font-weight: 650; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; opacity: .85; }
.nav-search { margin: 0 20px 8px; }
.nav-search input { background: #25483c; border-color: #466354; color: #fff; min-height: 38px; font-size: 12px; }
.nav-search input::placeholder { color: #c0d1c4; opacity: 1; }
.nav-search input:focus { border-color: #d7edb5; box-shadow: 0 0 0 2px #d7edb533; }
.nav-empty { color: #d2e0d6; padding: 18px 12px; font-size: 12px; }
.rail__foot { padding: 16px 22px; background: #15362c; }
.rail__role { color: #b1c7ba; }
.rail__logout { border-color: #456050; min-height: 34px; font-size: 11.5px; }
.topbar { padding: 21px 36px; min-height: 88px; background: #fffffff5; }
.topbar__crumb { font-size: 11px; color: var(--ink-soft); margin-bottom: 4px; }
.topbar__lede { font-size: 13px; color: #53694f; }
.topbar__actions { flex-wrap: wrap; justify-content: flex-end; }
.page-guide {
  background: #eaf0e2;
  border: 1px solid #dce6d6;
  border-radius: 16px;
  padding: 12px 20px;
  margin-bottom: 22px;
}
.page-guide__summary { color: #19553f; font-size: 13.5px; }
.page-guide__lede { color: #203b33; }
.page-guide__steps { color: #53694f; }
.page-guide__warnings { color: #8a6a1a; }
.topbar__actions { flex-wrap: wrap; justify-content: flex-end; }
.content { padding: 30px 36px 64px; max-width: 1640px; margin: 0 auto; }
.card, .kpi, .ribbon, .record-head { box-shadow: 0 3px 8px #203b3303; }
.card { margin-bottom: 22px; }
.card__head { padding: 20px 22px; flex-wrap: wrap; }
.card__body { padding: 22px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 14px 22px; flex-wrap: wrap; }
.grid { gap: 18px; }
.kpi { padding: 23px 22px; min-width: 0; }
.kpi__label { font-size: 10px; letter-spacing: .08em; font-weight: 650; }
.kpi__value { font-size: clamp(24px, 2.5vw, 36px); font-weight: 600; letter-spacing: -.05em; margin-top: 14px; overflow-wrap: anywhere; }
.kpi__value--sm { font-size: 26px; }
.kpi__sub { font-size: 12px; margin-top: 10px; }
.dashboard-welcome { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 34px 38px; margin-bottom: 30px; border: 1px solid #dce6d6; border-radius: 20px; background: #eaf0e2; position: relative; overflow: hidden; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: .16em; margin: 0 0 15px; }
.dashboard-welcome h2 { font-size: clamp(25px, 2.6vw, 38px); line-height: 1.18; font-weight: 600; letter-spacing: -.045em; }
.dashboard-welcome h2 span { color: #4e715b; }
.dashboard-welcome p:not(.eyebrow) { font-size: 13px; color: #53694f; margin: 15px 0 20px; max-width: 440px; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.welcome-actions .btn:not(.btn--primary) { background: transparent; border-color: #b9cbb1; }
.welcome-date { width: 145px; min-width: 145px; padding: 25px 15px; border: 1px solid #bccfb2; border-radius: 80px 80px 16px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; color: #426247; }
.welcome-date .eyebrow { font-size: 9px; margin: 0; }
.welcome-date strong { font: 400 64px Georgia, serif; line-height: 1.3; }
.welcome-date > span:last-child { font-size: 11px; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 14px; }
.section-heading h2 { font-size: 15px; }
.section-heading > span { font-size: 11px; color: var(--ink-soft); }
.dashboard-welcome + .section-heading + .grid .kpi:first-child { background: #234e3e; border-color: #234e3e; color: white; }
.dashboard-welcome + .section-heading + .grid .kpi:first-child .kpi__label,
.dashboard-welcome + .section-heading + .grid .kpi:first-child .kpi__sub { color: #c8dbc9; }
.mb-2 { margin-bottom: 22px; }
.table th { padding: 13px 18px; font-size: 10px; letter-spacing: .08em; }
.table td { padding: 14px 18px; height: 50px; font-size: 13px; }
.table--compact td { padding: 12px 18px; height: 44px; }
.table-wrap { border-radius: 0 0 var(--radius-lg) var(--radius-lg); scrollbar-width: thin; }
.table td a { font-weight: 550; }
.avatar { border-radius: 10px; width: 34px; height: 34px; flex-basis: 34px; }
.avatar--lg { width: 48px; height: 48px; flex-basis: 48px; border-radius: 15px; }
.badge { font-size: 10.5px; padding: 4px 9px; }
.btn { min-height: 40px; padding: 9px 15px; font-size: 12.5px; transition: background .15s ease, box-shadow .15s ease, border-color .15s ease, transform .12s ease; }
.btn--primary { box-shadow: 0 3px 5px #19553f12; }
.btn--sm { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.btn--link { min-height: 32px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea { min-height: 41px; padding: 9px 12px; }
input:disabled, select:disabled, textarea:disabled { background: #f1f3ef; color: #69746c; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
.filters { padding: 18px 22px; gap: 14px; }
.field > label { font-size: 12px; }
.empty { padding: 42px 24px; }
.empty__title { font-size: 16px; margin-bottom: 8px; }
.empty__hint { line-height: 1.7; }
.ribbon { padding: 23px 24px 18px; }
.ribbon__head { justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.ribbon__month { padding: 12px 6px; background: #f5f7f1; }
.ribbon__month--current { background: #e4efd9; border-color: #c3d8ad; }
.ribbon__lane { min-height: 27px; }
.tick { width: 13px; height: 13px; border-radius: 4px; }
.tick:hover, .tick:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ribbon__foot { margin-top: 12px; }
.tabs { gap: 12px; }
.tabs a { padding: 13px 10px; }
.flash { padding: 15px 18px; line-height: 1.65; }
.auth { min-height: 100svh; grid-template-columns: 1.1fr 1fr; padding: 0; background: #f7f8f3; gap: 0; }
.auth__story { align-self: stretch; padding: 48px clamp(30px, 5vw, 85px); background: #183c31; color: #eaf0e2; display: flex; flex-direction: column; justify-content: space-between; min-height: 100svh; }
.auth__wordmark { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; align-self: start; }
.auth__logo { width: 100%; height: auto; display: block; }
.auth__logo-plate {
  background: #fff;
  border-radius: 28px;
  padding: 14px 18px 10px;
  width: min(280px, 100%);
  box-sizing: border-box;
  box-shadow: 0 16px 40px rgba(0,0,0,.18);
}
.auth__version {
  display: inline-flex;
  align-self: flex-start;
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: #d7edb5;
  color: #183c31;
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.4;
  cursor: pointer;
}
.auth__pitch { margin: 60px 0; }
.auth__pitch .eyebrow { color: #c0d2b6; }
.auth__pitch h1 { font-size: clamp(40px, 4.4vw, 68px); line-height: 1.08; font-weight: 500; letter-spacing: -.05em; }
.auth__pitch h1 em { font-family: Georgia, serif; font-weight: 400; color: #d7edb5; }
.auth__pitch > p:last-child { max-width: 350px; line-height: 1.8; color: #baccbf; font-size: 14px; margin-top: 26px; }
.auth__domains { display: flex; flex-wrap: wrap; gap: 10px 20px; border-top: 1px solid #456353; padding-top: 23px; font-size: 11px; color: #c3d4c6; }
.auth__card { max-width: 460px; padding: 45px; background: transparent; box-shadow: none; }
.auth__brand { font-size: 28px; line-height: 1.25; letter-spacing: -.045em; }
.auth__intro { font-size: 13px; margin: 13px 0 32px; }
.auth__fields { gap: 22px; }
.auth__fields input { min-height: 48px; background: #fff; }
.auth .auth__fields > .btn { min-height: 48px; margin-top: 2px; }
.auth__note { text-align: left; line-height: 1.7; margin-top: 25px; color: var(--ink-soft); }
.auth-gate {
  min-height: 100svh;
  background: #183c31;
  color: #eaf0e2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 14px;
}
.auth-gate__logo { width: 100%; height: auto; display: block; }
.auth-gate .auth__logo-plate { width: min(300px, 78vw); }
.auth-gate .auth__version { align-self: center; }
.auth-gate h1 { font-size: clamp(28px, 4vw, 42px); font-weight: 500; letter-spacing: -.04em; line-height: 1.15; max-width: 18ch; }
.auth-gate p { color: #baccbf; font-size: 15px; max-width: 32ch; line-height: 1.6; margin: 0 0 10px; }
.auth-gate .btn { min-height: 48px; min-width: 180px; }
.auth-gate__fallback { margin-top: 8px; }
.auth-gate__fallback a { color: #d7edb5; }
.password-field { position: relative; }
.password-field input { padding-right: 148px; }
.password-field__actions {
  position: absolute;
  right: 6px;
  top: 6px;
  display: flex;
  align-items: center;
  gap: 2px;
}
.password-toggle,
.password-generate {
  height: 36px;
  padding: 0 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--accent-dark);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.password-toggle:hover,
.password-generate:hover { background: var(--accent-soft); }
.role-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.role-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}
.role-check input { margin: 0; }
.role-matrix {
  padding: 18px 0;
  border-bottom: 1px solid var(--border, #e5e7eb);
}
.role-matrix:last-child { border-bottom: none; }
.role-matrix__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.role-matrix__head h3 { margin: 0; font-size: 16px; }
.role-matrix__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px 12px;
}

.rail__account:hover { color: #fff; }
html[data-theme="dark"] .rail__account { color: rgba(255,255,255,.7); }
@media (min-width: 901px) and (max-width: 1180px) {
  :root { --rail: 224px; }
  .content { padding: 25px 24px 50px; }
  .topbar { padding: 18px 24px; }
  .dashboard-welcome { padding: 28px; }
}
@media (max-width: 900px) {
  .rail__brand { padding: 16px 20px; }
  .rail__foot { padding: 12px 20px; justify-content: space-between; }
  .rail__nav { display: block; max-height: none; }
  .has-js .rail__nav { display: none; }
  .has-js .rail__nav.is-open { display: block; max-height: 55vh; overflow-y: auto; }
  .nav-search { margin: 0 20px 12px; }
  .topbar { min-height: 76px; padding: 16px 20px; flex-wrap: wrap; gap: 12px; }
  .topbar h1 { font-size: 20px; }
  .topbar__actions { width: 100%; justify-content: flex-start; }
  .content { padding: 22px 20px 48px; }
  .rail-toggle { display: none; min-height: 40px; }
  .has-js .rail-toggle { display: inline-flex; align-items: center; }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-welcome { padding: 26px; }
  .welcome-date { min-width: 110px; width: 110px; padding: 20px 10px; }
  .welcome-date strong { font-size: 52px; }
  .auth { grid-template-columns: 1fr; }
  .auth__story { min-height: auto; padding: 28px; }
  .auth__pitch { margin: 30px 0 0; }
  .auth__pitch h1 { font-size: 38px; }
  .auth__pitch h1 br { display: none; }
  .auth__pitch h1 em { display: block; }
  .auth__pitch > p:last-child, .auth__domains { display: none; }
  .auth__card { padding: 35px 28px; max-width: 480px; }
}
@media (max-width: 540px) {
  .content { padding: 18px 14px 40px; }
  .dashboard-welcome { padding: 25px 22px; }
  .welcome-date { display: none; }
  .dashboard-welcome h2 { font-size: 28px; }
  .section-heading > span { display: none; }
  .kpi { padding: 18px 15px; }
  .kpi__label { font-size: 9px; }
  .kpi__value { font-size: 28px; }
  .kpi__sub { font-size: 11px; }
  .grid { gap: 12px; }
  .filters .field, .filters .field--search { flex: 1 1 100%; min-width: 0; }
  .filters { padding: 16px; }
  .card__head, .card__body { padding: 18px; }
  .card__body--flush { padding: 0; }
  .ribbon { padding: 18px; }
  input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea { font-size: 16px; }
  .btn { min-height: 42px; }
}
@media print {
  .dashboard-welcome { background: white; }
  .welcome-actions, .nav-search, .rail-toggle, .skip-link { display: none !important; }
  .topbar { position: static; }
  .content { padding: 16px 0; }
  .kpi { color: #203b33 !important; background: white !important; }
  .kpi__label, .kpi__sub { color: #5e6f67 !important; }
}
/* Les tableaux défilent dans leur carte, sans élargir la grille mobile. */
.grid > * { min-width: 0; }
@media (max-width: 540px) {
  .flash { display: block; overflow-wrap: anywhere; }
  .flash > a { display: inline; }
  .card__head h2 { flex-basis: 100%; }
}
.ribbon__grid, .table-wrap { position: relative; }

.auth__story { justify-self: stretch; }
html:not(.has-js) [data-amendment-field].hidden { display: flex !important; }

/* Cockpit commercial */
.ckp-delta { font-weight: 600; }
.ckp-delta--up { color: var(--accent-dark); }
.ckp-delta--down { color: var(--level-overdue); }
.ckp-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.2em; padding: 2px 7px; border-radius: 999px;
  font-size: 12px; font-weight: 650; border: 1px solid var(--line-strong);
}
.ckp-score--overdue { background: var(--level-overdue-soft); color: var(--level-overdue); border-color: #ECC0CB; }
.ckp-score--urgent { background: var(--level-urgent-soft); color: var(--level-urgent); border-color: #EFC9B4; }
.ckp-score--watch { background: var(--level-watch-soft); color: var(--level-watch); border-color: #E7D5AE; }
.ckp-score--accent { background: var(--accent-soft); color: var(--accent-dark); border-color: #C6DDD3; }
.ckp-spark { color: var(--ink-soft); vertical-align: middle; }
.ckp-map { height: 480px; width: 100%; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-alt); }
.ckp-map.leaflet-container { height: 480px; }
.ckp-map--sm { height: 280px; }
.ckp-map--sm.leaflet-container { height: 280px; }
.ckp-facts { list-style: none; margin: 0; padding: 0; }
.ckp-facts li { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ckp-facts li:last-child { border-bottom: none; }
.ckp-level h3 { font-size: 13px; margin: 0 0 8px; }
.filters .check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding-top: 18px; }
th.sortable { cursor: pointer; }
@media print {
  .no-print, .rail, .topbar, .rail-toggle { display: none !important; }
  .ckp-map { height: 240px; }
}

/* --- Apparence : accents + mode sombre (par compte) ----------------- */

:root {
  --rail-bg: #183c31;
}

html[data-accent="ocean"] {
  --accent: #2C6EAB;
  --accent-dark: #1E5285;
  --accent-soft: #E7EFF7;
  --rail-bg: #1a3348;
}
html[data-accent="ardoise"] {
  --accent: #4A5D6A;
  --accent-dark: #354652;
  --accent-soft: #ECEFF1;
  --rail-bg: #2a343c;
}
html[data-accent="cuivre"] {
  --accent: #A65D3F;
  --accent-dark: #7E452E;
  --accent-soft: #F6EBE6;
  --rail-bg: #3d2a22;
}
html[data-accent="raisin"] {
  --accent: #6B4C7A;
  --accent-dark: #523A5E;
  --accent-soft: #F0EAF2;
  --rail-bg: #2f2436;
}

html[data-theme="dark"] {
  --paper: #12181a;
  --surface: #1b2326;
  --surface-alt: #222b2f;
  --ink: #e8eeeb;
  --ink-soft: #a8b5ae;
  --ink-faint: #7d8b84;
  --line: #2e3a3e;
  --line-strong: #3d4c51;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, #1b2326);
  --level-info-soft: #1a2a38;
  --level-watch-soft: #2e2818;
  --level-urgent-soft: #322018;
  --level-overdue-soft: #321820;
  --shadow-pop: 0 6px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background: var(--paper);
  color: var(--ink);
}

html[data-theme="dark"] .topbar {
  background: #1b2326f0;
  border-bottom-color: var(--line);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .kpi,
html[data-theme="dark"] .ribbon,
html[data-theme="dark"] .record-head,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .filters {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: none;
}

html[data-theme="dark"] .table th {
  background: var(--surface-alt);
  color: var(--ink-soft);
}

html[data-theme="dark"] .table tbody tr:hover {
  background: var(--surface-alt);
}

html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: var(--surface-alt);
  color: var(--ink);
  border-color: var(--line-strong);
}

html[data-theme="dark"] .btn:not(.btn--primary):not(.btn--danger):not(.btn--link) {
  background: var(--surface-alt);
  color: var(--ink);
  border-color: var(--line-strong);
}

html[data-theme="dark"] .btn:not(.btn--primary):not(.btn--danger):not(.btn--link):hover {
  background: var(--line);
}

html[data-theme="dark"] .dashboard-welcome {
  background: #1e2a27;
  border-color: var(--line-strong);
  color: var(--ink);
}

html[data-theme="dark"] .dashboard-welcome p:not(.eyebrow) {
  color: var(--ink-soft);
}

html[data-theme="dark"] .chart {
  background: var(--surface-alt);
  border-color: var(--line);
}

html[data-theme="dark"] .flash--success { background: #1c2e26; border-color: #2f5a45; color: #b8dcc9; }
html[data-theme="dark"] .flash--error { background: #2e1a20; border-color: #6b3040; color: #e8b4c0; }
html[data-theme="dark"] .flash--warning { background: #2c2618; border-color: #6b5a30; color: #e6d4a8; }
html[data-theme="dark"] .flash--info { background: #1a2630; border-color: #3a5570; color: #b8cce0; }

/* Panneau apparence — icone discrete + popover */
.rail__foot-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.theme-pop { position: relative; flex: 0 0 auto; }
.theme-pop__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid #456050;
  border-radius: 9px;
  background: transparent;
  color: #d2e0d6;
  cursor: pointer;
}
.theme-pop__toggle:hover {
  background: rgba(255,255,255,.06);
  border-color: #6a8578;
  color: #fff;
}
.theme-pop__menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 40;
  width: 188px;
  padding: 10px;
  border: 1px solid #456050;
  border-radius: 12px;
  background: #15362c;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
}
.theme-pop__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 10px;
  padding: 3px;
  border-radius: 9px;
  background: #0f2922;
}
.theme-pop__seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 7px;
  font-size: 11.5px;
  cursor: pointer;
  color: #b1c7ba;
}
.theme-pop__seg input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pop__seg:has(input:checked) {
  background: #234e3e;
  color: #d7edb5;
  font-weight: 600;
}
.theme-pop__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}
.theme-pop__dot {
  position: relative;
  width: 22px;
  height: 22px;
  cursor: pointer;
}
.theme-pop__dot input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pop__dot span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2);
}
.theme-pop__dot:has(input:checked) span {
  box-shadow: 0 0 0 2px #15362c, 0 0 0 3.5px #d7edb5;
}

html[data-theme="dark"] .theme-pop__menu {
  background: #0f1a17;
  border-color: #3a5048;
}
html[data-theme="dark"] .rail__foot {
  background: color-mix(in srgb, var(--rail-bg) 85%, #000);
}

@media (max-width: 900px) {
  .rail__foot-main { width: 100%; margin-bottom: 0; align-items: center; }
  .theme-pop__menu { right: auto; left: 0; }
}

