.dash-body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 380px at 90% -10%, rgba(0,148,204,.28), transparent 55%),
    linear-gradient(165deg, #02122c 0%, #041c48 52%, #012a6e 100%);
}
#loginView[hidden],
.login-screen[hidden] { display: none !important; }
.dash-body.is-app .login-screen { display: none !important; }

.login-card {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}
.login-card img { border-radius: 50%; margin-bottom: 12px; }
.login-card h1 { font-family: var(--display); margin: 8px 0 6px; }
.login-card form { text-align: left; margin-top: 18px; }
.login-card .err { display: none; color: #b91c1c; margin-top: 10px; }
.login-card .ok {
  display: none;
  color: #047857;
  margin-top: 10px;
  font-size: .92rem;
  line-height: 1.4;
}
.login-card .ok:not([hidden]) { display: block; }
.login-forgot-row {
  margin: 12px 0 0;
  text-align: center;
}
.login-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  color: var(--blue, #0369a1);
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.login-link:hover { filter: brightness(1.05); }

#appView {
  --side-rail: 68px;
  --side-open: 220px;
  display: grid;
  grid-template-columns: var(--side-rail) 1fr;
  min-height: 100vh;
  position: relative;
  transition: grid-template-columns .22s ease;
}
/* Déplié (épinglé ou survol) : pousse le contenu, ne le couvre pas */
#appView.side-pinned,
#appView:has(.dash-side:hover),
#appView:has(.dash-side:focus-within) {
  grid-template-columns: var(--side-open) 1fr;
}
#appView[hidden] { display: none !important; }

.dash-side {
  background: linear-gradient(180deg, #02122c 0%, #041c48 100%);
  color: #fff;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 50;
  transition: none;
}

.dash-side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-height: 44px;
}
.dash-side-toggle {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: 2px 0 0;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.dash-side-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-side-toggle .ico-collapse { display: none; }
#appView.side-pinned .dash-side-toggle .ico-pin { display: none; }
#appView.side-pinned .dash-side-toggle .ico-collapse { display: block; }
.dash-side-toggle:hover { background: rgba(255,255,255,.16); color: #fff; }

.dash-brand { color: #fff; text-decoration: none; display: flex; gap: 10px; align-items: center; padding: 4px 4px; min-width: 0; flex: 1; }
.dash-brand img { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; }
.dash-brand .word { color: #fff; font-weight: 700; font-size: .95rem; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.dash-brand small { display: block; color: rgba(255,255,255,.55); font-size: .65rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; }

/* Replié : textes masqués (icônes visibles) — sauf survol / focus / épinglé */
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-brand .word,
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
  pointer-events: none;
}
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-side-head {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-brand {
  justify-content: center;
  padding: 4px 0;
}

.dash-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  align-content: start;
}
.dash-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.78);
  padding: 9px 12px;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-nav button {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-nav button.nav-sub {
  margin-left: 0;
  width: 100%;
  padding-left: 0;
}
.dash-nav button .nav-label { min-width: 0; overflow: hidden; }
.dash-nav button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dash-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.dash-nav button.on {
  background: linear-gradient(90deg, #002eb8 0%, #0153ff 55%, #0094cc 100%);
  color: #fff;
  box-shadow: 0 8px 18px rgba(1, 83, 255, .28);
}
.dash-nav button.nav-sub {
  margin-left: 10px;
  width: calc(100% - 10px);
  font-size: .86rem;
  padding-left: 10px;
  opacity: .95;
}

.suivi-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.suivi-kpi {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
}
.suivi-kpi:hover { border-color: color-mix(in srgb, var(--blue) 40%, var(--line)); }
.suivi-kpi .n {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--heading);
  line-height: 1.1;
}
.suivi-kpi .l {
  display: block;
  margin-top: 4px;
  font-size: .82rem;
  color: var(--muted);
  font-weight: 600;
}
.suivi-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 14px;
}
.suivi-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.suivi-filters .btn.on {
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  color: var(--blue);
}
.suivi-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.suivi-card {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  justify-content: space-between;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
}
.suivi-card h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}
.suivi-card-main { flex: 1 1 280px; min-width: 0; }
.suivi-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 10px 0 8px;
}
.suivi-action-label {
  margin: 0;
  font-size: .92rem;
}
.suivi-card-actions {
  flex: 0 1 auto;
  justify-content: flex-end;
  max-width: 100%;
}
.suivi-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--bg);
}
.suivi-badge.go {
  color: #0b5;
  background: color-mix(in srgb, #0b5 12%, var(--surface));
  border-color: color-mix(in srgb, #0b5 30%, var(--line));
}
.suivi-badge.wait {
  color: #b86a00;
  background: color-mix(in srgb, #f5a623 14%, var(--surface));
  border-color: color-mix(in srgb, #f5a623 35%, var(--line));
}
.suivi-badge.of {
  color: #0153ff;
  background: color-mix(in srgb, #0153ff 12%, var(--surface));
  border-color: color-mix(in srgb, #0153ff 35%, var(--line));
}
.suivi-badge.ok {
  color: #0a7;
  background: color-mix(in srgb, #0a7 12%, var(--surface));
}
.suivi-badge.bad {
  color: #c0392b;
  background: color-mix(in srgb, #c0392b 10%, var(--surface));
}
.suivi-badge.rappel {
  color: #b42318;
  background: color-mix(in srgb, #f04438 14%, var(--surface));
  border-color: color-mix(in srgb, #f04438 35%, var(--line));
}
.suivi-card.is-rappel-due {
  border-color: color-mix(in srgb, #f04438 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, #f04438 18%, transparent);
}
.suivi-note-preview {
  margin: 8px 0 0;
  font-size: .88rem;
  color: var(--muted);
}
.suivi-section-title {
  margin: 18px 0 8px;
  font-size: 1rem;
}
.suivi-next {
  font-weight: 600;
  color: var(--heading);
}
.peda-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  max-height: calc(100vh - 220px);
}
.peda-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .86rem;
  min-width: 1180px;
}
.peda-table th,
.peda-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
.peda-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--surface) 88%, #94a3b8);
  font-weight: 700;
  color: var(--heading);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.peda-table th.sortable {
  cursor: pointer;
  user-select: none;
}
.peda-table th.sortable:hover { color: var(--blue); }
.peda-table th.sorted { color: var(--blue); }
.peda-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface) 92%, #cbd5e1); }
.peda-table tbody tr:hover { background: color-mix(in srgb, var(--blue) 8%, var(--surface)); }
.peda-table a { color: var(--blue); font-weight: 650; text-decoration: none; }
.peda-table a:hover { text-decoration: underline; }
.peda-risk { font-weight: 700; }
.peda-risk.high { color: #c0392b; }
.peda-risk.medium { color: #d97706; }
.peda-risk.low { color: #059669; }
.peda-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 260px;
  max-width: 280px;
}
.peda-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: stretch;
}
a.peda-btn,
.peda-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 6px 10px !important;
  font-size: .72rem !important;
  font-weight: 650 !important;
  line-height: 1.25 !important;
  border-radius: 6px !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  box-shadow: none !important;
  min-height: 28px;
  flex: 0 0 auto;
  background: #fff !important;
  color: #1e3a5f !important;
  border: 1px solid #cbd5e1 !important;
}
a.peda-btn:hover,
.peda-btn:hover {
  background: #f1f5f9 !important;
  border-color: #94a3b8 !important;
  color: #0f172a !important;
  text-decoration: none !important;
}
a.peda-btn.primary,
.peda-btn.primary {
  background: #1e4a7a !important;
  color: #fff !important;
  border-color: #1e4a7a !important;
}
a.peda-btn.primary:hover,
.peda-btn.primary:hover {
  background: #163a61 !important;
  color: #fff !important;
  border-color: #163a61 !important;
}
.peda-table td:last-child {
  white-space: normal;
  min-width: 270px;
}
.suivi-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.suivi-timeline li {
  border-left: 3px solid color-mix(in srgb, var(--blue) 40%, var(--line));
  padding: 6px 0 6px 12px;
}
.suivi-tl-when {
  font-size: .78rem;
  color: var(--muted);
  font-weight: 600;
}
.suivi-tl-label { font-size: .92rem; }
.suivi-tl-by { font-size: .78rem; margin-top: 2px; }
.suivi-enrichi textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: inherit;
}

.cal-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cal-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
  border: 1px solid var(--line);
}
.cal-pill.entree {
  color: #0b5;
  background: color-mix(in srgb, #0b5 12%, var(--surface));
}
.cal-pill.sortie {
  color: #0153ff;
  background: color-mix(in srgb, #0153ff 12%, var(--surface));
}
.cal-pill.rappel {
  color: #b86a00;
  background: color-mix(in srgb, #f5a623 14%, var(--surface));
}
.cal-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  overflow: auto;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
  font-size: .78rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.cal-cell {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  background: var(--bg);
}
.cal-cell.has-events {
  cursor: pointer;
}
.cal-cell.has-events:hover {
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
  background: color-mix(in srgb, var(--blue) 4%, var(--bg));
}
.cal-cell.empty {
  background: transparent;
  border-color: transparent;
}
.cal-cell.is-today {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 25%, transparent);
}
.cal-daynum {
  font-size: .8rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.cal-day-count {
  font-size: .68rem;
  font-weight: 700;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  border-radius: 999px;
  padding: 1px 7px;
}
.cal-events {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-event {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 6px;
  padding: 3px 6px;
  font: inherit;
  font-size: .68rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
}
.cal-event.entree { background: #0b5; }
.cal-event.sortie { background: #0153ff; }
.cal-event.rappel { background: #c47a00; }
.cal-more {
  font-size: .7rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 0;
  text-align: left;
  font-weight: 700;
}
.cal-more:hover { color: var(--blue); text-decoration: underline; }
.cal-day-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-day-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  border-left: 4px solid var(--line);
}
.cal-day-item.entree { border-left-color: #0b5; }
.cal-day-item.sortie { border-left-color: #0153ff; }
.cal-day-item.rappel { border-left-color: #c47a00; }
.cal-day-item:hover {
  border-color: color-mix(in srgb, var(--blue) 35%, var(--line));
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}
.cal-formation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cal-formation-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}
.cal-formation-dates {
  margin-top: 4px;
  font-weight: 600;
  font-size: .9rem;
}
@media (max-width: 900px) {
  .suivi-kpis { grid-template-columns: 1fr 1fr; }
  .cal-cell { min-height: 72px; }
  .cal-event { font-size: .62rem; }
}

.dash-logout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.6);
  padding: 9px 12px;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  font-size: .88rem;
  cursor: pointer;
  white-space: nowrap;
}
#appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-logout {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
.dash-logout svg {
  width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.dash-logout:hover { background: rgba(255,255,255,.08); color: #fff; }

.dash-main { padding: 24px 28px 48px; min-width: 0; }
.dash-top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
.dash-top h1 { margin: 0; font-family: var(--display); font-size: 1.7rem; }
.dash-top .muted:empty { display: none; }
.dash-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.dash-form-link {
  white-space: nowrap;
  text-decoration: none;
}

/* Page Dossiers : outils fixes hors scroll, tableau scrollable (en-têtes + actions OK) */
body.page-dossiers {
  --dossiers-tools-h: 56px;
}
body.page-dossiers #appView {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.page-dossiers .dash-side {
  height: 100vh;
  height: 100dvh;
  overflow: auto;
}
body.page-dossiers .dash-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 12px 20px 12px;
  box-sizing: border-box;
  overflow: hidden;
}
body.page-dossiers .dash-top {
  margin-bottom: 8px;
  flex: 0 0 auto;
}
body.page-dossiers .dash-top h1 { font-size: 1.35rem; }
body.page-dossiers #dashNotify { flex: 0 0 auto; margin-bottom: 8px; }
body.page-dossiers #page {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body.page-dossiers .dossiers-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
body.page-dossiers .dossiers-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: 14px;
}
.dash-user {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
  font-size: .86rem;
}

.bento { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 16px 14px;
  box-shadow: var(--shadow);
  min-height: 96px;
}
button.tile.kpi-link {
  display: block;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
button.tile.kpi-link:hover {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--blue) 12%, transparent);
  transform: translateY(-1px);
}
button.tile.kpi-link:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.accueil-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 0 0 8px;
}
.pastel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--heading);
  line-height: 0;
}
.pastel-chip:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); }
.pastel-chip input { margin: 0; width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; }
.pastel-chip .palette-ico { flex: 0 0 auto; opacity: .85; }
.pastel-chip:has(input:checked) {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  border-color: color-mix(in srgb, var(--blue) 40%, var(--line));
}
.pastel-chip:has(input:checked) .palette-ico { opacity: 1; color: var(--blue); }

/* Graphique CA Accueil */
.ca-chart-card {
  margin: 18px 0 8px;
  padding: 18px 18px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  width: 100%;
  box-sizing: border-box;
}
.ca-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 20px;
  margin-bottom: 12px;
}
.ca-chart-head h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 1.15rem;
  color: var(--heading);
}
.ca-chart-head .muted { margin: 0; font-size: .86rem; }
.ca-chart-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  align-items: flex-end;
}
.ca-chart-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  letter-spacing: .02em;
  text-transform: uppercase;
}
.ca-chart-filters select {
  min-width: 140px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg, #fff);
  color: var(--heading);
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.ca-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 10px;
}
.ca-leg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, #fff);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.ca-leg input { margin: 0; width: 14px; height: 14px; cursor: pointer; }
.ca-leg:has(input:not(:checked)) { opacity: .45; text-decoration: line-through; }
.ca-leg-prev { color: #b45309; border-color: #fcd34d; background: #fffbeb; }
.ca-leg-prev input { accent-color: #d97706; }
.ca-leg-fact { color: #15803d; border-color: #86efac; background: #f0fdf4; }
.ca-leg-fact input { accent-color: #16a34a; }
.ca-leg-att { color: #0369a1; border-color: #7dd3fc; background: #f0f9ff; }
.ca-leg-att input { accent-color: #0284c7; }
.ca-leg-perdu { color: #b91c1c; border-color: #fca5a5; background: #fef2f2; }
.ca-leg-perdu input { accent-color: #dc2626; }
.ca-chart-wrap {
  position: relative;
  width: 100%;
  height: min(340px, 48vw);
  min-height: 220px;
}
.ca-chart-msg { margin: 8px 0 0; font-size: .82rem; }

/* KPI pastel (activé via .bento.pastel-on ou body.pastel-on) */
.bento.pastel-on .kpi-dossiers,
body.pastel-on .bento .kpi-dossiers { background: #eef2ff; border-color: #c7d2fe; }
.bento.pastel-on .kpi-tests,
body.pastel-on .bento .kpi-tests { background: #f3e8ff; border-color: #e9d5ff; }
.bento.pastel-on .kpi-edof,
body.pastel-on .bento .kpi-edof { background: #e0f2fe; border-color: #bae6fd; }
.bento.pastel-on .kpi-encours,
body.pastel-on .bento .kpi-encours { background: #ffedd5; border-color: #fed7aa; }
.bento.pastel-on .kpi-ca,
body.pastel-on .bento .kpi-ca,
.bento.pastel-on .kpi-ca-prev,
body.pastel-on .bento .kpi-ca-prev { background: #ffedd5; border-color: #fed7aa; }
.bento.pastel-on .kpi-ca-facture,
body.pastel-on .bento .kpi-ca-facture { background: #dcfce7; border-color: #86efac; }
.bento.pastel-on .kpi-ca-attente,
body.pastel-on .bento .kpi-ca-attente { background: #e0f2fe; border-color: #bae6fd; }
.bento.pastel-on .kpi-ca-perdu,
body.pastel-on .bento .kpi-ca-perdu { background: #fee2e2; border-color: #fecaca; }
.bento.pastel-on .kpi-avenir,
body.pastel-on .bento .kpi-avenir { background: #fef9c3; border-color: #fde68a; }
.bento.pastel-on .kpi-attente,
body.pastel-on .bento .kpi-attente { background: #dbeafe; border-color: #bfdbfe; }
.bento.pastel-on .kpi-paye,
body.pastel-on .bento .kpi-paye { background: #dcfce7; border-color: #86efac; }
.kpi-ca-prev .n { color: #9a3412; }
.kpi-ca-facture .n { color: #166534; }
.kpi-ca-attente .n { color: #075985; }
.kpi-ca-perdu .n { color: #991b1b; }

/* Lignes dossiers pastel (Wedof) — rouge annulé, ambre accepté, orange formation, bleu facturé, vert payé */
table.data.sheet tr.pastel-annule > td,
table.data.sheet tr.pastel-annule > td.sticky-col,
table.data.sheet tr.pastel-annule > td.actions-col,
table.data.sheet tr.pastel-annule > td.ro {
  background: #fee2e2 !important;
  background-color: #fee2e2 !important;
}
table.data.sheet tr.pastel-accepte > td,
table.data.sheet tr.pastel-accepte > td.sticky-col,
table.data.sheet tr.pastel-accepte > td.actions-col,
table.data.sheet tr.pastel-accepte > td.ro {
  background: #fef3c7 !important;
  background-color: #fef3c7 !important;
}
table.data.sheet tr.pastel-encours > td,
table.data.sheet tr.pastel-encours > td.sticky-col,
table.data.sheet tr.pastel-encours > td.actions-col,
table.data.sheet tr.pastel-encours > td.ro {
  background: #ffedd5 !important;
  background-color: #ffedd5 !important;
}
table.data.sheet tr.pastel-attente > td,
table.data.sheet tr.pastel-attente > td.sticky-col,
table.data.sheet tr.pastel-attente > td.actions-col,
table.data.sheet tr.pastel-attente > td.ro {
  background: #dbeafe !important;
  background-color: #dbeafe !important;
}
table.data.sheet tr.pastel-paye > td,
table.data.sheet tr.pastel-paye > td.sticky-col,
table.data.sheet tr.pastel-paye > td.actions-col,
table.data.sheet tr.pastel-paye > td.ro {
  background: #dcfce7 !important;
  background-color: #dcfce7 !important;
}
table.data.sheet tr.row-selected.pastel-annule > td,
table.data.sheet tr.row-selected.pastel-accepte > td,
table.data.sheet tr.row-selected.pastel-encours > td,
table.data.sheet tr.row-selected.pastel-attente > td,
table.data.sheet tr.row-selected.pastel-paye > td {
  outline: 1px solid color-mix(in srgb, var(--blue) 35%, transparent);
}
table.data.sheet tr.pastel-annule:hover > td,
table.data.sheet tr.pastel-annule:hover > td.sticky-col,
table.data.sheet tr.pastel-annule:hover > td.actions-col { background-color: #fecaca !important; background: #fecaca !important; }
table.data.sheet tr.pastel-accepte:hover > td,
table.data.sheet tr.pastel-accepte:hover > td.sticky-col,
table.data.sheet tr.pastel-accepte:hover > td.actions-col { background-color: #fde68a !important; background: #fde68a !important; }
table.data.sheet tr.pastel-encours:hover > td,
table.data.sheet tr.pastel-encours:hover > td.sticky-col,
table.data.sheet tr.pastel-encours:hover > td.actions-col { background-color: #fed7aa !important; background: #fed7aa !important; }
table.data.sheet tr.pastel-attente:hover > td,
table.data.sheet tr.pastel-attente:hover > td.sticky-col,
table.data.sheet tr.pastel-attente:hover > td.actions-col { background-color: #bfdbfe !important; background: #bfdbfe !important; }
table.data.sheet tr.pastel-paye:hover > td,
table.data.sheet tr.pastel-paye:hover > td.sticky-col,
table.data.sheet tr.pastel-paye:hover > td.actions-col { background-color: #bbf7d0 !important; background: #bbf7d0 !important; }
td.status-chip.pastel-annule { color: #991b1b; font-weight: 600; }
td.status-chip.pastel-accepte { color: #a16207; font-weight: 600; }
td.status-chip.pastel-encours { color: #9a3412; font-weight: 600; }
td.status-chip.pastel-attente { color: #1e40af; font-weight: 600; }
td.status-chip.pastel-paye { color: #166534; font-weight: 600; }

.tile.wide { grid-column: span 2; }
.tile h3 { margin: 0 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.tile .n { font-size: 1.55rem; font-weight: 700; color: var(--heading); }
.tile .hint { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.filter-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  font-size: .9rem;
}
.filter-chip[hidden] { display: none !important; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar input, .toolbar select { margin: 0; max-width: 280px; }
.dossiers-tools {
  position: relative;
  z-index: 8;
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: none;
}
.dossiers-tools .toolbar { margin-bottom: 0; gap: 8px; }
.dossiers-tools .tools-main .btn { white-space: nowrap; }
.dossiers-tools .tools-advanced {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.dossiers-tools .tools-advanced[hidden] { display: none !important; }
.dossiers-tools .tools-advanced .btn { white-space: nowrap; }
#btnAdvToggle .adv-caret { display: inline-block; transition: transform .15s ease; }
#btnAdvToggle.is-open .adv-caret { transform: rotate(180deg); }

.view-switch {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  flex: 0 0 auto;
}
.view-switch .view-btn {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}
.view-switch .view-btn + .view-btn {
  border-left: 1px solid var(--line);
}
.view-switch .view-btn:hover {
  color: var(--heading);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
}
.view-switch .view-btn.is-active {
  color: #fff;
  background: linear-gradient(90deg, #002eb8 0%, #0153ff 55%, #0094cc 100%);
}
#groupD[hidden] { display: none !important; }

.dossier-cards {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin: 0 0 8px;
}
.dossier-cards[hidden] { display: none !important; }
.dossier-cards .empty-cards {
  margin: 0;
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.dossier-group-title {
  margin: 0 0 12px;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}
.dossier-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.dossier-card {
  --card-bg: var(--surface);
  --card-border: var(--line);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 16px 14px;
  box-shadow: 0 4px 14px color-mix(in srgb, #02122c 6%, transparent);
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  outline: none;
}
.dossier-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--blue) 14%, transparent);
  border-color: color-mix(in srgb, var(--blue) 35%, var(--line));
}
.dossier-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.dossier-card.is-selected {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 22%, transparent);
}
.dossier-card.pastel-accepte {
  --card-bg: #fef3c7;
  --card-border: #fde68a;
}
.dossier-card.pastel-encours {
  --card-bg: #ffedd5;
  --card-border: #fed7aa;
}
.dossier-card.pastel-attente {
  --card-bg: #dbeafe;
  --card-border: #bfdbfe;
}
.dossier-card.pastel-paye {
  --card-bg: #dcfce7;
  --card-border: #86efac;
}
.dossier-card.pastel-annule {
  --card-bg: #fee2e2;
  --card-border: #fecaca;
}
.dossier-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.dossier-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.25;
}
.dossier-card-detail {
  flex: 0 0 auto;
  padding: 4px 10px;
  font-size: .78rem;
}
.dossier-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.dossier-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: color-mix(in srgb, var(--blue) 70%, var(--heading));
  border: 1px solid color-mix(in srgb, var(--blue) 22%, var(--line));
}
.dossier-badge.subtle {
  background: color-mix(in srgb, var(--bg) 80%, var(--surface));
  color: var(--muted);
  border-color: var(--line);
  font-weight: 600;
}
.dossier-card-meta {
  margin: 0;
  display: grid;
  gap: 8px;
}
.dossier-card-meta > div {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  align-items: baseline;
}
.dossier-card-meta dt {
  margin: 0;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 700;
}
.dossier-card-meta dd {
  margin: 0;
  font-size: .88rem;
  color: var(--ink);
  word-break: break-word;
  white-space: normal;
}
.dossier-card-id {
  margin: 12px 0 0;
  font-size: .75rem;
}
.field-ro {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  color: var(--ink);
  font-size: .9rem;
  word-break: break-word;
  white-space: pre-wrap;
}
.field-ro.drawer-cell.editable {
  cursor: text;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}
.field-ro.drawer-cell.editable:hover {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}
.field-ro.drawer-cell.editing {
  padding: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 25%, transparent);
  background: var(--surface);
  overflow: hidden;
}
.field-ro.drawer-cell.editing .cell-input {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  padding: 9px 12px;
  font: inherit;
  background: transparent;
  box-sizing: border-box;
}
.field-ro.drawer-cell.saving { opacity: .7; }
.field-ro.drawer-cell.err {
  border-color: #c0392b;
  box-shadow: 0 0 0 2px rgba(192, 57, 43, .2);
}

.table-wrap { overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.sheet-grid[hidden] { display: none !important; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.data th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg) 55%, var(--surface));
  position: sticky;
  top: 0;
  z-index: 5;
}
table.data tr:hover td { background: color-mix(in srgb, var(--blue) 6%, var(--surface)); }

.sheet-grid,
body.page-dossiers .table-wrap.sheet-grid {
  max-height: none;
  overflow: visible;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--heading) 45%, transparent) transparent;
}
body.page-dossiers .sheet-grid {
  flex: 0 0 auto;
}
body.has-sheet-float-scroll .dossiers-scroll {
  scrollbar-width: thin;
}
body.has-sheet-float-scroll .dossiers-scroll::-webkit-scrollbar:horizontal {
  height: 0;
  display: none;
}
.sheet-grid::-webkit-scrollbar { height: 12px; width: 12px; }
.sheet-grid::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--heading) 40%, transparent);
  border-radius: 999px;
}
body.has-sheet-float-scroll .sheet-grid {
  /* garder la scrollbar verticale ; masquer seulement l’horizontale native */
  scrollbar-width: thin;
}
body.has-sheet-float-scroll .sheet-grid::-webkit-scrollbar:horizontal {
  height: 0;
  display: none;
}

.sheet-float-scroll {
  position: fixed;
  left: var(--side-rail, 68px);
  right: 0;
  bottom: 0;
  z-index: 45;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px color-mix(in srgb, #02122c 10%, transparent);
  scrollbar-width: auto;
  scrollbar-color: #4b5563 #e8ecf2;
}
.sheet-float-scroll[hidden] { display: none !important; }
.sheet-float-scroll-inner {
  height: 1px;
  pointer-events: none;
}
.sheet-float-scroll::-webkit-scrollbar { height: 14px; }
.sheet-float-scroll::-webkit-scrollbar-track {
  background: #e8ecf2;
}
.sheet-float-scroll::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 999px;
  border: 3px solid #e8ecf2;
  background-clip: padding-box;
}
.sheet-float-scroll::-webkit-scrollbar-thumb:hover {
  background: #1f2937;
  border: 3px solid #e8ecf2;
  background-clip: padding-box;
}
body.has-sheet-float-scroll .dash-main { padding-bottom: 64px; }
body.page-dossiers.has-sheet-float-scroll .dash-main { padding-bottom: 12px; }

@media (max-width: 980px) {
  .sheet-float-scroll { left: 0; }
}
/* Firefox : barre toujours bien contrastée */
@supports (-moz-appearance: none) {
  .sheet-float-scroll {
    height: 20px;
    scrollbar-width: auto;
    scrollbar-color: #374151 #dbe1ea;
  }
  /* Si la barre flottante échoue, le scroller natif du tableau reste visible */
  body:not(.has-sheet-float-scroll) .sheet-grid {
    scrollbar-width: auto;
    scrollbar-color: #374151 #dbe1ea;
  }
}
table.data.sheet {
  width: max-content;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
table.data.sheet colgroup col {
  min-width: 48px;
}
table.data.sheet th, table.data.sheet td {
  box-sizing: border-box;
  padding: 6px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.data.sheet th .th-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}
table.data.sheet th { z-index: 5; background: var(--surface); box-shadow: 0 1px 0 var(--line); }
table.data.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 45;
  background: var(--surface);
  background-color: var(--surface);
}
/* Les en-têtes non figés horizontalement ne doivent PAS avoir de left sticky */
table.data.sheet thead th:not(.sticky-col):not(.sel-col):not(.actions-col) {
  left: auto !important;
}
table.data.sheet td.sticky-col,
table.data.sheet th.sticky-col,
table.data.sheet td.actions-col,
table.data.sheet td.sel-col,
table.data.sheet th.actions-col,
table.data.sheet th.sel-col {
  position: sticky !important;
  background-clip: padding-box;
}
table.data.sheet td.sticky-col {
  top: auto;
  z-index: 6;
  background: #fff;
  background-color: #fff;
}
table.data.sheet td.actions-col,
table.data.sheet td.sel-col {
  top: auto;
  z-index: 7;
  background: #fff;
  background-color: #fff;
}
table.data.sheet thead th.sticky-col,
table.data.sheet thead th.actions-col,
table.data.sheet thead th.sel-col {
  top: 0 !important;
  z-index: 55;
  background: var(--surface) !important;
  background-color: var(--surface) !important;
  box-shadow: 1px 0 0 var(--line);
}
table.data.sheet td.nav-cell { cursor: cell; }
table.data.sheet td.editable { cursor: cell; }
body.edit-mode-on table.data.sheet td.editable:hover { outline: 1px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: -1px; }
table.data.sheet td.ro { cursor: cell; color: var(--muted); background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
table.data.sheet td.cell-focus {
  outline: 2px solid var(--blue) !important;
  outline-offset: -2px;
  position: relative;
  z-index: 3;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--blue) 35%, transparent);
}
table.data.sheet td.sticky-col.cell-focus,
table.data.sheet td.actions-col.cell-focus { z-index: 7; }

.edit-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--heading);
  font-size: .86rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.edit-mode-switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 35%, var(--line));
  position: relative;
  cursor: pointer;
  transition: background .15s ease;
  flex: 0 0 auto;
}
.edit-mode-switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.edit-mode-switch input:checked {
  background: var(--blue);
}
.edit-mode-switch input:checked::after {
  transform: translateX(16px);
}
.edit-mode-switch:has(input:checked) {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
  color: var(--blue);
}
body.edit-mode-on .edit-mode-switch span::after {
  content: " · ON";
  font-weight: 700;
  opacity: .8;
}
table.data.sheet td.sticky-col,
table.data.sheet th.sticky-col {
  position: sticky;
  z-index: 6;
  background: #fff;
  background-color: #fff;
  background-clip: padding-box;
  box-shadow: 2px 0 0 var(--line);
  /* Empêche le navigateur de redistribuer la largeur au scroll */
  flex-shrink: 0;
}
table.data.sheet th.sticky-col {
  z-index: 8;
  background: color-mix(in srgb, var(--bg) 70%, #fff);
  background-color: color-mix(in srgb, var(--bg) 70%, #fff);
}
table.data.sheet tr:hover > td.sticky-col:not([class*="pastel-"]) {
  background: color-mix(in srgb, var(--blue) 6%, #fff);
  background-color: color-mix(in srgb, var(--blue) 6%, #fff);
}
table.data.sheet td.sticky-col.ro {
  background: color-mix(in srgb, var(--bg) 55%, #fff);
  background-color: color-mix(in srgb, var(--bg) 55%, #fff);
}
table.data.sheet td.editing {
  padding: 0;
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  overflow: visible;
}
table.data.sheet td.saving { opacity: .55; }
table.data.sheet td.err { outline: 2px solid #b91c1c; outline-offset: -2px; }
.cell-input {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 32px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 6px 8px;
  font: inherit;
  background: #fff;
  box-shadow: none;
}
.actions-col {
  position: sticky;
  left: 0;
  right: auto;
  z-index: 7;
  background: #fff;
  background-color: #fff;
  background-clip: padding-box;
  min-width: 136px;
  width: 136px;
  text-align: center;
  box-shadow: 2px 0 0 var(--line);
  white-space: nowrap;
  overflow: visible;
}
table.data.sheet td.actions-col,
table.data.sheet th.actions-col {
  overflow: visible;
}
table.data.sheet th.actions-col {
  z-index: 36;
  background: color-mix(in srgb, var(--bg) 70%, #fff);
  background-color: color-mix(in srgb, var(--bg) 70%, #fff);
}
table.data.sheet tr:hover > td.actions-col {
  background: color-mix(in srgb, var(--blue) 6%, #fff);
  background-color: color-mix(in srgb, var(--blue) 6%, #fff);
}
.actions-col .btn-icon {
  margin: 0 1px;
}
.btn-icon {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-grid;
  place-items: center;
  vertical-align: middle;
  padding: 0;
  color: var(--heading);
}
.btn-icon:hover { background: color-mix(in srgb, var(--blue) 12%, var(--surface)); }
.btn-icon.danger { color: #b91c1c; }
.btn-icon.danger:hover { background: color-mix(in srgb, #b91c1c 12%, var(--surface)); }
.btn-icon:disabled { opacity: .5; cursor: wait; }
/* Sticky horizontal + vertical : forcer sur en-têtes et cellules figées */
table.data.sheet thead th.sticky-col,
table.data.sheet tbody td.sticky-col,
table.data.sheet thead th.sel-col,
table.data.sheet tbody td.sel-col,
table.data.sheet thead th.actions-col,
table.data.sheet tbody td.actions-col {
  position: sticky !important;
}
/* Ne pas mettre position:relative ici : ça écrase sticky vertical des en-têtes.
   sticky sert aussi de containing block pour .col-resizer (absolute). */
table.data.sheet th.sortable { cursor: pointer; user-select: none; }
table.data.sheet th.sortable.sticky-col {
  position: sticky !important;
  top: 0;
}
table.data.sheet th.sortable:hover { color: var(--heading); }
table.data.sheet th.sorted { color: var(--blue); }
.col-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  right: 5px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}
table.data.sheet th:hover .col-resizer::after,
.col-resizer:hover::after {
  background: color-mix(in srgb, var(--blue) 55%, var(--line));
}
body.col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.col-resizing iframe { pointer-events: none; }
.sort-ind { margin-left: 4px; opacity: .35; font-size: .85em; }
.sort-ind.on { opacity: 1; color: var(--blue); }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 8px 0 4px;
  position: static;
}
body.page-dossiers .pager.dossiers-pager {
  flex: 0 0 auto;
  margin-top: 0;
  margin-bottom: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 -6px 18px color-mix(in srgb, #02122c 6%, transparent);
  z-index: 40;
  position: relative;
}
/* Pager au-dessus de la barre de défilement horizontal flottante */
body.page-dossiers.has-sheet-float-scroll .pager.dossiers-pager {
  margin-bottom: 16px;
}
@supports (-moz-appearance: none) {
  body.page-dossiers.has-sheet-float-scroll .pager.dossiers-pager {
    margin-bottom: 20px;
  }
}
body.page-dossiers #wedofMsg:empty,
body.page-dossiers #wedofMsg[hidden] { display: none !important; }
body.page-dossiers #wedofMsg:not(:empty) {
  display: block;
  margin: 0;
}
body.page-dossiers #wedofMsg.is-copy-ok:not(:empty),
#lienFormMsg.is-copy-ok:not(:empty) {
  margin: 8px 0 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #34d399;
  font-weight: 600;
  line-height: 1.45;
  word-break: break-word;
}
body.page-dossiers #wedofMsg.is-copy-ok a.copy-link-url,
#lienFormMsg.is-copy-ok a.copy-link-url,
.dash-notify a.copy-link-url {
  color: #047857;
  text-decoration: underline;
  font-weight: 700;
  word-break: break-all;
}
body.page-dossiers #wedofMsg.is-copy-ok a.copy-link-url:hover,
#lienFormMsg.is-copy-ok a.copy-link-url:hover,
.dash-notify a.copy-link-url:hover {
  color: #065f46;
}
body.page-dossiers .filter-chip,
body.page-dossiers .bulk-bar,
body.page-dossiers #wedofMsg:not(:empty) {
  flex: 0 0 auto;
  margin-bottom: 0;
}
body.page-dossiers .dossiers-tools {
  flex: 0 0 auto;
}
body.page-dossiers .dossier-cards {
  overflow: visible;
}
.pager-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .9rem;
}
.pager-size select {
  min-width: 72px;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.bulk-bar[hidden] { display: none !important; }
.trash-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trash-bulk-bar {
  margin: 0;
}
.trash-table th:first-child,
.trash-table td:first-child {
  width: 40px;
  text-align: center;
  vertical-align: middle;
}
.trash-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.comm-totals td {
  padding-top: 12px;
  border-top: 2px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, var(--blue));
  font-size: .92rem;
}
.comm-totals strong { color: var(--heading); }
.btn.danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}
.btn.danger:hover { filter: brightness(1.05); }
.btn-xs {
  width: 32px;
  min-width: 32px;
  padding: 4px 0;
  line-height: 1;
}
.col-view-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(60vh, 520px);
  overflow: auto;
  margin-top: 12px;
}
.col-view-row {
  display: grid;
  grid-template-columns: 22px 22px minmax(0, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: grab;
  transition: border-color .12s ease, background .12s ease, box-shadow .12s ease;
}
.col-view-row:active { cursor: grabbing; }
.col-view-row.dragging {
  opacity: .55;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
}
.col-view-row.drag-over {
  border-color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}
.col-drag {
  color: var(--muted);
  font-size: .85rem;
  letter-spacing: -2px;
  user-select: none;
  text-align: center;
  cursor: grab;
}
.col-view-label { font-size: .92rem; }
.col-sticky-lab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
.col-sticky-lab input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.col-sticky-lab:has(input:checked) {
  color: var(--blue);
  font-weight: 600;
}

.sel-col {
  text-align: center;
  padding: 4px !important;
}
.sel-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
table.data.sheet tr.row-selected td {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}
table.data.sheet tr.row-selected td.sticky-col {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}
table.data.sheet th.sel-col {
  z-index: 6;
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
}

.equipe-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.equipe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.eq-row-actions {
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.eq-actif-switch span {
  min-width: 5.5rem;
}
table.data tr.row-inactive td {
  opacity: .72;
}
table.data tr.row-selected td {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}

.lien-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.lien-box code { display: block; word-break: break-all; background: var(--bg); padding: 12px; border-radius: 12px; margin: 12px 0; font-size: .85rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }

.drawer {
  position: fixed; inset: 0; background: rgba(2,18,44,.45); z-index: 90;
  display: grid; justify-items: end;
  box-sizing: border-box;
}
.drawer[hidden] { display: none !important; }
.drawer-panel {
  width: min(560px, 100%);
  height: 100%;
  background: var(--surface);
  overflow: auto;
  padding: 22px;
  box-shadow: -12px 0 40px rgba(0,0,0,.12);
  box-sizing: border-box;
}
.drawer.is-wide {
  justify-items: stretch;
  align-items: stretch;
  padding: 16px 22px;
}
.drawer.is-wide .drawer-panel,
.drawer-panel.is-wide {
  width: auto;
  max-width: none;
  height: auto;
  max-height: 100%;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
  padding: 0;
  /* Le scroll est dans #drawerBody : le radius n’est plus masqué par la scrollbar */
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.drawer.is-wide .drawer-head {
  flex: 0 0 auto;
  padding: 22px 28px 12px;
  margin-bottom: 0;
}
.drawer.is-wide #drawerBody {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 28px 28px;
  -webkit-overflow-scrolling: touch;
}
.drawer.is-wide .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 18px;
}
@media (max-width: 1100px) {
  .drawer.is-wide .form-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .drawer.is-wide { padding: 0; }
  .drawer.is-wide .drawer-panel,
  .drawer-panel.is-wide {
    border-radius: 0;
    max-height: none;
    height: 100%;
  }
  .drawer.is-wide .form-grid { grid-template-columns: 1fr; }
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.drawer-head h2 { margin: 0; font-size: 1.2rem; }

.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 18, 44, .55);
  backdrop-filter: blur(4px);
}
.confirm-modal[hidden] { display: none !important; }
.confirm-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22);
  text-align: center;
}
.confirm-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: #b91c1c;
  background: color-mix(in srgb, #b91c1c 12%, var(--surface));
  border: 1px solid color-mix(in srgb, #b91c1c 30%, var(--line));
}
.confirm-card h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
  color: var(--heading);
}
.confirm-msg {
  margin: 0 0 8px;
  color: var(--heading);
  line-height: 1.45;
  word-break: break-word;
}
.confirm-warn {
  margin: 0 0 18px;
  color: #b91c1c;
  font-size: .9rem;
  font-weight: 600;
}
.confirm-math {
  text-align: left;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg) 70%, var(--surface));
  border: 1px solid var(--line);
}
.confirm-math label {
  display: block;
  margin-bottom: 8px;
  font-size: .92rem;
}
.confirm-math input {
  width: 100%;
  margin: 0;
  appearance: textfield;
  -moz-appearance: textfield;
}
.confirm-math input::-webkit-outer-spin-button,
.confirm-math input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.confirm-math .err {
  margin: 8px 0 0;
  font-size: .85rem;
}
.confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.form-modal-card {
  text-align: left;
  width: min(460px, 100%);
}
.form-modal-card--wide {
  width: min(640px, 100%);
}
.form-modal-card--wide .mail-create-code,
.mail-create-code {
  width: 100%;
  box-sizing: border-box;
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.4;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  resize: vertical;
  background: #0f172a;
  color: #e2e8f0;
}
.form-modal-card select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1rem;
}
.mail-mjml-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 8px;
}
.form-modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--blue) 28%, var(--line));
}
.form-modal-card h2 {
  text-align: center;
  margin: 0 0 8px;
}
.form-modal-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.45;
  text-align: center;
}
.form-modal-body {
  margin-bottom: 4px;
}
.ui-dialog-text {
  margin: 0;
  font-size: .95rem;
  line-height: 1.5;
  color: var(--muted, #475569);
  white-space: pre-wrap;
}
.form-modal-body .field {
  margin-bottom: 0;
}
.form-modal-body input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  font-size: 1.05rem;
  letter-spacing: .02em;
  padding: 12px 14px;
  border-radius: 12px;
}
#formModalErr {
  margin-top: 12px;
  text-align: center;
}

.mail-log-list { margin-top: 12px; }
.mail-log-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.mail-log-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.mail-log-table th,
.mail-log-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.mail-log-table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
.mail-log-subj { max-width: 280px; }
.mail-log-table .linkish {
  background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; text-align: left; font: inherit;
}
.mail-log-table .linkish:hover { text-decoration: underline; }
.mail-comms { margin-top: 8px; }
.mail-comms-list .mail-view-btn { margin-top: 6px; }

/* Fiche stagiaire — actions en grille large */
.dossier-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 18px 0 8px;
  align-items: stretch;
}
.dossier-action-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--blue) 3%, var(--surface));
  padding: 14px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dossier-action-title {
  margin: 0;
  font-size: .95rem;
  font-weight: 800;
  color: var(--heading, #0f172a);
}
.dossier-action-hint {
  margin: 0;
  font-size: .82rem;
  line-height: 1.35;
}
.dossier-action-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.dossier-action-btns .btn {
  flex: 0 1 auto;
}
.dossier-action-msg {
  margin: 0;
  font-size: .84rem;
  min-height: 0;
}
.dossier-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .88rem;
}
.dossier-form-preview {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  max-height: 280px;
  overflow: auto;
}
.dossier-ia-out {
  white-space: pre-wrap;
  background: #f8fafc;
  padding: 10px;
  border-radius: 8px;
  margin: 0;
  max-height: 220px;
  overflow: auto;
}
.dossier-comms-fold {
  margin: 16px 0 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
}
.dossier-comms-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 800;
  font-size: .95rem;
  user-select: none;
}
.dossier-comms-summary::-webkit-details-marker { display: none; }
.dossier-comms-summary::before {
  content: "▸";
  color: var(--muted);
  font-size: .85rem;
  margin-right: 4px;
  transition: transform .15s ease;
}
.dossier-comms-fold[open] .dossier-comms-summary::before {
  content: "▾";
}
.dossier-comms-fold #dossierComms {
  padding: 0 16px 14px;
  border-top: 1px solid var(--line);
}
.dossier-comms-fold .mail-comms-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}
.dossier-comms-fold .mail-comms-list li {
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--blue) 40%, var(--line));
  border-radius: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--blue) 2%, var(--surface));
  margin: 0;
}
.dossier-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
@media (max-width: 900px) {
  .dossier-actions { grid-template-columns: 1fr; }
  .dossier-comms-fold .mail-comms-list { grid-template-columns: 1fr; }
}
.mail-item-actions { margin-top: 8px; }
.mail-actions-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 600;
}
.mail-actions-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.mail-log-actions .mail-actions-btns { flex-direction: column; align-items: stretch; min-width: 96px; }
.mail-log-actions .btn { padding: 5px 8px; font-size: .82rem; }
.mail-statut {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
}
.mail-statut-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
  cursor: help;
}
.mail-statut-err {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  cursor: help;
}
.mail-statut-ign {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
  cursor: help;
}
.mail-actions-btns .btn:disabled { opacity: .45; cursor: not-allowed; }
.mail-channel {
  display: inline-grid; place-items: center;
  min-width: 1.6em; height: 1.6em; padding: 0 4px;
  border-radius: 6px; font-size: .7rem; font-weight: 700;
  background: color-mix(in srgb, var(--blue) 12%, var(--surface));
  color: var(--blue); margin-right: 4px;
}
.mail-preview-meta { margin-bottom: 12px; line-height: 1.5; }
.mail-preview-meta p { margin: 0 0 6px; }

/* Bandeau notifications actions (Wedof, import, export…) */
.dash-notify {
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  box-shadow: 0 4px 14px rgba(2, 18, 44, 0.08);
}
.dash-notify[hidden] { display: none !important; }
.dash-notify .dash-notify-ico { flex: 0 0 auto; font-size: 1.1rem; line-height: 1.2; }
.dash-notify .dash-notify-text { flex: 1; min-width: 0; }
.dash-notify.is-progress {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.dash-notify.is-progress .dash-notify-ico {
  animation: dash-notify-pulse 1s ease-in-out infinite;
}
.dash-notify.is-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #34d399;
}
.dash-notify.is-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  font-weight: 600;
}
.dash-notify.is-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #93c5fd;
}
@keyframes dash-notify-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@media (max-width: 980px) {
  #appView {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100dvh;
    transition: none;
  }
  #appView.side-pinned,
  #appView:has(.dash-side:hover),
  #appView:has(.dash-side:focus-within) {
    grid-template-columns: 1fr;
  }
  .dash-side {
    position: sticky !important;
    top: 0;
    z-index: 60;
    height: auto !important;
    max-height: none;
    overflow: visible !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    width: 100% !important;
    box-shadow: none !important;
  }
  #appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-brand .word,
  #appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .nav-label {
    opacity: 1;
    width: auto;
    overflow: visible;
    pointer-events: auto;
  }
  #appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-side-head {
    flex-direction: row;
    align-items: center;
  }
  #appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-brand,
  #appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-nav button,
  #appView:not(.side-pinned):not(:has(.dash-side:hover)):not(:has(.dash-side:focus-within)) .dash-logout {
    justify-content: flex-start;
    padding-left: initial;
    padding-right: initial;
    gap: 10px;
  }
  .dash-side-head {
    flex: 0 0 auto;
    min-height: 0;
    align-items: center;
  }
  .dash-side-toggle { display: none; }
  .dash-brand {
    flex: 0 0 auto;
    padding: 0;
  }
  .dash-brand .word small { display: none; }
  .dash-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1 1 auto;
    gap: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .dash-nav button {
    width: auto;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: .82rem;
  }
  .dash-nav button.nav-sub {
    margin-left: 0;
    width: auto;
  }
  .dash-logout {
    width: auto;
    margin-left: auto;
    flex: 0 0 auto;
  }
  .dash-main {
    padding: 14px 14px 28px;
    height: auto !important;
    overflow: visible !important;
  }
  .dash-top {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }
  .dash-top h1 { font-size: 1.35rem; }
  .dash-top-actions { width: 100%; justify-content: space-between; }
  .bento { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .ca-chart-filters { width: 100%; }
  .ca-chart-filters select { min-width: 0; flex: 1; width: 100%; }
  .ca-chart-filters label { flex: 1 1 140px; }
  .sheet-float-scroll { left: 0 !important; }

  /* Dossiers : pas de viewport verrouillé sur mobile */
  body.page-dossiers #appView,
  body.page-dossiers .dash-side,
  body.page-dossiers .dash-main {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  body.page-dossiers #page,
  body.page-dossiers .dossiers-panel {
    flex: none !important;
    min-height: 0;
    overflow: visible !important;
  }
  body.page-dossiers .dossiers-scroll {
    flex: none !important;
    max-height: min(70dvh, 640px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  body.page-dossiers .pager.dossiers-pager {
    position: sticky;
    bottom: 0;
  }
  body.page-dossiers .dossiers-tools .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  body.page-dossiers .dossiers-tools input,
  body.page-dossiers .dossiers-tools select,
  body.page-dossiers .dossiers-tools .btn {
    max-width: none;
    width: 100%;
  }
  body.page-dossiers .view-switch { width: 100%; }
  body.page-dossiers .view-switch .view-btn { flex: 1; }
}

@media (max-width: 600px) {
  .dash-nav button svg { display: none; }
  .dash-user { font-size: .78rem; padding: 6px 10px; }
  .dash-form-link { font-size: .82rem; padding: 8px 12px; }
  .pager { gap: 8px; font-size: .85rem; }
}

/* Paramètres — onglets + éditeur TipTap mails */
.settings-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.settings-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.settings-tab.on {
  background: linear-gradient(90deg, #002eb8 0%, #0153ff 55%, #0094cc 100%);
  color: #fff;
  border-color: transparent;
}
.settings-pane[hidden] { display: none !important; }

.wf-settings { max-width: 920px; }
.wf-group {
  margin-bottom: 22px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.wf-group:last-of-type { border-bottom: 0; }
.wf-group-head h3 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  color: var(--heading);
}
.wf-group-head p { margin: 0 0 12px; }
.wf-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wf-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: var(--surface);
}
.wf-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.wf-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
}
.wf-switch input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.wf-label-input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
}
.wf-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
}
.wf-card-hint {
  margin: 10px 0 0;
  font-size: .85rem;
}
.wf-etape-field[hidden] { display: none !important; }

.mail-actions-row {
  margin-top: 12px;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.mail-actions-row .mail-test-input {
  width: min(240px, 100%);
  min-width: 160px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
}
.mail-actions-row #mailMsg,
.mail-actions-row #mailTestMsg {
  font-size: .85rem;
  flex: 1 1 auto;
  min-width: 120px;
}

.mail-vars-card {
  width: min(720px, 96vw);
  max-height: min(86vh, 820px);
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 18px 20px 16px;
}
.mail-vars-body {
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 4px;
}
.mail-vars-group h3 {
  margin: 0 0 8px;
  font-size: .95rem;
  color: var(--heading);
}
.mail-vars-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mail-var-item {
  display: grid;
  grid-template-columns: minmax(140px, 180px) 1fr auto;
  gap: 8px 12px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  cursor: pointer;
}
.mail-var-item:hover {
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  background: #eff6ff;
}
.mail-var-item code {
  font-size: .82rem;
  font-weight: 700;
  color: #004a99;
  word-break: break-all;
}
.mail-var-item .mail-var-desc {
  font-size: .82rem;
  color: var(--muted, #64748b);
}
.mail-var-item .mail-var-ex {
  font-size: .75rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}
@media (max-width: 640px) {
  .mail-var-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .mail-var-item .mail-var-ex { max-width: 100%; }
}

.mail-settings {
  display: grid;
  grid-template-columns: minmax(180px, 240px) 1fr;
  gap: 16px;
  align-items: start;
}
.mail-tpl-side {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.mail-tpl-item.is-custom strong::after {
  content: " ★";
  color: #0153ff;
  font-size: .75em;
}
.btn.danger-ghost {
  color: #b91c1c;
  border-color: #fecaca;
}
.btn.danger-ghost:hover {
  background: #fef2f2;
}

.form-schema-settings { max-width: 960px; }
.fs-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fs-field-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface);
}
.fs-field-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.fs-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px 12px;
}
.fs-field-grid .field.full { grid-column: 1 / -1; }
.fs-options[hidden] { display: none !important; }

.fs-revisions {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.fs-revisions h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--heading);
}
.fs-rev-select {
  flex: 1;
  min-width: 260px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
}
.fs-rev-preview {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 14px;
  max-height: min(50vh, 420px);
  overflow: auto;
}
.fs-rev-step { margin-bottom: 14px; }
.fs-rev-step:last-child { margin-bottom: 0; }
.fs-rev-step h4 {
  margin: 0 0 6px;
  font-size: .95rem;
}
.fs-rev-questions {
  margin: 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: .9rem;
}

.mail-tpl-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(70vh, 640px);
  overflow: auto;
}
.mail-tpl-item {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mail-tpl-item strong { font-size: .9rem; color: var(--heading); }
.mail-tpl-item.on {
  border-color: color-mix(in srgb, var(--blue) 50%, var(--line));
  background: #eff6ff;
}
.mail-tpl-editor { min-width: 0; }
.tiptap-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.tiptap-toolbar button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: .85rem;
  cursor: pointer;
}
.tiptap-toolbar button:hover { background: #f1f5f9; }
.mail-rte-toolbar {
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #f8fafc;
}
.mail-rte-toolbar .rte-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid var(--line);
}
.mail-rte-toolbar .rte-group:last-of-type { border-right: 0; }
.mail-rte-toolbar .rte-select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .78rem;
  color: #64748b;
}
.mail-rte-toolbar .rte-select select {
  font: inherit;
  font-size: .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  background: #fff;
  max-width: 140px;
}
.mail-rte-toolbar .rte-color input[type="color"] {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}
.mail-rte-toolbar .rte-insert {
  position: relative;
}
.mail-rte-toolbar .rte-insert summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
}
.mail-rte-toolbar .rte-insert summary::-webkit-details-marker { display: none; }
.mail-rte-toolbar .rte-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(2, 18, 44, .12);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mail-rte-toolbar .rte-menu button {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
}
.mail-rte-toolbar .rte-menu button:hover { background: #eff6ff; }
.tiptap-editor {
  border: 1px solid var(--line);
  border-radius: 0 0 12px 12px;
  background: #fff;
  min-height: 280px;
}
.mail-rte-toolbar + .tiptap-editor { border-top: 0; }
.tiptap-content {
  outline: none;
  padding: 14px 16px;
  min-height: 260px;
  font: inherit;
  line-height: 1.5;
}
.tiptap-content h2 { margin: 0 0 10px; font-size: 1.25rem; }
.tiptap-content h3 { margin: 0 0 8px; font-size: 1.1rem; }
.tiptap-content p { margin: 0 0 10px; }
.tiptap-content ul, .tiptap-content ol { margin: 0 0 10px; padding-left: 1.2em; }
.tiptap-content img {
  height: auto;
  border-radius: 8px;
  display: inline-block;
  max-width: 100%;
  cursor: pointer;
}
.tiptap-content img.ProseMirror-selectednode,
.tiptap-content img[data-selected] {
  outline: 2px solid #0153ff;
  outline-offset: 2px;
}
.tiptap-content img[width] {
  max-width: none;
}
.mail-preview-frame img {
  height: auto;
  max-width: 100%;
}
.mail-preview-frame img[width="88"],
.mail-preview-frame img[width="64"],
.mail-preview-frame img[width="120"] {
  max-width: none;
}
.tiptap-content hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 16px 0;
}
.mail-html-raw {
  width: 100%;
  min-height: 420px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .82rem;
  line-height: 1.45;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
  resize: vertical;
  background: #0f172a;
  color: #e2e8f0;
}
.mail-preview {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  background: #eef5fd;
}
.mail-preview-live {
  position: sticky;
  top: 12px;
}
.mail-preview-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
  margin-bottom: 10px;
}
.mail-preview-head strong {
  color: var(--heading);
  font-size: .95rem;
}
.mail-preview-frame {
  background: transparent;
  border-radius: 8px;
  padding: 0;
  border: 1px solid #d7e4f3;
  min-height: 480px;
  overflow: hidden;
}
.mail-preview-frame img { max-width: 100%; height: auto; }
.mail-preview-iframe {
  display: block;
  width: 100%;
  min-height: 720px;
  height: 720px;
  border: 0;
  background: #eef5fd;
}
.mail-raw-hint {
  margin: 0 0 8px;
  font-size: .85rem;
  color: #64748b;
}
@media (max-width: 900px) {
  .mail-settings { grid-template-columns: 1fr; }
  .mail-tpl-list { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; max-height: none; }
  .mail-tpl-item { min-width: 160px; }
  .mail-preview-iframe { min-height: 560px; height: 560px; }
}

.auto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px 12px;
}
.auto-wf-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.auto-wf-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  white-space: normal;
  cursor: pointer;
}
/* Contre `input { width:100% }` global — sinon la case s’étire et le texte part à droite */
.auto-wf-row input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  flex: 0 0 18px !important;
  margin: 2px 0 0;
  accent-color: var(--blue);
  cursor: pointer;
}
.auto-wf-row > span {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}
.auto-wf-row .muted { font-weight: 500; }

.ex-suggest-field { position: relative; z-index: 2; }
.ex-suggest-wrap { position: relative; }
.ex-suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 40;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  max-height: 260px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}
.ex-suggest-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px;
  cursor: pointer;
}
.ex-suggest-item:hover,
.ex-suggest-item.on {
  background: color-mix(in srgb, var(--blue) 10%, var(--surface));
}
.ex-suggest-item strong { font-size: .92rem; }
.ex-suggest-item .muted { font-size: .8rem; }
.ex-suggest-empty {
  padding: 10px 12px;
  font-size: .86rem;
}

.pack-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
  font-size: .82rem;
}
.pack-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.pack-toggle-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  flex: 0 0 auto;
  transition: background .15s ease;
}
.pack-toggle-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .25);
  transition: transform .15s ease;
}
.pack-toggle input:checked + .pack-toggle-ui {
  background: linear-gradient(100deg, #086cf0, #08cddd);
}
.pack-toggle input:checked + .pack-toggle-ui::after {
  transform: translateX(18px);
}
.pack-toggle-label { color: var(--muted); min-width: 2.2em; }

/* Drive files list + preview */
.drive-files-bar { margin-top: 12px; }
.drive-files-bar label { display:block; margin-bottom:4px; font-size:.85rem; }
.drive-file-select {
  width: 100%;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  font: inherit;
}
.drive-preview-wrap {
  margin-top: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}
.drive-preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
}
.drive-preview-frame {
  width: 100%;
  height: min(70vh, 640px);
  border: 0;
  background: #fff;
}
