/**
 * Design unifié du panel (style outline partout)
 * Thème sombre : fond #050508, bordures visibles, fonds transparents, orbes en arrière-plan
 */

/* ---------- Thème sombre : fond et orbes (style Token) ---------- */
body[data-pc-theme="dark"] {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
}

body[data-pc-theme="dark"]::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(59, 130, 246, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse 80% 60% at 100% 50%, rgba(99, 102, 241, 0.12) 0%, transparent 45%),
    radial-gradient(ellipse 60% 80% at 0% 80%, rgba(34, 211, 238, 0.1) 0%, transparent 45%),
    radial-gradient(ellipse 50% 50% at 50% 100%, rgba(59, 130, 246, 0.08) 0%, transparent 50%);
}

body[data-pc-theme="dark"] .panel-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  animation: panel-orb-float 18s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
body[data-pc-theme="dark"] .panel-orb-1 {
  position: fixed;
  width: 380px;
  height: 380px;
  background: rgba(59, 130, 246, 0.18);
  top: -12%;
  right: -5%;
  animation-delay: 0s;
}
body[data-pc-theme="dark"] .panel-orb-2 {
  position: fixed;
  width: 280px;
  height: 280px;
  background: rgba(34, 211, 238, 0.12);
  bottom: 10%;
  left: -5%;
  animation-delay: -8s;
}
@keyframes panel-orb-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(20px, -30px) scale(1.05); }
  66% { transform: translate(-15px, 15px) scale(0.95); }
}

body[data-pc-theme="dark"] .pc-container,
body[data-pc-theme="dark"] .pc-content {
  position: relative;
  z-index: 1;
}

/* Variables outline (style partout) */
body[data-pc-theme="dark"] {
  --panel-outline: 2px solid rgba(255, 255, 255, 0.18);
  --panel-outline-subtle: 1px solid rgba(255, 255, 255, 0.22);
  --panel-fill: rgba(255, 255, 255, 0.08);
}

body[data-pc-theme="dark"] .pc-sidebar {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: var(--panel-fill) !important;
  border-inline-end: var(--panel-outline);
}

/* Sidebar mobile : fond flouté pour un bel effet (pas transparent) */
@media (max-width: 1024px) {
  body[data-pc-theme="dark"] .pc-sidebar.mob-sidebar-active {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(15, 15, 22, 0.88) !important;
    border-inline-end: var(--panel-outline);
  }
  /* Sidebar au-dessus du contenu pour que l'overlay reçoive les clics */
  .pc-sidebar.mob-sidebar-active {
    z-index: 1030;
  }
  .pc-sidebar.mob-sidebar-active .pc-menu-overlay {
    z-index: 1025;
  }
  .pc-sidebar.mob-sidebar-active .navbar-wrapper {
    z-index: 1035;
  }
  /* Bouton Fermer (X) visible uniquement sur mobile quand la sidebar est ouverte */
  .pc-sidebar.mob-sidebar-active .pc-sidebar-close-mob {
    display: inline-flex !important;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.5rem;
    height: 2.5rem;
    justify-content: center;
    border-radius: 0.5rem;
    color: var(--pc-sidebar-color, rgba(255,255,255,0.6));
    font-size: 1.35rem;
  }
  .pc-sidebar-close-mob:hover {
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.08);
  }
}
@media (min-width: 1025px) {
  #sidebar-close-mob {
    display: none !important;
  }
}

body[data-pc-theme="dark"] .pc-header {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(15, 15, 22, 0.6) !important;
  border-bottom: none;
}

/* ---------- Cartes (contenu principal + sidebar) : outline en dark ---------- */
.pc-content .card,
.pc-sidebar .card {
  --bs-card-border-radius: 16px;
  --bs-card-inner-border-radius: 15px;
  border-radius: var(--bs-card-border-radius);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 25px 50px -12px rgba(27, 46, 94, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
}

body[data-pc-theme="dark"] .pc-content .card,
body[data-pc-theme="dark"] .pc-sidebar .card {
  background: var(--panel-fill, rgba(255, 255, 255, 0.02)) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: var(--panel-outline, 2px solid rgba(255, 255, 255, 0.18)) !important;
  box-shadow: none;
}

.pc-content .card .card-header,
.pc-sidebar .card .card-header {
  border-radius: var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius) 0 0;
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

body[data-pc-theme="dark"] .pc-content .card .card-header,
body[data-pc-theme="dark"] .pc-sidebar .card .card-header {
  border-bottom: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.12));
  background: transparent !important;
}

.pc-content .card .card-footer,
.pc-sidebar .card .card-footer {
  border-radius: 0 0 var(--bs-card-inner-border-radius) var(--bs-card-inner-border-radius);
  border-top-color: rgba(0, 0, 0, 0.06);
}

body[data-pc-theme="dark"] .pc-content .card .card-footer,
body[data-pc-theme="dark"] .pc-sidebar .card .card-footer {
  border-top: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.12));
  background: transparent !important;
}

/* ---------- Modals : style outline en dark ---------- */
.modal-content,
.modal .introjs-tooltip {
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 25px 50px -12px rgba(27, 46, 94, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

body[data-pc-theme="dark"] .modal-content,
body[data-pc-theme="dark"] .modal .introjs-tooltip {
  background: rgba(5, 5, 8, 0.97) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: var(--panel-outline, 2px solid rgba(255, 255, 255, 0.2)) !important;
  box-shadow: none;
}

body[data-pc-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1.25rem 1.5rem;
}

body[data-pc-theme="dark"] .modal-header {
  border-bottom: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.12));
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
}

body[data-pc-theme="dark"] .modal-body {
  color: rgba(229, 231, 235, 0.95);
}

/* Cartes à l'intérieur des modals (ex: di_app_modal_helper) */
body[data-pc-theme="dark"] .modal .card {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.14));
  border-radius: 16px;
}
body[data-pc-theme="dark"] .modal .card.border-primary {
  border-color: rgba(59, 130, 246, 0.4);
}
body[data-pc-theme="dark"] .modal .card-header.bg-light {
  background: transparent !important;
  border-bottom: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.12));
  color: rgba(255, 255, 255, 0.9);
}
body[data-pc-theme="dark"] .modal .card-body {
  color: rgba(229, 231, 235, 0.9);
}
body[data-pc-theme="dark"] .modal .table {
  color: inherit;
}
body[data-pc-theme="dark"] .modal .alert {
  border-radius: 12px;
  background: transparent !important;
  border-width: 2px;
}

/* Modal Changelog (sidebar) : thème sombre aligné Token */
body[data-pc-theme="dark"] #changelogModalContent .changelog-body {
  background: transparent;
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-timeline::before {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.6) 0%, rgba(34, 211, 238, 0.4) 50%, rgba(255,255,255,0.15) 100%);
  box-shadow: 0 0 0 3px rgba(15, 15, 22, 0.5);
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-dot {
  border-color: rgba(15, 15, 22, 0.9);
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-card {
  background: transparent;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.14));
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-card .changelog-date {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-card ul {
  color: rgba(229, 231, 235, 0.9);
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-footer {
  background: transparent;
  border-top: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.12));
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-footer .changelog-current-version {
  color: rgba(255, 255, 255, 0.6);
}
body[data-pc-theme="dark"] #changelogModalContent .changelog-footer .changelog-current-version strong {
  color: rgba(34, 211, 238, 0.9);
}

.modal-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.modal-body {
  padding: 1.25rem 1.5rem;
}

.modal-footer {
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1rem 1.5rem 1.25rem;
}

body[data-pc-theme="dark"] .modal-footer {
  border-top: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.12));
  background: transparent;
}

/* Modals avec header coloré (danger, primary, etc.) : garder le style, ajuster uniquement le radius */
.modal-header.bg-primary,
.modal-header.bg-danger,
.modal-header.bg-warning,
.modal-header[style*="background"] {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

/* Boutons principaux dans les modals (CTA pleine largeur optionnel) */
.modal-footer .btn-primary {
  border-radius: 10px;
  font-weight: 600;
  min-width: 6rem;
}

/* Champs dans les modals / cartes : cohérence + style Token en dark */
.pc-content .form-control,
.modal .form-control {
  border-radius: 10px;
}

.pc-content .form-select,
.modal .form-select {
  border-radius: 10px;
}

body[data-pc-theme="dark"] .pc-content .form-control,
body[data-pc-theme="dark"] .modal .form-control {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.2));
  color: #fff;
}
body[data-pc-theme="dark"] .pc-content .form-control::placeholder,
body[data-pc-theme="dark"] .modal .form-control::placeholder {
  color: rgba(255, 255, 255, 0.35);
}
body[data-pc-theme="dark"] .pc-content .form-control:hover,
body[data-pc-theme="dark"] .modal .form-control:hover {
  border-color: rgba(255, 255, 255, 0.28);
}
body[data-pc-theme="dark"] .pc-content .form-control:focus,
body[data-pc-theme="dark"] .modal .form-control:focus {
  border: 2px solid rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

body[data-pc-theme="dark"] .pc-content .form-select,
body[data-pc-theme="dark"] .modal .form-select {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.2));
  color: #fff;
}

/* ---------- Modals : outline et focus (ensemble de l'app) ---------- */
/* Pas d'outline sur le conteneur modal (évite double cadre au focus) */
.modal {
  outline: none !important;
}
.modal-content {
  outline: none !important;
}
/* Focus visible clair dans tous les modals : champs, boutons, liens */
.modal .form-control:focus-visible,
.modal .form-select:focus-visible,
.modal .form-check-input:focus-visible,
.modal .btn:focus-visible,
.modal .btn-close:focus-visible,
.modal a:focus-visible,
.modal [role="button"]:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.8);
  outline-offset: 2px;
}
body[data-pc-theme="dark"] .modal .form-control:focus-visible,
body[data-pc-theme="dark"] .modal .form-select:focus-visible,
body[data-pc-theme="dark"] .modal .btn:focus-visible,
body[data-pc-theme="dark"] .modal .btn-close:focus-visible,
body[data-pc-theme="dark"] .modal a:focus-visible {
  outline-color: rgba(96, 165, 250, 0.9);
}

/* Tous les select en thème sombre : fond sombre + texte clair (éviter blanc sur blanc) */
body[data-pc-theme="dark"] .form-select,
body[data-pc-theme="dark"] select.form-control,
body[data-pc-theme="dark"] select.form-select {
  background-color: transparent !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e2e8f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 16px 12px !important;
  color: #f1f5f9 !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.2)) !important;
}
body[data-pc-theme="dark"] .form-select option,
body[data-pc-theme="dark"] select.form-select option,
body[data-pc-theme="dark"] select.form-control option {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

/* Tables et contenus dans le panel (dark) */
body[data-pc-theme="dark"] .table {
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] .table thead th {
  border-bottom: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.18));
  color: rgba(255, 255, 255, 0.7);
}
body[data-pc-theme="dark"] .table td,
body[data-pc-theme="dark"] .table th {
  border-color: rgba(255, 255, 255, 0.1);
}
body[data-pc-theme="dark"] .table-hover tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Dropdown en dark (aligné Token) */
body[data-pc-theme="dark"] .dropdown-menu {
  background: rgba(5, 5, 8, 0.98) !important;
  backdrop-filter: none;
  border: var(--panel-outline, 2px solid rgba(255, 255, 255, 0.2));
  border-radius: 14px;
  box-shadow: none;
}

/* ---------- Cartes stats DI (fond + couleur texte en dark) ---------- */
body[data-pc-theme="dark"] .di-stat-pending {
  background: rgba(59, 130, 246, 0.18) !important;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
body[data-pc-theme="dark"] .di-stat-pending .di-stat-label,
body[data-pc-theme="dark"] .di-stat-pending .di-stat-desc { color: rgba(255, 255, 255, 0.85) !important; }
body[data-pc-theme="dark"] .di-stat-pending .di-stat-num { color: #93c5fd !important; }
body[data-pc-theme="dark"] .di-stat-pending .di-stat-icon-wrap { background: rgba(59, 130, 246, 0.35) !important; color: #93c5fd !important; }

body[data-pc-theme="dark"] .di-stat-waiting {
  background: rgba(251, 191, 36, 0.18) !important;
  border: 1px solid rgba(251, 191, 36, 0.35);
}
body[data-pc-theme="dark"] .di-stat-waiting .di-stat-label,
body[data-pc-theme="dark"] .di-stat-waiting .di-stat-desc { color: rgba(255, 255, 255, 0.85) !important; }
body[data-pc-theme="dark"] .di-stat-waiting .di-stat-num { color: #fcd34d !important; }
body[data-pc-theme="dark"] .di-stat-waiting .di-stat-icon-wrap { background: rgba(251, 191, 36, 0.35) !important; color: #fcd34d !important; }

body[data-pc-theme="dark"] .di-stat-validated {
  background: rgba(34, 197, 94, 0.18) !important;
  border: 1px solid rgba(34, 197, 94, 0.35);
}
body[data-pc-theme="dark"] .di-stat-validated .di-stat-label,
body[data-pc-theme="dark"] .di-stat-validated .di-stat-desc { color: rgba(255, 255, 255, 0.85) !important; }
body[data-pc-theme="dark"] .di-stat-validated .di-stat-num { color: #86efac !important; }
body[data-pc-theme="dark"] .di-stat-validated .di-stat-icon-wrap { background: rgba(34, 197, 94, 0.35) !important; color: #86efac !important; }

body[data-pc-theme="dark"] .di-stat-rejected {
  background: rgba(239, 68, 68, 0.18) !important;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
body[data-pc-theme="dark"] .di-stat-rejected .di-stat-label,
body[data-pc-theme="dark"] .di-stat-rejected .di-stat-desc { color: rgba(255, 255, 255, 0.85) !important; }
body[data-pc-theme="dark"] .di-stat-rejected .di-stat-num { color: #fca5a5 !important; }
body[data-pc-theme="dark"] .di-stat-rejected .di-stat-icon-wrap { background: rgba(239, 68, 68, 0.35) !important; color: #fca5a5 !important; }

/* Cartes impact : en-tête + flèche en dark */
body[data-pc-theme="dark"] .di-impact-card-header { color: rgba(255, 255, 255, 0.95); }
body[data-pc-theme="dark"] .di-impact-arrow { color: rgba(255, 255, 255, 0.6); }

/* ---------- Cartes impact environnemental (style outline bien visible) ---------- */
.pc-content .di-impact-card,
.di-impact-card {
  border-radius: 16px;
  overflow: hidden;
  background: transparent !important;
  border: 2px solid rgba(0, 0, 0, 0.22) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}
.di-impact-card .card-body {
  padding: 1.25rem 1.35rem;
  background: transparent !important;
}
.di-impact-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.di-impact-icon i {
  font-size: 1.4rem;
}
.di-impact-icon--env {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}
.di-impact-icon--bream {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
}
.di-impact-icon--iso {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}
.di-impact-title {
  font-weight: 600;
  margin: 0;
}
.di-impact-intro {
  font-size: 0.9rem;
  line-height: 1.5;
  color: inherit;
  margin-bottom: 1rem;
  opacity: 0.9;
}
.di-impact-metrics {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.di-impact-metrics li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 0.5rem 0.65rem;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
}
.di-impact-emoji {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}
.di-impact-metric-value {
  font-weight: 600;
}
.di-impact-metric-detail {
  font-size: 0.85rem;
  opacity: 0.85;
}
.di-impact-footer {
  font-size: 0.85rem;
  margin: 0;
  opacity: 0.8;
}
body[data-pc-theme="dark"] .pc-content .di-impact-card,
body[data-pc-theme="dark"] .di-impact-card {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border: 2px solid rgba(255, 255, 255, 0.28) !important;
  box-shadow: none !important;
}
body[data-pc-theme="dark"] .di-impact-card .card-body {
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] .di-impact-title {
  color: rgba(255, 255, 255, 0.95);
}
body[data-pc-theme="dark"] .di-impact-icon--env {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}
body[data-pc-theme="dark"] .di-impact-icon--bream {
  background: rgba(20, 184, 166, 0.2);
  color: #2dd4bf;
}
body[data-pc-theme="dark"] .di-impact-icon--iso {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

/* Carte BREEAM : outline teal (visible) */
.di-impact-card--bream {
  border: 2px solid rgba(13, 148, 136, 0.45) !important;
  background: rgba(13, 148, 136, 0.03) !important;
}
.di-impact-card--bream .card-body {
  background: transparent !important;
}
body[data-pc-theme="dark"] .di-impact-card--bream {
  border: 2px solid rgba(45, 212, 191, 0.45) !important;
  background: rgba(13, 148, 136, 0.05) !important;
}

/* Carte ISO : outline bleu (visible) */
.di-impact-card--iso {
  border: 2px solid rgba(59, 130, 246, 0.5) !important;
  background: rgba(59, 130, 246, 0.04) !important;
}
.di-impact-card--iso .card-body {
  background: transparent !important;
}
.di-impact-card--iso .di-impact-title {
  font-weight: 700;
}
.di-impact-card--iso .di-impact-icon--iso {
  width: 52px;
  height: 52px;
  font-size: 1.6rem;
  background: rgba(59, 130, 246, 0.18);
  color: #2563eb;
}
.di-impact-card--iso .di-impact-icon--iso i {
  font-size: 1.5rem;
}
.di-impact-card--iso .di-impact-footer {
  font-size: 0.9rem;
  font-weight: 500;
  opacity: 0.95;
}
body[data-pc-theme="dark"] .di-impact-card--iso {
  border: 2px solid rgba(96, 165, 250, 0.5) !important;
  background: rgba(59, 130, 246, 0.06) !important;
}
body[data-pc-theme="dark"] .di-impact-card--iso .di-impact-icon--iso {
  background: rgba(59, 130, 246, 0.28);
  color: #93c5fd;
}
body[data-pc-theme="dark"] .di-impact-card--iso .di-impact-metrics li {
  background: rgba(59, 130, 246, 0.06);
  border-color: rgba(59, 130, 246, 0.12);
}

body[data-pc-theme="dark"] .di-impact-metrics li {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
body[data-pc-theme="dark"] .di-impact-intro,
body[data-pc-theme="dark"] .di-impact-footer {
  color: rgba(229, 231, 235, 0.9);
}

/* ---------- Onglets DI App : Réglages, Form Builder, Analyse IA (design outline) ---------- */
body[data-pc-theme="dark"] #reglages .settings-card,
body[data-pc-theme="dark"] #formbuilder .card,
body[data-pc-theme="dark"] #chatgpt .card {
  background: var(--panel-fill, rgba(255, 255, 255, 0.02)) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: var(--panel-outline, 2px solid rgba(255, 255, 255, 0.18)) !important;
  border-radius: 20px;
  box-shadow: none;
}

body[data-pc-theme="dark"] #reglages .settings-card .card-header,
body[data-pc-theme="dark"] #reglages .settings-card .card-footer,
body[data-pc-theme="dark"] #formbuilder .card .card-header,
body[data-pc-theme="dark"] #chatgpt .card .card-header {
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.95);
}

body[data-pc-theme="dark"] #reglages .settings-card .card-body,
body[data-pc-theme="dark"] #formbuilder .card .card-body,
body[data-pc-theme="dark"] #chatgpt .card .card-body {
  color: rgba(229, 231, 235, 0.95);
}

/* Réglages : bordures et icônes uniformes (pas de couleurs) */
body[data-pc-theme="dark"] #reglages .settings-card .card-header {
  border-start-width: 4px;
  border-start-style: solid;
  border-start-color: rgba(255, 255, 255, 0.15);
}
body[data-pc-theme="dark"] #reglages .settings-card.settings-card--logo .card-header,
body[data-pc-theme="dark"] #reglages .settings-card.settings-card--contenu .card-header,
body[data-pc-theme="dark"] #reglages .settings-card.settings-card--horaires .card-header,
body[data-pc-theme="dark"] #reglages .settings-card.settings-card--notif-sound .card-header,
body[data-pc-theme="dark"] #reglages .settings-card.settings-card--url-form .card-header,
body[data-pc-theme="dark"] #reglages .settings-card.settings-card--notif-email .card-header {
  border-start-color: rgba(255, 255, 255, 0.15);
}
body[data-pc-theme="dark"] #reglages .settings-card .card-header h5 i,
body[data-pc-theme="dark"] #reglages .settings-card .card-header .text-info,
body[data-pc-theme="dark"] #reglages .settings-card .card-header .text-warning,
body[data-pc-theme="dark"] #reglages .settings-card .card-header .text-success,
body[data-pc-theme="dark"] #reglages .settings-card .card-header .text-primary,
body[data-pc-theme="dark"] #reglages .settings-card .card-header .text-danger,
body[data-pc-theme="dark"] #reglages .settings-card .card-header [style*="color"] {
  color: rgba(255, 255, 255, 0.75) !important;
}
body[data-pc-theme="dark"] #reglages .settings-card .logo-actuel-box {
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] #reglages .form-control,
body[data-pc-theme="dark"] #reglages .form-select,
body[data-pc-theme="dark"] #reglages select {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.2)) !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #reglages .form-select option,
body[data-pc-theme="dark"] #reglages select option {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}

/* Form Builder : liste des champs (toutes les cartes en sombre, override bg-body-secondary) */
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item,
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item.bg-body-secondary {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.18)) !important;
  border-radius: 12px;
  color: rgba(229, 231, 235, 0.95);
  margin-bottom: 0.5rem;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item strong {
  color: #e2e8f0;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item small.text-muted,
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item code {
  color: rgba(148, 163, 184, 0.95) !important;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item .badge {
  border: none;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item .btn-outline-secondary {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(226, 232, 235, 0.95);
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item .btn-outline-secondary:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item .text-muted {
  color: rgba(148, 163, 184, 0.95) !important;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList .list-group-item.di-alert-item {
  background: rgba(251, 191, 36, 0.18) !important;
  border-color: rgba(251, 191, 36, 0.4) !important;
  color: #fcd34d;
}
body[data-pc-theme="dark"] #formbuilder #fieldsList.list-group {
  background: transparent !important;
  border: none;
}
/* Aperçu du formulaire : fond sombre obligatoire, tous les champs en sombre (override Bootstrap) */
body[data-pc-theme="dark"] #formbuilder #formPreview {
  background: transparent !important;
  border: var(--panel-outline, 2px solid rgba(255, 255, 255, 0.18));
  border-radius: 14px;
  color: #e2e8f0;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .form-label,
body[data-pc-theme="dark"] #formbuilder #formPreview .form-check-label {
  color: #e2e8f0 !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview input.form-control,
body[data-pc-theme="dark"] #formbuilder #formPreview .form-control,
body[data-pc-theme="dark"] #formbuilder #formPreview .form-select,
body[data-pc-theme="dark"] #formbuilder #formPreview textarea.form-control {
  background: transparent !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .form-control::placeholder,
body[data-pc-theme="dark"] #formbuilder #formPreview textarea.form-control::placeholder {
  color: rgba(255, 255, 255, 0.5) !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .form-control:focus,
body[data-pc-theme="dark"] #formbuilder #formPreview .form-select:focus,
body[data-pc-theme="dark"] #formbuilder #formPreview textarea.form-control:focus {
  background-color: rgba(30, 41, 59, 1) !important;
  border-color: rgba(59, 130, 246, 0.6) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .form-check-input {
  background-color: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .form-check-input:checked {
  background-color: #2563eb !important;
  border-color: #2563eb !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .text-danger {
  color: #f87171 !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview .text-muted {
  color: rgba(148, 163, 184, 0.95) !important;
}
body[data-pc-theme="dark"] #formbuilder #formPreview select.form-select option {
  background: #1e293b !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #formbuilder .alert-info {
  background: transparent;
  border: 2px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}
body[data-pc-theme="dark"] #formbuilder .list-group-item.di-alert-item {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fcd34d;
}

/* Icône robot SVG dans l’onglet IA */
.di-tab-icon-robot { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* Analyse IA (#chatgpt) : intro et sections */
#chatgpt .di-analyse-ia-intro h4 { font-weight: 700; }
#chatgpt .di-analyse-ia-intro .text-primary { color: var(--bs-primary) !important; }
#chatgpt .di-chatgpt-config-card .card-header { border-bottom: 1px solid var(--bs-border-color, #e2e8f0); font-weight: 600; }
#chatgpt .h6.text-uppercase.fw-bold.text-muted { letter-spacing: 0.05em; }

/* Analyse IA (#chatgpt) : cartes uniformes (même style que le reste du panel, pas de couleurs) */
body[data-pc-theme="dark"] #chatgpt .card .card-header,
body[data-pc-theme="dark"] #chatgpt .card .card-header.bg-primary,
body[data-pc-theme="dark"] #chatgpt .card .card-header.bg-warning.text-dark {
  background: rgba(255, 255, 255, 0.04) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95) !important;
}
body[data-pc-theme="dark"] #chatgpt .card .card-header.bg-warning.text-dark {
  color: rgba(255, 255, 255, 0.95) !important;
}
body[data-pc-theme="dark"] #chatgpt .alert-info {
  background: transparent;
  border: 2px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}
body[data-pc-theme="dark"] #chatgpt .alert-warning {
  background: transparent;
  border: 2px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d;
}
body[data-pc-theme="dark"] #chatgpt .alert-success {
  background: transparent;
  border: 2px solid rgba(34, 197, 94, 0.45);
  color: #86efac;
}
body[data-pc-theme="dark"] #chatgpt .di-chatgpt-config-card .card-header {
  background: rgba(255, 255, 255, 0.04) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
}
body[data-pc-theme="dark"] #chatgpt .list-group-item {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.14));
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] #chatgpt .form-label,
body[data-pc-theme="dark"] #chatgpt .form-check-label {
  color: rgba(226, 232, 235, 0.95);
}
body[data-pc-theme="dark"] #chatgpt .form-control,
body[data-pc-theme="dark"] #chatgpt .form-select,
body[data-pc-theme="dark"] #chatgpt select {
  background: transparent !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.2)) !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #chatgpt .form-select option,
body[data-pc-theme="dark"] #chatgpt select option {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #chatgpt .form-text.text-muted,
body[data-pc-theme="dark"] #chatgpt .text-muted {
  color: rgba(148, 163, 184, 0.9);
}

/* Modals Form Builder : outline */
body[data-pc-theme="dark"] #customFieldModal .modal-content,
body[data-pc-theme="dark"] #independentAlertModal .modal-content {
  background: rgba(5, 5, 8, 0.98) !important;
  backdrop-filter: none;
  border: var(--panel-outline, 2px solid rgba(255, 255, 255, 0.2)) !important;
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] #customFieldModal .modal-header,
body[data-pc-theme="dark"] #independentAlertModal .modal-header {
  background: transparent !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.95);
}
body[data-pc-theme="dark"] #customFieldModal .modal-body,
body[data-pc-theme="dark"] #independentAlertModal .modal-body {
  background: transparent !important;
  color: rgba(229, 231, 235, 0.95);
}
body[data-pc-theme="dark"] #customFieldModal .modal-footer,
body[data-pc-theme="dark"] #independentAlertModal .modal-footer {
  background: transparent !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
body[data-pc-theme="dark"] #customFieldModal #customFieldModalTabs {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
}
body[data-pc-theme="dark"] #customFieldModal #customFieldModalTabs .nav-link {
  color: rgba(148, 163, 184, 0.95);
}
body[data-pc-theme="dark"] #customFieldModal #customFieldModalTabs .nav-link.active {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.95) !important;
  border-radius: 10px;
}
body[data-pc-theme="dark"] #customFieldModal .form-label,
body[data-pc-theme="dark"] #customFieldModal .form-check-label,
body[data-pc-theme="dark"] #independentAlertModal .form-label,
body[data-pc-theme="dark"] #independentAlertModal .form-check-label {
  color: rgba(226, 232, 235, 0.95) !important;
}
body[data-pc-theme="dark"] #customFieldModal .form-control,
body[data-pc-theme="dark"] #customFieldModal .form-select,
body[data-pc-theme="dark"] #customFieldModal textarea.form-control,
body[data-pc-theme="dark"] #customFieldModal select,
body[data-pc-theme="dark"] #independentAlertModal .form-control,
body[data-pc-theme="dark"] #independentAlertModal .form-select,
body[data-pc-theme="dark"] #independentAlertModal select {
  background: transparent !important;
  background-image: none !important;
  border: var(--panel-outline-subtle, 1px solid rgba(255, 255, 255, 0.2)) !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #customFieldModal .form-select,
body[data-pc-theme="dark"] #customFieldModal select.form-select,
body[data-pc-theme="dark"] #independentAlertModal .form-select,
body[data-pc-theme="dark"] #independentAlertModal select.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23e2e8f0' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.75rem center !important;
  background-size: 16px 12px !important;
}
body[data-pc-theme="dark"] #customFieldModal .form-select option,
body[data-pc-theme="dark"] #customFieldModal select option,
body[data-pc-theme="dark"] #independentAlertModal .form-select option,
body[data-pc-theme="dark"] #independentAlertModal select option {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
}
body[data-pc-theme="dark"] #customFieldModal .form-control::placeholder,
body[data-pc-theme="dark"] #customFieldModal textarea.form-control::placeholder {
  color: rgba(255, 255, 255, 0.4) !important;
}
body[data-pc-theme="dark"] #customFieldModal .form-check-input {
  background-color: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}
body[data-pc-theme="dark"] #customFieldModal .form-check-input:checked {
  background-color: rgba(255, 255, 255, 0.35) !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
}
body[data-pc-theme="dark"] #customFieldModal .text-muted,
body[data-pc-theme="dark"] #customFieldModal .form-text.text-muted {
  color: rgba(148, 163, 184, 0.9) !important;
}
body[data-pc-theme="dark"] #customFieldModal .modal-footer .btn-secondary,
body[data-pc-theme="dark"] #independentAlertModal .modal-footer .btn-secondary {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  color: rgba(229, 231, 235, 0.95) !important;
}

/* ---------- Dashboard : garder le fond coloré des cartes KPI en dark ---------- */
body[data-pc-theme="dark"] .dash-card.border-accent.total {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border: 1px solid rgba(59, 130, 246, 0.4);
}
body[data-pc-theme="dark"] .dash-card.border-accent.attente {
  background: linear-gradient(135deg, #ea580c 0%, #c2410c 100%) !important;
  border: 1px solid rgba(234, 88, 12, 0.4);
}
body[data-pc-theme="dark"] .dash-card.border-accent.validees {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
  border: 1px solid rgba(34, 197, 94, 0.4);
}
body[data-pc-theme="dark"] .dash-card.border-accent.refusees {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
  border: 1px solid rgba(239, 68, 68, 0.4);
}
body[data-pc-theme="dark"] .dash-card.border-accent.mois {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%) !important;
  border: 1px solid rgba(34, 211, 238, 0.4);
}
body[data-pc-theme="dark"] .dash-card .dash-num,
body[data-pc-theme="dark"] .dash-card .dash-label { color: #fff !important; }
body[data-pc-theme="dark"] .dash-card .dash-icon-wrap { background: rgba(0, 0, 0, 0.2) !important; color: #fff !important; }
body[data-pc-theme="dark"] .dash-card .dash-icon-wrap i { color: #fff !important; }
.dash-card .dash-icon-wrap i { color: #fff !important; }

/* === Fix décalage table DI === */
/* La colonne description peut être très longue et faire déborder la table.
   On la limite à 380px avec wrap propre + ellipsis multi-lignes. */
.di-dat-table {
  table-layout: auto;
  width: 100% !important;
}
.di-dat-table thead th:nth-child(5),
.di-dat-table tbody td:nth-child(5) {
  max-width: 380px;
  min-width: 220px;
}
.di-dat-table tbody td:nth-child(5) {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.di-dat-table tbody td:nth-child(5) p,
.di-dat-table tbody td:nth-child(5) div {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Force scroll horizontal contained sur .table-responsive (au cas où Bootstrap est surchargé) */
.dt-container .table-responsive,
div.table-responsive {
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

/* === Responsive modal Détails DI (Mallops mobile) === */
/* Sur mobile : la modal-xl prend toute la largeur, plus de width fixe sur les tds, padding réduit */
@media (max-width: 767.98px) {
  .modal-xl,
  .modal-lg {
    --bs-modal-width: 100% !important;
  }
  .modal-dialog.modal-xl,
  .modal-dialog.modal-lg {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .modal-dialog.modal-xl .modal-content,
  .modal-dialog.modal-lg .modal-content {
    border-radius: 0 !important;
    min-height: 100vh;
  }
  /* Padding compact à l'intérieur */
  .modal-body.p-4,
  #requestDetailsContent,
  #requestActionModal .modal-body {
    padding: 0.75rem !important;
  }
  /* Cards : marges réduites, plus de débordement */
  #requestDetailsContent .card,
  #requestActionModal .card {
    margin-bottom: 0.75rem;
  }
  #requestDetailsContent .card-body,
  #requestActionModal .card-body {
    padding: 0.75rem !important;
  }
  /* Tables borderless : annule width fixe + autorise wrap */
  #requestDetailsContent .table-borderless td,
  #requestActionModal .table-borderless td,
  #requestDetailsContent table td[style*=width: 200px],
  #requestActionModal table td[style*=width: 200px] {
    width: auto !important;
    min-width: 0 !important;
    white-space: normal !important;
    word-break: break-word;
    padding: 0.35rem 0.4rem !important;
    font-size: 0.875rem;
    vertical-align: top;
  }
  #requestDetailsContent .table-borderless td.fw-bold,
  #requestActionModal .table-borderless td.fw-bold {
    width: 42% !important;
    padding-right: 0.5rem !important;
  }
  /* Force toutes les cartes col-md-X à col-12 plein largeur */
  #requestDetailsContent .row > [class*=col-md-],
  #requestActionModal .row > [class*=col-md-] {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
  }
  /* Header modal compact (le gradient) */
  .modal-header h5.modal-title {
    font-size: 1rem !important;
    line-height: 1.3;
  }
}

/* === Safe area iOS pour l'app Capacitor (Mallops) === */
/* On pousse TOUT le body vers le bas sous la status bar iOS, pour que
   le contenu (titres de page, etc.) ne soit pas masqué. */
html.mallops-ios,
body.mallops-ios,
html.mallops-ios body {
  background-color: #050508;
}
body.mallops-ios {
  padding-top: env(safe-area-inset-top, 0) !important;
  padding-bottom: env(safe-area-inset-bottom, 0) !important;
  min-height: 100vh;
  box-sizing: border-box;
}
/* Si .pc-header est position:fixed, lui aussi doit descendre */
body.mallops-ios .pc-header {
  top: env(safe-area-inset-top, 0) !important;
}
/* Background plein écran sous la status bar (couleur cohérente avec l'app) */
body.mallops-ios::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0);
  background-color: #050508;
  z-index: 99999;
  pointer-events: none;
}

/* === Modal sous safe-area iOS Mallops app === */
/* Le header de la modal full-screen sur mobile doit descendre sous la status bar iOS. */
html.mallops-ios .modal-dialog.modal-xl .modal-content,
html.mallops-ios .modal-dialog.modal-lg .modal-content,
body.mallops-ios .modal-dialog.modal-xl .modal-content,
body.mallops-ios .modal-dialog.modal-lg .modal-content {
  padding-top: env(safe-area-inset-top, 0) !important;
}
html.mallops-ios .modal-dialog.modal-xl .modal-header,
body.mallops-ios .modal-dialog.modal-xl .modal-header {
  padding-top: 0.75rem !important;
}

/* === Empêche le débordement des longues valeurs dans les tables === */
/* (emails, noms longs, etc. dans la modal Détails DI) */
@media (max-width: 767.98px) {
  #requestDetailsContent .table-borderless td,
  #requestActionModal .table-borderless td {
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    hyphens: auto;
  }
  /* Force colonne valeur à wrap propre */
  #requestDetailsContent .table-borderless td:not(.fw-bold),
  #requestActionModal .table-borderless td:not(.fw-bold) {
    max-width: 60% !important;
    min-width: 0 !important;
  }
  /* Les badges (Statut, type travaux, score IA) qui peuvent déborder : autoriser le wrap */
  #requestDetailsContent .badge,
  #requestActionModal .badge {
    white-space: normal !important;
    word-break: break-word;
    max-width: 100%;
    text-align: left;
    line-height: 1.3;
  }
}


/* === Modal mallops-ios : full opaque + title responsive === */
/* L'app iOS Capacitor utilise le thème dark, où les cards ont
   background:transparent → le tableau derrière passe à travers le modal.
   On force tout opaque + on évite le chevauchement du titre avec le X. */
body.mallops-ios .modal-backdrop.show {
  opacity: 1 !important;
  background-color: #000 !important;
}
body.mallops-ios .modal-content {
  background-color: #0a0a10 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
}
body.mallops-ios .modal-body {
  background-color: #0a0a10 !important;
  color: #e7e9ee !important;
}
body.mallops-ios .modal .card,
body.mallops-ios .modal .card.border-primary {
  background-color: #11141a !important;
  border-color: rgba(59, 130, 246, 0.45) !important;
}
body.mallops-ios .modal .card-header.bg-light {
  background-color: #1d2230 !important;
  color: #e7e9ee !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.mallops-ios .modal .card-header h5 {
  color: #e7e9ee !important;
}
body.mallops-ios .modal-title {
  font-size: 0.95rem !important;
  line-height: 1.25 !important;
  word-break: break-word;
  padding-right: 2.5rem;        /* laisse la place pour le X */
}
body.mallops-ios .modal-header {
  position: relative;
  padding-right: 3rem;          /* X reste accessible */
}
body.mallops-ios .modal-header .btn-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}
/* Empêcher la nav DI derrière de se voir à travers le modal */
body.mallops-ios .modal {
  background-color: #000 !important;
}



/* === Modal mallops-ios : table stack vertical === */
/* Dans l'app iOS, les tables de Détails DI ont une colonne label fixée à 200px
   et une colonne valeur qui n'a plus assez de place pour des emails / badges
   longs → ça déborde du card. On passe TOUT en bloc 100%. */
body.mallops-ios .modal-body .table.table-borderless,
body.mallops-ios .modal-body .table.table-borderless tbody,
body.mallops-ios .modal-body .table.table-borderless tr {
  display: block !important;
  width: 100% !important;
}
body.mallops-ios .modal-body .table.table-borderless td {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0.15rem 0 !important;
  border: none !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  white-space: normal !important;
}
body.mallops-ios .modal-body .table.table-borderless td.fw-bold {
  padding-top: 0.65rem !important;
  color: #94a3b8 !important;
  font-size: 0.7rem !important;
  font-weight: 600 !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
body.mallops-ios .modal-body .table.table-borderless td:not(.fw-bold) {
  color: #e7e9ee !important;
  font-size: 0.95rem !important;
  padding-bottom: 0.4rem !important;
}
/* Espace entre les "lignes" stackées */
body.mallops-ios .modal-body .table.table-borderless tr + tr td.fw-bold:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  margin-top: 0.35rem;
  padding-top: 0.75rem !important;
}
/* Badges (statut, type travaux, score IA, Enseigne en exploitation) */
body.mallops-ios .modal-body .table.table-borderless .badge {
  white-space: normal !important;
  word-break: break-word;
  max-width: 100%;
  display: inline-block;
  line-height: 1.3;
  text-align: left;
}
/* Card body padding plus serré sur mobile pour gagner de la place */
body.mallops-ios .modal-body .card .card-body {
  padding: 0.85rem 1rem !important;
}



/* === Notif dropdown mallops-ios dark === */
/* Le dropdown #notifDropdown ouvre par-dessus la page sombre.
   Bootstrap + thème dark donne un fond translucide + un .bg-light blanc
   sur les non-lues = texte noir invisible. On reprend tout en main. */
body.mallops-ios #notifDropdown {
  background-color: #0a0a10 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: #e7e9ee !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7) !important;
  padding: 0 !important;
  overflow: hidden;
}
body.mallops-ios #notifDropdown .dropdown-header {
  background-color: #11141a !important;
  color: #e7e9ee !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body.mallops-ios #notifDropdown .dropdown-header h6 {
  color: #e7e9ee !important;
}
body.mallops-ios #markAllReadBtn {
  color: #60a5fa !important;
}
body.mallops-ios #notifList {
  background-color: #0a0a10 !important;
}
/* Item de notif : on bypasse le style inline color:#0f172a en JS */
body.mallops-ios #notifList a[data-notif-id] {
  background-color: transparent !important;
  color: #e7e9ee !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
body.mallops-ios #notifList a[data-notif-id]:hover,
body.mallops-ios #notifList a[data-notif-id]:active {
  background-color: rgba(255, 255, 255, 0.04) !important;
}
/* Non-lue : on neutralise .bg-light et on met un accent à gauche */
body.mallops-ios #notifList a[data-notif-id].bg-light {
  background-color: rgba(13, 110, 253, 0.10) !important;
  border-left: 3px solid #0d6efd !important;
  padding-left: calc(1rem - 3px) !important;
}
body.mallops-ios #notifList a[data-notif-id] .text-muted {
  color: #94a3b8 !important;
}
body.mallops-ios #notifList a[data-notif-id] .ti-bell {
  color: #0d6efd !important;
}
/* Empty / loading text */
body.mallops-ios #notifList .text-muted.small {
  color: #94a3b8 !important;
}



/* === Notif dropdown desktop dark === */
/* Pendant desktop du bloc mallops-ios : applique le même style sombre
   sur le dropdown notifications quand le thème dark est actif via
   <body data-pc-theme="dark">, pour cohérence visuelle. */
body[data-pc-theme="dark"] #notifDropdown {
  background-color: #0a0a10 !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  color: #e7e9ee !important;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7) !important;
  padding: 0 !important;
  overflow: hidden;
}
body[data-pc-theme="dark"] #notifDropdown .dropdown-header {
  background-color: #11141a !important;
  color: #e7e9ee !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
body[data-pc-theme="dark"] #notifDropdown .dropdown-header h6 {
  color: #e7e9ee !important;
}
body[data-pc-theme="dark"] #markAllReadBtn {
  color: #60a5fa !important;
}
body[data-pc-theme="dark"] #notifList {
  background-color: #0a0a10 !important;
}
body[data-pc-theme="dark"] #notifList a[data-notif-id] {
  background-color: transparent !important;
  color: #e7e9ee !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
body[data-pc-theme="dark"] #notifList a[data-notif-id]:hover,
body[data-pc-theme="dark"] #notifList a[data-notif-id]:active {
  background-color: rgba(255, 255, 255, 0.04) !important;
}
/* Non-lue : neutralise bg-light blanc + accent bleu à gauche */
body[data-pc-theme="dark"] #notifList a[data-notif-id].bg-light {
  background-color: rgba(13, 110, 253, 0.10) !important;
  border-left: 3px solid #0d6efd !important;
  padding-left: calc(1rem - 3px) !important;
}
body[data-pc-theme="dark"] #notifList a[data-notif-id] .text-muted {
  color: #94a3b8 !important;
}
body[data-pc-theme="dark"] #notifList a[data-notif-id] .ti-bell {
  color: #0d6efd !important;
}
body[data-pc-theme="dark"] #notifList .text-muted.small {
  color: #94a3b8 !important;
}



/* === Pagination responsive mobile === */
/* La pagination Bootstrap (.pagination) déborde de l'écran sur iPhone :
   "Précédent" coupé à gauche, "174" et "Suivant" coupés à droite.
   On la rend horizontalement scrollable + on raccourcit les labels. */
@media (max-width: 767.98px) {
  .pagination {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;             /* Firefox */
    padding: 0 .5rem;
    margin-left: -.5rem;
    margin-right: -.5rem;
    justify-content: flex-start !important;
  }
  .pagination::-webkit-scrollbar { display: none; }  /* Safari/Chrome */

  .pagination .page-item {
    flex-shrink: 0;
  }
  .pagination .page-link {
    padding: .35rem .6rem !important;
    font-size: .85rem;
    min-width: 2rem;
    text-align: center;
  }
  /* Remplace "Précédent" et "Suivant" par chevrons unicode sur mobile.
     Le texte original est masqué via font-size 0 sur le span/text,
     mais on garde l'élément pour l'accessibilité. */
  .pagination .page-item:first-child .page-link {
    font-size: 0;
  }
  .pagination .page-item:first-child .page-link::before {
    content: '‹';
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
  }
  .pagination .page-item:last-child .page-link {
    font-size: 0;
  }
  .pagination .page-item:last-child .page-link::before {
    content: '›';
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
  }
  /* Conteneur d'info "Affichage de 1 à 20 sur 3463" : passer en col-12 */
  .dataTables_info,
  #historyInfo,
  .text-center.text-muted {
    font-size: .75rem;
  }
}

/* Variante iOS app : forcer la même règle même si le viewport n'est pas
   strictement <768px (Capacitor reporte parfois une largeur > au device). */
body.mallops-ios .pagination {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  justify-content: flex-start !important;
}
body.mallops-ios .pagination::-webkit-scrollbar { display: none; }
body.mallops-ios .pagination .page-item { flex-shrink: 0; }
body.mallops-ios .pagination .page-link {
  padding: .35rem .6rem !important;
  font-size: .85rem;
  min-width: 2rem;
  text-align: center;
}
body.mallops-ios .pagination .page-item:first-child .page-link {
  font-size: 0;
}
body.mallops-ios .pagination .page-item:first-child .page-link::before {
  content: '‹';
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}
body.mallops-ios .pagination .page-item:last-child .page-link {
  font-size: 0;
}
body.mallops-ios .pagination .page-item:last-child .page-link::before {
  content: '›';
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}



/* === Sidebar mobile iOS : safe-area + close button === */
/* Le logo CREATIVITYAPP est masqué par la status bar iPhone parce que la
   sidebar est position:fixed top:0 (échappe au padding du body).
   On lui injecte le safe-area-inset-top en padding interne. */
body.mallops-ios .pc-sidebar .m-header,
html.mallops-ios .pc-sidebar .m-header {
  padding-top: env(safe-area-inset-top, 0) !important;
}

/* Affiche le bouton de fermeture (X) en haut à droite quand la sidebar mobile
   est active. À l'origine il a class="d-none" en permanence — jamais wired. */
@media (max-width: 1024px) {
  .pc-sidebar.mob-sidebar-active #sidebar-close-mob {
    display: inline-flex !important;
    position: absolute;
    top: calc(env(safe-area-inset-top, 0) + 1rem);
    right: 0.75rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    color: #e7e9ee;
  }
  .pc-sidebar.mob-sidebar-active #sidebar-close-mob i {
    font-size: 1.2rem;
  }
  .pc-sidebar.mob-sidebar-active #sidebar-close-mob:active {
    background: rgba(255, 255, 255, 0.15);
  }
}



/* ===========================================================
   Modals scrollable — FIX UNIVERSEL (desktop + mobile) — v4
   -----------------------------------------------------------
   VRAIE cause racine : nos modals enveloppent body+footer dans un
   <form> (Créer/Modifier rôle, Créer/Modifier utilisateur, Assigner
   rôle...). Or `modal-dialog-scrollable` de Bootstrap suppose que
   .modal-body et .modal-footer sont enfants DIRECTS de .modal-content.
   Le <form> intermédiaire casse la chaîne flex → le body n'obtient
   jamais de hauteur contrainte → overflow-y:auto n'a rien à scroller,
   et le bas (footer + fin du body) est coupé. Sur desktop ET mobile.

   FIX : faire participer le <form> à la colonne flex de .modal-content,
   puis laisser le .modal-body (dans le form) scroller. Pas de media
   query : ça répare partout.
   =========================================================== */
.modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.modal-dialog-scrollable .modal-content > form > .modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}
.modal-dialog-scrollable .modal-content > form > .modal-header,
.modal-dialog-scrollable .modal-content > form > .modal-footer {
  flex-shrink: 0;
}

/* Spécificités mobile : safe-area iOS + momentum tactile sur le body. */
@media (max-width: 991.98px) {
  .modal {
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .modal-dialog-scrollable .modal-body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
}
