:root {
  --lpf-color-page: #f4f7fb;
  --lpf-color-surface: #ffffff;
  --lpf-color-surface-secondary: #f8fafc;
  --lpf-color-text: #213042;
  --lpf-color-text-secondary: #64748b;
  --lpf-color-border: #e5ebf2;
  --lpf-color-primary: #2563eb;
  --lpf-color-success: #166534;
  --lpf-color-warning: #92400e;
  --lpf-color-danger: #b42318;
  --lpf-radius-card: 12px;
  --lpf-shadow-card: 0 3px 10px rgba(15, 23, 42, 0.04);
  --lpf-touch-target-min: 40px;
  --lpf-mobile-bottom-nav-space: 72px;
}

[data-theme="dark"] {
  --lpf-color-page: #0f172a;
  --lpf-color-surface: #172033;
  --lpf-color-surface-secondary: #1e293b;
  --lpf-color-text: #f8fafc;
  --lpf-color-text-secondary: #cbd5e1;
  --lpf-color-border: #334155;
  --lpf-color-primary: #60a5fa;
  --lpf-color-success: #4ade80;
  --lpf-color-warning: #fcd34d;
  --lpf-color-danger: #f87171;
  --lpf-radius-card: 12px;
  --lpf-shadow-card: 0 3px 10px rgba(0, 0, 0, 0.28);
  --lpf-touch-target-min: 40px;
  --lpf-mobile-bottom-nav-space: 72px;
}

.about-philosophy-viewer.ql-container.ql-snow {
  border: 0;
}

.dashboard-task-type-icon.dashboard-task-state-non_realisee {
  color: var(--lpf-color-text-secondary);
  filter: grayscale(1) opacity(.68);
}

.dashboard-task-type-icon.dashboard-task-state-partiellement_realisee {
  color: var(--lpf-color-warning);
  filter: invert(52%) sepia(93%) saturate(940%) hue-rotate(359deg) brightness(99%) contrast(102%);
}

.dashboard-task-type-icon.dashboard-task-state-realisee {
  color: var(--lpf-color-success);
  filter: invert(36%) sepia(82%) saturate(640%) hue-rotate(94deg) brightness(91%) contrast(88%);
}

.dashboard-task-type-icon.dashboard-task-state-annulee {
  color: var(--lpf-color-danger);
  filter: invert(19%) sepia(91%) saturate(2859%) hue-rotate(349deg) brightness(77%) contrast(90%);
}

.admin-secondary-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--lpf-color-border);
}

.admin-secondary-nav-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-secondary-nav-button {
  min-height: var(--lpf-touch-target-min);
}

.admin-secondary-nav-select-label,
.admin-secondary-nav-select {
  display: none;
}

@media (max-width: 768px) {
  .admin-secondary-nav-buttons {
    display: none;
  }

  .admin-secondary-nav-select-label,
  .admin-secondary-nav-select {
    display: block;
    width: 100%;
  }

  .admin-secondary-nav-select-label {
    color: var(--lpf-color-text);
    font-size: .875rem;
    font-weight: 700;
  }

  .admin-secondary-nav-select {
    min-height: var(--lpf-touch-target-min);
  }

  #pageContent .rdv-filters .rdv-filter-item:has(#rdvFilterDateFrom),
  #pageContent .rdv-filters .rdv-filter-item:has(#rdvFilterDateTo) {
    display: none;
  }

  #pageContent .entretiens-mobile-sort-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
  }

  #pageContent .entretiens-mobile-sort-controls .table-sort-button {
    min-height: var(--lpf-touch-target-min);
    padding: 8px 10px;
  }


  #pageContent .admin-mobile-sort-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
  }

  #pageContent .admin-mobile-sort-controls .table-sort-button {
    min-height: var(--lpf-touch-target-min);
    padding: 8px 10px;
  }

  #pageContent .admin-mobile-account-card {
    margin-top: 12px;
  }

  #pageContent .admin-mobile-account-card .lpf-mobile-card-meta-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #pageContent .admin-mobile-account-card.admin-test-account-row {
    border-left: 3px solid var(--lpf-color-danger);
  }

  #pageContent .profil-page.lpf-mobile-card {
    gap: 0;
  }

  #pageContent .legal-notice-section.lpf-mobile-card {
    gap: 0;
  }

  #pageContent .admin-legal-section.lpf-mobile-card {
    gap: 0;
  }

  #pageContent .phrase-day-mobile-sort-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0;
  }

  #pageContent .phrase-day-mobile-sort-controls .table-sort-button {
    min-height: var(--lpf-touch-target-min);
    padding: 8px 10px;
  }

  #pageContent .phrase-day-mobile-list {
    display: grid;
    gap: 12px;
  }

  .lpf-mobile-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--lpf-color-border);
    border-radius: var(--lpf-radius-card);
    background: var(--lpf-color-surface);
    box-shadow: var(--lpf-shadow-card);
    color: var(--lpf-color-text);
  }

  .lpf-mobile-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
  }

  .lpf-mobile-card-title {
    min-width: 0;
    margin: 0;
    color: var(--lpf-color-text);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .lpf-mobile-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
  }

  .lpf-mobile-card-meta {
    display: grid;
    gap: 8px;
    min-width: 0;
    color: var(--lpf-color-text-secondary);
  }

  .lpf-mobile-card-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    align-items: center;
    min-width: 0;
  }

  .lpf-mobile-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--lpf-color-border);
  }

  .lpf-mobile-card-actions > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--lpf-touch-target-min);
  }

  .lpf-mobile-card-details {
    padding-top: 12px;
    border-top: 1px solid var(--lpf-color-border);
    color: var(--lpf-color-text-secondary);
  }

  .lpf-mobile-chip:not(.documents-type-badge):not(.rdv-status) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: var(--lpf-touch-target-min);
    max-width: 100%;
    padding: 0 10px;
    border: 1px solid var(--lpf-color-border);
    border-radius: var(--lpf-radius-card);
    background: var(--lpf-color-surface-secondary);
    color: var(--lpf-color-text);
    font-size: .875rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  /* Compatibilité transitoire avec les cartes mobiles existantes des Tâches. */
  #pageContent .tache-mobile-card.lpf-mobile-card {
    gap: 0;
  }

  #pageContent .tache-mobile-card.lpf-mobile-card .tache-mobile-state.lpf-mobile-chip {
    min-height: auto;
    border: 0;
  }

  #pageContent .tache-mobile-card.lpf-mobile-card .task-type-badge.lpf-mobile-chip {
    min-height: auto;
    padding: 4px 7px;
    border: 1px solid color-mix(in srgb, var(--task-type-tint) 30%, #ffffff);
    border-radius: 999px;
    background: color-mix(in srgb, var(--task-type-tint) 10%, #ffffff);
    color: #334155;
    font-size: 12px;
    line-height: 1.25;
  }

  #pageContent .tache-mobile-card.lpf-mobile-card .tache-mobile-card-actions.lpf-mobile-card-actions .table-action {
    min-height: var(--lpf-touch-target-min);
  }

  #pageContent .tache-mobile-card.lpf-mobile-card .tache-mobile-card-details.lpf-mobile-card-details {
    padding-top: 0;
  }

  #pageContent .db2-card.lpf-mobile-card {
    gap: 0;
  }

  #pageContent .db2-card .db2-card-header.lpf-mobile-card-header {
    flex-wrap: wrap;
    align-items: center;
  }

  #pageContent .db2-card .db2-card-header.lpf-mobile-card-header > h3 {
    flex: 1 1 150px;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #pageContent .db2-card .db2-card-header.lpf-mobile-card-header > .db2-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--lpf-touch-target-min);
    margin-left: auto;
    padding: 0 4px;
  }
  #pageContent .admin-connected-section .admin-connected-mobile-card.lpf-mobile-card {
    box-shadow: none;
  }

}

@media (min-width: 1025px) {
  #pageContent .taches-responsive-table-wrapper .taches-table {
    table-layout: auto;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table th:nth-child(1),
  #pageContent .taches-responsive-table-wrapper .taches-table td:nth-child(1) {
    width: 115px;
    min-width: 115px;
    white-space: nowrap;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table th:nth-child(2),
  #pageContent .taches-responsive-table-wrapper .taches-table td:nth-child(2) {
    width: 160px;
    min-width: 160px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table th:nth-child(3),
  #pageContent .taches-responsive-table-wrapper .taches-table td:nth-child(3),
  #pageContent .taches-responsive-table-wrapper .taches-table th:nth-child(4),
  #pageContent .taches-responsive-table-wrapper .taches-table td:nth-child(4),
  #pageContent .taches-responsive-table-wrapper .taches-table th:nth-child(5),
  #pageContent .taches-responsive-table-wrapper .taches-table td:nth-child(5) {
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

  /* Variante avec colonne Accompagné : 10 colonnes. */
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(3),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(3) {
    width: 170px;
    min-width: 170px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(4),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(4) {
    width: 280px;
    min-width: 280px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(5),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(5) {
    width: 320px;
    min-width: 320px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(6),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(6) {
    width: 160px;
    min-width: 160px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(7),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(7),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(8),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(8),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(9),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(9) {
    width: 120px;
    min-width: 120px;
    white-space: nowrap;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) th:nth-child(10),
  #pageContent .taches-responsive-table-wrapper .taches-table:not(.without-accompagne) td:nth-child(10) {
    width: 150px;
    min-width: 150px;
    white-space: nowrap;
  }

  /* Variante sans colonne Accompagné : 9 colonnes. */
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(3),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(3) {
    width: 170px;
    min-width: 170px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(4),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(4) {
    width: 320px;
    min-width: 320px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(5),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(5) {
    width: 360px;
    min-width: 360px;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(6),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(6),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(7),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(7),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(8),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(8) {
    width: 120px;
    min-width: 120px;
    white-space: nowrap;
  }

  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne th:nth-child(9),
  #pageContent .taches-responsive-table-wrapper .taches-table.without-accompagne td:nth-child(9) {
    width: 150px;
    min-width: 150px;
    white-space: nowrap;
  }
}

.recent-activity-modal {
  box-sizing: border-box;
  width: min(calc(100vw - 32px), 1100px);
  max-height: calc(100dvh - 32px);
}

.recent-activity-modal .modal-body {
  min-width: 0;
  max-height: calc(100dvh - 180px);
  overflow: auto;
}

.recent-activity-modal .table-wrapper {
  width: 100%;
  margin: 0;
  overflow-x: auto;
}

.recent-activity-modal .modern-table {
  width: 100%;
  min-width: 640px;
}

.recent-activity-modal .modern-table th,
.recent-activity-modal .modern-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .recent-activity-modal {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .recent-activity-modal .modal-body {
    max-height: calc(100dvh - 152px);
  }

  .recent-activity-modal .modern-table {
    min-width: 560px;
  }
}
