.transfert-stock-page .transfert-stock-page__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.transfert-stock-page .transfert-stock-page__container {
  max-width: 720px;
  margin-top: 1.5rem;
}

@media (max-width: 640px) {
  .transfert-stock-page .transfert-stock-page__header .button {
    width: 100%;
  }

  .transfert-stock-page .transfert-stock-page__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .transfert-stock-page .transfert-stock-page__actions .button {
    width: 100%;
  }
}

:root {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #e8eef6;
  background: #0f1419;
  
  /* Variables pour le layout flexible */
  --header-height: auto;
  --header-padding: 0.6rem 1rem;
  --navbar-gap: 1.5rem;
  --content-padding: 1rem;
  --border-radius: 8px;
  --transition-speed: 0.3s;
  
  /* Breakpoints */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
  
  /* Espacements */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  
  /* Z-index layers */
  --z-header: 20;
  --z-navbar: 100;
  --z-modal: 1000;
}

/* ===== ANIMATIONS RÉUTILISABLES ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ===== COMPOSANTS RÉUTILISABLES ===== */
.loader-spinner {
  display: inline-block;
  animation: spin 1s linear infinite;
}

.loading-overlay {
  position: fixed;
  /* Ne couvre pas la sidebar / chrome mobile : navigation reste visible pendant le chargement */
  top: 0;
  left: var(--sidebar-width, 280px);
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn 0.2s ease-out;
}

@media (max-width: 768px) {
  .loading-overlay {
    left: 0;
    top: var(--phc-mobile-header-h, 56px);
    bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
  }
}

.loading-overlay.hidden {
  animation: fadeOut 0.2s ease-out;
  opacity: 0;
  pointer-events: none;
}

.global-loading-box {
  min-width: 180px;
  background: #111827;
  color: #ffffff;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.global-loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.global-loading-text {
  font-size: 0.92rem;
  font-weight: 600;
}

/* ===== STYLES PROFESSIONNELS POUR LES FILTRES ===== */
.filters-container-catalogue {
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s ease;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.filters-container-catalogue:hover {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters-header {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #e2e8f0;
}

.filters-title {
  display: flex;
  align-items: center;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: -0.01em;
}

.filters-title svg {
  color: #3b82f6;
}

.filters-grid-catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.filter-item-catalogue {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.filter-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.filter-icon {
  position: absolute;
  left: 0.75rem;
  color: #94a3b8;
  pointer-events: none;
  z-index: 1;
}

.filter-input-catalogue {
  width: 100%;
  padding: 0.625rem 0.75rem 0.625rem 2.5rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  color: #1e293b;
  background: #151b24;
  transition: all 0.2s ease;
  outline: none;
}

.filter-input-catalogue:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: #151b24;
}

.filter-input-catalogue::placeholder {
  color: #94a3b8;
}

.filter-select-catalogue {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  font-size: 0.9375rem;
  color: #1e293b;
  background: #151b24;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23475569' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.filter-select-catalogue:hover {
  border-color: #cbd5e1;
  background-color: #1a222d;
}

.filter-select-catalogue:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background-color: #151b24;
}

.filter-select-catalogue option {
  padding: 0.5rem;
  color: #1e293b;
}

.filters-actions-catalogue {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #64748b;
  background: #151b24;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.btn-reset-filters:hover {
  color: #1e293b;
  background: #1a222d;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-reset-filters:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-reset-filters svg {
  transition: transform 0.2s ease;
}

.btn-reset-filters:hover svg {
  transform: rotate(-90deg);
}

@media (max-width: 768px) {
  .filters-grid-catalogue {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .filters-container-catalogue {
    padding: 1rem;
  }
  
  .filters-actions-catalogue {
    flex-direction: column;
    justify-content: stretch;
  }
  
  .btn-reset-filters {
    width: 100%;
    justify-content: center;
  }
}

/* =============================================================================
   Page — Gestion des Outils  #tools
   ============================================================================= */
.tools-page {
  --tools-border: #e5e7eb;
  --tools-soft: #f8fafc;
  --tools-text: #111827;
  --tools-muted: #6b7280;
  --tools-accent: #0b4a63;
  --tools-accent-ring: rgba(11, 74, 99, 0.2);
}

/* Monitoring Engins Dashboard */
.monitor-page {
  --monitor-border: rgba(148, 163, 184, 0.22);
  --monitor-soft: #121a24;
  --monitor-surface: #151b24;
  --monitor-accent: #0ea5a4;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0;
}

.monitor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--monitor-border);
  margin-bottom: 0.85rem;
}

.monitor-head-main {
  flex: 1 1 16rem;
  min-width: 0;
}

.monitor-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--monitor-accent);
}

.monitor-head-main h2 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.monitor-lede {
  margin: 0;
  max-width: 42rem;
  font-size: 0.86rem;
  line-height: 1.4;
}

.monitor-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  flex: 0 1 auto;
}

.monitor-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.35rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--monitor-border);
  border-radius: 10px;
  background: var(--monitor-surface);
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.monitor-check input {
  accent-color: var(--monitor-accent);
}

.monitor-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.85rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--monitor-border);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(14, 165, 164, 0.06), transparent 55%), var(--monitor-surface);
}

.monitor-toolbar__row {
  display: grid;
  gap: 0.55rem 0.7rem;
  align-items: end;
}

.monitor-toolbar__row--primary {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1.25fr) auto;
}

.monitor-toolbar__row--more {
  grid-template-columns: repeat(2, minmax(180px, 260px));
  padding-top: 0.1rem;
}

.monitor-toolbar__row--more[hidden] {
  display: none !important;
}

.monitor-toolbar-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 0.45rem;
  align-items: stretch;
}

.monitor-toolbar-actions .monitor-reset-btn {
  width: auto;
  min-width: 7.25rem;
  padding: 0 0.85rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.monitor-page.is-loading-soft .monitor-body {
  opacity: 0.72;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.monitor-toolbar__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  min-height: 2rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.monitor-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.monitor-field--search {
  min-width: 0;
}

.monitor-field--actions {
  justify-self: end;
}

.monitor-field--actions .monitor-toolbar-actions {
  height: 2.5rem;
}

.monitor-reset-btn {
  height: 2.5rem;
  min-height: 2.5rem;
  box-sizing: border-box;
}

.monitor-field--status {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.monitor-field--status .monitor-field__lab {
  height: auto;
  margin: 0;
}

.monitor-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.monitor-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  height: 1.85rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 164, 0.35);
  background: rgba(14, 165, 164, 0.12);
  color: #99f6e4;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1;
}

.monitor-chip__x {
  border: 0;
  background: transparent;
  color: #5eead4;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0;
  opacity: 0.85;
}

.monitor-chip__x:hover {
  opacity: 1;
  color: #f8fafc;
}

.monitor-active-filters:empty::before {
  content: 'Aucun filtre actif';
  color: #64748b;
  font-size: 0.78rem;
}

.monitor-field__lab {
  display: block;
  height: 0.95rem;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 0.95rem;
  text-transform: uppercase;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.monitor-scope-label {
  display: inline-flex;
  align-items: center;
  height: 1.85rem;
  min-height: 1.85rem;
  padding: 0 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 165, 164, 0.35);
  background: rgba(14, 165, 164, 0.12);
  color: #5eead4;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.monitor-filters {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.monitor-select,
.monitor-input {
  width: 100%;
  min-width: 0;
  height: 2.5rem;
  min-height: 2.5rem;
  box-sizing: border-box;
  border: 1px solid var(--monitor-border);
  border-radius: 10px;
  padding: 0 0.7rem;
  background: #0b1220;
  color: #f1f5f9;
  font-size: 0.88rem;
  line-height: 1.2;
}

.monitor-select:focus,
.monitor-input:focus {
  outline: none;
  border-color: rgba(14, 165, 164, 0.65);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.15);
}

.monitor-body {
  display: grid;
  gap: 0.9rem;
  min-height: 0;
}

.monitor-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  padding: 0.25rem;
  border: 1px solid var(--monitor-border);
  border-radius: 12px;
  background: #0b1220;
}

.monitor-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 0.5rem 0.95rem;
  font-weight: 650;
  font-size: 0.85rem;
  cursor: pointer;
  color: #94a3b8;
  opacity: 1;
}

.monitor-tab-btn:hover {
  color: #e2e8f0;
  background: rgba(148, 163, 184, 0.08);
}

.monitor-tab-btn.active {
  background: rgba(14, 165, 164, 0.18);
  color: #5eead4;
  border-color: rgba(14, 165, 164, 0.35);
}

.monitor-table-wrap {
  border: 1px solid var(--monitor-border);
  border-radius: 12px;
  overflow: auto;
  background: var(--monitor-surface);
}

.monitor-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0f172a;
  white-space: nowrap;
}

.monitor-page.is-loading .monitor-body {
  pointer-events: none;
}

.monitor-page.is-loading .monitor-scope-label {
  border-color: rgba(56, 189, 248, 0.4);
  background: rgba(12, 74, 110, 0.35);
  color: #7dd3fc;
}

.monitor-page.is-loading .monitor-scope-label::after {
  content: '';
  width: 0.55rem;
  height: 0.55rem;
  margin-left: 0.45rem;
  border-radius: 50%;
  border: 2px solid rgba(125, 211, 252, 0.25);
  border-top-color: #7dd3fc;
  animation: monitor-spin 0.7s linear infinite;
}

@keyframes monitor-spin {
  to { transform: rotate(360deg); }
}

@keyframes monitor-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.monitor-skel-line {
  display: block;
  height: 0.7rem;
  width: 72%;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(148, 163, 184, 0.12) 0%,
    rgba(148, 163, 184, 0.28) 45%,
    rgba(148, 163, 184, 0.12) 90%
  );
  background-size: 200% 100%;
  animation: monitor-shimmer 1.15s ease-in-out infinite;
}

.monitor-skel-line--sm {
  width: 48%;
  height: 0.55rem;
  margin-bottom: 0.55rem;
}

.monitor-skel-line--lg {
  width: 36%;
  height: 1.15rem;
}

.monitor-skel-line--num {
  width: 2.2rem;
  flex-shrink: 0;
}

.monitor-skel-line--table {
  width: 100%;
  height: 0.85rem;
  margin: 0.15rem 0;
}

.monitor-summary-card.monitor-skel,
.monitor-kpi-row.monitor-skel {
  pointer-events: none;
}

.monitor-skel-row td {
  padding: 0.75rem 0.65rem;
}

@media (max-width: 1200px) {
  .monitor-toolbar__row--primary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .monitor-field--actions {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
  .monitor-toolbar-actions {
    width: 100%;
    grid-auto-columns: 1fr;
  }
  .monitor-toolbar-actions .monitor-reset-btn {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .monitor-toolbar__row--primary,
  .monitor-toolbar__row--more {
    grid-template-columns: 1fr 1fr;
  }
  .monitor-field--search,
  .monitor-field--actions {
    grid-column: 1 / -1;
  }
  .monitor-field--status {
    flex-wrap: wrap;
  }
  .monitor-head-actions {
    justify-content: flex-start;
  }
}

.monitor-tab-pane {
  display: none;
}

.monitor-tab-pane.active {
  display: block;
}

.monitor-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.monitor-summary-card {
  border: 1px solid var(--monitor-border);
  border-radius: 10px;
  background: #151b24;
  padding: 0.75rem;
}

.monitor-summary-card strong {
  font-size: 1.3rem;
}

.monitor-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.monitor-card {
  border: 1px solid var(--monitor-border);
  border-radius: 10px;
  background: #151b24;
  padding: 0.75rem;
}

.monitor-card-title {
  margin: 0 0 0.5rem;
}

.monitor-details-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.monitor-details-head-text {
  flex: 1;
  min-width: min(100%, 220px);
}

.monitor-details-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.monitor-details-head-actions .button {
  white-space: nowrap;
}

.monitor-engin-actions-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  min-width: 7.5rem;
}

.monitor-engin-actions-cell .button {
  width: 100%;
  justify-content: center;
}

.monitor-signalement-from-monitoring {
  text-align: center;
  justify-content: center;
}

.monitor-signalement-compact {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.monitor-component-card-actions {
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--monitor-border);
}

.monitor-component-card-actions .button {
  width: 100%;
  justify-content: center;
}

.monitor-component-interv {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--monitor-border, #e5e7eb);
}

.monitor-interv-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 0.35rem;
}

.monitor-interv-list {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.72rem;
  line-height: 1.35;
  max-height: 7.5rem;
  overflow-y: auto;
}

.monitor-interv-list li {
  margin-bottom: 0.2rem;
}

.monitor-interv-date {
  white-space: nowrap;
}

.monitor-interv-more {
  margin: 0.25rem 0 0;
  font-size: 0.7rem;
}

.monitor-interv-cell {
  max-width: 22rem;
  vertical-align: top;
}

.monitor-matrix-interv .monitor-interv-list {
  max-height: 5rem;
}

.monitor-interv-counts {
  font-size: 0.7rem;
  margin-bottom: 0.25rem;
}

.monitor-kpi-list {
  display: grid;
  gap: 0.45rem;
}

.monitor-kpi-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--monitor-border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  background: var(--monitor-soft);
}

.monitor-inline-filters {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.6rem;
}

.monitor-pagination {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-end;
  margin-top: 0.65rem;
}

.monitor-details-head {
  margin-bottom: 0.6rem;
}

.monitor-details-head h3 {
  margin: 0 0 0.2rem;
}

.monitor-health-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.monitor-health-good {
  background: #dcfce7;
  color: #166534;
}

.monitor-health-warning {
  background: #ffedd5;
  color: #9a3412;
}

.monitor-health-critical {
  background: #fee2e2;
  color: #991b1b;
}

.monitor-component-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.monitor-component-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #151b24;
  padding: 0.7rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.monitor-component-card.monitor-health-critical {
  border-color: #fca5a5;
  background: #fff5f5;
}

.monitor-component-card.monitor-health-warning {
  border-color: #fdba74;
  background: #fffaf2;
}

.monitor-component-card.monitor-health-good {
  border-color: #86efac;
  background: #f3fff7;
}

.monitor-component-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: flex-start;
}

.monitor-component-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.monitor-component-icon {
  min-width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #0f172a;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.monitor-component-top h5 {
  margin: 0;
  font-size: 0.95rem;
}

.monitor-component-ref {
  margin: 0.35rem 0;
  color: #475569;
  font-size: 0.82rem;
}

.monitor-ring-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.2rem 0 0.35rem;
}

.monitor-score-ring {
  --ring-color: #22c55e;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--score, 0) * 1%), #e2e8f0 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.monitor-score-ring::before {
  content: "";
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #151b24;
  position: absolute;
}

.monitor-score-ring span {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  font-weight: 700;
}

.monitor-score-ring.monitor-health-warning {
  --ring-color: #f59e0b;
}

.monitor-score-ring.monitor-health-critical {
  --ring-color: #ef4444;
}

.monitor-ring-info {
  min-width: 0;
}

.monitor-view-switch {
  display: inline-flex;
  gap: 0.4rem;
  margin: 0.2rem 0 0.6rem;
}

.monitor-view-btn {
  border: 1px solid #cbd5e1;
  background: #151b24;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.monitor-view-btn.active {
  background: #0b4a63;
  color: #fff;
  border-color: #0b4a63;
}

.monitor-view-pane {
  display: none;
}

.monitor-view-pane.active {
  display: block;
}

.monitor-heatmap-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.6rem;
  margin-bottom: 0.6rem;
  background: #1a222d;
}

.monitor-heatmap-panel h4 {
  margin: 0 0 0.45rem;
}

.monitor-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18px, 1fr));
  gap: 5px;
}

.monitor-heat-cell {
  height: 18px;
  border-radius: 4px;
  background: #cbd5e1;
}

/* Couleurs de criticité (les classes .monitor-health-* seules sont écrasées par .monitor-heat-cell sans combinateur) */
.monitor-heat-cell.monitor-health-good {
  background: #22c55e;
}

.monitor-heat-cell.monitor-health-warning {
  background: #f59e0b;
}

.monitor-heat-cell.monitor-health-critical {
  background: #ef4444;
}

.monitor-component-gauge {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.monitor-component-gauge-fill {
  height: 100%;
  border-radius: 999px;
}

.monitor-component-gauge-fill.monitor-health-critical {
  background: #ef4444;
}

.monitor-component-gauge-fill.monitor-health-warning {
  background: #f59e0b;
}

.monitor-component-gauge-fill.monitor-health-good {
  background: #22c55e;
}

.monitor-component-meta {
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

.monitor-spark-wrap {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.2rem;
}

.monitor-spark-bars {
  height: 34px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  align-items: end;
}

.monitor-spark-bar {
  display: block;
  border-radius: 3px 3px 0 0;
  background: #94a3b8;
}

.monitor-spark-bar.monitor-health-good {
  background: #22c55e;
}

.monitor-spark-bar.monitor-health-warning {
  background: #f59e0b;
}

.monitor-spark-bar.monitor-health-critical {
  background: #ef4444;
}

.monitor-spark-label {
  font-size: 0.72rem;
  color: #64748b;
}

.monitor-health-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}

.monitor-health-pill {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #151b24;
}

.monitor-health-pill span {
  font-size: 0.82rem;
}

.monitor-health-pill strong {
  font-size: 1rem;
}

.monitor-tech-details {
  margin-top: 0.8rem;
}

.monitor-tech-details > summary {
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: #0b4a63;
}

.monitor-matrix-panel {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.6rem;
  background: #1a222d;
}

.monitor-matrix-panel h4 {
  margin: 0 0 0.45rem;
}

.monitor-matrix-comp {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.monitor-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.monitor-dot.monitor-health-good { background: #22c55e; }
.monitor-dot.monitor-health-warning { background: #f59e0b; }
.monitor-dot.monitor-health-critical { background: #ef4444; }

.monitor-auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--monitor-border);
  border-radius: 8px;
  background: #151b24;
  font-size: 0.85rem;
  color: #334155;
}

.monitor-wall-mode {
  background: #0f172a;
  color: #e2e8f0;
}

.monitor-wall-mode .monitor-card,
.monitor-wall-mode .monitor-summary-card,
.monitor-wall-mode .monitor-health-pill,
.monitor-wall-mode .monitor-component-card,
.monitor-wall-mode .panel-body,
.monitor-wall-mode .table-container,
.monitor-wall-mode .data-table,
.monitor-wall-mode .data-table thead th,
.monitor-wall-mode .data-table tbody td {
  background: #111827;
  color: #e5e7eb;
  border-color: #1f2937;
}

.monitor-wall-mode .monitor-tab-btn {
  background: #1f2937;
  color: #cbd5e1;
  border-color: #334155;
}

.monitor-wall-mode .monitor-tab-btn.active {
  background: #0ea5e9;
  border-color: #0ea5e9;
  color: #0b1120;
}

.monitor-wall-mode .monitor-component-ref,
.monitor-wall-mode .muted,
.monitor-wall-mode .monitor-spark-label {
  color: #94a3b8 !important;
}

@media print {
  body.monitor-print-mode * {
    visibility: hidden !important;
  }

  body.monitor-print-mode .monitor-page,
  body.monitor-print-mode .monitor-page * {
    visibility: visible !important;
  }

  body.monitor-print-mode .monitor-page {
    position: absolute;
    inset: 0;
    width: 100%;
    background: #fff !important;
    color: #000 !important;
  }

  body.monitor-print-mode .monitor-head,
  body.monitor-print-mode .monitor-tabs {
    margin-bottom: 8px;
  }

  body.monitor-print-mode .monitor-tab-pane {
    display: none !important;
  }

  body.monitor-print-mode[data-monitor-print-tab="overview"] #monitor-tab-overview,
  body.monitor-print-mode[data-monitor-print-tab="engins"] #monitor-tab-engins,
  body.monitor-print-mode[data-monitor-print-tab="interventions"] #monitor-tab-interventions,
  body.monitor-print-mode[data-monitor-print-tab="composants"] #monitor-tab-composants {
    display: block !important;
  }
}

@media (max-width: 860px) {
  .monitor-select,
  .monitor-input {
    min-width: 140px;
  }
}

.tools-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  border-bottom: 1px solid var(--tools-border);
  padding-bottom: 1rem;
}

.tools-head-main {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 42rem;
}

.tools-head-main h2 {
  margin: 0;
  color: var(--tools-text);
  letter-spacing: -0.01em;
}

.tools-head-main p {
  margin-top: 0.4rem;
  color: var(--tools-muted);
}

.tools-role-note {
  margin-top: 0.45rem;
  font-size: 0.85rem;
}

.tools-head-actions-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  flex: 1 1 360px;
  min-width: min(100%, 280px);
  justify-content: flex-end;
}

.tools-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.tools-head-actions--exports {
  padding-left: 0.85rem;
  margin-left: 0.15rem;
  border-left: 1px solid var(--tools-border);
  align-items: center;
}

.tools-export-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tools-muted);
  margin-right: 0.15rem;
  white-space: nowrap;
}

/* Barre d’outils : largeurs auto (évite une colonne par champ à cause de width:100%) */
.tools-head-actions .tools-input,
.tools-head-actions .tools-select {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
}

.tools-head-actions--filters .tools-input--scan {
  width: clamp(11rem, 18vw, 17rem);
  flex: 1 1 11rem;
  max-width: 20rem;
}

.tools-head-actions--filters input[type="search"] {
  width: clamp(11rem, 20vw, 18rem);
  flex: 1 1 11rem;
  max-width: 22rem;
}

.tools-head-actions--filters .tools-select {
  width: clamp(9.5rem, 14vw, 13rem);
  max-width: 16rem;
}

.tools-head-actions--filters .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.tools-head-actions--exports .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .tools-head-actions-wrap {
    justify-content: flex-start;
  }
  .tools-head-actions--exports {
    flex-basis: 100%;
    border-left: none;
    padding-left: 0;
    margin-left: 0;
    padding-top: 0.55rem;
    border-top: 1px solid var(--tools-border);
  }
}

.tools-panel-body {
  display: grid;
  gap: 1.25rem;
}

.tools-input,
.tools-select {
  min-height: 40px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  background: #151b24;
  color: var(--tools-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  max-width: 100%;
}

/* Pleine largeur réservée aux champs dans les formulaires (grille / .tools-field) */
.tools-field .tools-input,
.tools-field .tools-select,
.tools-form-grid .tools-field .tools-input,
.tools-form-grid .tools-field .tools-select {
  width: 100%;
}

.tools-field--full .tools-input,
.tools-field--full .tools-select,
.tools-field--full textarea.tools-input {
  width: 100%;
}

.tools-input::placeholder {
  color: #9ca3af;
}

.tools-input:focus,
.tools-select:focus {
  outline: none;
  border-color: var(--tools-accent);
  box-shadow: 0 0 0 3px var(--tools-accent-ring);
}

.tools-form-card,
.tools-table-card {
  border: 1px solid var(--tools-border);
  border-radius: 12px;
  background: #151b24;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.tools-inventory-hero {
  border-left: 4px solid var(--tools-accent);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.tools-inventory-lede {
  margin: -0.25rem 0 1rem 0;
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 72ch;
}

.tools-affectations-lede {
  margin-top: 0;
  margin-bottom: 0.85rem;
  max-width: 70ch;
}

/* Onglet Affectations : lanceurs vers modales */
.tools-ops-launchers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.5rem;
}

.tools-ops-launch-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--tools-border);
  border-radius: 12px;
  background: #151b24;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  font: inherit;
  color: var(--tools-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.tools-ops-launch-card:hover:not(:disabled) {
  border-color: var(--tools-accent);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.tools-ops-launch-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tools-ops-launch-card--accent {
  border-left: 4px solid var(--tools-accent);
}

.tools-ops-launch-card--admin {
  border-left: 4px solid #b45309;
}

.tools-ops-launch-kicker {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--tools-muted);
}

.tools-ops-launch-title {
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tools-ops-launch-desc {
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0;
}

.modal-content.modal-content--tools-ops {
  width: 10cm;
  max-width: 10cm;
}

.modal-content.modal-content--tools-create {
  width: 10cm;
  max-width: 10cm;
}

/* Ajustements modales : champs plus compacts */
.tools-ops-modal .modal-body {
  padding: 1rem 1.1rem;
}
.tools-ops-modal .tools-form-grid {
  grid-template-columns: 1fr;
  gap: 0.75rem 0.9rem;
}
.tools-ops-modal .tools-comment {
  min-height: 56px;
}
.tools-ops-modal .tools-form-actions {
  margin-top: 0.85rem;
}
@media (max-width: 520px) {
  .tools-ops-modal .tools-form-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .tools-ops-modal .modal-content.modal-content--tools-ops,
  .tools-ops-modal .modal-content.modal-content--tools-create {
    max-width: 100%;
  }
}
.tools-ops-modal .modal-body .tools-form-help {
  margin-top: 0;
}

/* Modales outils: pas de scroll interne */
.tools-ops-modal {
  overflow-y: hidden;
}
.tools-ops-modal .modal-content {
  max-height: none;
  overflow-y: visible;
}

.tools-details {
  border: 1px solid var(--tools-border);
  border-radius: 12px;
  background: #151b24;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  overflow: hidden;
}

.tools-details-summary {
  list-style: none;
  position: relative;
  padding: 1rem 2.35rem 1rem 1.2rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  background: linear-gradient(180deg, #f1f5f9 0%, #fff 55%);
  transition: background 0.15s ease;
}

.tools-details-summary::-webkit-details-marker {
  display: none;
}

.tools-details-summary::after {
  content: "▸";
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--tools-muted);
  transition: transform 0.2s ease;
}

.tools-details {
  position: relative;
}

.tools-details[open] .tools-details-summary::after {
  transform: translateY(-50%) rotate(90deg);
}

.tools-details-summary:hover {
  background: linear-gradient(180deg, #e2e8f0 0%, #f8fafc 60%);
}

.tools-details[open] .tools-details-summary {
  border-bottom: 1px solid var(--tools-border);
}

.tools-details-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--tools-text);
}

.tools-details-hint {
  font-size: 0.85rem;
  color: var(--tools-muted);
  line-height: 1.35;
  max-width: 52rem;
}

.tools-details-inner {
  padding: 1.15rem 1.2rem 1.25rem;
  display: grid;
  gap: 1.25rem;
  background: var(--tools-soft);
}

.tools-form-card--in-details {
  margin: 0;
  background: #151b24;
  border: 1px solid #e2e8f0;
  box-shadow: none;
}

.panel.tools-form-card--in-details {
  padding: 1.15rem 1.25rem;
}

.tools-subsection-title {
  margin: 0 0 0.35rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--tools-text);
}

.tools-form-help {
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
  line-height: 1.45;
}

.tools-form-section-label {
  margin: 1.1rem 0 0.7rem 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--tools-muted);
}

#tools-da-card .tools-form-section-label:first-of-type {
  margin-top: 0.2rem;
}

.tools-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.tools-field--full {
  margin-top: 0.85rem;
}

.tools-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
}

.tools-req {
  color: #b45309;
  font-weight: 700;
}

.tools-da-table-wrap {
  margin-top: 1rem;
}

.tools-section-title {
  margin: 0 0 0.8rem 0;
  color: var(--tools-text);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tools-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem 1.1rem;
}

/* Formulaire création outil : lisible sur mobile, grille posée sur grand écran */
.tools-form-card--create {
  border-left: 4px solid var(--tools-accent);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.07);
  margin-bottom: 1.25rem;
}

.tools-create-title {
  margin: 0 0 0.35rem 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tools-text);
  letter-spacing: -0.02em;
}

.tools-form-grid--create {
  grid-template-columns: 1fr;
  gap: 1rem 1.25rem;
}

@media (min-width: 640px) {
  .tools-form-grid--create {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .tools-form-grid--create {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 6.5rem) minmax(0, 0.85fr) minmax(0, 1fr);
  }
}

.tools-form-card--create .tools-field--full {
  margin-top: 0.5rem;
}

@media (min-width: 960px) {
  .tools-field--narrow {
    max-width: none;
  }
}

@media (min-width: 720px) {
  .tools-field--span2 {
    grid-column: span 2;
  }
}

.tools-ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 0.75rem;
}

.tools-comment {
  margin-top: 0;
  min-height: 72px;
  resize: vertical;
}

.tools-form-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.tools-form-actions--split {
  justify-content: space-between;
  flex-wrap: wrap;
}

.tools-camera-box {
  display: none;
  border: 1px solid var(--tools-border);
  border-radius: 12px;
  padding: 0.85rem;
  margin-bottom: 0;
}

.tools-camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}

.tools-camera-video {
  width: 100%;
  max-height: 320px;
  border-radius: 10px;
  background: #111827;
  object-fit: cover;
}

.tools-camera-status {
  margin-top: 0.55rem;
}

.tools-page .data-table th {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 2px solid var(--tools-border);
}

.tools-page .data-table tbody tr:hover {
  background: #1a222d;
}

.tools-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.5rem;
  border: 1px solid var(--tools-border);
  border-radius: 10px;
  background: var(--tools-soft);
}

.tools-tab-btn {
  border: 1px solid #d1d5db;
  background: #151b24;
  color: #374151;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.tools-tab-btn.active {
  border-color: var(--tools-accent);
  background: var(--tools-accent);
  color: #fff;
}

.tools-tab-pane {
  display: none;
}

.tools-tab-pane.active {
  display: block;
}

.tools-admin-actions {
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .tools-form-actions {
    justify-content: stretch;
  }
  .tools-form-actions .button {
    width: 100%;
  }
  .tools-form-actions--split {
    flex-direction: column;
  }
  .tools-details-summary::after {
    right: 0.85rem;
  }
}

* { 
  box-sizing: border-box; 
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  position: relative;
  display: flex;
  min-height: 100vh;
}

/* Empêcher le scroll horizontal sur TOUS les écrans */
html, body {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

/* S'assurer que tous les éléments respectent la largeur */
* {
  max-width: 100%;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Conteneurs principaux */
main.layout,
.panel,
.panel-body,
.panel-head {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

h1 { margin: 0; }
h2 { margin: 0 0 .25rem; }
p { margin: 0; }

.session {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  flex-direction: row;
}

.session-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  order: 2;
}

.lang-switches {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  order: 1;
}

.user-pill {
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== SIDEBAR DESKTOP ===== */
.sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #fff;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  z-index: 9500; /* au-dessus du loading-overlay (9000) */
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  box-sizing: border-box;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

/* Sidebar Header avec nom de l'application */
.sidebar-header {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand {
  width: 100%;
  text-align: center;
  padding: 0.25rem 0.5rem;
}

.app-logo {
  display: block;
  object-fit: contain;
  max-width: 100%;
}

.app-logo--sidebar {
  max-height: 58px;
  margin: 0 auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.app-logo--mobile,
.app-logo--mobile-nav {
  max-height: 34px;
  width: auto;
}

.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.app-logo--auth {
  max-height: 88px;
  width: auto;
}

.sidebar-app-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.sidebar-nav {
  flex: 1 1 auto;
  padding: 0.75rem 0;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
  max-height: 100%;
}

.sidebar-nav .nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 0 0.75rem;
  width: 100%;
  box-sizing: border-box;
}

/* Sections de navigation - supprimées pour économiser l'espace */

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1rem;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.875rem;
  font-weight: 500;
  position: relative;
  margin: 0 0.25rem;
}

.sidebar-nav .nav-link .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke-width: 2;
  transition: all 0.25s ease;
  font-size: 1.1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sidebar-nav .nav-link .nav-icon--img,
.mobile-nav-links .nav-link .nav-icon--img {
  overflow: hidden;
  border-radius: 4px;
}

.sidebar-nav .nav-link .nav-icon--img img,
.mobile-nav-links .nav-link .nav-icon--img img {
  width: 18px;
  height: 18px;
  display: block;
  object-fit: contain;
  border-radius: 4px;
}

.sidebar-nav .nav-link .nav-text {
  flex: 1;
  letter-spacing: -0.01em;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.sidebar-nav .nav-link:hover .nav-icon {
  transform: scale(1.1);
  color: #3ba63b;
}

.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, rgba(59, 166, 59, 0.15) 0%, rgba(59, 166, 59, 0.08) 100%);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid #3ba63b;
  box-shadow: 0 2px 8px rgba(59, 166, 59, 0.2);
}

.sidebar-nav .nav-link.active .nav-icon {
  color: #3ba63b;
}

.sidebar-nav .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #3ba63b;
  border-radius: 0 2px 2px 0;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* User Card */
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.25s ease;
}

.sidebar-user-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3ba63b 0%, #2d8f2d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.user-avatar svg {
  width: 20px;
  height: 20px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.125rem;
}

/* Logout Button */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s ease;
  width: 100%;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ffffff;
  transform: translateY(-1px);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

/* Lang Switches */
.sidebar .lang-switches {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  padding: 0.375rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.lang-switch {
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lang-switch:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

.lang-switch.active {
  background: #3ba63b;
  border-color: #3ba63b;
  color: #ffffff;
}

/* ===== HEADER MOBILE ===== */
.app-bar-mobile {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9500; /* au-dessus du loading-overlay */
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 0;
  border-bottom: 2px solid rgba(59, 166, 59, 0.3);
  height: 64px;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  width: 100%;
  height: 100%;
}

.mobile-app-title {
  flex: 1;
  display: flex;
  align-items: center;
}

.mobile-app-name {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 0.5rem; /* Décalage vers la droite */
  margin-left: 0.25rem; /* Espacement supplémentaire */
}

/* Sur desktop, s'assurer que la sidebar est visible */
@media (min-width: 769px) {
  .sidebar {
    display: flex !important;
  }
  
  .app-bar-mobile {
    display: none !important;
  }
  
  .layout {
    margin-left: 280px !important;
    width: calc(100% - 280px) !important;
  }
}

.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-navbar);
}

.mobile-nav-overlay.active {
  display: block;
}

.mobile-nav {
  position: fixed;
  top: 0;
  left: -320px;
  width: 320px;
  max-width: 85vw;
  height: 100vh;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  z-index: calc(var(--z-navbar) + 1);
  transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-right: 2px solid rgba(59, 166, 59, 0.3);
  display: flex !important;
  flex-direction: column;
  max-height: 100vh;
  box-sizing: border-box;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
}

.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

.mobile-nav-brand {
  flex: 1;
}

.mobile-nav-app-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.mobile-nav-close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.mobile-nav-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.mobile-nav-close:active {
  transform: scale(0.95);
}

.mobile-nav.active {
    left: 0 !important;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  gap: 0.375rem;
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  overflow-x: hidden;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.mobile-nav-links::-webkit-scrollbar {
  width: 6px;
}

.mobile-nav-links::-webkit-scrollbar-track {
  background: transparent;
}

.mobile-nav-links::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.mobile-nav-links::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.mobile-nav-links .nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0 0.75rem;
  position: relative;
  min-height: 48px;
}

.mobile-nav-links .nav-link .nav-icon {
  font-size: 1.1em;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 1.2em;
  text-align: center;
}

.mobile-nav-links .nav-link .nav-text {
  flex: 1;
}

.mobile-nav-links .nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  transform: translateX(4px);
}

.mobile-nav-links .nav-link.active {
  background: linear-gradient(135deg, rgba(59, 166, 59, 0.15) 0%, rgba(59, 166, 59, 0.08) 100%);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid #3ba63b;
  box-shadow: 0 2px 8px rgba(59, 166, 59, 0.2);
}

.mobile-nav-links .nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #3ba63b;
  border-radius: 0 2px 2px 0;
}

/* Navigation structurée (groupes + sous-liens) */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.nav-group-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
}

.nav-group-toggle:hover {
  background: rgba(148, 163, 184, 0.14);
}

.nav-group-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-group-caret {
  font-size: 0.75rem;
  opacity: 0.9;
}

.nav-group-toggle[aria-expanded="true"] .nav-group-caret {
  transform: rotate(180deg);
}

.nav-submenu {
  display: none;
  padding-left: 0.3rem;
}

.nav-submenu.open {
  display: block;
}

.nav-link.nav-sublink {
  margin-left: 0.45rem;
}

/* ===== Modern Navigation (Desktop) ===== */
.sidebar-nav .nav-links {
  padding: 0.5rem 0.65rem;
  gap: 0.6rem;
}

.sidebar-nav .nav-group {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 12px;
  padding: 0.35rem;
  margin-bottom: 0.25rem;
}

.sidebar-nav .nav-group-toggle {
  padding: 0.55rem 0.6rem;
  color: #e2e8f0;
  font-size: 0.95rem;
  border-radius: 10px;
  font-weight: 700;
}

.sidebar-nav .nav-group-toggle:hover {
  background: rgba(59, 130, 246, 0.14);
}

.sidebar-nav .nav-group-icon {
  display: inline-flex;
  width: 18px;
  justify-content: center;
}

.sidebar-nav .nav-submenu {
  display: none;
  padding: 0.2rem 0.15rem 0.25rem 0.15rem;
}

.sidebar-nav .nav-submenu.open {
  display: block;
}

.sidebar-nav .nav-link.nav-sublink {
  margin: 0.2rem 0.2rem;
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  font-size: 0.84rem;
  color: #cbd5e1;
  transform: none !important;
}

.sidebar-nav .nav-link.nav-sublink .nav-icon {
  font-size: 0.95rem;
  width: 16px;
}

.sidebar-nav .nav-link.nav-sublink:hover {
  background: rgba(59, 130, 246, 0.16);
  color: #ffffff;
}

.sidebar-nav .nav-link.nav-sublink.active {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.35), rgba(16, 185, 129, 0.22));
  border-left: 3px solid #38bdf8;
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.25);
}

/* Keep collapse behavior on mobile drawer */
.mobile-nav-links .nav-submenu {
  display: none;
  padding-left: 0.2rem;
}

.mobile-nav-links .nav-submenu.open {
  display: block;
}

/* ===== Dashboard Professional polish ===== */
.dashboard-stats-grid .stat-card {
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.dashboard-stats-grid .stat-card:hover {
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.1);
  transform: translateY(-1px);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dashboard-kpi-operational {
  background: linear-gradient(180deg, #151b24 0%, #121820 100%) !important;
  border: 1px solid #2a3544 !important;
}

.dashboard-tabs-container {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #151b24;
  box-shadow: 0 1px 3px rgba(2, 6, 23, 0.04);
}

.dashboard-tabs-nav {
  position: sticky;
  top: 0;
  background: #151b24;
  z-index: 5;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 14px 14px 0 0;
}

.mobile-nav-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  box-sizing: border-box;
  position: relative !important;
  z-index: 10 !important;
  margin-top: 0 !important;
  min-height: auto !important;
  height: auto !important;
  gap: 0.75rem;
}

.mobile-user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3ba63b 0%, #2d8f2d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.mobile-user-avatar svg {
  width: 20px;
  height: 20px;
}

.mobile-user-info {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
}

.mobile-nav-footer .mobile-lang-switches {
  display: flex !important;
  gap: 0.5rem !important;
  justify-content: center !important;
  margin-bottom: 0.75rem !important;
  width: 100% !important;
}

.mobile-nav-footer .mobile-lang-switches .lang-switch {
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.4) !important;
  background: transparent !important;
  color: #ffffff !important;
  font-size: 0.75rem !important;
  padding: 0.25rem 0.55rem !important;
  cursor: pointer !important;
  display: inline-block !important;
}

.mobile-nav-footer .mobile-lang-switches .lang-switch.lang-active {
  background: #151b24 !important;
  color: #0b4a63 !important;
}

.mobile-logout-btn {
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
  padding: 0.75rem 1rem !important;
  background: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.2) !important;
  color: #fca5a5 !important;
  border-radius: 8px !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  transition: all 0.25s ease !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 11 !important;
  text-decoration: none !important;
  margin: 0 !important;
}

.mobile-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #ffffff !important;
  transform: translateY(-1px) !important;
}

.mobile-logout-btn:active {
  transform: translateY(0) !important;
}

.mobile-nav-footer .logout-link,
.mobile-nav-footer #logout-mobile {
  width: 100% !important;
  text-align: left !important;
  background: rgba(220, 38, 38, 0.2) !important;
  border: 1px solid rgba(220, 38, 38, 0.4) !important;
  color: #ffffff !important;
  margin-top: 0 !important;
  padding: 0.75rem 1.5rem !important;
  border-radius: 8px !important;
  font-size: 0.9rem !important;
  font-weight: 500 !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  visibility: visible !important;
  opacity: 1 !important;
  position: relative !important;
  z-index: 11 !important;
  border: none !important;
  text-decoration: none !important;
}

.mobile-nav-footer button.logout-link,
.mobile-nav-footer #logout-mobile {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  min-height: 40px !important;
}

/* ===== LAYOUT PRINCIPAL ===== */
.layout {
  flex: 1;
  width: calc(100% - 280px);
  margin-left: 280px;
  padding: var(--content-padding);
  background: #0f1419;
  min-height: 0;
  transition: margin-left 0.3s ease;
  position: relative;
}

html.phc-app-shell .layout {
  min-height: 0;
}

/* ===== ANCIEN HEADER (caché) ===== */
.app-bar {
  display: none;
}

@media (min-width: 769px) {
  .app-bar {
    grid-template-areas: 
      "nav nav session";
    grid-template-columns: 1fr auto;
    padding-left: 1rem;
  }
  
  .navbar {
    justify-content: flex-start;
    padding-left: 0;
  }
  
  .nav-links {
    margin-left: 0;
    padding-left: 0;
    justify-content: flex-start;
  }
  
  /* Cacher complètement le hamburger sur desktop et le retirer du flux */
  .nav-toggle {
    display: none !important;
    position: absolute !important;
    left: -9999px !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
  }
}

.app-bar-left {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: .75rem;
  grid-area: logo;
}

.nav-toggle {
  grid-area: toggle;
}

.navbar {
  grid-area: nav;
}

.session {
  grid-area: session;
}

.app-logo {
  display: none !important;
}

.logo-mark {
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .04em;
  color: #0b4a63;
  text-transform: uppercase;
}

.app-title {
  display: none !important;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.6rem 0.5rem;
  gap: 0.3rem;
  z-index: 100;
  position: absolute;
  top: 0.6rem;
  left: 1rem;
  order: -1;
  transition: all 0.3s ease;
  min-width: 44px;
  min-height: 44px;
  justify-content: center;
  align-items: center;
}

/* Sur desktop, cacher complètement le hamburger */
@media (min-width: 769px) {
  .nav-toggle {
    display: none !important;
  }
}

.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.nav-toggle:active {
  transform: scale(0.95);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 3px;
  background: #151b24;
  border-radius: 3px;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nav-toggle:hover span {
  background: #c4e4f2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-toggle[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.6);
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
  background: #151b24;
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
  background: #151b24;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--navbar-gap);
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed) ease;
  width: 100%;
}

.nav-link {
  position: relative;
  text-decoration: none;
  color: #e5e7eb;
  font-size: .9rem;
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.35rem;
  height: 2px;
  border-radius: 999px;
  background: #151b24;
}

.user-pill {
  padding: .25rem .6rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  font-size: .82rem;
}

button.small {
  padding: .4rem .8rem;
  font-size: .85rem;
}

.lang-switch {
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.4);
  background: transparent;
  color: #e5e7eb;
  font-size: .75rem;
  padding: .25rem .55rem;
}

.lang-switch.lang-active {
  background: #151b24;
  color: #0b4a63;
}

main.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
  padding: var(--content-padding);
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* S'assurer que le layout ne dépasse jamais la largeur de l'écran */
@media (min-width: 769px) {
  main.layout {
    max-width: calc(100vw - 280px); /* Largeur écran - sidebar */
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

.panel {
  background: #151b24;
  border: 1px solid #2a3544;
  border-radius: 10px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.03);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.panel-body {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* fin ancien bottom-nav supprimé */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--spacing-md);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Classes utilitaires pour layouts flexibles */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.cards {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.card.metric {
  padding: 1rem;
  border: 1px solid #e6e9ef;
  border-radius: 12px;
  background: linear-gradient(135deg, #f9fbff, #f3f6ff);
  box-shadow: 0 6px 16px rgba(17, 24, 39, 0.06);
}

.card.metric strong {
  display: block;
  font-size: 1.6rem;
  color: #0f172a;
}

label {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  font-size: .95rem;
  color: #333;
}

input, select, button {
  font: inherit;
  padding: .55rem .65rem;
  border-radius: 8px;
  border: 1px solid #d6d9e2;
  background: #151b24;
}

input:focus, select:focus {
  outline: 2px solid #4b7bec33;
  border-color: #4b7bec;
}

button {
  cursor: pointer;
  background: #1b6ef3;
  color: #fff;
  border: none;
  padding: .6rem 1.2rem;
}

button.secondary {
  background: #f1f3f8;
  color: #333;
  border: 1px solid #d6d9e2;
}

.filters select { 
  min-width: 140px; 
  max-width: 100%;
}

/* S'assurer que les filtres ne débordent pas */
.filters {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 100%;
}

/* Sur desktop, limiter la largeur des tables pour éviter le scroll horizontal */
@media (min-width: 769px) {
  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
  }
  
  table {
    width: 100%;
    table-layout: auto;
    word-wrap: break-word;
  }
  
  th, td {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px; /* Limiter la largeur max des cellules */
  }
}

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

th, td {
  text-align: left;
  padding: .6rem;
  border-bottom: 1px solid #f0f2f7;
}

th {
  background: #1a222d;
  font-weight: 600;
}

tbody tr:hover { background: #f9fbff; }

.tag {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 999px;
  font-size: .85rem;
  border: 1px solid transparent;
}

.tag.en-service { background: #e6f6e9; color: #1d7a36; border-color: #ccecd3; }
.tag.hors-service { background: #ffeaea; color: #b22626; border-color: #ffd4d4; }
.tag.en-maintenance { background: #fff7e6; color: #a56500; border-color: #ffe8c7; }

.actions {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}

.actions button {
  padding: .4rem .8rem;
}

.history {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.history li {
  padding: .6rem .75rem;
  border: 1px solid #e9ecf3;
  border-radius: 8px;
  background: #fbfcff;
}

.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2rem 2rem 3.5rem;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.auth::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 30%, rgba(59, 166, 59, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(11, 74, 99, 0.15) 0%, transparent 50%);
  pointer-events: none;
}

.auth-layout {
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
}

.auth-box {
  max-width: 440px;
  width: 100%;
  padding: 3rem 2.5rem;
  border: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.auth-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: #3ba63b;
}

.auth-aside {
  display: none;
}

@media (max-width: 900px) {
  .auth {
    padding: 1.5rem;
  }
  
  .auth-layout {
    flex-direction: column;
    max-width: 500px;
    width: 100%;
  }
  
  .auth-aside {
    display: none;
  }
  
  .auth-box {
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .auth {
    padding: 1rem;
  }
  
  .auth-box {
    padding: 1.5rem 1.25rem;
    border-radius: 16px;
  }
  
  .auth-head h1 {
    font-size: 1.75rem;
  }
  
  .auth-form {
    gap: 1.25rem;
  }
}

.auth-head {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

.auth-head .pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.25rem;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  width: fit-content;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-head h1 {
  margin: 1rem 0 0.5rem 0;
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.02em;
}

.auth-head .muted {
  margin-top: 0;
  font-size: 1rem;
  color: #6b7280;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.badge-secondary {
  background: #e5e7eb;
  color: #374151;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: .25rem .7rem;
  border-radius: 999px;
  background: #eef3ff;
  color: #1b4ed8;
  font-weight: 600;
  font-size: .85rem;
  width: fit-content;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 0;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.auth-form label span {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  margin-bottom: 0.25rem;
}

.auth-form input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: #151b24;
  box-sizing: border-box;
}

.auth-form input:focus {
  outline: none;
  border-color: #0b4a63;
  box-shadow: 0 0 0 3px rgba(11, 74, 99, 0.1);
}

.auth-form input::placeholder {
  color: #9ca3af;
}

.auth-form button[type="submit"],
.auth-form .auth-submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-form button[type="submit"]:hover,
.auth-form .auth-submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  background: linear-gradient(180deg, #1e293b 0%, #334155 100%);
}

.auth-form button[type="submit"]:active,
.auth-form .auth-submit:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.auth-password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-wrap input {
  width: 100%;
  padding-right: 3rem !important;
}

.auth-password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.4rem !important;
  height: 2.4rem !important;
  min-width: 2.4rem !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #9aa8b8 !important;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  line-height: 1;
  z-index: 2;
}

.auth-password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  pointer-events: none;
}

.auth-password-toggle:hover {
  transform: translateY(-50%) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: none !important;
}

.auth-password-toggle:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-submit__idle,
.auth-submit__loading {
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.auth-submit__idle:not([hidden]),
.auth-submit__loading:not([hidden]) {
  display: inline-flex;
}

.auth-submit__idle[hidden],
.auth-submit__loading[hidden] {
  display: none !important;
}

.auth-submit.is-loading,
.auth-form button.auth-submit:disabled {
  opacity: 0.85;
  cursor: wait;
  transform: none !important;
}

.auth-spinner {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

.muted { color: #6b7280; font-size: .95rem; }
.muted.light { color: #e5e7eb; }
.muted.small { font-size: .9rem; }
.center { text-align: center; }
.link { color: #1b6ef3; text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

.error {
  color: #b22626;
  background: #ffeaea;
  border: 1px solid #ffd4d4;
  padding: .5rem;
  border-radius: 6px;
}

footer {
  text-align: center;
  margin-top: 1rem;
  color: #555;
  font-size: .9rem;
}

.auth-aside {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  border-radius: 20px;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  overflow: hidden;
  max-width: 500px;
  width: 100%;
}

.auth-aside::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.3) 0%, rgba(30, 41, 59, 0.3) 100%);
  opacity: 0.8;
  z-index: -1;
}

.auth-aside h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.bullets {
  list-style: none;
  padding: 0;
  margin: .5rem 0 0;
  display: grid;
  gap: .45rem;
}

.bullets li {
  position: relative;
  padding-left: 1.2rem;
  color: #e5ebff;
}

.bullets li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #6fa4ff;
  font-weight: 900;
}

/* Animations pour les notifications */
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Styles pour la maintenance */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.maintenance-page {
  padding: 0.5rem 0.75rem !important;
  overflow-x: clip !important;
  overflow-y: visible !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

.maintenance-page__head {
  margin-bottom: 0.45rem !important;
  align-items: center;
  flex: 0 0 auto;
}

.maintenance-page__title {
  font-size: 1.35rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  margin: 0 !important;
  color: #f8fafc;
}

.maintenance-page__cta {
  min-height: 2.35rem !important;
  padding: 0.45rem 1.1rem !important;
  font-size: 0.875rem !important;
  font-weight: 650 !important;
  border-radius: 10px !important;
  background: #2563eb !important;
  border-color: #2563eb !important;
  color: #fff !important;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset, 0 6px 16px rgba(37, 99, 235, 0.28);
}

.maintenance-page__cta:hover {
  background: #1d4ed8 !important;
  border-color: #1d4ed8 !important;
}

.maintenance-page > .tabs {
  margin-bottom: 0.65rem;
  gap: 0.15rem;
  border-bottom: 1px solid #2a3544 !important;
  flex: 0 0 auto;
  flex-wrap: wrap;
  position: sticky;
  top: var(--topbar-height, 40px);
  z-index: 45;
  background: #0f1419;
  padding-top: 0.15rem;
  max-width: 100%;
}

.maintenance-page > .tabs .tab-button {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  border-radius: 8px 8px 0 0;
  flex: 0 1 auto;
  max-width: 100%;
}

/* Onglet signalements : filtres + liste — hauteur fluide (zoom-safe) */
.maintenance-page #tab-signalements.tab-content.active {
  display: flex !important;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  max-height: none;
  height: auto;
}

/* Barre filtres — wrap fluide (résiste au zoom navigateur) */
.maintenance-page .maint-sig-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.55rem;
  padding: 0.5rem 0.6rem;
  background: #151b24;
  border: 1px solid #2a3544;
  border-radius: 12px;
  overflow-x: visible;
  flex: 0 0 auto;
  position: sticky;
  top: calc(var(--topbar-height, 40px) + 2.6rem);
  z-index: 50;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  max-width: 100%;
  box-sizing: border-box;
}

.maintenance-page .maint-sig-bar__search {
  position: relative;
  flex: 1 1 12rem;
  min-width: min(100%, 9rem);
  max-width: 100%;
}

.maintenance-page .maint-sig-bar__search-icon {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-size: 0.95rem;
  pointer-events: none;
  line-height: 1;
}

.maintenance-page .maint-sig-bar__search .form-control {
  width: 100%;
  min-height: 2.15rem !important;
  height: 2.15rem !important;
  border-radius: 9px !important;
  padding: 0.25rem 0.65rem 0.25rem 2rem !important;
  font-size: 0.82rem !important;
  margin: 0 !important;
  background: #0f1419 !important;
  border-color: #2a3544 !important;
}

.maintenance-page .maint-sig-bar__ctl {
  flex: 1 1 7rem;
  width: auto;
  min-width: min(100%, 6.5rem);
  max-width: 12rem;
  min-height: 2.15rem !important;
  height: 2.15rem !important;
  padding: 0.2rem 0.45rem !important;
  font-size: 0.78rem !important;
  margin: 0 !important;
  border-radius: 9px !important;
  background: #0f1419 !important;
  border-color: #2a3544 !important;
  box-sizing: border-box;
}

.maintenance-page .maint-sig-bar__date {
  flex: 1 1 7.5rem;
  min-width: min(100%, 7rem);
  max-width: 10rem;
}

.maintenance-page .maint-sig-bar__reset,
.maintenance-page .maint-sig-bar__actions .button {
  flex: 0 1 auto;
  min-height: 2.15rem !important;
  height: 2.15rem !important;
  padding: 0.25rem 0.7rem !important;
  font-size: 0.78rem !important;
  border-radius: 9px !important;
  white-space: nowrap;
}

.maintenance-page .maint-sig-bar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-left: auto;
  padding-left: 0.35rem;
  border-left: 1px solid #2a3544;
  max-width: 100%;
}

/* Demandes d'achat — barre actions + filtres sticky */
.maintenance-page #tab-demandes.tab-content.active {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  max-height: none;
  height: auto;
}

.maintenance-page #demandes-achat-list-container .demande-achat-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  max-width: 100%;
}

.maintenance-page #demandes-achat-list-container .demande-piece-row__qte {
  font-size: 0.85rem;
  margin-top: 0.25rem;
  color: #e2e8f0;
}

.maintenance-page .maint-da-toolbar {
  flex: 0 0 auto;
  position: sticky;
  top: calc(var(--topbar-height, 40px) + 2.6rem);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0 0 0.65rem;
  padding: 0.5rem 0.55rem;
  background: #151b24;
  border: 1px solid #2a3544;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.maintenance-page .maint-da-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.maintenance-page .maint-da-toolbar__actions .button {
  min-height: 2rem !important;
  height: 2rem !important;
  padding: 0.2rem 0.65rem !important;
  font-size: 0.75rem !important;
  border-radius: 8px !important;
  white-space: nowrap;
}

.maintenance-page .maint-da-filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.maintenance-page .maint-da-filters .form-control,
.maintenance-page .maint-da-filters .button {
  flex: 0 0 auto;
  min-height: 2rem !important;
  height: 2rem !important;
  margin: 0 !important;
  padding: 0.2rem 0.45rem !important;
  font-size: 0.75rem !important;
  border-radius: 8px !important;
}

.maintenance-page .maint-da-filters select.form-control {
  min-width: 7rem;
  max-width: 10rem;
}

.maintenance-page .maint-da-filters input[type="date"] {
  min-width: 7.25rem;
  max-width: 8.5rem;
}

.maintenance-page .maint-da-filters__search {
  flex: 1 1 10rem !important;
  min-width: 9rem !important;
  max-width: 16rem !important;
}

.maintenance-page #demandes-achat-list-container {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Liste signalements — tableau INT / Engin / Statut */
.maintenance-page .signalements-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  max-width: 100%;
  overflow-y: auto;
  overflow-x: clip;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

.maintenance-page .maint-sig-table {
  background: #12171f;
  border: 1px solid #2a3544;
  border-radius: 12px;
  overflow: visible;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

/* Les autres lignes restent toujours visibles (pas d’accordion) */
.maintenance-page .maint-sig-table__body > .maint-sig-row {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.maintenance-page .maint-sig-table__head,
.maintenance-page .maint-sig-row__main {
  --maint-sig-cols: minmax(0, 12rem) minmax(0, 1fr) max-content 1.5rem;
  display: grid;
  grid-template-columns: var(--maint-sig-cols);
  gap: 0.55rem 0.75rem;
  align-items: center;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.maintenance-page .maint-sig-table__head {
  padding: 0.35rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  border-bottom: 1px solid #2a3544;
  background: #121820;
  position: sticky;
  top: 0;
  z-index: 5;
}

.maintenance-page .maint-sig-table__h-statut,
.maintenance-page .maint-sig-row__statut {
  justify-self: end;
}

.maintenance-page .maint-sig-table__body {
  display: flex;
  flex-direction: column;
}

.maintenance-page .signalement-card.maintenance-compact-card.maint-sig-row {
  background: transparent;
  border: none;
  border-bottom: 1px solid #1e2733;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
  transition: background 0.12s;
}

.maintenance-page .signalement-card.maintenance-compact-card.maint-sig-row:last-child {
  border-bottom: none;
}

.maintenance-page .signalement-card.maintenance-compact-card.maint-sig-row:hover {
  background: rgba(59, 130, 246, 0.06);
  border-color: #1e2733;
  box-shadow: none;
}

.maintenance-page .maint-sig-row.is-expanded {
  background: rgba(59, 130, 246, 0.08);
}

.maintenance-page .maint-sig-row.is-expanded .maint-sig-row__chevron {
  transform: rotate(90deg);
  color: #93c5fd;
}

.maintenance-page .maint-sig-row__main {
  padding: 0.35rem 0.75rem;
  min-height: 2.35rem;
  scroll-margin-top: 5.5rem;
}

.maintenance-page .maint-sig-row__int {
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.maintenance-page .maint-sig-row__engin {
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.45rem;
}

.maintenance-page .maint-sig-row__engin-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.maintenance-page .maint-sig-row__site {
  font-size: 0.7rem;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maintenance-page .maint-sig-row__site::before {
  content: '·';
  margin-right: 0.35rem;
  color: #475569;
}

.maintenance-page .maint-sig-row__statut {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.maintenance-page .maint-sig-row__statut .badge,
.maintenance-page .maint-sig-status {
  font-size: 0.7rem !important;
  padding: 0.15rem 0.45rem !important;
  line-height: 1.2 !important;
}

.maintenance-page .maint-sig-row__chevron {
  text-align: center;
  font-size: 1rem;
  font-weight: 300;
  color: #64748b;
  line-height: 1;
}

.maintenance-page .maint-sig-row:hover .maint-sig-row__chevron {
  color: #93c5fd;
}

.maintenance-page .maint-sig-row .signalement-body,
.maintenance-page .maint-sig-row .signalement-actions {
  padding: 0 0.75rem 0.55rem;
}

.maintenance-page .maint-sig-detail-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin: 0 0 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid #1e2733;
}

.maintenance-page .maint-sig-detail-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
}

.maintenance-page .maint-sig-ids {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  flex: 1 1 auto;
  min-width: 0;
}

.maintenance-page .maint-sig-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  color: #cbd5e1;
  background: #121820;
  border: 1px solid #334155;
  white-space: nowrap;
}

.maintenance-page .maint-sig-chip strong {
  color: #f1f5f9;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.maintenance-page .maint-sig-meta {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  line-height: 1.3;
}

.maintenance-page .maint-sig-desc {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
  line-height: 1.4;
  color: #e2e8f0;
  max-width: 72rem;
}

.maintenance-page .maint-sig-comp-ref {
  display: inline-block;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #5eead4;
  margin-right: 0.25rem;
}

.maintenance-page .maint-sig-comp-name {
  color: #e8eef6;
}

.maintenance-page .maint-sig-comps {
  margin: 0.2rem 0 0.15rem;
  font-size: 0.84rem;
  color: #e8eef6;
}

.maintenance-page .maint-sig-comps > strong {
  display: inline;
  margin-right: 0.4rem;
  color: #94a3b8;
  font-size: 0.75rem;
  font-weight: 650;
}

.maintenance-page .maint-sig-comp-list {
  margin: 0.2rem 0 0;
  padding: 0 0 0 1rem;
  list-style: disc;
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 1.25rem;
}

.maintenance-page .maint-sig-comp-list li {
  margin: 0;
  padding: 0;
  color: #e8eef6;
  font-size: 0.82rem;
  line-height: 1.3;
}

.maintenance-page .maint-sig-row .signalement-body {
  margin: 0;
}

.maintenance-page .maint-sig-row .signalement-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-top: 0.15rem;
}

.maintenance-page .maintenance-compact-card .signalement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.maintenance-page .maintenance-compact-card .badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}

.maintenance-page .maintenance-compact-card .badge,
.maintenance-page .maint-sig-status {
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.maintenance-page .maintenance-compact-card .badge.neutral,
.maintenance-page .maint-sig-status.badge.neutral {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.maintenance-page .maintenance-compact-card .badge.info,
.maintenance-page .maint-sig-status.badge.info {
  background: rgba(59, 130, 246, 0.22);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.maintenance-page .maintenance-compact-card .badge.warning,
.maintenance-page .maint-sig-status.badge.warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.maintenance-page .maintenance-compact-card .badge.success,
.maintenance-page .maint-sig-status.badge.success {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.maintenance-page .maintenance-compact-card .badge.error,
.maintenance-page .maint-sig-status.badge.error {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Zoom / largeurs moyennes : grille plus compacte */
@media (max-width: 1100px) {
  .maintenance-page .maint-sig-table__head,
  .maintenance-page .maint-sig-row__main {
    --maint-sig-cols: minmax(0, 10.5rem) minmax(0, 1fr) max-content 1.35rem;
    gap: 0.4rem 0.55rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
  .maintenance-page .maint-sig-bar__actions {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    width: 100%;
  }
}

@media (max-width: 900px) {
  .maintenance-page .maint-sig-table__head {
    display: none;
  }
  .maintenance-page .maint-sig-row__main {
    --maint-sig-cols: minmax(0, 1fr) max-content 1.35rem;
  }
  .maintenance-page .maint-sig-row__int {
    grid-column: 1;
    grid-row: 1;
  }
  .maintenance-page .maint-sig-row__engin {
    grid-column: 1;
    grid-row: 2;
  }
  .maintenance-page .maint-sig-row__statut {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    justify-self: end;
  }
  .maintenance-page .maint-sig-row__chevron {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .maintenance-page .maint-sig-bar__ctl,
  .maintenance-page .maint-sig-bar__date {
    flex: 1 1 calc(50% - 0.4rem);
    max-width: none;
  }
  .maintenance-page .maint-sig-bar__search {
    flex: 1 1 100%;
  }
}

@media (max-width: 640px) {
  .maintenance-page .maint-sig-table__head {
    display: none;
  }
  .maintenance-page .maint-sig-row__main {
    --maint-sig-cols: minmax(0, 1fr) 1.25rem;
    gap: 0.2rem 0.5rem;
  }
  .maintenance-page .maint-sig-row__int,
  .maintenance-page .maint-sig-row__engin,
  .maintenance-page .maint-sig-row__statut {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }
  .maintenance-page .maint-sig-row__chevron {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
  .maintenance-page .maint-sig-bar {
    top: calc(var(--topbar-height, 40px) + 3.1rem);
  }
  .maintenance-page .maint-sig-bar__actions .button,
  .maintenance-page .maint-sig-bar__reset {
    flex: 1 1 auto;
  }
  .maintenance-page__head {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .maintenance-page__cta {
    width: 100%;
    text-align: center;
  }
}

/* Conteneur fluide si supporté (zoom + redimensionnement) */
@supports (container-type: inline-size) {
  .maintenance-page #tab-signalements.tab-content.active {
    container-type: inline-size;
    container-name: maint-sig;
  }
  @container maint-sig (max-width: 720px) {
    .maintenance-page .maint-sig-bar__ctl,
    .maintenance-page .maint-sig-bar__date {
      flex: 1 1 calc(50% - 0.4rem);
      max-width: none;
    }
  }
}

/* Legacy class kept for safety if old markup cached */
.maintenance-page .maint-sig-toolbar {
  display: none;
}

.maintenance-page .maint-sig-filters.collapsed {
  display: none !important;
}

.panel-actions {
  display: flex;
  gap: 0.5rem;
}

.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 1.5rem;
}

.tab-button {
  padding: 0.75rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  color: #666;
  transition: all 0.2s;
}

.tab-button:hover {
  color: #0b4a63;
}

.tab-button.active {
  color: #0b4a63;
  border-bottom-color: #0b4a63;
}

.settings-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.tab-btn {
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #666;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s;
  position: relative;
  z-index: 2;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.tab-btn:hover {
  color: #0b4a63;
  background: rgba(11, 74, 99, 0.05);
}

.tab-btn:active {
  transform: translateY(1px);
}

.tab-btn.active {
  color: #0b4a63;
  border-bottom-color: #0b4a63;
  background: rgba(11, 74, 99, 0.05);
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ========== MODAL POPUP ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9600;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.modal[style*="display: flex"],
.modal.show {
  display: flex !important;
}

.modal-content {
  background: #151b24;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalFadeIn 0.2s ease-out;
}

.modal-content.modal-large {
  max-width: 900px;
}

/* Styles pour le modal de détails d'engin */
.engin-details-modal-content {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.engin-details-body {
  padding: 0 !important;
  overflow-y: auto;
  flex: 1;
  max-height: calc(90vh - 70px);
}

/* Sections de détails */
.details-section {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.details-section:last-of-type {
  border-bottom: none;
}

.details-section h4 {
  margin: 0 0 1.25rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e5e7eb;
}

.details-section h4::before {
  content: '';
  width: 4px;
  height: 1.1rem;
  background: #4b7bec;
  border-radius: 2px;
}

/* Grille de détails */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.25rem;
}

/* Item de détail */
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.875rem;
  background: #1a222d;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  transition: all 0.2s ease;
}

.detail-item:hover {
  background: #1a222d;
  border-color: #d1d5db;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 1rem;
  font-weight: 500;
  color: #111827;
  word-break: break-word;
}

.detail-value strong {
  font-weight: 600;
  color: #1f2937;
}

/* Section description */
.details-section .details-description {
  padding: 1.25rem;
  background: #1a222d;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  white-space: pre-wrap;
  color: #374151;
  line-height: 1.7;
  font-size: 0.95rem;
}

/* Section pièces associées */
.pieces-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.piece-card {
  background: #151b24;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.piece-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
  border-color: #d1d5db;
}

.piece-card-header {
  padding: 1rem 1.25rem;
  background: #1a222d;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.piece-card-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #111827;
  border: none;
  padding: 0;
}

.piece-card-header h4::before {
  display: none;
}

.piece-classification {
  font-size: 0.75rem;
  padding: 0.25rem 0.625rem;
  background: #4b7bec;
  color: white;
  border-radius: 12px;
  font-weight: 500;
}

.piece-card-body {
  padding: 1.25rem;
}

.piece-card-body p {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.piece-card-body p:last-child {
  margin-bottom: 0;
}

.piece-card-body strong {
  color: #374151;
  font-weight: 600;
  display: inline-block;
  min-width: 100px;
}

/* Galerie d'images des pièces */
.piece-images-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.piece-images-section strong {
  display: block;
  margin-bottom: 0.75rem;
  color: #374151;
  font-size: 0.9rem;
}

.piece-images-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.75rem;
}

.piece-image-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid #e5e7eb;
  transition: all 0.2s ease;
}

.piece-image-item:hover {
  border-color: #4b7bec;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.piece-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Actions dans le modal de détails */
.engin-details-body .modal-actions {
  margin-top: 0;
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  background: #1a222d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  border-radius: 0 0 12px 12px;
  flex-wrap: wrap;
}

.modal-actions-left {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}

.modal-actions-right {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

/* Boutons d'export */
.btn-export {
  padding: 0.625rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
}

.btn-export-pdf {
  background: #dc2626;
}

.btn-export-pdf:hover {
  background: #b91c1c;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(220, 38, 38, 0.3);
}

.btn-export-excel {
  background: #16a34a;
}

.btn-export-excel:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(22, 163, 74, 0.3);
}

/* Amélioration des boutons d'export sur mobile */
@media (max-width: 768px) {
  /* Panel head avec boutons d'export */
  .panel-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .panel-head > div:last-child {
    order: 2;
    width: 100%;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: flex-start;
  }

  /* Dashboard header avec boutons d'export */
  .dashboard-header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    width: 100%;
    margin-top: 0.75rem;
  }

  /* Boutons d'export compacts sur mobile */
  button[id*="export"],
  .btn-export {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.8125rem !important;
    min-width: auto !important;
    flex: 0 0 auto !important;
    white-space: nowrap;
  }

  /* Container des actions dans les headers */
  .panel-head > div[style*="display: flex"] {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
  }
}

/* Très petits écrans - boutons icon-only */
@media (max-width: 480px) {
  button[id*="export"] span:not(:first-child),
  .btn-export span:not(:first-child) {
    display: none !important;
  }

  button[id*="export"],
  .btn-export {
    padding: 0.625rem !important;
    min-width: 44px !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0;
  }

  button[id*="export"] span:first-child,
  .btn-export span:first-child {
    font-size: 1.125rem !important;
    margin: 0 !important;
  }

  /* Dashboard header actions sur très petits écrans */
  .dashboard-header-actions {
    justify-content: space-between;
    gap: 0.5rem;
  }

  .dashboard-header-actions button:not([id*="export"]) {
    flex: 1;
    min-width: 0;
  }
}

/* Actions des pièces */
.piece-actions {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
}

.btn-sm {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

/* Page de détails d'engin — contenu fixé, scroll uniquement dans le volet */
.app-content-column:has(#app-main .engin-details-page) {
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

#app-main:has(.engin-details-page),
#app-main:has(.sig-details-page) {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  overflow: hidden !important;
  padding: 0 !important;
  gap: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}

.app-content-column:has(#app-main .sig-details-page) {
  height: 100vh;
  max-height: 100dvh;
  overflow: hidden;
}

#app-main:has(.sig-details-page) > .sig-details-page {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

#app-main:has(.engin-details-page) > .engin-details-page {
  flex: 1 1 auto;
  min-height: 0;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.engin-details-page {
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 768px) {
  .app-content-column:has(#app-main .engin-details-page) {
    height: 100dvh;
    max-height: 100dvh;
  }

  #app-main .panel.engin-details-page,
  #app-main .panel.engin-details-page.mobile-workflow-page {
    padding: 0 !important;
    margin: 0 !important;
  }
}

.engin-details-page > .page-header,
.engin-details-page > .ed-page-header {
  flex: 0 0 auto;
  padding: 0.75rem 1.25rem;
  gap: 0.75rem;
  border-bottom: 1px solid #2a3544;
  background: #121821;
}

.engin-details-page .page-header-left {
  gap: 0.35rem;
}

.engin-details-page .btn-back {
  font-size: 0.8rem;
  color: #94a3b8;
}

.engin-details-page .ed-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.engin-details-page .page-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #f1f5f9;
  line-height: 1.25;
}

.engin-details-page .ed-subtitle {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.15rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #94a3b8;
}

.engin-details-page .ed-sub-ref {
  font-weight: 600;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.engin-details-page .ed-sub-dot {
  margin: 0 0.35rem;
  color: #475569;
  user-select: none;
}

.engin-details-page .ed-subtitle .badge {
  margin-left: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
}

.engin-details-page .page-header-actions .btn-export {
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 6px;
}

.engin-details-page-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0 !important;
  background: #0f141b;
}

/* Shell volets détail engin — lecture calme */
.ed-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.ed-tabs {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0 1.25rem;
  border-bottom: 1px solid #2a3544;
  background: #121821;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ed-tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.55rem;
  padding: 0.55rem 0.15rem;
  margin-right: 1.35rem;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}

.ed-tab:hover {
  color: #e2e8f0;
}

.ed-tab.is-active {
  color: #f8fafc;
  border-bottom-color: #3b82f6;
  background: transparent;
}

.ed-tab-count {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ed-tab.is-active .ed-tab-count {
  color: #94a3b8;
}

.ed-panes {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.ed-pane {
  height: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 1.1rem 1.25rem 1.75rem;
}

.ed-pane[hidden] {
  display: none !important;
}

.ed-fiche {
  max-width: 52rem;
}

.ed-group {
  margin: 0 0 1.5rem;
}

.ed-group:last-child {
  margin-bottom: 0;
}

.ed-group__title {
  margin: 0 0 0.65rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #1e293b;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.ed-dl {
  display: grid;
  grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr);
  column-gap: 1.25rem;
  row-gap: 0.55rem;
  margin: 0;
}

.ed-dl dt {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: #64748b;
  line-height: 1.45;
}

.ed-dl dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: #e2e8f0;
  line-height: 1.45;
  word-break: break-word;
}

.ed-desc-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.ed-text-link {
  font-size: 0.82rem;
  font-weight: 550;
  color: #60a5fa;
  text-decoration: none;
}

.ed-text-link:hover {
  text-decoration: underline;
  color: #93c5fd;
}

.ed-pane-filter {
  flex: 1 1 12rem;
  min-width: 9rem;
  max-width: 20rem;
  height: 2.1rem !important;
  min-height: 2.1rem !important;
  padding: 0.25rem 0.65rem !important;
  font-size: 0.82rem !important;
  background: #121821 !important;
  border: 1px solid #334155 !important;
  border-radius: 6px !important;
  color: #e2e8f0 !important;
}

.ed-row-click {
  cursor: pointer;
}

.ed-row-click:hover {
  background: rgba(59, 130, 246, 0.06);
}

.ed-col-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
  color: #94a3b8;
}

.ed-compact-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #121821;
  box-shadow: 0 1px 0 #1e293b;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.ed-photos-manage {
  max-width: 52rem;
}

.ed-photos-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #1e293b;
}

.ed-btn {
  min-height: 2.1rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #121821;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.ed-btn:hover {
  border-color: #475569;
  color: #f8fafc;
}

.ed-btn--soft {
  background: transparent;
}

.ed-btn--primary {
  background: #1d4ed8;
  border-color: #2563eb;
  color: #fff;
  margin-left: auto;
}

.ed-btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ed-photo-hint {
  font-size: 0.78rem;
  color: #64748b;
}

.ed-photo-preview {
  margin-bottom: 0.85rem;
}

.ed-photo-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.45rem;
}

.ed-photo-preview-item {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #121821;
}

.ed-photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ed-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}

.ed-photo-card-wrap {
  position: relative;
}

.ed-photo-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 0;
  border: 1px solid #1e293b;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #121821;
  text-align: left;
  color: inherit;
}

.ed-photo-card:hover {
  border-color: #3b82f6;
}

.ed-photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #0f141b;
}

.ed-photo-cap {
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ed-photo-del {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.92);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 640px) {
  .ed-btn--primary {
    margin-left: 0;
    width: 100%;
  }
}

.ed-pane-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.75rem;
}

.ed-pane-toolbar > strong {
  font-size: 0.82rem;
  font-weight: 650;
  color: #e2e8f0;
}

.ed-pane-toolbar .muted {
  margin-left: auto;
  font-size: 0.75rem;
  color: #64748b;
}

.ed-table-wrap {
  max-width: 100%;
}

.ed-compact-table {
  width: 100%;
  font-size: 0.84rem;
}

.ed-compact-table th,
.ed-compact-table td {
  padding: 0.5rem 0.55rem !important;
  vertical-align: top;
  border-color: #1e293b !important;
}

.ed-row-actions {
  white-space: nowrap;
  width: 1%;
}

.ed-empty {
  padding: 2rem 0.5rem;
  text-align: center;
  color: #64748b;
}

.ed-hist-block + .ed-hist-block {
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid #1e293b;
}

@media (max-width: 640px) {
  .ed-dl {
    grid-template-columns: 1fr;
    row-gap: 0.15rem;
  }

  .ed-dl dt {
    margin-top: 0.45rem;
  }

  .ed-dl dt:first-child {
    margin-top: 0;
  }

  .ed-pane {
    padding: 0.9rem 1rem 1.5rem;
  }

  .ed-tabs {
    padding: 0 1rem;
  }

  .ed-tab {
    margin-right: 1rem;
    font-size: 0.84rem;
  }
}

/* Page photos engins — layout calme */
.ei-page {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height, 40px) - 0.5rem);
  max-height: calc(100dvh - var(--topbar-height, 40px) - 0.5rem);
  min-height: 0;
  overflow: hidden;
}

.ei-page > .ei-page-header {
  flex: 0 0 auto;
  padding: 0.75rem 1.25rem;
  gap: 0.75rem;
  border-bottom: 1px solid #2a3544;
  background: #121821;
}

.ei-page .page-header-left {
  gap: 0.35rem;
}

.ei-page .btn-back {
  font-size: 0.8rem;
  color: #94a3b8;
}

.ei-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.ei-page .ei-page-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: #f1f5f9;
  line-height: 1.25;
}

.ei-subtitle {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #94a3b8;
}

.ei-sub-ref {
  font-weight: 600;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.ei-sub-dot {
  margin: 0 0.35rem;
  color: #475569;
  user-select: none;
}

.ei-page-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 !important;
  background: #0f141b;
}

.ei-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 1.75rem;
}

.ei-toolbar {
  flex: 0 0 auto;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #1e293b;
}

.ei-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.ei-btn {
  min-height: 2.1rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid #334155;
  border-radius: 6px;
  background: #121821;
  color: #e2e8f0;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.ei-btn:hover {
  border-color: #475569;
  color: #f8fafc;
}

.ei-btn--soft {
  background: transparent;
}

.ei-btn--primary {
  background: #1d4ed8;
  border-color: #2563eb;
  color: #fff;
  margin-left: auto;
}

.ei-btn--primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ei-file-hint {
  font-size: 0.78rem;
  color: #64748b;
}

.ei-text-link {
  font-size: 0.85rem;
  font-weight: 550;
  color: #60a5fa;
  text-decoration: none;
}

.ei-text-link:hover {
  text-decoration: underline;
}

.ei-preview {
  margin-bottom: 0.85rem;
}

.ei-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.45rem;
}

.ei-preview-item {
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #121821;
}

.ei-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ei-main {
  flex: 1 1 auto;
  min-height: 0;
}

.ei-viewer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  max-height: min(52vh, 520px);
  padding: 0.75rem;
  border: 1px solid #1e293b;
  border-radius: 8px;
  background: #121821;
}

.ei-viewer--empty {
  min-height: 200px;
}

.ei-viewer-img {
  max-width: 100%;
  max-height: min(48vh, 480px);
  object-fit: contain;
  display: block;
}

.ei-nav {
  position: absolute;
  top: 50%;
  left: 0.5rem;
  transform: translateY(-50%);
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  border-radius: 50%;
  background: rgba(15, 20, 27, 0.72);
  color: #e2e8f0;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.ei-nav--next {
  left: auto;
  right: 0.5rem;
}

.ei-nav:hover {
  background: rgba(59, 130, 246, 0.55);
}

.ei-counter {
  margin: 0.55rem 0 0.65rem;
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}

.ei-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ei-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid #1e293b;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  background: #121821;
}

.ei-thumb.is-active {
  border-color: #3b82f6;
}

.ei-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ei-thumb-del {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 1.25rem;
  height: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(185, 28, 28, 0.92);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
}

.ei-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: #94a3b8;
}

@media (max-width: 640px) {
  .ei-shell {
    padding: 0.85rem 0.9rem 1.4rem;
  }

  .ei-btn--primary {
    margin-left: 0;
    width: 100%;
  }

  .ei-viewer {
    min-height: 220px;
    max-height: 42vh;
  }
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #151b24;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-width: 200px;
}

/* Styles pour page-details-header (composant_view, composant_images) */
.page-details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #151b24;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-details-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s ease;
  white-space: nowrap;
}

.btn-back:hover {
  color: #111827;
}

.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: #111827;
}

.page-header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.engin-details-page-content:not(:has(.ed-shell)) {
  padding: 1.5rem;
  background: #1a222d;
  min-height: 400px;
}

.loading-state,
.error-state {
  padding: 3rem;
  text-align: center;
  color: #6b7280;
}

.error-state {
  color: #dc2626;
}

@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .page-header-left {
    min-width: 0;
  }
  
  .page-header-actions {
    width: 100%;
  }
  
  .page-header-actions button {
    flex: 1;
  }
  
  .engin-details-page-content {
    padding: 1rem;
  }
  
  /* Styles responsive pour page-details-header */
  .page-details-header {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }
  
  .page-details-header-left {
    min-width: 0;
    width: 100%;
  }
  
  .page-details-header h2 {
    font-size: 1.25rem;
  }
  
  /* Responsive pour les détails */
  .details-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .pieces-list {
    grid-template-columns: 1fr;
  }
  
  .engin-details-body {
    max-height: calc(95vh - 70px);
  }
  
  .details-section {
    padding: 1rem;
  }
  
  .engin-details-body .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .modal-actions-left,
  .modal-actions-right {
    width: 100%;
    margin-left: 0;
  }
  
  .modal-actions-left {
    margin-bottom: 0.75rem;
  }
  
  .modal-actions-left .btn-export {
    flex: 1;
    justify-content: center;
  }
  
  .modal-actions-right {
    flex-direction: column;
  }
  
  .modal-actions-right button {
    width: 100%;
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  background: #1a222d;
  border-radius: 12px 12px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.75rem;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #e5e7eb;
  color: #111827;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-content form {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 0.95rem;
}

.form-group .required {
  color: #dc2626;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #4b7bec;
  box-shadow: 0 0 0 3px rgba(75, 123, 236, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}

.form-actions .button {
  padding: 0.65rem 1.5rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s;
}

.form-actions .button.primary {
  background: #1b6ef3;
  color: #fff;
  border: none;
}

.form-actions .button.primary:hover {
  background: #1557d0;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(27, 110, 243, 0.3);
}

.form-actions .button.secondary {
  background: #1a222d;
  color: #374151;
  border: 1px solid #d1d5db;
}

.form-actions .button.secondary:hover {
  background: #e5e7eb;
}

/* Styles pour la listbox de sélection d'engin */
select[size] {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.5rem;
  background: #151b24;
  font-size: 0.9rem;
  overflow-y: auto;
  width: 100%;
  min-height: 140px;
  max-height: 200px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

select[size]:focus {
  outline: none;
  border-color: #4b7bec;
  box-shadow: 0 0 0 3px rgba(75, 123, 236, 0.1), inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

select[size]:disabled {
  background: #1a222d;
  color: #9ca3af;
  cursor: not-allowed;
}

select[size] option {
  padding: 0.6rem 0.75rem;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}

select[size] option:last-child {
  border-bottom: none;
}

select[size] option:hover {
  background: #f0f4f8;
}

select[size] option:checked,
select[size] option:focus {
  background: #0b4a63;
  color: #fff;
}

select[size] option:disabled {
  color: #9ca3af;
  font-style: italic;
  cursor: not-allowed;
}

.settings-menu {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.settings-section-label {
  grid-column: 1 / -1;
  margin: 0.85rem 0 0.15rem;
  padding: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}
.settings-section-label:first-child {
  margin-top: 0;
}

.settings-menu-item--accent {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 191, 0.12);
}

.settings-menu-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
  background: #151b24;
  min-height: 0;
}

.settings-menu-item:hover {
  border-color: #0b4a63;
  background: #f9fbff;
  transform: none;
  box-shadow: none;
}

.settings-menu-icon {
  font-size: 1.25rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f4f8;
  border-radius: 7px;
  flex-shrink: 0;
}

.settings-menu-item h3 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.25;
  color: #1f2937;
}

.settings-menu-item .muted {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filters select {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

/* Composants de signalement */
.composants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}

.composant-card {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 1rem;
  transition: all 0.2s;
}

.composant-card:hover {
  border-color: #0b4a63;
  box-shadow: 0 2px 8px rgba(11, 74, 99, 0.1);
}

.composant-checkbox {
  display: flex;
  align-items: flex-start;
  cursor: pointer;
}

.composant-checkbox input[type="checkbox"] {
  margin-right: 0.75rem;
  margin-top: 0.25rem;
}

.composant-info {
  flex: 1;
}

.composant-selected-card {
  border: 2px solid #0b4a63;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background: #1a222d;
}

.composant-selected-card h4 {
  margin: 0 0 1rem 0;
  color: #0b4a63;
}

.form-step {
  margin-bottom: 2rem;
}

.form-step h3 {
  margin-bottom: 1.5rem;
  color: #0b4a63;
}

.engin-info {
  background: #1a222d;
  padding: 1rem;
  border-radius: 4px;
  margin-top: 0.5rem;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e0e0e0;
}

.required {
  color: #dc2626;
}

/* Cards de signalement/historique/demande */
.signalement-card,
.historique-card,
.demande-card {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: #151b24;
}

.signalement-header,
.historique-header,
.demande-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.signalement-body,
.historique-body,
.demande-body {
  margin-bottom: 1rem;
}

.signalement-actions,
.demande-actions {
  display: flex;
  gap: 0.5rem;
}

.badges {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 500;
}

.badge.success {
  background: #d4edda;
  color: #155724;
}

.badge.warning {
  background: #fff3cd;
  color: #856404;
}

.badge.error {
  background: #f8d7da;
  color: #721c24;
}

.badge.info {
  background: #d1ecf1;
  color: #0c5460;
}

.badge:not(.success):not(.warning):not(.error):not(.info) {
  background: #e9ecef;
  color: #495057;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST
   ============================================ */

/* Empêcher le scroll horizontal sur TOUS les écrans */
* {
  max-width: 100%;
  box-sizing: border-box;
}

img, video, iframe, embed, object {
  max-width: 100%;
  height: auto;
}

/* Mobile: jusqu'à 768px */
@media (max-width: 768px) {

  /* Cacher l'ancien header et la sidebar */
  .app-bar {
    display: none !important;
  }
  
  .sidebar {
    display: none !important;
  }
  
  /* Layout sur mobile - pas de margin-left car sidebar cachée */
  .layout {
    margin-left: 0 !important;
    width: 100% !important;
    padding-top: 70px !important; /* Espace pour le header mobile */
  }
  
  /* Afficher le header mobile */
  .app-bar-mobile {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--z-header);
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 0;
    border-bottom: 2px solid rgba(59, 166, 59, 0.3);
    height: 64px;
    align-items: center;
    justify-content: flex-start;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  .mobile-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    width: 100%;
    height: 100%;
  }
  
  .mobile-app-title {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
  }
  
  .mobile-app-name {
    font-size: 1rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-left: 0.5rem !important; /* Décalage vers la droite */
    margin-left: 0.25rem !important; /* Espacement supplémentaire */
  }
  
  /* Styles pour le hamburger menu sur mobile - positionné à gauche, compact */
  .app-bar-mobile .nav-toggle {
    display: flex !important;
    position: relative !important;
    left: 0 !important;
    top: 0 !important;
    visibility: visible !important;
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0.5rem !important;
    opacity: 1 !important;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
  }
  
  .app-bar-mobile .nav-toggle span {
    display: block;
    width: 20px;
    height: 2.5px;
    background: #151b24;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
  }
  
  .app-bar-mobile .nav-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
  }
  
  .app-bar-mobile .nav-toggle[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
  }
  
  .app-bar-mobile .nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }
  
  .app-bar-mobile .nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }
  
  .app-bar-mobile .nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
  
  /* Layout principal sans marge sur mobile */
  .layout {
    margin-left: 0 !important;
    margin-top: 64px !important;
    width: 100% !important;
    padding-top: 1rem !important;
  }
  
  /* S'assurer que le menu slide-in ne soit pas bloqué et que les liens sont accessibles */
  .mobile-nav {
    width: 320px !important;
    max-width: 85vw !important;
    left: -320px !important;
    top: 0 !important;
    z-index: calc(var(--z-navbar) + 1) !important;
  }
  
  .mobile-nav.active {
    left: 0 !important;
  }
  
  .mobile-nav-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 1rem 1.25rem !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    background: rgba(0, 0, 0, 0.2) !important;
    flex-shrink: 0 !important;
  }
  
  .mobile-nav-links {
    padding: 0.75rem 0 !important;
  }
  
  .mobile-nav-links .nav-link {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.75rem 1.5rem !important;
    text-align: left !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
  
  .mobile-nav-links .nav-link .nav-icon {
    font-size: 1.1em !important;
    line-height: 1 !important;
    flex-shrink: 0 !important;
    min-width: 1.2em !important;
    text-align: center !important;
  }
  
  .mobile-nav-links .nav-link .nav-text {
    flex: 1 !important;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
  }

  .nav-links.active {
    max-height: 600px;
    opacity: 1;
    padding: 0.5rem 0;
  }
  
  .nav-links.active .nav-mobile-logout {
    display: block !important;
    opacity: 1;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    width: 100%;
    display: block;
    border-radius: 6px;
    margin-bottom: 0.25rem;
  }

  .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
  }

  .session {
    width: 100%;
    justify-content: space-between;
    order: 2;
    margin-top: 0.5rem;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
  }

  /* Cacher user et logout sur mobile dans la session, mais les afficher dans le menu */
  .session-user {
    display: none !important;
  }
  
  /* Sur desktop, afficher le bouton logout dans la session */
  @media (min-width: 769px) {
    .session-user {
      display: flex !important;
    }
  }

  /* Afficher logout dans le menu mobile - visible seulement quand menu actif */
  .nav-mobile-logout {
    display: none; /* Caché par défaut */
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
  }
  
  .nav-links.active .nav-mobile-logout {
    display: block !important;
  }
  
  /* Cacher logout mobile sur desktop - TOUJOURS caché sur desktop */
  @media (min-width: 769px) {
    .nav-mobile-logout,
    .nav-mobile-logout *,
    #logout-mobile-clone {
      display: none !important;
      visibility: hidden !important;
    }
  }
  
  /* Sur desktop, s'assurer que le bouton logout mobile n'est jamais visible */
  @media (min-width: 769px) {
    .nav-links .nav-mobile-logout,
    .nav-links.active .nav-mobile-logout {
      display: none !important;
    }
  }

  .nav-user-info {
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
    color: #ffffff;
  }

  .logout-link {
    width: 100%;
    text-align: left;
    background: rgba(220, 38, 38, 0.2) !important;
    border: 1px solid rgba(220, 38, 38, 0.4) !important;
    color: #ffffff !important;
  }

  .logout-link:hover {
    background: rgba(220, 38, 38, 0.3) !important;
    border-color: rgba(220, 38, 38, 0.6) !important;
  }

  .lang-switches {
    align-self: flex-end;
  }

  .app-title h1 {
    font-size: 0.95rem;
  }

  .app-title p {
    font-size: 0.75rem;
  }

  /* Layout principal */
  main.layout {
    padding: 0.75rem;
  }

  .panel {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .panel-head h2 {
    font-size: 1.25rem;
  }

  .panel-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  /* Grids */
  .grid {
    grid-template-columns: 1fr !important;
    gap: 1rem;
  }

  /* Tableaux */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    font-size: 0.85rem;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
    word-wrap: break-word;
  }

  th, td {
    padding: 0.4rem 0.3rem;
    word-wrap: break-word;
    max-width: 150px;
    overflow-wrap: break-word;
  }

  th, td {
    padding: 0.5rem 0.4rem;
    font-size: 0.85rem;
  }

  /* Formulaires */
  .form-group {
    margin-bottom: 1rem;
  }

  .form-group label {
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
  }

  input, select, textarea {
    font-size: 0.9rem;
    padding: 0.6rem;
  }

  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-actions button {
    width: 100%;
  }

  /* Boutons */
  button {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
  }

  button.small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
  }

  /* Filtres */
  .filters {
    flex-direction: column;
    gap: 0.75rem;
  }

  .filters select,
  .filters input {
    width: 100%;
    min-width: auto;
  }

  /* Cartes */
  .signalement-card,
  .historique-card,
  .demande-card {
    padding: 1rem;
  }

  .signalement-header,
  .historique-header,
  .demande-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .badges {
    width: 100%;
    justify-content: flex-start;
  }

  .signalement-actions,
  .demande-actions {
    width: 100%;
    flex-direction: column;
  }

  .signalement-actions button,
  .demande-actions button {
    width: 100%;
  }

  /* Modals */
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    margin: 1rem;
    max-height: 95vh;
    border-radius: 8px;
  }

  .modal-header {
    padding: 1rem;
    flex-wrap: wrap;
  }

  .modal-header h3 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 1rem;
    font-size: 0.9rem;
  }

  .modal-footer {
    padding: 0.75rem 1rem;
    flex-direction: column;
  }

  .modal-footer button {
    width: 100%;
  }

  /* Tabs */
  .tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .tab-button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    flex: 1;
    min-width: auto;
  }

  /* Composants spécifiques */
  .composant-image-card {
    width: 100%;
  }

  .composant-image-info {
    font-size: 0.8rem;
    padding: 0.5rem;
  }

  .composant-image-actions {
    flex-direction: column;
  }

  .composant-image-actions button {
    width: 100%;
  }

  /* Report sections dans les modals */
  .report-section {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .report-info-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Auth pages */
  .auth-box {
    padding: 1.5rem;
    max-width: 100%;
  }
}

/* Tablettes: 769px à 1024px */
@media (min-width: 769px) and (max-width: 1024px) {
  .app-bar {
    padding: 0.75rem 1rem;
  }

  .nav-links {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .nav-link {
    font-size: 0.85rem;
    padding: 0.5rem 0.6rem;
  }

  .nav-toggle {
    display: none;
  }

  .nav-links {
    max-height: none !important;
    opacity: 1 !important;
  }
}

/* Desktop: au-dessus de 768px - menu toujours visible */
@media (min-width: 769px) {
  .nav-toggle {
    display: none;
  }

  .nav-links {
    max-height: none !important;
    opacity: 1 !important;
    padding: 0 !important;
  }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .modal-content {
    max-width: 85% !important;
  }

  .panel {
    padding: 1.25rem;
  }
}

/* Très petits écrans: jusqu'à 480px */
@media (max-width: 480px) {
  .app-bar {
    padding: 0.5rem;
  }

  .app-logo {
    width: 32px;
    height: 32px;
  }

  .logo-mark {
    font-size: 0.75rem;
  }

  .app-title h1 {
    font-size: 0.85rem;
  }

  .app-title p {
    font-size: 0.7rem;
  }

  .panel {
    padding: 0.75rem;
  }

  .panel-head h2 {
    font-size: 1.1rem;
  }

  table {
    font-size: 0.75rem;
    width: 100%;
    max-width: 100%;
    table-layout: auto;
  }

  th, td {
    padding: 0.3rem 0.2rem;
    font-size: 0.75rem;
    max-width: 120px;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 0.75rem;
  }

  button {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
  }

  .badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
  }
}

/* Amélioration du viewport pour mobile */
@viewport {
  width: device-width;
  initial-scale: 1;
  maximum-scale: 5;
  user-scalable: yes;
}

/* Amélioration du touch sur mobile */
@media (hover: none) and (pointer: coarse) {
  button,
  .nav-link,
  .tab-button {
    min-height: 44px;
    min-width: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px; /* Évite le zoom automatique sur iOS */
  }
}

/* Styles inline dans les modals - responsive */
@media (max-width: 768px) {
  /* Override des styles inline dans maintenance.js */
  .report-info-grid[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Composants dans les modals */
  div[style*="grid-template-columns: repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  /* Grid avec image et contenu */
  div[style*="grid-template-columns: 150px 1fr"],
  div[style*="grid-template-columns: '150px 1fr'"] {
    grid-template-columns: 1fr !important;
  }

  /* Images dans les modals */
  img[style*="max-width: 100%"] {
    max-width: 100% !important;
    height: auto !important;
  }

  /* Sections de rapport */
  .report-section {
    padding: 1rem !important;
  }

  /* Headers de sections */
  h4[style*="font-size: 1.1rem"] {
    font-size: 1rem !important;
  }

  /* Grilles d'informations */
  div[style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Composant detail grid */
  .composant-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .composant-detail-grid img {
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 1rem;
  }

  /* Catalogue info grid */
  .composant-catalogue-info {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  /* Encore plus compact sur très petits écrans */
  .report-section {
    padding: 0.75rem !important;
  }

  h4[style*="font-size"] {
    font-size: 0.95rem !important;
  }

  div[style*="padding: 1.5rem"] {
    padding: 1rem !important;
  }

  div[style*="padding: 0.75rem"] {
    padding: 0.5rem !important;
  }
}

/* ===== RESPONSIVE POUR TOUS LES FORMULAIRES ===== */

/* Styles de base pour les formulaires */
.form-section {
  margin-bottom: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-weight: 500;
  color: #374151;
  font-size: 0.875rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9375rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  margin-top: 2rem;
}

.form-actions .button {
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Responsive pour les formulaires - TOUS les écrans */
.form-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

form {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Responsive pour les formulaires */
@media (max-width: 768px) {
  /* Toutes les grilles de formulaires passent en une colonne */
  .form-row {
    grid-template-columns: 1fr !important;
    gap: 0.75rem;
  }

  /* Grilles inline dans les formulaires */
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns: repeat(2, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  div[style*="grid-template-columns: 1fr 1fr 1fr"],
  div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* Grilles de sélection de type d'engin */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
}

/* Sur desktop, s'assurer que les formulaires ne débordent pas */
@media (min-width: 769px) {
  form[style*="max-width: 1200px"],
  form[style*="max-width: 900px"],
  form[style*="max-width: 800px"] {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .form-row {
    max-width: 100%;
    overflow-x: hidden;
  }
}

  /* Actions de formulaire en colonne sur mobile */
@media (max-width: 768px) {
  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .form-actions .button {
    width: 100%;
    justify-content: center;
  }

  /* Boutons d'action dans les formulaires */
  div[style*="display: flex"][style*="justify-content: flex-end"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  div[style*="display: flex"][style*="justify-content: flex-end"] button {
    width: 100% !important;
  }

  /* Sections de formulaire */
  .form-section {
    margin-bottom: 1.5rem;
  }

  .form-section h3 {
    font-size: 1.125rem;
    margin-bottom: 0.75rem;
  }

  /* Panels de formulaire */
  .panel-body {
    padding: 1rem !important;
  }

  /* Max-width des formulaires */
  form[style*="max-width: 1200px"],
  form[style*="max-width: 900px"],
  form[style*="max-width: 800px"] {
    max-width: 100% !important;
    padding: 0 0.5rem;
  }

  div[style*="max-width: 900px"],
  div[style*="max-width: 800px"] {
    max-width: 100% !important;
    padding: 0 0.5rem;
  }
}

@media (max-width: 480px) {
  /* Encore plus compact sur très petits écrans */
  .form-row {
    gap: 0.5rem;
  }

  .form-group {
    margin-bottom: 0.75rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.5rem;
    font-size: 16px; /* Évite le zoom automatique sur iOS */
  }

  /* Grilles de sélection de type d'engin en une colonne */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }

  /* Boutons de type d'engin */
  .engin-type-btn {
    padding: 1rem !important;
  }

  .engin-type-btn div:first-child {
    font-size: 1.5rem !important;
  }

  /* Headers de formulaire */
  .panel-head {
    padding: 1rem !important;
  }

  .panel-head h2 {
    font-size: 1.125rem !important;
  }

  /* Liens de retour */
  a[style*="margin-right: 1rem"] {
    display: block;
    margin-bottom: 0.5rem !important;
    margin-right: 0 !important;
  }
}

/* Responsive pour les filtres - TOUS les écrans */
.filters {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.filters select,
.filters input {
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .filters {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  .filters select,
  .filters input {
    width: 100%;
  }

  .filters button {
    width: 100%;
  }

  /* Filtres avec auto-fit */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(180px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
}

/* Sur desktop aussi, s'assurer que les filtres ne débordent pas */
@media (min-width: 769px) {
  .filters {
    max-width: 100%;
    overflow-x: hidden;
  }
  
  .filters select {
    min-width: 140px;
    max-width: 100%;
  }
}

/* Responsive pour les tables */
@media (max-width: 768px) {
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
    width: calc(100% + 2rem);
    max-width: calc(100vw - 2rem);
  }

  table {
    min-width: 600px;
    font-size: 0.875rem;
    width: 100%;
  }

  /* Responsive pour les pages Transport et Mouvements */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }
  
  /* Responsive pour les grilles dans mouvement_details */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(300px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
  
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Responsive pour les boutons d'export dans mouvement_details */
  .panel-head .panel-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  
  .panel-head .panel-actions button {
    width: 100%;
  }
  
  /* Responsive pour les cartes dans mouvement_details */
  div[style*="display: flex; justify-content: space-between"] {
    flex-direction: column !important;
    align-items: flex-start !important;
  }
  
  div[style*="text-align: right"] {
    text-align: left !important;
    margin-top: 1rem;
  }
  
  /* Responsive pour les filtres dans transport */
  div[style*="display: flex; flex-wrap: wrap"] {
    flex-direction: column !important;
  }
  
  div[style*="flex: 1; min-width: 200px"] {
    min-width: 100% !important;
    width: 100% !important;
  }
  
  /* Responsive pour les onglets */
  .tabs {
    flex-wrap: wrap;
  }
  
  .tab-button {
    flex: 1;
    min-width: calc(50% - 0.5rem);
  }
  
  /* Responsive pour les formulaires */
  .form-row[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Responsive pour les boutons d'action dans les tableaux */
  .button.small {
    font-size: 0.75rem;
    padding: 0.4rem 0.6rem;
  }
  
  /* Responsive pour les liens de retour */
  a[style*="margin-right: 1rem"] {
    display: block;
    margin-bottom: 0.5rem !important;
    margin-right: 0 !important;
  }
  
  /* Responsive pour les panels */
  .panel-body[style*="max-width"] {
    max-width: 100% !important;
    padding: 1rem !important;
  }
  
  /* Responsive pour les en-têtes de page */
  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .panel-head h2 {
    font-size: 1.25rem;
  }
  
  /* Responsive pour les cartes d'information */
  div[style*="background: #1a222d"] {
    padding: 1rem !important;
  }
  
  /* Responsive pour les grilles de statistiques */
  div[style*="display: grid"][style*="grid-template-columns: repeat(auto-fit"] {
    grid-template-columns: 1fr !important;
  }

  th, td {
    padding: 0.5rem 0.375rem;
    white-space: nowrap;
    max-width: none;
  }

  /* Tables avec beaucoup de colonnes - afficher en mode carte sur mobile */
  .table-responsive.table-responsive-cards {
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
  }
  .table-responsive-cards {
    display: block;
  }
  .table-responsive-cards table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
  }
  .table-responsive-cards thead {
    display: none;
  }

  .table-responsive-cards tbody,
  .table-responsive-cards tr,
  .table-responsive-cards td {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .table-responsive-cards tr {
    margin-bottom: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    background: #151b24;
    max-width: 100%;
    box-sizing: border-box;
  }

  .table-responsive-cards td {
    border: none;
    padding: 0.5rem 0;
    text-align: left !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.15rem !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .table-responsive-cards td:before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: #6b7280;
    display: block !important;
    min-width: 0 !important;
  }

  .table-responsive-cards td > * {
    max-width: 100% !important;
    min-width: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .table-responsive-cards td[data-label=""]:before {
    content: none;
    display: none;
  }

  /* Bouton action (Voir) contenu dans la carte, pas de débordement */
  .table-responsive-cards td[data-label=""] {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .table-responsive-cards td[data-label=""] .button {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .table-responsive-cards tr td:first-child {
    font-size: 1.05rem;
    padding-top: 0;
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
  }
}

/* Responsive pour les onglets */
@media (max-width: 768px) {
  .tabs {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .tab-button {
    flex: 1;
    min-width: 0;
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }
}

/* Plans d'action - liste des signalements scrollable */
.signalements-list-scroll {
  scrollbar-width: thin;
  scrollbar-color: #94a3b8 #f1f5f9;
}
.signalements-list-scroll::-webkit-scrollbar {
  width: 8px;
}
.signalements-list-scroll::-webkit-scrollbar-track {
  background: #1a222d;
  border-radius: 4px;
}
.signalements-list-scroll::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 4px;
}
.signalements-list-scroll::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Responsive pour les listes de signalements et autres */
@media (max-width: 768px) {
  .signalements-list,
  .historique-list,
  .demandes-list {
    padding: 0.5rem;
  }

  /* Cards dans les listes */
  .signalement-card,
  .historique-card,
  .demande-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  /* Actions dans les cards */
  .card-actions {
    flex-direction: column;
    gap: 0.5rem;
  }

  .card-actions button {
    width: 100%;
  }
}

/* Responsive pour les modals de formulaire - TOUS les écrans */
.modal-content {
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}

.modal-body {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .modal-content {
    max-width: 100% !important;
    margin: 0;
    border-radius: 0;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .modal-body form {
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
}

/* Sur desktop aussi */
@media (min-width: 769px) {
  .modal-content {
    max-width: 90vw;
    max-width: min(90vw, 1200px);
    overflow-x: hidden;
  }
}

/* Styles pour la page de gestion des images de composants */
.composant-images-page-content {
  width: 100%;
}

.composant-images-page-content .image-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3) !important;
  border-color: rgba(255, 255, 255, 0.5) !important;
}

.composant-images-page-content .image-nav-btn:disabled {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}

.composant-images-page-content .thumbnail-image:hover {
  border-color: rgba(59, 130, 246, 0.5) !important;
  transform: scale(1.05);
}

.composant-images-page-content .thumbnail-image.active {
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Responsive pour la page composant_images */
@media (max-width: 1200px) {
  .composant-images-page-content > div > div[style*="grid-template-columns: 1fr 400px"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 1024px) {
  .composant-images-page-content .view-images-section {
    margin-bottom: 1.5rem;
  }
  
  .composant-images-page-content #view-main-image-page {
    max-height: 400px !important;
  }
  
  .composant-images-page-content div[style*="min-height: 500px"] {
    min-height: 400px !important;
  }
}

@media (max-width: 768px) {
  .composant-images-page-content #view-main-image-page {
    max-height: 300px !important;
  }
  
  .composant-images-page-content div[style*="min-height: 500px"],
  .composant-images-page-content div[style*="min-height: 400px"] {
    min-height: 300px !important;
  }
  
  .composant-images-page-content .image-nav-btn {
    width: 40px !important;
    height: 40px !important;
    font-size: 1.5rem !important;
  }
  
  .composant-images-page-content .thumbnail-image {
    width: 60px !important;
    height: 60px !important;
  }
}

/* Modal plein écran pour les photos avec zoom / pan — au-dessus de toute la nav */
.images-zoom-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.96);
  display: none;
  justify-content: stretch;
  align-items: stretch;
  z-index: 60000 !important;
}
.images-zoom-modal.is-open {
  display: flex !important;
}
/* Masquer chrome app pendant le plein écran */
html.images-zoom-open .sidebar,
html.images-zoom-open .app-topbar,
html.images-zoom-open #app-topbar,
html.images-zoom-open .app-bar-mobile,
html.images-zoom-open .bottom-nav,
html.images-zoom-open .mobile-nav,
html.images-zoom-open .mobile-nav-overlay,
html.images-zoom-open .phc-top-progress,
html.images-zoom-open .app-header,
body.images-zoom-open .sidebar,
body.images-zoom-open .app-topbar,
body.images-zoom-open #app-topbar,
body.images-zoom-open .app-bar-mobile,
body.images-zoom-open .bottom-nav,
body.images-zoom-open .mobile-nav,
body.images-zoom-open .mobile-nav-overlay,
body.images-zoom-open .phc-top-progress,
body.images-zoom-open .app-header {
  visibility: hidden !important;
  pointer-events: none !important;
}

.images-zoom-modal-content {
  background: transparent;
  border-radius: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: none;
}

.images-zoom-modal-header {
  padding: 0.55rem 0.85rem;
  background: rgba(15, 23, 42, 0.9);
  color: white;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex: 0 0 auto;
}
.images-zoom-modal-tools {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}
.images-zoom-tool {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.45rem;
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}
.images-zoom-hint {
  font-size: 0.68rem;
  color: #94a3b8;
  font-weight: 400;
}

.images-zoom-modal-close:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

.images-zoom-modal-body {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 0.5rem;
  overflow: hidden;
  min-height: 0;
  background: #000;
  cursor: grab;
  touch-action: none;
}
.images-zoom-modal-body.is-dragging {
  cursor: grabbing;
}

.images-zoom-main-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 0;
  cursor: zoom-in;
  transition: none;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
}
.images-zoom-main-image.zoomed {
  cursor: grab;
}

.images-zoom-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
}

.images-zoom-nav:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.images-zoom-nav.prev {
  left: 1rem;
}

.images-zoom-nav.next {
  right: 1rem;
}

.images-zoom-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.images-zoom-thumbnails {
  display: flex;
  gap: 0.5rem;
  padding: 1rem;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.zoom-modal-thumbnail {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s;
  flex-shrink: 0;
}

.zoom-modal-thumbnail:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.zoom-modal-thumbnail.active {
  border-color: #3b82f6;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.images-zoom-counter {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.9rem;
  z-index: 10;
}

@media (max-width: 768px) {
  .images-zoom-modal-content {
    width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  
  .images-zoom-modal-body {
    min-height: calc(100vh - 180px);
  }
  
  .images-zoom-main-image {
    max-height: calc(100vh - 220px);
  }
  
  .images-zoom-nav {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
  
  .zoom-modal-thumbnail {
    width: 60px;
    height: 60px;
  }
}

/* ===== DASHBOARD STYLES ===== */

/* Grille des statistiques */
.dashboard-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Cartes de statistiques */
.stat-card {
  background: #151b24;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06);
  border-color: rgba(59, 130, 246, 0.3);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon-wrapper {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.stat-card:hover .stat-icon-wrapper {
  transform: scale(1.1) rotate(5deg);
}

.stat-icon {
  width: 28px;
  height: 28px;
}

.stat-icon-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
}

.stat-icon-warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}

.stat-icon-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
}

.stat-icon-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
}

.stat-icon-info {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
}

.stat-content {
  flex: 1;
  min-width: 0;
}

.stat-label {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0 0 0.5rem 0;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  display: block;
}

.stat-value-warning {
  color: #d97706;
}

.stat-value-danger {
  color: #dc2626;
}

.stat-value-success {
  color: #059669;
}

.stat-value-info {
  color: #2563eb;
}

.stat-card-primary {
  border-left: 4px solid #3b82f6;
}

.stat-card-warning {
  border-left: 4px solid #f59e0b;
}

.stat-card-danger {
  border-left: 4px solid #ef4444;
}

.stat-card-success {
  border-left: 4px solid #10b981;
}

.stat-card-muted {
  border-left: 4px solid #64748b;
}

.stat-icon-muted {
  color: #94a3b8;
}

/* Grille des graphiques */
.dashboard-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* Cartes détaillées pour les statistiques par site et type */
.dashboard-card-detailed {
  display: flex;
  flex-direction: column;
}

.dashboard-card-scrollable {
  flex: 1;
  overflow-x: hidden;
  padding-right: 0.75rem;
}

/* Amélioration de l'affichage des statistiques par site/type */
.site-stat-item > div[style*="display: grid; grid-template-columns: repeat(3, 1fr)"],
.type-stat-item > div[style*="display: grid; grid-template-columns: repeat(3, 1fr)"] {
  gap: 0.75rem !important;
}

.site-stat-item > div[style*="display: grid; grid-template-columns: repeat(3, 1fr)"] > div,
.type-stat-item > div[style*="display: grid; grid-template-columns: repeat(3, 1fr)"] > div {
  padding: 0.75rem 0.5rem !important;
  border-radius: 8px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.site-stat-item > div[style*="display: grid; grid-template-columns: repeat(3, 1fr)"] > div:hover,
.type-stat-item > div[style*="display: grid; grid-template-columns: repeat(3, 1fr)"] > div:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.dashboard-card-scrollable::-webkit-scrollbar {
  width: 6px;
}

.dashboard-card-scrollable::-webkit-scrollbar-track {
  background: #1a222d;
  border-radius: 3px;
}

.dashboard-card-scrollable::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.dashboard-card-scrollable::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.dashboard-activity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 1.5rem;
}

/* Système d'onglets du dashboard */
.dashboard-tabs-container {
  margin-top: 2rem;
  background: #151b24;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.dashboard-tabs-nav {
  display: flex;
  background: #1a222d;
  border-bottom: 2px solid #e5e7eb;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.dashboard-tabs-nav::-webkit-scrollbar {
  height: 6px;
}

.dashboard-tabs-nav::-webkit-scrollbar-track {
  background: #1a222d;
}

.dashboard-tabs-nav::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.dashboard-tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
  transition: all 0.2s ease;
  position: relative;
}

.dashboard-tab-btn:hover {
  background: #1a222d;
  color: #1f2937;
}

.dashboard-tab-btn.active {
  color: #0b4a63;
  border-bottom-color: #0b4a63;
  background: #151b24;
  font-weight: 600;
}

.dashboard-tab-btn span:first-child {
  font-size: 1.1rem;
}

.dashboard-tabs-content {
  position: relative;
  min-height: 400px;
}

.dashboard-tab-pane {
  display: none;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.dashboard-tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dashboard-overview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

@media (max-width: 1024px) {
  .dashboard-overview-grid {
    grid-template-columns: 1fr;
  }
}

/* Cartes du dashboard */
.dashboard-card {
  background: #151b24;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  overflow: hidden;
}

.dashboard-card:hover {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.dashboard-card-header {
  padding: 1.5rem 1.5rem 1rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.dashboard-card-link {
  color: #3b82f6;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.dashboard-card-link:hover {
  color: #2563eb;
  text-decoration: underline;
}

.dashboard-card-content {
  padding: 1.5rem;
}

/* Graphiques */
.chart-bar-container {
  margin-bottom: 1.25rem;
}

.chart-bar-item {
  margin-bottom: 1rem;
}

.chart-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  align-items: center;
}

.chart-bar-label {
  font-size: 0.875rem;
  color: #374151;
  font-weight: 500;
}

.chart-bar-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: #111827;
}

.chart-bar-bg {
  background: #1a222d;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
  position: relative;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.chart-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Métriques de performance */
.metrics-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.metric-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
}

.metric-item:hover {
  background-color: #1a222d;
  margin: 0 -1.5rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.metric-item-last {
  border-bottom: none;
}

.metric-label {
  font-size: 0.875rem;
  color: #374151;
  font-weight: 500;
}

.metric-value {
  font-size: 1rem;
  color: #111827;
  font-weight: 600;
}

/* Liste d'activité */
.dashboard-activity-list {
  max-height: 400px;
  overflow-y: auto;
  padding: 0 !important;
}

.dashboard-activity-list::-webkit-scrollbar {
  width: 6px;
}

.dashboard-activity-list::-webkit-scrollbar-track {
  background: #1a222d;
  border-radius: 3px;
}

.dashboard-activity-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

.dashboard-activity-list::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.recent-item,
.upcoming-item {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.recent-item:last-child,
.upcoming-item:last-child {
  border-bottom: none;
}

.recent-item:hover,
.upcoming-item:hover {
  background-color: #1a222d;
  padding-left: 1.75rem;
}

.recent-item::before,
.upcoming-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: #3b82f6;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.recent-item:hover::before,
.upcoming-item:hover::before {
  opacity: 1;
}

.activity-item-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.activity-item-main {
  flex: 1;
  min-width: 0;
}

.activity-item-title {
  color: #111827;
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 0.5rem 0;
}

.activity-item-description {
  color: #6b7280;
  font-size: 0.875rem;
  margin: 0.5rem 0;
  line-height: 1.5;
}

.activity-item-date {
  color: #9ca3af;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.status-badge {
  flex-shrink: 0;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-left: 1rem;
}

.badge-pending {
  background: #1a222d;
  color: #6b7280;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-success {
  background: #d1fae5;
  color: #065f46;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

/* Styles pour les statistiques par site et type */
.site-stat-item,
.type-stat-item {
  padding: 1.25rem;
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.2s ease;
}

.site-stat-item:last-child,
.type-stat-item:last-child {
  border-bottom: none;
}

.site-stat-item:hover,
.type-stat-item:hover {
  background-color: #1a222d;
  border-left: 3px solid #3b82f6;
  margin-left: -3px;
  padding-left: calc(1.25rem - 3px);
}

/* Styles pour les statistiques par type et site */
.site-type-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.type-site-stat-item {
  transition: all 0.2s ease;
}

.type-site-stat-item:hover {
  background-color: #1a222d !important;
  border-left-color: #3b82f6 !important;
  transform: translateX(4px);
}

/* Pas de scroll vertical pour stats-by-type-site - tout s'affiche */
#stats-by-type-site {
  overflow: visible;
  max-height: none;
}

/* Responsive pour les filtres du dashboard */
@media (max-width: 768px) {
  .panel-head {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }

  .panel-head > div:last-child {
    flex-direction: column;
    gap: 0.75rem;
  }

  #dashboard-filter-site,
  #dashboard-filter-type {
    width: 100%;
  }

  #dashboard-refresh-btn {
    width: 100%;
    justify-content: center;
  }

  /* Statistiques par site et type en une colonne */
  .site-stat-item > div[style*="grid-template-columns: repeat(3, 1fr)"],
  .type-stat-item > div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Statistiques par type et site - responsive */
  .site-type-group > div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }

  .type-site-stat-item {
    margin-left: 0.75rem !important;
  }

  .type-site-stat-item > div[style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
}

/* Responsive */
@media (max-width: 1024px) {
  .dashboard-charts-grid,
  .dashboard-activity-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-card-detailed {
    min-height: auto;
  }

  .dashboard-card-scrollable {
    min-height: auto;
  }
}

@media (max-width: 768px) {
  .dashboard-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .dashboard-card-detailed {
    min-height: auto;
  }

  .dashboard-card-scrollable {
    min-height: auto;
  }

  .site-stat-item,
  .type-stat-item {
    padding: 1rem;
  }

  .dashboard-tabs-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .dashboard-tab-btn {
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
  }

  .dashboard-tab-btn span:last-child {
    display: none;
  }

  .dashboard-tabs-content {
    padding: 1rem;
  }

  .dashboard-overview-grid {
    grid-template-columns: 1fr;
  }
  
  .stat-card {
    padding: 1rem;
    flex-direction: column;
    text-align: center;
  }
  
  .stat-icon-wrapper {
    width: 48px;
    height: 48px;
  }
  
  .stat-icon {
    width: 24px;
    height: 24px;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .dashboard-card-header {
    padding: 1rem 1rem 0.75rem 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .dashboard-card-content {
    padding: 1rem;
  }

  .dashboard-card-scrollable {
    min-height: auto;
  }
  
  .recent-item,
  .upcoming-item {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .dashboard-stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Messages de chargement et d'état vide */
.dashboard-card-content .muted {
  text-align: center;
  padding: 2rem 1rem;
  color: #9ca3af;
  font-style: italic;
}

.dashboard-card-content p.muted {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

/* ===== STYLES POUR LA SAISIE DES QUANTITÉS MENSUELLES ===== */
.engin-saisie-card {
  background: #151b24;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.consommable-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: #1a222d;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.consommable-row:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border-color: #d1d5db;
}

.consommable-row input[type="number"]:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

@media (max-width: 768px) {
  .consommable-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .consommable-row > div,
  .consommable-row > label {
    min-width: 100% !important;
    margin: 0 !important;
  }
}

/* ===== OPTIMISATION MOBILE COMPLÈTE - TOUS LES ÉLÉMENTS ===== */
@media (max-width: 768px) {
  /* Empêche le défilement horizontal de la page (tableaux = scroll interne) */
  html,
  body {
    overflow-x: hidden;
    max-width: 100%;
  }

  #app-main {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  /* ===== PANELS ET CONTENEURS ===== */
  .panel {
    padding: 1rem !important;
    margin: 0.5rem !important;
    border-radius: 12px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .panel-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .panel-head h2 {
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
    margin: 0 !important;
  }

  .panel-head > div:last-child {
    width: 100% !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .panel-body {
    padding: 1rem !important;
  }

  .panel-section {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* ===== BOUTONS ===== */
  .button,
  button:not(.nav-toggle):not(.lang-switch):not(.mobile-nav-close):not(.mobile-tab):not(.mobile-header-action):not(.reports-category-button):not(.reports-tab-button):not(.dashboard-tab-btn):not(.tab-button):not(.monitor-tab-btn) {
    width: 100% !important;
    min-height: 48px !important;
    padding: 0.875rem 1.25rem !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    border-radius: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem !important;
    box-sizing: border-box !important;
  }

  .button.primary,
  button.primary {
    background: #1b6ef3 !important;
    color: #ffffff !important;
  }

  .button.secondary,
  button.secondary {
    background: #1a2330 !important;
    color: #e8eef6 !important;
    border: 1px solid #2a3544 !important;
  }

  .btn-primary,
  .btn-secondary,
  .btn-export {
    width: 100% !important;
    min-height: 48px !important;
    padding: 0.875rem 1.25rem !important;
    margin-bottom: 0.75rem !important;
  }

  .btn-export-pdf,
  .btn-export-excel {
    width: 100% !important;
    min-height: 48px !important;
    padding: 0.875rem !important;
    margin-bottom: 0.5rem !important;
  }

  /* Groupes de boutons */
  .button-group,
  .btn-group {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .button-group .button,
  .btn-group button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* ===== FORMULAIRES ===== */
  form {
    padding: 0 !important;
  }

  .form-group {
    margin-bottom: 1.25rem !important;
  }

  .form-group label {
    font-size: 0.9375rem !important;
    font-weight: 600 !important;
    margin-bottom: 0.5rem !important;
    display: block !important;
  }

  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="number"],
  .form-group input[type="date"],
  .form-group input[type="time"],
  .form-group select,
  .form-group textarea {
    width: 100% !important;
    min-height: 48px !important;
    padding: 0.875rem 1rem !important;
    font-size: 16px !important; /* Évite le zoom sur iOS */
    border-radius: 10px !important;
    border: 1.5px solid #d1d5db !important;
    box-sizing: border-box !important;
  }

  .form-group textarea {
    min-height: 120px !important;
    resize: vertical !important;
  }

  .form-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
    margin-top: 1.5rem !important;
    padding-top: 1.5rem !important;
  }

  .form-actions .button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* ===== FILTRES ===== */
  .filters-bar,
  .filters-container,
  .filters-container-catalogue {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-radius: 12px !important;
  }

  .filters-grid,
  .filters-grid-catalogue {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .filter-item,
  .filter-item-catalogue {
    width: 100% !important;
  }

  .filter-label {
    font-size: 0.875rem !important;
    margin-bottom: 0.5rem !important;
  }

  .filter-select,
  .search-input,
  select.filter-select,
  input.search-input {
    width: 100% !important;
    min-height: 48px !important;
    padding: 0.875rem 1rem !important;
    font-size: 16px !important;
    border-radius: 10px !important;
    box-sizing: border-box !important;
  }

  .filters-actions,
  .filters-actions-catalogue {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .filters-actions button,
  .filters-actions-catalogue button {
    width: 100% !important;
  }

  /* ===== TABLEAUX ===== */
  .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 12px !important;
  }

  table {
    width: 100% !important;
    min-width: 600px !important;
    font-size: 0.875rem !important;
    border-collapse: collapse !important;
  }

  th, td {
    padding: 0.875rem 0.75rem !important;
    font-size: 0.875rem !important;
    white-space: nowrap !important;
  }

  th {
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
  }

  /* Tableaux responsive en cartes */
  .table-responsive.table-responsive-cards {
    overflow-x: hidden !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .table-responsive-cards table {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
  }
  .table-responsive-cards {
    display: block !important;
  }

  .table-responsive-cards thead {
    display: none !important;
  }

  .table-responsive-cards tbody,
  .table-responsive-cards tr,
  .table-responsive-cards td {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .table-responsive-cards tr {
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    margin-bottom: 1rem !important;
    padding: 1rem !important;
    background: #151b24 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .table-responsive-cards td {
    border: none !important;
    padding: 0.75rem 0 !important;
    text-align: left !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.15rem !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .table-responsive-cards td:before {
    content: attr(data-label) ": " !important;
    font-weight: 600 !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    color: #6b7280 !important;
  }

  .table-responsive-cards td > * {
    max-width: 100% !important;
    min-width: 0 !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }

  .table-responsive-cards td[data-label=""]:before {
    content: none !important;
    display: none !important;
  }

  /* Bouton action (Voir) contenu dans la carte, pas de débordement */
  .table-responsive-cards td[data-label=""] {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  .table-responsive-cards td[data-label=""] .button {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-width: 0 !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  .table-responsive-cards tr td:first-child {
    font-size: 1.05rem !important;
    padding-top: 0 !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 0.25rem !important;
    border-bottom: 1px solid #e5e7eb !important;
  }

  /* ===== CARTES ET CARDS ===== */
  .card,
  .dashboard-card,
  .signalement-card,
  .historique-card,
  .demande-card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-radius: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .card-header,
  .dashboard-card-header {
    padding: 1rem 1rem 0.75rem 1rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  .card-title,
  .dashboard-card-title {
    font-size: 1.125rem !important;
    line-height: 1.4 !important;
  }

  .card-content,
  .dashboard-card-content {
    padding: 1rem !important;
  }

  /* ===== ONGLETS (TABS) ===== */
  .settings-tabs,
  .tab-buttons,
  .tab-nav {
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0 !important;
    margin-bottom: 1rem !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }

  .settings-tabs::-webkit-scrollbar,
  .tab-buttons::-webkit-scrollbar,
  .tab-nav::-webkit-scrollbar {
    display: none !important;
  }

  .tab-button,
  .settings-tabs button {
    min-width: auto !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.875rem !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    min-height: 44px !important;
  }

  .tab-content {
    padding: 1rem !important;
  }

  /* ===== MODALS ===== */
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    margin: 1rem auto !important;
    max-height: 90vh !important;
    border-radius: 16px !important;
  }

  .modal-header {
    padding: 1rem 1.25rem !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.75rem !important;
  }

  .modal-header h3 {
    font-size: 1.125rem !important;
    line-height: 1.4 !important;
  }

  .modal-body {
    padding: 1rem 1.25rem !important;
    max-height: calc(90vh - 150px) !important;
    overflow-y: auto !important;
  }

  .modal-footer {
    padding: 1rem 1.25rem !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .modal-footer button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* ===== GRILLES (GRIDS) ===== */
  .grid,
  .cards-grid,
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Grilles avec auto-fit */
  div[style*="grid-template-columns: repeat(auto-fit"],
  div[style*="grid-template-columns: repeat(auto-fill"] {
    grid-template-columns: 1fr !important;
  }

  /* ===== LISTES ===== */
  .list,
  .items-list {
    gap: 0.75rem !important;
  }

  .list-item,
  .item-card {
    padding: 1rem !important;
    margin-bottom: 0.75rem !important;
    border-radius: 12px !important;
  }

  /* ===== STATISTIQUES (mobile-layout.css affine #app-main) ===== */
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }

  .dashboard-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.5rem !important;
  }

  /* Boutons dans barres d'actions : ne pas forcer pleine largeur (mobile-layout gère la grille) */
  #app-main .panel-actions .button,
  #app-main .panel-actions button,
  #app-main .panel-head-actions .button,
  #app-main .dashboard-header-actions .button,
  #app-main .dashboard-header-actions a.button,
  #app-main .btn-export-group .button,
  #app-main .btn-export {
    width: auto !important;
    min-height: 32px !important;
  }

  .stat-card {
    padding: 1.25rem !important;
    border-radius: 12px !important;
  }

  .stat-value {
    font-size: 1.75rem !important;
  }

  .stat-label {
    font-size: 0.875rem !important;
  }

  /* ===== BADGES ET LABELS ===== */
  .badge {
    padding: 0.375rem 0.75rem !important;
    font-size: 0.8125rem !important;
    border-radius: 8px !important;
  }

  /* ===== LIENS ===== */
  a.button,
  a.btn-primary,
  a.btn-secondary {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 48px !important;
    text-decoration: none !important;
  }

  /* ===== ESPACEMENTS GLOBAUX ===== */
  .section,
  .content-section {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  h1 {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    margin-bottom: 1rem !important;
  }

  h2 {
    font-size: 1.25rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.75rem !important;
  }

  h3 {
    font-size: 1.125rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.75rem !important;
  }

  h4 {
    font-size: 1rem !important;
    line-height: 1.4 !important;
    margin-bottom: 0.5rem !important;
  }

  p {
    font-size: 0.9375rem !important;
    line-height: 1.6 !important;
    margin-bottom: 0.75rem !important;
  }

  /* ===== UTILITAIRES ===== */
  .text-center {
    text-align: center !important;
  }

  .text-left {
    text-align: left !important;
  }

  .text-right {
    text-align: right !important;
  }

  .mb-0 { margin-bottom: 0 !important; }
  .mb-1 { margin-bottom: 0.5rem !important; }
  .mb-2 { margin-bottom: 1rem !important; }
  .mb-3 { margin-bottom: 1.5rem !important; }

  .mt-0 { margin-top: 0 !important; }
  .mt-1 { margin-top: 0.5rem !important; }
  .mt-2 { margin-top: 1rem !important; }
  .mt-3 { margin-top: 1.5rem !important; }

  .p-0 { padding: 0 !important; }
  .p-1 { padding: 0.5rem !important; }
  .p-2 { padding: 1rem !important; }
  .p-3 { padding: 1.5rem !important; }
}

/* ===== TRÈS PETITS ÉCRANS (≤ 480px) ===== */
@media (max-width: 480px) {
  .panel {
    padding: 0.75rem !important;
    margin: 0.25rem !important;
  }

  .panel-head h2 {
    font-size: 1.125rem !important;
  }

  .button,
  button {
    font-size: 0.875rem !important;
    padding: 0.75rem 1rem !important;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px !important;
    padding: 0.75rem !important;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    max-height: 100vh !important;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 0.75rem !important;
  }

  table {
    font-size: 0.8125rem !important;
  }

  th, td {
    padding: 0.625rem 0.5rem !important;
    font-size: 0.8125rem !important;
  }

  h1 { font-size: 1.375rem !important; }
  h2 { font-size: 1.125rem !important; }
  h3 { font-size: 1rem !important; }
  h4 { font-size: 0.9375rem !important; }
}

/* ===== OPTIMISATIONS SPÉCIFIQUES POUR ÉLÉMENTS COURANTS ===== */
@media (max-width: 768px) {
  /* Boutons dans les headers de panel */
  .panel-head .button,
  .panel-head button,
  .panel-head .btn-primary,
  .panel-head .btn-secondary {
    width: 100% !important;
    margin-top: 0.5rem !important;
  }

  /* Boutons d'export côte à côte */
  .btn-export-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .btn-export-group .btn-export {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Onglets horizontaux avec scroll */
  .tab-navigation,
  .tabs-nav {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin !important;
    gap: 0.5rem !important;
    padding-bottom: 0.5rem !important;
    margin-bottom: 1rem !important;
  }

  .tab-navigation button,
  .tabs-nav button {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-width: auto !important;
    padding: 0.75rem 1.25rem !important;
  }

  /* Filtres en grille */
  .filters-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Recherche et filtres combinés */
  .search-filters-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .search-filters-container > * {
    width: 100% !important;
  }

  /* Actions rapides */
  .quick-actions,
  .actions-bar {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .quick-actions .button,
  .actions-bar button {
    width: 100% !important;
  }

  /* Grilles de statistiques */
  .stats-grid-2,
  .stats-grid-3,
  .stats-grid-4 {
    grid-template-columns: 1fr !important;
  }

  /* Cartes empilées */
  .cards-stack {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  /* Sections avec bordures */
  .section-bordered {
    border-left: none !important;
    border-top: 3px solid #3ba63b !important;
    padding-left: 1rem !important;
    padding-top: 1rem !important;
  }

  /* Listes avec icônes */
  .icon-list {
    gap: 0.75rem !important;
  }

  .icon-list-item {
    padding: 1rem !important;
    min-height: 60px !important;
  }

  /* Formulaires multi-colonnes */
  .form-row,
  .form-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .form-row > *,
  .form-grid > * {
    width: 100% !important;
  }

  /* Tableaux avec actions */
  .table-actions {
    flex-direction: column !important;
    gap: 0.5rem !important;
    width: 100% !important;
  }

  .table-actions button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Messages et alertes */
  .alert,
  .message,
  .notification {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-radius: 12px !important;
    font-size: 0.9375rem !important;
  }

  /* Breadcrumbs */
  .breadcrumb {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    font-size: 0.875rem !important;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap !important;
    gap: 0.5rem !important;
    justify-content: center !important;
  }

  .pagination button {
    min-width: 44px !important;
    min-height: 44px !important;
    padding: 0.5rem !important;
  }

  /* Tooltips et infos */
  .tooltip,
  .info-badge {
    font-size: 0.8125rem !important;
    padding: 0.375rem 0.625rem !important;
  }
}

/* ===== AMÉLIORATION DU TOUCH SUR MOBILE ===== */
@media (hover: none) and (pointer: coarse) {
  /* Tous les éléments interactifs doivent avoir une taille minimale */
  button,
  .button,
  a.button,
  .nav-link,
  .tab-button,
  input[type="checkbox"],
  input[type="radio"],
  select,
  .clickable {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Amélioration des zones de touch */
  .touch-target {
    padding: 0.75rem !important;
    margin: -0.75rem !important;
  }

  /* Pas de hover sur mobile */
  *:hover {
    transform: none !important;
  }

  /* Focus visible amélioré */
  *:focus {
    outline: 3px solid #3ba63b !important;
    outline-offset: 2px !important;
  }
}

/* ===== OPTIMISATIONS SPÉCIFIQUES POUR PAGES COURANTES ===== */
@media (max-width: 768px) {
  /* Page Maintenance */
  .maintenance-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
    padding-bottom: 0.5rem !important;
  }

  .maintenance-tabs .tab-button {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    min-width: auto !important;
  }

  /* Page Actifs */
  .assets-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .assets-actions .button {
    width: 100% !important;
  }

  /* Page Paramètres */
  .settings-menu {
    grid-template-columns: 1fr !important;
    gap: 0.45rem !important;
  }

  .settings-menu-item {
    padding: 0.7rem 0.75rem !important;
    min-height: 0 !important;
  }

  .settings-menu-icon {
    width: 2rem !important;
    height: 2rem !important;
    font-size: 1.1rem !important;
  }

  /* Page Présence */
  .presence-table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .presence-table {
    min-width: 800px !important;
  }

  /* Page Rapports */
  .reports-section {
    padding: 1rem !important;
    margin-bottom: 1.5rem !important;
  }

  .reports-section-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  /* Page Stocks */
  .stock-actions,
  .stocks-page-header,
  .stocks-page-actions,
  .stocks-filters-header,
  .stocks-filters-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .stock-actions button,
  .stocks-page-actions button,
  .stocks-page-actions a,
  .stocks-filters-actions button {
    width: 100% !important;
  }

  .stocks-filters-box .stocks-filters-header > div {
    width: 100% !important;
  }

  /* Page Catalogue */
  .catalogue-filters {
    padding: 1rem !important;
  }

  .catalogue-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Page Dashboard */
  .dashboard-overview {
    padding: 1rem !important;
  }

  .dashboard-quick-actions {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Page Transport */
  .transport-filters {
    flex-direction: column !important;
    gap: 1rem !important;
  }

  .transport-actions {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  /* Page Techniciens */
  .technicians-list {
    gap: 1rem !important;
  }

  .technician-card {
    padding: 1rem !important;
  }

  /* Formulaires de création/édition */
  .form-maintenance,
  .form-engin,
  .form-signalement {
    padding: 1rem !important;
  }

  .form-maintenance .form-group,
  .form-engin .form-group,
  .form-signalement .form-group {
    margin-bottom: 1.25rem !important;
  }

  /* Sections avec description */
  .section-description {
    font-size: 0.875rem !important;
    line-height: 1.6 !important;
    margin-bottom: 1rem !important;
  }

  /* Instructions et aide */
  .instructions-box,
  .help-box {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
    border-radius: 12px !important;
    font-size: 0.875rem !important;
  }

  /* Messages d'état vide */
  .empty-state {
    padding: 2rem 1rem !important;
    text-align: center !important;
  }

  .empty-state p {
    font-size: 0.9375rem !important;
  }

  /* Grilles de boutons d'action */
  .actions-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  /* Boutons d'export groupés */
  .export-buttons {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .export-buttons button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Filtres par site/type */
  .site-filters,
  .type-filters {
    flex-direction: column !important;
    gap: 0.75rem !important;
  }

  .site-filters button,
  .type-filters button {
    width: 100% !important;
    padding: 0.875rem 1rem !important;
    min-height: 48px !important;
  }

  /* ===== PAGE GESTION DES ENGINS - OPTIMISATIONS SPÉCIFIQUES ===== */
  .engins-filters-bar {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .filter-item-engins {
    width: 100% !important;
    min-width: 100% !important;
  }

  .filter-actions-engins {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
  }

  .filter-actions-engins button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Onglets de sites */
  .sites-tabs-nav,
  #sites-tabs {
    display: flex !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 0.5rem !important;
    padding: 0.5rem 0 !important;
    scrollbar-width: thin !important;
    -ms-overflow-style: none !important;
  }

  .sites-tabs-nav::-webkit-scrollbar,
  #sites-tabs::-webkit-scrollbar {
    height: 4px !important;
  }

  .sites-tabs-nav::-webkit-scrollbar-track,
  #sites-tabs::-webkit-scrollbar-track {
    background: #1a222d !important;
    border-radius: 2px !important;
  }

  .sites-tabs-nav::-webkit-scrollbar-thumb,
  #sites-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 2px !important;
  }

  .sites-tabs-nav .tab-btn,
  #sites-tabs .tab-btn {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 0.75rem 1.25rem !important;
    min-height: 44px !important;
    font-size: 0.875rem !important;
    border-radius: 8px 8px 0 0 !important;
    border: none !important;
    background: transparent !important;
    color: #6b7280 !important;
    border-bottom: 3px solid transparent !important;
    transition: all 0.2s ease !important;
  }

  .sites-tabs-nav .tab-btn.active,
  #sites-tabs .tab-btn.active {
    color: #1b6ef3 !important;
    border-bottom-color: #1b6ef3 !important;
    font-weight: 600 !important;
    background: rgba(27, 110, 243, 0.05) !important;
  }

  .sites-tabs-nav .tab-btn:hover,
  #sites-tabs .tab-btn:hover {
    background: rgba(27, 110, 243, 0.1) !important;
    color: #1b6ef3 !important;
  }

  /* ===== PAGE ACTIFS - OPTIMISATIONS SPÉCIFIQUES ===== */
  .assets-filters-bar {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .filter-item-assets {
    width: 100% !important;
    min-width: 100% !important;
  }

  .filter-item-assets label {
    display: block !important;
    margin-bottom: 0.5rem !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    color: #374151 !important;
  }

  /* Tableaux dans les onglets de sites */
  #sites-tabs-content .table-container {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
    margin: 0 !important;
  }

  #sites-tabs-content table {
    min-width: 800px !important;
    font-size: 0.875rem !important;
  }

  #sites-tabs-content th,
  #sites-tabs-content td {
    padding: 0.75rem 0.5rem !important;
    font-size: 0.875rem !important;
  }

  /* Actions dans les tableaux */
  .table-actions-cell {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .table-actions-cell button {
    width: 100% !important;
    min-height: 40px !important;
    padding: 0.5rem !important;
    font-size: 0.8125rem !important;
  }

  /* Header de la page Gestion des engins */
  .engins-panel-head {
    flex-direction: column !important;
    gap: 1rem !important;
    align-items: flex-start !important;
  }

  .engins-panel-head .panel-head-title {
    width: 100% !important;
  }

  .engins-panel-head .panel-head-actions {
    width: 100% !important;
  }

  .engins-panel-head .panel-head-actions button {
    width: 100% !important;
  }

  .back-link {
    font-size: 0.9375rem !important;
    padding: 0.5rem 0 !important;
    min-height: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
  }
}

/* ===== PAGE AIDE / MANUEL ===== */
.help-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0 1.5rem;
  box-sizing: border-box;
}

.help-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.help-tab {
  border: none;
  background: transparent;
  font-size: 0.9rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  color: #6b7280;
  border-radius: 8px 8px 0 0;
}

.help-tab-active {
  background: #151b24;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-color: #ffffff;
}

.help-hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #0d9488 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.5rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(30, 58, 95, 0.35);
  position: relative;
  overflow: hidden;
}

.help-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(255,255,255,0.12), transparent 50%);
  pointer-events: none;
}

.help-hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.help-hero-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.help-hero-subtitle {
  font-size: 0.9rem;
  opacity: 0.92;
  margin: 0;
}

.help-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.help-action-btn {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s, transform 0.15s;
}

.help-action-btn:hover {
  background: rgba(255,255,255,0.35);
  transform: translateY(-1px);
}

.help-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.help-quick-link {
  font-size: 0.78rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: rgba(0,0,0,0.15);
  color: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.help-quick-link:hover {
  background: rgba(0,0,0,0.28);
}

.help-accordion {
  margin-bottom: 1.5rem;
}

.help-details {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 0.5rem;
  background: #151b24;
  overflow: hidden;
}

.help-details-summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: #111827;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.help-details-summary::-webkit-details-marker { display: none; }

.help-details-summary::after {
  content: "+";
  float: right;
  font-weight: 400;
  color: #6b7280;
}

.help-details[open] .help-details-summary::after {
  content: "−";
}

.help-details-summary:hover {
  background: #1a222d;
}

.help-details-body {
  padding: 0 1rem 1rem;
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.5;
  border-top: 1px solid #f3f4f6;
}

.help-details-body p {
  margin: 0.5rem 0 0;
}

.help-details-body p:first-child { margin-top: 0.75rem; }

.help-details-body code {
  font-size: 0.8em;
  padding: 0.15rem 0.4rem;
  background: #1a222d;
  border-radius: 4px;
  color: #7dd3fc;
}

.help-details-body h4 {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.help-details-body ul {
  margin: 0.25rem 0 0.75rem;
  padding-left: 1.15rem;
}

.help-details-body li {
  margin: 0.2rem 0;
  font-size: 0.86rem;
}

.help-cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0.75rem 1rem;
  margin-top: 0.5rem;
}

.help-lead {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.45;
}

.help-cat-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 1rem 0 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7dd3fc;
}

.help-cat-count {
  display: inline-flex;
  min-width: 1.4rem;
  justify-content: center;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: #0b1220;
  color: #cbd5e1;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.help-table-wrap {
  overflow-x: auto;
  border: 1px solid #2a3544;
  border-radius: 8px;
  margin-bottom: 0.65rem;
}

.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.help-table th,
.help-table td {
  padding: 0.4rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid #1e293b;
  vertical-align: top;
}

.help-table th {
  background: #0b1220;
  color: #94a3b8;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
  position: sticky;
  top: 0;
}

.help-table tr:last-child td {
  border-bottom: none;
}

.help-table code {
  white-space: nowrap;
}

.help-callout {
  background: #0b1220;
  border: 1px solid #2a3544;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0 0.75rem;
}

.help-callout p {
  margin-top: 0.35rem;
}

.help-steps {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.help-steps li {
  margin: 0.4rem 0;
  line-height: 1.45;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.help-bullets {
  margin: 0.4rem 0 0.6rem;
  padding-left: 1.15rem;
}

.help-bullets li {
  margin: 0.35rem 0;
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.4;
}

.help-note {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #94a3b8;
  padding: 0.5rem 0.65rem;
  background: #0b1220;
  border-radius: 6px;
  border-left: 3px solid #38bdf8;
}

.help-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #2a3544;
  text-align: center;
}

.help-copyright {
  margin: 0;
  font-size: 0.78rem;
  color: #9aa8b8;
}

.auth-help-link {
  margin-top: 0.75rem !important;
}

.auth-help-link a {
  color: #7dd3fc;
  text-decoration: none;
  font-weight: 600;
}

.auth-help-link a:hover {
  text-decoration: underline;
}

.auth-copyright {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 0px));
  text-align: center;
  font-size: 0.72rem;
  color: #7a8796;
  letter-spacing: 0.02em;
  background: transparent;
  pointer-events: none;
}

.help-contact-block {
  background: #0f172a;
  color: #e5e7eb;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
}

.help-contact-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.help-contact-desc {
  font-size: 0.82rem;
  color: #9ca3af;
  margin: 0 0 1rem;
}

.help-contact-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 0.35rem;
}

.help-contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.help-contact-form .input {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.help-contact-form .input::placeholder {
  color: #64748b;
}

.help-contact-form .button.primary {
  align-self: flex-start;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  background: #22c55e;
  border: none;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
}

.help-contact-form .button.primary:hover {
  background: #16a34a;
}

.help-extras-block {
  margin-top: 1rem;
  background: #1a222d;
  border-radius: 10px;
  padding: 1rem 1.25rem;
  border: 1px solid #e5e7eb;
}

.help-extras-list {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: #4b5563;
}

@media (max-width: 640px) {
  .help-hero { padding: 1.2rem 1rem; }
  .help-hero-title { font-size: 1.2rem; }
  .help-page { padding-inline: 0.75rem; }
  .help-quick-actions { gap: 0.4rem; }
  .help-action-btn { padding: 0.45rem 0.7rem; font-size: 0.75rem; }
}

/* ===== ADAPTATION MOBILE GLOBALE - TOUTES LES PAGES ===== */
@media (max-width: 768px) {
  /* Empêcher le scroll horizontal global */
  html, body {
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
  }

  /* Safe area pour encoches (iPhone X+, etc.) */
  .layout {
    padding-left: max(1rem, env(safe-area-inset-left)) !important;
    padding-right: max(1rem, env(safe-area-inset-right)) !important;
    padding-bottom: max(1rem, env(safe-area-inset-bottom)) !important;
  }

  .app-bar-mobile {
    padding-left: max(0.5rem, env(safe-area-inset-left)) !important;
    padding-right: max(0.5rem, env(safe-area-inset-right)) !important;
  }

  /* dl avec grille (demande_workflow, détails, etc.) */
  dl[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
  }

  dl[style*="grid-template-columns"] dt {
    font-weight: 600;
    padding-top: 0.5rem;
    border-top: 1px solid #e5e7eb;
  }

  dl[style*="grid-template-columns"] dt:first-child {
    padding-top: 0;
    border-top: none;
  }

  /* En-têtes avec flex space-between (stocks, etc.) */
  .panel > div[style*="display: flex"][style*="space-between"],
  div[style*="display: flex"][style*="justify-content: space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .panel > div[style*="display: flex"][style*="space-between"] > div:last-child,
  div[style*="display: flex"][style*="justify-content: space-between"] > div:last-child {
    width: 100% !important;
  }

  .panel > div[style*="display: flex"][style*="space-between"] button,
  .panel > div[style*="display: flex"][style*="space-between"] .button,
  .panel > div[style*="display: flex"][style*="space-between"] a.button {
    width: 100% !important;
    margin: 0 !important;
  }

  /* Filtres avec grille inline (stocks, transport, etc.) */
  div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Blocs flex avec wrap - forcer colonne sur mobile */
  div[style*="display: flex"][style*="flex-wrap"] {
    flex-direction: column !important;
  }

  /* Formulaires workflow - boutons en colonne */
  div[style*="display: flex"][style*="gap: 0.75rem"] {
    flex-direction: column !important;
  }

  div[style*="display: flex"][style*="gap: 0.75rem"] button,
  div[style*="display: flex"][style*="gap: 0.75rem"] .button,
  div[style*="display: flex"][style*="gap: 0.75rem"] a {
    width: 100% !important;
  }

  /* Onglets - scroll horizontal fluide (écrase flex:1 / wrap des blocs mobile plus anciens) */
  .tabs {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex-wrap: nowrap !important;
    padding-bottom: 0.5rem !important;
    gap: 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    touch-action: pan-x;
    scrollbar-width: thin;
  }

  .tabs .tab-button {
    flex: 0 0 auto !important;
    white-space: nowrap !important;
    min-height: 44px !important;
    padding: 0.625rem 1rem !important;
    font-size: 0.875rem !important;
    min-width: auto !important;
  }

  /* Cartes demandes d'achat (stocks.js) */
  .demande-achat-card,
  .demande-consommable-card,
  [class*="demande-achat"] {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  .demande-achat-actions,
  .demande-consommable-actions,
  [class*="demande-achat-actions"] {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .demande-achat-actions button,
  .demande-consommable-actions button,
  [class*="demande-achat-actions"] button {
    width: 100% !important;
  }

  /* Mouvements / transport - cartes */
  .mouvement-card,
  .mouvements-card,
  .chauffeur-card {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* Signalements / maintenance - cartes */
  .signalement-card,
  .intervention-card {
    padding: 1rem !important;
  }

  /* Page détail demande (demande_details_stock) */
  #demande-details-content,
  #demande-details-stock-content,
  .demande-details-panel {
    padding: 1rem !important;
  }

  .demande-details-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 1rem !important;
  }

  .demande-details-body {
    grid-template-columns: 1fr !important;
  }

  /* Filtres génériques (tous les onglets stocks, transport, etc.) */
  .filters-container > div[style*="display: flex"][style*="space-between"],
  div[style*="background: #1a222d"][style*="border-radius"] > div[style*="display: flex"][style*="space-between"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  div[style*="background: #1a222d"][style*="border-radius"] > div[style*="display: flex"][style*="space-between"] > div:last-child {
    width: 100% !important;
  }

  div[style*="background: #1a222d"][style*="border-radius"] > div[style*="display: flex"][style*="space-between"] button {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  .layout {
    padding-left: max(0.75rem, env(safe-area-inset-left)) !important;
    padding-right: max(0.75rem, env(safe-area-inset-right)) !important;
  }

  .panel {
    margin-left: 0 !important;
    margin-right: 0 !important;
    border-radius: 0 !important;
  }

  .tabs .tab-button {
    font-size: 0.8125rem !important;
    padding: 0.5rem 0.75rem !important;
  }

  /* Stocks : liste déroulante à la place de la barre d’onglets */
  .stocks-tabs-nav .stocks-tab-select-wrap {
    display: block !important;
  }

  .stocks-tabs-nav .stocks-tabs-row.tabs {
    display: none !important;
  }

  .stocks-tab-select-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.35rem;
  }

  .stocks-tab-select {
    width: 100%;
    max-width: 100%;
    font-size: 16px !important;
    min-height: 48px;
    padding: 0.65rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #151b24;
    box-sizing: border-box;
  }
}

/* Page Stocks — menu « Section » masqué sauf sur très petit écran (voir @media 480px) */
.stocks-tab-select-wrap {
  display: none;
}

/* =============================================================================
   Page — Ajustement stock pièces (admin)  #stock_ajustement_admin
   ============================================================================= */
.stock-adj-page {
  --stock-adj-border: #2a3544;
  --stock-adj-bg-soft: #151b24;
  --stock-adj-bg: #0f1620;
  --stock-adj-text: #e2e8f0;
  --stock-adj-muted: #94a3b8;
  --stock-adj-accent: #34d399;
  --stock-adj-accent-ring: rgba(52, 211, 153, 0.22);
  color: var(--stock-adj-text);
}

.stock-adj-page .stock-adj-panel-head {
  border-bottom: 1px solid var(--stock-adj-border);
  padding-bottom: 0.85rem;
  margin-bottom: 0;
}

.stock-adj-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.stock-adj-header-main {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  flex: 1;
  min-width: min(100%, 260px);
}

.stock-adj-back {
  flex-shrink: 0;
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  font-weight: 600;
  border-radius: 8px;
}

.stock-adj-title-block h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.stock-adj-intro {
  margin: 0.35rem 0 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--stock-adj-muted);
  max-width: 48rem;
}

.stock-adj-intro strong {
  color: #cbd5e1;
  font-weight: 600;
}

.stock-adj-header-actions {
  flex-shrink: 0;
}

.stock-adj-refresh-btn {
  padding: 0.45rem 0.95rem;
  font-weight: 600;
  border-radius: 8px;
}

.stock-adj-panel-body {
  padding: 0.85rem 0 0;
}

.stock-adj-filters {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  padding: 0.55rem 0.65rem;
  background: var(--stock-adj-bg-soft);
  border: 1px solid var(--stock-adj-border);
  border-radius: 10px;
  margin-bottom: 0.75rem;
}

.stock-adj-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.stock-adj-field--full,
.stock-adj-field--motif {
  flex: 1 1 220px;
  min-width: 180px;
}

.stock-adj-label {
  display: block;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 650;
  color: var(--stock-adj-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stock-adj-label-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: #64748b;
}

.stock-adj-input,
.stock-adj-select {
  width: 100%;
  min-height: 34px;
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--stock-adj-border);
  border-radius: 7px;
  font-size: 0.85rem;
  background: var(--stock-adj-bg);
  color: var(--stock-adj-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.stock-adj-input::placeholder {
  color: #64748b;
}

.stock-adj-input:hover,
.stock-adj-select:hover {
  border-color: #475569;
}

.stock-adj-input:focus,
.stock-adj-select:focus {
  outline: none;
  border-color: var(--stock-adj-accent);
  box-shadow: 0 0 0 3px var(--stock-adj-accent-ring);
}

.stock-adj-field--motif .stock-adj-input {
  max-width: none;
}

.stock-adj-table-wrap {
  border: 1px solid var(--stock-adj-border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--stock-adj-bg-soft);
  box-shadow: none;
}

.stock-adj-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stock-adj-table-scroll::-webkit-scrollbar {
  height: 10px;
}

.stock-adj-table-scroll::-webkit-scrollbar-track {
  background: #0f1620;
}

.stock-adj-table-scroll::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 5px;
}

.stock-adj-table-scroll::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

table.stock-adj-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 820px;
}

.stock-adj-table thead th {
  text-align: left;
  padding: 0.65rem 0.85rem;
  background: #121820;
  border-bottom: 1px solid var(--stock-adj-border);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--stock-adj-muted);
  white-space: nowrap;
}

.stock-adj-table thead th:nth-child(4),
.stock-adj-table tbody td.stock-adj-cell-qty {
  text-align: right;
}

.stock-adj-table thead th:nth-child(6),
.stock-adj-table tbody td.stock-adj-cell-submit {
  text-align: center;
}

.stock-adj-table tbody tr.stock-adj-row {
  border-bottom: 1px solid #1e2733;
  transition: background-color 0.12s ease;
}

.stock-adj-table tbody tr.stock-adj-row:nth-child(even) {
  background: #121820;
}

.stock-adj-table tbody tr.stock-adj-row:hover {
  background: rgba(52, 211, 153, 0.08);
}

.stock-adj-table tbody td.stock-adj-cell {
  padding: 0.65rem 0.85rem;
  vertical-align: middle;
  color: var(--stock-adj-text);
}

.stock-adj-cell-site {
  font-weight: 700;
  color: #818cf8;
  white-space: nowrap;
}

.stock-adj-cell-name {
  font-weight: 600;
  color: #f1f5f9;
  line-height: 1.35;
  max-width: 14rem;
}

.stock-adj-cell-ref {
  color: var(--stock-adj-muted);
  font-size: 0.8rem;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  max-width: 12rem;
  word-break: break-word;
}

.stock-adj-cell-qty {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #60a5fa;
  white-space: nowrap;
}

.stock-adj-actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.stock-adj-mode {
  flex: 1 1 11rem;
  min-width: 10rem;
  max-width: 240px;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--stock-adj-border);
  border-radius: 7px;
  font-size: 0.8rem;
  background: var(--stock-adj-bg);
  color: var(--stock-adj-text);
  cursor: pointer;
}

.stock-adj-mode:focus {
  outline: none;
  border-color: var(--stock-adj-accent);
  box-shadow: 0 0 0 3px var(--stock-adj-accent-ring);
}

.stock-adj-qty {
  width: 5.75rem;
  min-width: 4.5rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--stock-adj-border);
  border-radius: 7px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  background: var(--stock-adj-bg);
  color: var(--stock-adj-text);
}

.stock-adj-qty:focus {
  outline: none;
  border-color: var(--stock-adj-accent);
  box-shadow: 0 0 0 3px var(--stock-adj-accent-ring);
}

.stock-adj-page .stock-adj-apply {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 7px;
  white-space: nowrap;
}

.stock-adj-loading,
.stock-adj-empty {
  text-align: center;
  padding: 2rem 1.25rem;
  color: var(--stock-adj-muted);
  font-size: 0.9rem;
}

.stock-adj-error {
  color: #f87171;
  font-weight: 500;
}

.stock-adj-page .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 768px) {
  .stock-adj-header {
    flex-direction: column;
    align-items: stretch;
  }

  .stock-adj-header-actions {
    width: 100%;
  }

  .stock-adj-header-actions .stock-adj-refresh-btn {
    width: 100%;
  }

  .stock-adj-filters {
    grid-template-columns: 1fr;
    padding: 1.15rem 1.2rem;
  }

  .stock-adj-field--motif .stock-adj-input {
    max-width: none;
  }

  .stock-adj-cell-name,
  .stock-adj-cell-ref {
    max-width: none;
  }
}

