/* ==========================================================================
   TOKENS
   ========================================================================== */
:root {
  --color-bg: #0a0e1a;
  --color-surface: #131a2c;
  --color-surface-alt: #0d1424;
  --color-border: #232c42;
  --color-text: #e7ebf5;
  --color-text-muted: #8891a8;
  --color-primary: #6366f1;
  --color-primary-hover: #818cf8;
  --color-primary-soft: rgba(99, 102, 241, 0.15);
  --color-success: #22c55e;
  --color-success-hover: #34d872;
  --color-danger: #ef4444;
  --color-danger-hover: #f87171;
  --color-warning: #f59e0b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.55);
}

* {
  box-sizing: border-box;
}

/* ==========================================================================
   BASE
   ========================================================================== */
body {
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(
      circle at 15% 0%,
      rgba(99, 102, 241, 0.12),
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 100%,
      rgba(124, 58, 237, 0.1),
      transparent 50%
    ),
    var(--color-bg);
  color: var(--color-text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

h1,
h2,
h3 {
  color: #f9fafb;
  margin-top: 0;
}

.hidden {
  display: none;
}

.hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.error {
  color: var(--color-danger);
  font-size: 0.9rem;
  min-height: 1.1em;
}

/* ==========================================================================
   FORM FIELDS
   ========================================================================== */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--color-text-muted);
  font-weight: 500;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input[type="text"],
input[type="password"],
input[type="url"],
input[type="search"],
input[type="email"],
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 0.95rem;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

input::placeholder {
  color: #556080;
}

input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

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

.input-icon .icon {
  position: absolute;
  left: 12px;
  font-size: 0.95rem;
  pointer-events: none;
  opacity: 0.85;
}

.input-icon input {
  padding-left: 38px;
  padding-right: 40px;
}

.icon-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.95rem;
}

.icon-btn:hover {
  background: var(--color-border);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    transform 0.1s ease,
    opacity 0.15s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: #1e293b;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: #263049;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-surface);
}

/* Boutons génériques restants (utilisés dans le rendu JS des lignes) */
button {
  font-family: inherit;
}

/* ==========================================================================
   AUTH SCREEN
   ========================================================================== */
#master-screen:not(.hidden) {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

#master-screen.hidden {
  display: none;
}

.auth-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 960px;
  width: 100%;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
}

.auth-brand {
  background: linear-gradient(155deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-logo {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.auth-brand h1 {
  color: white;
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.brand-tagline {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  margin-bottom: 28px;
  line-height: 1.5;
}

.brand-features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.brand-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.92);
}

.feature-icon {
  font-size: 1.05rem;
}

.auth-form {
  background: var(--color-surface);
  padding: 48px 40px;
}

.auth-form h2 {
  font-size: 1.4rem;
  margin-bottom: 6px;
}

.auth-form .hint {
  margin-bottom: 20px;
}

.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.zero-knowledge-note {
  margin-top: 18px;
  margin-bottom: 0;
}

/* ==========================================================================
   VAULT SCREEN
   ========================================================================== */
#vault-screen:not(.hidden) {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#vault-screen.hidden {
  display: none;
}

.vault-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(13, 20, 36, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.brand-mini {
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.brand-mini-logo {
  font-size: 1.2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lock-btn {
  border-color: rgba(239, 68, 68, 0.35) !important;
  color: var(--color-danger-hover) !important;
}

.lock-btn:hover {
  background: rgba(239, 68, 68, 0.12) !important;
}

/* ==========================================================================
   MENU DÉROULANT DE L'EN-TÊTE (actions secondaires)
   ========================================================================== */
.menu-dropdown {
  position: relative;
}

.menu-toggle-btn[aria-expanded="true"] {
  background: var(--color-surface);
  border-color: var(--color-primary);
}

.menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 30;
  animation: modalSpawn 0.15s ease-out;
}

.menu-panel.hidden {
  display: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.menu-item:hover {
  background: var(--color-surface-alt);
}

.menu-item-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVE DE L'EN-TÊTE
   ========================================================================== */
@media (max-width: 640px) {
  .vault-header {
    padding: 12px 16px;
  }

  /* Ne garde que l'icône sur très petit écran, pour tous les boutons du header
     (Verrouiller, Menu, Retour au coffre...) et éviter tout débordement horizontal */
  .header-actions .btn span:last-child {
    display: none;
  }
}

.vault-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.vault-title-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 18px;
}

.vault-title-row h2 {
  font-size: 1.3rem;
}

.entries-count {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 0;
}

.vault-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 20px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0 12px;
}

.search-field .icon {
  opacity: 0.8;
  margin-right: 8px;
}

.search-field input {
  border: none;
  background: transparent;
  padding: 10px 0;
  flex: 1;
}

.search-field input:focus {
  box-shadow: none;
}

.folder-select {
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  min-width: 190px;
  font-size: 0.9rem;
}

.folder-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.add-btn {
  margin-left: auto;
}

/* ==========================================================================
   TABLE
   ========================================================================== */
.table-container {
  width: 100%;
  max-height: 500px;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

#entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

#entries-table th,
#entries-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--color-border);
  text-align: left;
  vertical-align: middle !important; /* 🎯 Force toutes les cellules au même niveau horizontal */
}

#entries-table th {
  position: sticky;
  top: 0;
  background: var(--color-surface-alt);
  color: var(--color-text-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  z-index: 10;
  border-bottom: 1px solid var(--color-border);
}

#entries-table tbody tr {
  transition: background 0.15s ease;
}

#entries-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.06);
}

#entries-table tbody tr:last-child td {
  border-bottom: none;
}

/* 🎯 CORRECTION STRICTE DU DISPLAY FLEX INJECTÉ PAR LE JS (ÉCRAN PC) */
@media (min-width: 769px) {
  #entries-table td[data-label="Mot de passe"] {
    display: table-cell !important; /* Écrase le flex du JS sur ordinateur */
    white-space: nowrap;
  }

  #entries-table td[data-label="Mot de passe"] span {
    display: inline-block;
    vertical-align: middle;
  }

  #entries-table td[data-label="Mot de passe"] button {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
  }
}

#entries-table td a {
  color: var(--color-primary-hover);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

#entries-table td a:hover {
  text-decoration: underline;
}

#entries-table td a:visited {
  color: var(--color-primary-hover);
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* Boutons d'action & jetons dans le tableau (générés en JS) */
.action-btn {
  margin-right: 6px;
  font-size: 0.78rem;
  padding: 6px 10px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  color: white;
}

.action-btn.edit {
  background: var(--color-success);
}

.action-btn.edit:hover {
  background: var(--color-success-hover);
}

.action-btn.delete {
  background: var(--color-danger);
}

.action-btn.delete:hover {
  background: var(--color-danger-hover);
}

.toggle-pw-btn {
  background: transparent;
  padding: 3px 7px;
  margin-left: 8px;
  font-size: 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.toggle-pw-btn:hover {
  background: var(--color-border);
}

.hidden-password {
  font-family: monospace;
  letter-spacing: 1.5px;
}

/* ==========================================================================
   MODALE : AJOUT / MODIFICATION D'UNE ENTRÉE
   ========================================================================== */
#entry-form:not(.hidden) {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 18, 0.72);
  backdrop-filter: blur(4px);
  z-index: 1000;
  overflow-y: auto;
}

#entry-form.hidden {
  display: none;
}

.modal-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  max-width: 500px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  margin: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-header h3 {
  font-size: 1.15rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}

.modal-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.password-container {
  display: flex;
  gap: 8px;
}

.password-container input {
  flex: 1;
}

.gen-options {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.gen-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.strength-bar {
  height: 5px;
  width: 0%;
  margin-top: 8px;
  border-radius: 4px;
  background: transparent;
  transition:
    width 0.3s ease,
    background-color 0.3s ease;
}

.strength-bar.weak {
  width: 33%;
  background-color: var(--color-danger);
}

.strength-bar.medium {
  width: 66%;
  background-color: var(--color-warning);
}

.strength-bar.strong {
  width: 100%;
  background-color: var(--color-success);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   TOAST
   ========================================================================== */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e1b4b;
  color: #c7d2fe;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: 1px solid #4338ca;
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 9999;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  max-width: min(360px, calc(100vw - 32px));
}

.toast-hidden {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}

.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   🔑 STYLES POUR LES CODES DE SECOURS (RECOVER & ACTIVATION 2FA)
   ========================================================================== */
.btn-link {
  background: transparent;
  border: none;
  color: var(--color-primary-hover);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px;
}

.btn-link:hover {
  color: var(--color-text);
}

.backup-codes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background-color: var(--color-surface-alt);
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin: 15px 0;
}

.backup-code-item {
  background: var(--color-surface);
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: bold;
  color: var(--color-text);
  letter-spacing: 1px;
}

.warning-text {
  font-size: 0.85rem;
  color: var(--color-warning);
  background-color: rgba(245, 158, 11, 0.1);
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(245, 158, 11, 0.3);
  text-align: left;
  line-height: 1.4;
}

#backup-codes-modal:not(.hidden) {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 18, 0.85);
  backdrop-filter: blur(6px);
  z-index: 2100;
}

/* Couleur de la bordure latérale pour les événements de sécurité 2FA */
.activity-row-securite {
  border-left-color: #a855f7; /* Violet / Purple */
}

/* ==========================================================================
   📤 STYLES D'IMPORTATION CSV (DRAG & DROP)
   ========================================================================== */
.file-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  background: var(--color-surface-alt);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background-color 0.2s ease;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* Empêche le tableau de s'étirer à l'infini */
#entries-table {
  width: 100%;
  table-layout: fixed; /* 💡 Forcer le respect des largeurs de colonnes */
}

/* Redimensionnement propre des colonnes */
#entries-table th:nth-child(1),
#entries-table td:nth-child(1) {
  width: 22%;
} /* Nom */
#entries-table th:nth-child(2),
#entries-table td:nth-child(2) {
  width: 30%;
} /* URL */
#entries-table th:nth-child(3),
#entries-table td:nth-child(3) {
  width: 20%;
} /* Identifiant */
#entries-table th:nth-child(4),
#entries-table td:nth-child(4) {
  width: 18%;
} /* Mdp */
#entries-table th:nth-child(5),
#entries-table td:nth-child(5) {
  width: 10%;
} /* Actions */

/* Tronquage visuel avec "..." pour la colonne URL */
#entries-table td[data-label="URL"] a {
  display: block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; /* 💡 Ajoute les "..." automatiques */
}

/* ==========================================================================
   MODALE DE CONFIRMATION PERSONNALISÉE
   ========================================================================== */
#confirm-modal:not(.hidden),
#report-modal:not(.hidden),
#guide-modal:not(.hidden),
#twofa-modal:not(.hidden),
#import-modal:not(.hidden) {
  /* 💡 Ajoute cette ligne ici */
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 18, 0.8);
  backdrop-filter: blur(6px);
  z-index: 2000;
}

#confirm-modal.hidden {
  display: none;
}

.confirm-card {
  max-width: 420px !important;
  border: 1px solid var(--color-danger) !important;
  animation: modalSpawn 0.2s ease-out;
}

.confirm-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text);
  margin-bottom: 14px;
}

.confirm-body strong {
  color: var(--color-danger-hover);
}

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

/* ==========================================================================
   CORRECTION AFFICHAGE MOT DE PASSE LONG
   ========================================================================== */
#entries-table td:nth-child(4) {
  max-width: 200px;
  word-break: break-all;
  white-space: normal;
}

#entries-table td:nth-child(4) .toggle-pw-btn {
  display: inline-block;
  vertical-align: middle;
  margin-left: 6px;
}

.name-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
}

.folder-badge {
  display: inline-flex !important;
  align-items: center;
  background-color: var(--color-primary-soft) !important;
  color: var(--color-primary-hover) !important;
  font-size: 0.7rem !important;
  font-weight: 700 !important;
  padding: 2px 8px !important;
  border-radius: 20px !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  width: fit-content !important;
}

.entry-title {
  font-weight: 500;
  color: var(--color-text);
}

/* ==========================================================================
   📁 MODALE DOSSIER PERSONNALISÉE
   ========================================================================== */
#folder-modal:not(.hidden) {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 7, 18, 0.8);
  backdrop-filter: blur(6px);
  z-index: 2000;
}

#folder-modal.hidden {
  display: none;
}

.folder-card {
  max-width: 400px !important;
  border: 1px solid var(--color-border) !important;
  animation: modalSpawn 0.2s ease-out;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 860px) {
  .auth-card {
    grid-template-columns: 1fr;
    max-width: 460px;
  }

  .auth-brand {
    padding: 32px 28px;
  }

  .brand-features {
    display: none;
  }

  .auth-form {
    padding: 32px 28px;
  }
}

@media (max-width: 768px) {
  .vault-header {
    padding: 12px 16px;
  }

  .vault-main {
    padding: 20px 14px 40px;
  }

  .vault-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .add-btn {
    margin-left: 0;
  }

  .folder-select {
    width: 100%;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .password-container {
    flex-direction: column;
  }

  .password-container input {
    width: 100%;
  }

  #generate-btn {
    width: 100%;
  }

  .table-container {
    max-height: none;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  #entries-table thead {
    display: none;
  }

  #entries-table,
  #entries-table tbody,
  #entries-table tr,
  #entries-table td {
    display: block;
    width: 100%;
  }

  #entries-table tr {
    background: var(--color-surface) !important;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  #entries-table td {
    text-align: left;
    padding: 7px 2px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
  }

  #entries-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--color-text-muted);
    margin-right: 8px;
  }

  .action-btn {
    margin-top: 4px;
    padding: 7px 10px;
    font-size: 0.8rem;
    flex: 1;
    text-align: center;
  }

  #entries-table td:last-child {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    margin-top: 6px;
  }

  .modal-card {
    padding: 22px;
  }

  #toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    max-width: none;
    text-align: center;
  }

  /* RESPONSIVE MODALE RAPPORT (le donut/score/tuiles ont leur propre media query
     dédiée plus bas ; ceci ne concerne que le contenu des listes) */
  @media (max-width: 600px) {
    #report-list-pwned > div,
    #report-list-weak > div {
      flex-direction: column !important;
      align-items: stretch !important;
      gap: 8px !important;
      padding: 12px 0 !important;
    }

    #report-list-pwned strong,
    #report-list-weak strong {
      white-space: normal !important;
    }

    #report-list-pwned .action-btn,
    #report-list-weak .action-btn {
      width: 100% !important;
      text-align: center;
      padding: 8px !important;
    }
  }

  /* ==========================================================================
   📱 ALIGNEMENT DE L'EMOJI ET FIX DES RETOURS À LA LIGNE INVOLONTAIRES
   ========================================================================== */
  @media (max-width: 768px) {
    /* Empêche le label "Mot de passe" de casser son dernier caractère */
    td[data-label="Mot de passe"]::before {
      white-space: nowrap !important;
      padding-right: 10px !important;
    }

    /* Force la structure en ligne propre sur mobile */
    td[data-label="Identifiant"],
    td[data-label="Mot de passe"] {
      display: flex !important;
      justify-content: space-between !important;
      align-items: center !important;
    }

    /* Force le span et le bouton à faire bloc à la fin de la ligne sur mobile */
    td[data-label="Identifiant"] > :not(::before),
    td[data-label="Mot de passe"] > :not(::before) {
      display: inline-flex !important;
      align-items: center !important;
      gap: 6px !important; /* Fixe l'émoji collé à 6px après le texte */
      justify-content: flex-end !important;
    }

    /* Bloque le saut de ligne involontaire du dernier point de mot de passe */
    td[data-label="Identifiant"] span,
    td[data-label="Mot de passe"] span {
      flex: 0 1 auto !important;
      text-align: right !important;
      white-space: nowrap !important;
    }

    /* Autorise le mot de passe en clair à retourner à la ligne s'il est trop long */
    td[data-label="Mot de passe"] span:not(.hidden-password) {
      white-space: normal !important;
      word-break: break-all !important;
    }

    td[data-label="Identifiant"] button,
    td[data-label="Mot de passe"] button {
      flex-shrink: 0 !important;
      margin: 0 !important;
      display: inline-block !important;
    }
  }

  /* ==========================================================================
   🏷️ BADGES DES DOSSIERS / CATÉGORIES (CORRIGÉ SANS ACCOLADE EN TROP)
   ========================================================================== */
  .name-wrapper {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-start;
  }

  .folder-badge {
    display: inline-flex !important;
    align-items: center;
    background-color: var(--color-primary-soft) !important;
    color: var(--color-primary-hover) !important;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 9px !important;
    border-radius: 20px !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    width: auto !important;
  }

  .entry-title {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.95rem;
  }

  @media (max-width: 768px) {
    .name-wrapper {
      align-items: flex-end;
      text-align: right;
      width: 100%;
    }
  }
}

/* ==========================================================================
   🕓 HISTORIQUE D'ACTIVITÉ : FILTRES ET LIGNES
   ========================================================================== */
.filter-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.filter-chip {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
}

.filter-chip.active {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary-hover);
}

.activity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0 12px 12px;
  border-bottom: 1px solid var(--color-border);
  border-left: 3px solid transparent;
}

.activity-row:last-child {
  border-bottom: none;
}

.activity-row-connexion {
  border-left-color: var(--color-primary);
}

.activity-row-ajout {
  border-left-color: var(--color-success);
}

.activity-row-modification {
  border-left-color: var(--color-warning);
}

.activity-row-suppression {
  border-left-color: var(--color-danger);
}

.activity-row-consultation {
  border-left-color: #38bdf8;
}

/* ==========================================================================
   📊 RAPPORT DE SÉCURITÉ
   ========================================================================== */
.report-card {
  max-width: 620px !important;
}

.report-score-section {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px;
  margin-bottom: 18px;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.report-donut {
  flex-shrink: 0;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: conic-gradient(var(--color-border) 0deg 360deg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease;
}

.report-donut-hole {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--color-surface-alt);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.report-donut-hole span {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-text);
}

.report-donut-hole small {
  font-size: 0.68rem;
  color: var(--color-text-muted);
}

.report-score-details {
  flex: 1;
  min-width: 0;
}

.report-score-label {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 4px 0;
}

.report-score-hint {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0 0 12px 0;
  line-height: 1.5;
}

.report-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.report-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.report-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.report-dot-healthy {
  background: var(--color-success);
}

.report-dot-weak {
  background: var(--color-warning);
}

.report-dot-pwned {
  background: var(--color-danger);
}

.report-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.report-stat-tile {
  background: var(--color-surface-alt);
  padding: 14px;
  border-radius: var(--radius-md);
  text-align: center;
  border: 1px solid var(--color-border);
}

.report-stat-icon {
  font-size: 1.3rem;
}

.report-stat-tile h4 {
  margin: 6px 0 2px 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  font-weight: 600;
}

.report-stat-tile p {
  font-size: 1.3rem;
  font-weight: bold;
  margin: 0;
}

.report-stat-tile-warning p {
  color: var(--color-warning);
}

.report-stat-tile-danger p {
  color: var(--color-danger);
}

.report-lists-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.report-list {
  max-height: 180px;
  overflow-y: auto;
  background: var(--color-surface-alt);
  padding: 10px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-top: 6px;
}

.report-list-pwned {
  border: 1px solid #ef4444;
}

.report-list-weak {
  border: 1px solid #f59e0b;
}

@media (max-width: 560px) {
  .report-score-section {
    flex-direction: column;
    text-align: center;
  }

  .report-legend {
    justify-content: center;
  }

  .report-stats-row {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   ⏳ ÉCRAN DE CHARGEMENT (restauration de session)
   ========================================================================== */
#boot-screen:not(.hidden) {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

#boot-screen.hidden {
  display: none;
}

.boot-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: boot-spin 0.7s linear infinite;
}

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