html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

:root {
  --hz-bg: #f4f7fb;
  --hz-surface: #ffffff;
  --hz-surface-soft: #f8fafc;
  --hz-border: #e2e8f0;
  --hz-text: #0f172a;
  --hz-text-soft: #64748b;
  --hz-primary: #2563eb;
  --hz-primary-dark: #1d4ed8;
  --hz-success: #16a34a;
  --hz-warning-bg: #fff7ed;
  --hz-warning-border: #fed7aa;
  --hz-warning-text: #9a3412;
  --hz-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus,
.form-select:focus {
  box-shadow:
    0 0 0 0.1rem white,
    0 0 0 0.25rem rgba(37, 140, 251, 0.25);
}

html,
body {
  background: var(--hz-bg);
  color: var(--hz-text);
}

body {
  min-height: 100vh;
  margin-bottom: 0;
}

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

.hz-navbar-wrap {
  position: sticky;
  top: 0;
  z-index: 1030;
  padding: 1rem 0 0;
  background: linear-gradient(
    180deg,
    rgba(244, 247, 251, 0.95),
    rgba(244, 247, 251, 0.75)
  );
  backdrop-filter: blur(8px);
}

.hz-navbar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.85);
  box-shadow: var(--hz-shadow);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
}

.hz-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--hz-text) !important;
    text-decoration: none;
}

.hz-brand:hover {
    color: var(--hz-text) !important;
    text-decoration: none;
}

.hz-brand-mark {
    /* On remplace la largeur fixe par un padding horizontal */
    height: 2.25rem;
    padding: 0 0.85rem;
    border-radius: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--hz-primary), #60a5fa);
    color: white;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
}

/* Rouge vif et contrasté pour le 'R' */
.hz-brand-mark .text-danger,
.hz-brand-accent {
    color: #ef4444 !important;
}

.hz-navbar .nav-link {
  color: var(--hz-text-soft) !important;
  font-weight: 500;
  border-radius: 0.75rem;
  padding: 0.6rem 0.9rem !important;
  transition: all 0.2s ease;
}

.hz-navbar .nav-link:hover {
  color: var(--hz-text) !important;
  background: var(--hz-surface-soft);
}

.hz-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  background: var(--hz-surface-soft);
  border: 1px solid var(--hz-border);
  border-radius: 999px;
  color: var(--hz-text);
  font-weight: 600;
}

.hz-user-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--hz-success);
  display: inline-block;
}

.hz-logout-btn {
  color: #dc2626 !important;
  font-weight: 600;
}

.hz-logout-btn:hover {
  background: #fef2f2 !important;
  color: #b91c1c !important;
}

.hz-impersonation {
  margin-bottom: 1rem;
  border: 1px solid var(--hz-warning-border);
  background: var(--hz-warning-bg);
  color: var(--hz-warning-text);
  border-radius: 1rem;
  box-shadow: 0 8px 24px rgba(154, 52, 18, 0.08);
}

.hz-impersonation .btn {
  border-radius: 0.75rem;
  font-weight: 600;
}

.hz-main {
  flex: 1;
  padding: 1.5rem 0 2rem;
}

.hz-page-wrap {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: 1.25rem;
  padding: 1.5rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.04);
}

.hz-footer {
  padding: 1.25rem 0 2rem;
  color: var(--hz-text-soft);
  font-size: 0.95rem;
}

.hz-footer a {
  color: var(--hz-primary);
  text-decoration: none;
  font-weight: 500;
}

.hz-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 991.98px) {
  .hz-navbar-wrap {
    padding-top: 0.75rem;
  }

  .hz-navbar {
    border-radius: 0.9rem;
  }

  .hz-page-wrap {
    padding: 1rem;
    border-radius: 1rem;
  }
}

/* Titres et sous-titres de pages d'administration */
.hz-page {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hz-page-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.hz-page-title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--hz-text);
}

.hz-page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--hz-text-soft);
  max-width: 780px;
}

/* Boutons d�actions en haut de page (Retour, Cr�er, etc.) */
.hz-page-actions-top {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Carte de section g�n�rique (formulaires, tableaux, etc.) */
.hz-section-card {
  background: #ffffff;
  border: 1px solid var(--hz-border);
  border-radius: 1.25rem;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.hz-section-card-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid #eef2f7;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.hz-section-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--hz-text);
}

.hz-section-card-text {
  margin: 0.2rem 0 0;
  color: var(--hz-text-soft);
  font-size: 0.95rem;
}

.hz-section-card-body {
  padding: 1.25rem;
}

/* Styles de base pour les formulaires dans les cartes */
.hz-form .form-label {
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.45rem;
}

.hz-form .form-control,
.hz-form .form-select {
  border-radius: 0.85rem;
  border: 1px solid #dbe2ea;
  padding: 0.75rem 0.95rem;
  box-shadow: none;
}

.hz-form .form-control:focus,
.hz-form .form-select:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

/* Zone d�actions en bas de formulaire */
.hz-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
  padding-top: 1.25rem;
  border-top: 1px solid #eef2f7;
}

@media (max-width: 991.98px) {
  .hz-page-hero {
    flex-direction: column;
    align-items: stretch;
  }

  .hz-page-actions-top {
    width: 100%;
  }

  .hz-page-actions-top .btn,
  .hz-form-actions .btn {
    width: 100%;
  }

  .hz-form-actions {
    justify-content: stretch;
  }
}

.edms-toggle-col,
.edms-toggle-cell {
  width: 52px;
  text-align: center;
}

.edms-toggle-btn {
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #475569;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

.edms-toggle-btn:hover {
  background-color: #eef2ff;
  color: #1d4ed8;
}

.edms-toggle-icon {
  font-size: 1rem;
  line-height: 1;
}

.edms-row-summary > td {
  vertical-align: middle;
}

.edms-row-detail > td {
  padding-top: 0;
  border-top: 0;
  background: #fafbff;
}

.edms-detail-panel {
  padding: 1rem 1.25rem 1.25rem;
  border-radius: 0.75rem;
}

.edms-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 1rem 1.5rem;
}

.edms-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.edms-detail-item-wide {
  grid-column: 1 / -1;
}

.edms-detail-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.edms-detail-value {
  color: #0f172a;
  font-weight: 500;
  word-break: break-word;
}

@media (max-width: 767.98px) {
  .edms-detail-grid {
    grid-template-columns: 1fr;
  }
}

.validation-summary-valid {
  display: none;
}

.hz-user-menu {
  border: 0;
  background: transparent;
  padding: 0;
  color: inherit;
}

.hz-user-menu:hover,
.hz-user-menu:focus,
.hz-user-menu:active {
  background: transparent !important;
  color: inherit !important;
  box-shadow: none !important;
}

.hz-user-menu::after {
  margin-left: 0.5rem;
}
/* === Sous-cartes Reflex === */

.hz-section-subcard {
  margin-top: 1.5rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.hz-section-subcard-header {
  padding: 1.25rem 1.5rem 0.5rem;
}

.hz-section-subcard-title {
  margin: 0;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.3;
}

.hz-section-subcard-text {
  margin: 0.35rem 0 0;
  color: #6b7280;
  font-size: 0.95rem;
  line-height: 1.55;
}

.hz-section-subcard-body {
  padding: 1.25rem 1.5rem 1.5rem;
}

.hz-scope-shell {
  padding: 1rem;
  background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
  border: 1px solid #dbe4f0;
  border-radius: 18px;
}

/* === Picker EDM (double liste) === */

.hz-scope-picker {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Topbar : recherche + compteur */

.hz-scope-picker-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
}

.hz-scope-picker-search {
  min-width: 0;
}

.hz-scope-picker-search .form-control {
  min-height: 44px;
  border-color: #dbe4f0;
  border-radius: 12px;
  box-shadow: none;
}

.hz-scope-picker-search .form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

.hz-scope-picker-count {
  color: #64748b;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Grille centrale : liste gauche / boutons / liste droite */

.hz-scope-picker-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

/* Colonnes de listes */

.hz-scope-picker-list {
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
}

/* on force la colonne de droite � exister visuellement m�me vide */
.hz-scope-picker-list--selected {
  min-height: 320px;
}

.hz-scope-picker-list-title {
  margin: 0 0 0.75rem;
  color: #0f172a;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.35;
}

.hz-scope-picker-list-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 220px;
  max-height: 360px;
  overflow: auto;
  padding-right: 0.25rem;
}

.hz-scope-picker-list-body::-webkit-scrollbar {
  width: 8px;
}

.hz-scope-picker-list-body::-webkit-scrollbar-track {
  background: transparent;
}

.hz-scope-picker-list-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

/* Colonne centrale : boutons */

.hz-scope-picker-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
  align-items: center;
}

.hz-scope-picker-actions .btn {
  min-width: 52px;
  min-height: 42px;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-weight: 700;
}

/* === �l�ments de liste === */

.hz-scope-item {
  width: 100%;
  padding: 0.8rem 0.9rem;
  text-align: left;
  color: #0f172a;
  font-size: 0.95rem;
  line-height: 1.45;
  cursor: pointer;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  transition: all 0.18s ease;
}

.hz-scope-item:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  transform: translateY(-1px);
}

.hz-scope-item:focus-visible {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.hz-scope-item.is-active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hz-scope-item.is-dragging {
  opacity: 0.65;
}

.hz-scope-empty {
  padding: 1rem;
  text-align: center;
  color: #94a3b8;
  font-size: 0.94rem;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
}

/* �tat vide global */

.hz-empty-state {
  padding: 1.25rem 1.5rem;
  text-align: center;
  color: #64748b;
  font-size: 0.95rem;
  line-height: 1.5;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
}

/* === Radio cards (modes de p�rim�tre) === */

.hz-radio-card-group {
  display: grid;
  gap: 0.75rem;
}

.hz-radio-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.hz-radio-card:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.hz-radio-card:has(input:checked) {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hz-radio-card input {
  margin-top: 0.25rem;
  accent-color: #2563eb;
}

.hz-radio-card strong {
  display: block;
  color: #0f172a;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.hz-radio-card small {
  display: block;
  margin-top: 0.15rem;
  color: #64748b;
  line-height: 1.45;
}

/* === Cartes ETT === */

.hz-scope-list {
  display: grid;
  gap: 1rem;
}

.hz-scope-card {
  padding: 1rem;
  background: #fff;
  border: 1px solid #dbe4f0;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.hz-scope-card-header {
  margin-bottom: 0.85rem;
}

.hz-scope-card-title {
  margin: 0;
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.hz-scope-card-text {
  margin: 0.25rem 0 0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* === Responsive === */

@media (max-width: 991.98px) {
  .hz-scope-picker-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .hz-scope-picker-grid {
    grid-template-columns: 1fr;
  }

  .hz-scope-picker-actions {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
    margin-block: 0.5rem;
  }

  .hz-scope-picker-list {
    min-height: auto;
  }

  .hz-scope-picker-list-body {
    max-height: 280px;
  }
}

@media (max-width: 575.98px) {
  .hz-section-subcard-header,
  .hz-section-subcard-body {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hz-scope-shell {
    padding: 0.75rem;
  }

  .hz-scope-picker-actions .btn {
    flex: 1 1 calc(50% - 0.5rem);
    min-width: 0;
  }

  .hz-radio-card,
  .hz-scope-card {
    padding: 0.9rem;
  }
}
.hz-scope-list {
  display: grid;
  gap: 1rem;
}

.hz-scope-card {
  padding: 1rem 1.125rem;
  border-radius: 14px;
  border: 1px solid transparent;
  transition:
    background-color 0.2s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.hz-scope-card--sky {
  background: #f3f7ff;
  border-color: #dbe7ff;
}

.hz-scope-card--sage {
  background: #f3faf5;
  border-color: #d8eadc;
}

.hz-scope-card--sky:hover {
  background: #edf4ff;
  border-color: #cddfff;
  box-shadow: 0 4px 10px rgba(73, 110, 180, 0.08);
}

.hz-scope-card--sage:hover {
  background: #edf8f0;
  border-color: #cde3d3;
  box-shadow: 0 4px 10px rgba(72, 128, 92, 0.08);
}

.hz-scope-card-header {
  margin-bottom: 0.875rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.hz-scope-card-title {
  margin: 0;
  color: #1f2937;
  font-size: 1rem;
  font-weight: 600;
}

.hz-scope-card-text {
  margin: 0.25rem 0 0;
  color: #667085;
  font-size: 0.92rem;
}

.hz-scope-card .hz-scope-shell {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(15, 23, 42, 0.1);
}

.hz-pagination-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 0.5rem;
  padding-bottom: 0.75rem;
}

.hz-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

.hz-pagination .page-link {
  min-width: 2.5rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.75rem;
  text-align: center;
  border: 1px solid #d9e2ec;
  color: #1f3b57;
  background-color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
}

.hz-pagination .page-item:first-child .page-link,
.hz-pagination .page-item:last-child .page-link {
  border-radius: 0.75rem;
}

.hz-pagination .page-link:hover {
  background-color: #f8fbff;
  border-color: #b8cbe0;
  color: #16324a;
}

.hz-pagination .page-item.active .page-link {
  background-color: #1f4e79;
  border-color: #1f4e79;
  color: #fff;
  font-weight: 600;
}

.hz-pagination .page-item.disabled .page-link {
  color: #9aa9b8;
  background-color: #f5f7fa;
  border-color: #e2e8f0;
  pointer-events: none;
  opacity: 1;
}
