/* --- 1. VARIABLES & RESET --------------------------------------------------------------------------------------- */
:root {
    --bg-sidebars: #d9dbdb; 
    --bg-main: #f4f7f6;
    --btn-l1-inactive: #b5b4b0;
    --btn-l1-active: #d8d7d4;
    --btn-l2-inactive: #c7c6c3;
    --btn-l2-active: #e6e5e3;
    --color-primary: #81daea;
    --header-height: 120px;
}

* { box-sizing: border-box; }

/* --- PRIORITÉ ABSOLUE : Angles carrés pour tous les éléments --- */
input, select, textarea, .solum-search-container, .panel, button, .btn-nav, .btn-action, .btn-module, .error-msg, .modal-box, #toggleBtn {
    border-radius: 0 !important;
}

body { 
    margin: 0; font-family: 'Roboto', 'Segoe UI', sans-serif; background-color: var(--bg-main); 
    color: #333; padding-top: var(--header-height); 
    height: 100vh; 
    height: calc(var(--vh, 1vh) * 100); 
    overflow: hidden; 
}

/* --- UNIFORMISATION SYSTÉMATIQUE DES POLICES --- */
body, input, select, textarea, .header-link {
    font-family: 'Roboto', sans-serif !important;
}
h1, h2, h3, h4, h5, h6, .modal-title, legend, button, .btn-nav, .btn-action, .btn-module, .panel h2, .page-title {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-weight: normal !important;
}

/* --- 2. HEADER FIGÉ --------------------------------------------------------------------------------------------- */
.main-header { 
    position: fixed; top: 0; left: 0; width: 100%; height: var(--header-height);
    background-color: #2c3e50; display: flex; align-items: center; padding: 0 20px; color: white;
}
.header-left { display: flex; align-items: center; width: 100%; }
.header-logo { height: 80px; width: auto; }
.header-text { margin-left: 20px; margin-top: 15px; flex-grow: 1; }
.header-text h1 { margin: 0; font-size: 1.6rem; font-weight: normal; }
.header-sub { display: flex; align-items: baseline; margin-top: 5px; }
.header-sub p { margin: 0; font-size: 1rem; opacity: 0.9; }
.header-link { font-family: 'Roboto', 'Segoe UI', sans-serif; color: #ffffff; font-size: 0.85rem; text-decoration: none; opacity: 0.7; transition: opacity 0.2s; margin-left: auto; margin-right: 20px; }
.header-link:hover { opacity: 1; text-decoration: underline; }

/* --- 3. SIDEBARS --------------------------------------------------------------------------------- */
.app-wrapper { 
    display: flex; 
    height: calc(100vh - var(--header-height)); 
    height: calc((var(--vh, 1vh) * 100) - var(--header-height)); 
}

.sidebar-nav { 
    width: 200px; 
    min-width: 100px;
    max-width: 300px;
    flex-shrink: 0;
    background-color: var(--bg-sidebars); 
    padding: 20px 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
}

.nav-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: visible !important;
    height: 100%;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.nav-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Ajustement dynamique des boutons de la sidebar navigation */
.sidebar-nav .btn-nav,
.sidebar-nav a {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 10px 8px !important;
    font-size: 0.85rem !important;
}

/* --- STYLES MODULES EN SIDEBAR NAVIGATION --- */
.sidebar-modules-container {
    display: flex;
    flex-direction: column;
    gap: 4px !important; /* Espacement de 4px entre les modules (identique à la sidebar_actions) */
    width: 100%;
    box-sizing: border-box;
    background-color: var(--bg-sidebars, #f4f7f6);
    -webkit-animation: sidebarModulesSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation: sidebarModulesSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@-webkit-keyframes sidebarModulesSlideDown {
    0% {
        opacity: 0;
        -webkit-transform: translateY(-8px);
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

@keyframes sidebarModulesSlideDown {
    0% {
        opacity: 0;
        -webkit-transform: translateY(-8px);
        transform: translateY(-8px);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0);
        transform: translateY(0);
    }
}

.sidebar-module-wrapper {
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* Boutons principaux, secondaires et tertiaires */
.btn-sidebar-module,
.btn-sidebar-secondary,
.btn-sidebar-tertiary {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    border: none !important;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 0.85rem !important;
    font-weight: normal !important;
    color: #ffffff !important;
    text-align: center !important;
    line-height: 1.2 !important;
    padding: 10px 8px !important; /* Même taille et espacement que .btn-action dans sidebar_actions */
    white-space: normal !important;
    word-break: break-word !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 38px !important;
    margin: 0 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    transition: opacity 0.25s ease, font-size 0.2s ease, background-color 0.2s ease, font-weight 0.2s ease !important;
}

.btn-sidebar-module:hover,
.btn-sidebar-secondary:hover,
.btn-sidebar-tertiary:hover {
    opacity: 0.95 !important;
}

/* Masquer les boutons des autres modules sans modifier la géométrie pour éviter tout saut/scintillement */
.sidebar-modules-container:has(.sidebar-module-wrapper:hover) .sidebar-module-wrapper:not(:hover),
.sidebar-modules-container:has(.sidebar-module-wrapper:focus-within) .sidebar-module-wrapper:not(:focus-within),
.sidebar-modules-container.has-active-module .sidebar-module-wrapper:not(.is-active-module) {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease, visibility 0.15s ease !important;
}

.sidebar-modules-container .sidebar-module-wrapper:hover .btn-sidebar-module,
.sidebar-modules-container .sidebar-module-wrapper:focus-within .btn-sidebar-module,
.sidebar-modules-container .sidebar-module-wrapper.is-open .btn-sidebar-module,
.sidebar-module-wrapper.is-active-module .btn-sidebar-module {
    opacity: 1 !important;
    font-size: calc(0.85rem + 1px) !important; /* Taille de police 1px supérieure pour le bouton père survolé */
    font-weight: bold !important; /* Texte en corps de police gras lors du survol */
    transition: opacity 0.15s ease 0s, font-size 0.15s ease 0s, font-weight 0.15s ease 0s !important;
}

/* Conteneur des boutons secondaires (accordéon fluide vers le bas) */
.sidebar-secondary-container {
    display: flex;
    flex-direction: column;
    gap: 2px !important;
    width: 100%;
    box-sizing: border-box;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    margin-top: 0;
    transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, margin 0.2s ease;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: max-height, opacity;
}

.sidebar-module-wrapper:hover .sidebar-secondary-container,
.sidebar-module-wrapper:focus-within .sidebar-secondary-container,
.sidebar-module-wrapper.is-open .sidebar-secondary-container,
.sidebar-module-wrapper.is-active-module .sidebar-secondary-container {
    max-height: 600px;
    opacity: 1;
    margin-top: 2px;
    transition-delay: 0s !important; /* Déploiement immédiat des boutons fils dès le survol du bouton père */
}

/* Poignée de redimensionnement de la sidebar_nav (2 triangles isocèles opposés) */
.sidebar-nav-resizer {
    position: absolute;
    top: 50%;
    right: -11px;
    transform: translateY(-50%);
    width: 22px;
    height: 32px;
    background-color: transparent;
    border: none;
    box-shadow: none;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    user-select: none;
    -webkit-user-select: none;
}

.sidebar-nav-resizer:hover,
.sidebar-nav-resizer.is-dragging {
    background-color: transparent;
    border: none;
}

.sidebar-nav-resizer .resizer-triangles-svg {
    display: block;
    pointer-events: none;
}

.sidebar-actions { 
    width: 200px;
    min-width: 60px;
    max-width: 300px;
    flex-shrink: 0;
    background-color: var(--bg-sidebars); 
    padding: 20px 12px; 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    overflow: visible; 
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

/* Ajustement dynamique des boutons de la sidebar actions */
.sidebar-actions .btn-action,
.sidebar-actions button,
.sidebar-actions a {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 10px 8px !important;
    font-size: 0.85rem !important;
}

/* Poignée de redimensionnement de la sidebar_actions (2 triangles isocèles opposés) */
.sidebar-actions-resizer {
    position: absolute;
    top: 50%;
    left: -11px;
    transform: translateY(-50%);
    width: 22px;
    height: 32px;
    background-color: transparent;
    border: none;
    box-shadow: none;
    cursor: ew-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    user-select: none;
    -webkit-user-select: none;
}

.sidebar-actions-resizer:hover,
.sidebar-actions-resizer.is-dragging {
    background-color: transparent;
    border: none;
}

.sidebar-actions-resizer .resizer-triangles-svg {
    display: block;
    pointer-events: none;
}

.actions-content { 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
    flex-grow: 1;
}

.sidebar-actions.collapsed { 
    width: 60px; 
    padding: 20px 10px; 
}

.sidebar-actions.collapsed .actions-content { display: none !important; }
.sidebar-actions.collapsed #solum-notifications-panel { display: none !important; }

/* Zone de message modale (sidebar_actions) - Titre et message */
#solum-next-command-title {
    display: block !important;
    font-size: 0.88rem !important;
    line-height: 1.2 !important;
    font-weight: bold !important;
    margin-bottom: 2px !important;
}

#solum-next-command-text {
    display: block !important;
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
    font-weight: normal !important;
}

.main-content { 
    flex-grow: 1; 
    padding: 20px; 
    overflow-y: auto; 
}

/* --- MODULE RÉPERTOIRES : LIMITATION DU SCROLLBAR VERTICAL À LA ZONE D'ÉDITION / CONSULTATION --- */
.main-content.repertoire-main-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 0;
    position: relative;
    box-sizing: border-box;
}

.repertoire-main-content #solum-ai-module-container {
    margin: 0 !important;
    width: 100% !important;
    flex-shrink: 0 !important;
    border-bottom: 1px solid #c8d0d8 !important;
    box-sizing: border-box !important;
}

.repertoire-scroll-container {
    flex-grow: 1;
    flex-shrink: 1;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
    direction: ltr; /* Positionne le scrollbar vertical à droite, contre la sidebar_actions */
    box-sizing: border-box;
}

.repertoire-content-inner {
    direction: ltr;
    padding: 20px;
    min-height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* --- 4. ÉLÉMENTS INTERACTIFS ------------------------------------------------------------------------------------ */
#toggleBtn, .btn-toggle-sidebar {
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: #b5b4b0 !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: 0 !important;
    cursor: pointer;
    font-size: 0.85rem;
    flex-shrink: 0;
}
#toggleBtn svg, #toggleBtnIcon, .btn-toggle-sidebar svg {
    width: 14px;
    height: 14px;
    fill: #ffffff !important;
    color: #ffffff !important;
}

.btn-nav, .btn-action, .btn-display, .btn-danger { 
    display: block; 
    width: 100%; 
    padding: 10px 8px; 
    border: none; 
    border-radius: 0 !important; 
    text-align: center; 
    text-decoration: none; 
    font-family: 'Plus Jakarta Sans', sans-serif; 
    cursor: pointer; 
    transition: background-color 0.2s, filter 0.2s; 
    margin-bottom: 0 !important; 
    font-size: 0.85rem; 
    font-weight: normal !important; 
    color: #ffffff !important; 
}

/* Bouton standard (Inactif / Annuler) */
.btn-nav, .bouton_standard { background-color: #b5b4b0 !important; color: #ffffff !important; font-weight: normal !important; }

/* Bouton Portail / Parvis */
.btn-portail, button.btn-portail, .btn-nav.btn-portail { background-color: #a5a9b3 !important; color: #ffffff !important; font-weight: normal !important; }

/* Bouton Action de modification dans une page fille (Orange) */
.btn-action, .bouton_suite { background-color: #cc9966 !important; color: #ffffff !important; font-weight: normal !important; }

/* Bouton Éditer dans les lignes de titre de module de l'anabase (Cursus) */
.btn-anabase-editer,
a.btn-anabase-editer,
a.btn-anabase-editer:link,
a.btn-anabase-editer:visited,
a.btn-anabase-editer:hover,
a.btn-anabase-editer:active,
a.btn-anabase-editer:focus {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    background-color: #cc9966 !important;
    background: #cc9966 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    text-decoration-line: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 0.60rem !important;
    font-weight: normal !important;
    border-radius: 0 !important;
    border: none !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    line-height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    user-select: none !important;
}
a.btn-anabase-editer:hover {
    filter: brightness(0.93) !important;
    text-decoration: none !important;
    color: #ffffff !important;
}

/* Bouton Action d'affichage (Gris) */
.btn-display, #btn-show-ollama { background-color: #6c757d !important; color: #ffffff !important; font-weight: normal !important; }

/* Bouton Confirmation Retour à l'état précédent (Rouge) */
.btn-danger, .bouton_Annulation { background-color: #cc3333 !important; color: #ffffff !important; font-weight: normal !important; }

/* Ensemble des boutons (survol) = TSL (L) -7% -> filter: brightness(0.93) */
.btn-nav:hover, 
.btn-action:hover, 
.btn-display:hover, 
.btn-danger:hover, 
.btn-sidebar-module:hover, 
.btn-sidebar-secondary:hover, 
.sidebar-actions button:hover, 
.sidebar-actions a:hover, 
#toggleBtn:hover { 
    filter: brightness(0.93) !important; 
}
.btn-nav.active, .btn-action.active { font-weight: bold; }

/* --- 5. STYLE PAGE CONNEXION ------------------------------------------------------------------------------------- */
.panel { width: 100% !important; max-width: none !important; margin: 0 !important; padding: 12px 15px !important; }
.panel h2 { margin-top: 0; color: #2c3e50; }
.form-group { margin-bottom: 12px !important; }
.form-group label { display: block; margin-bottom: 4px !important; font-weight: 500; color: #555; }
.form-group input { width: 100%; padding: 5px 8px !important; border: 1px solid #ccc; border-radius: 4px; font-size: 0.85rem !important; height: 30px !important; box-sizing: border-box !important; }

/* --- 6. CORRECTIFS INPUTS --------------------------------------------------------------------------------------- */
input[type="password"]::-webkit-credentials-view-button, input[type="password"]::-webkit-contacts-auto-fill-button { display: none !important; }
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none !important; }
.error-msg { background-color: #f8d7da; color: #d9994f; border: 1px solid #f5c6cb; padding: 10px; border-radius: 4px; margin-bottom: 20px; font-size: 0.9rem; text-align: center; }
.btn-action:disabled { background-color: #d1d1d1; color: #888; cursor: not-allowed; filter: none; opacity: 0.7; }

/* --- 7. COMPACTION GLOBAL FIELDSETS --- */
fieldset {
    padding: 10px 12px !important;
    margin-bottom: 12px !important;
    margin-top: 0 !important;
}

/* --- 8. UNIFORMISATION CHAMPS --- */
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"], select {
    font-family: 'Roboto', 'Segoe UI', sans-serif; font-size: 0.85rem !important; padding: 5px 8px !important; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box !important; width: 100%; height: 30px !important;
}
textarea {
    font-family: 'Roboto', 'Segoe UI', sans-serif; font-size: 0.85rem !important; padding: 5px 8px !important; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box !important; width: 100%;
}

/* --- 9. MODALES SYSTÈME (Solum) ------------------------------------------------------------------------------ */
.modal-overlay { 
    display: none; position: fixed; z-index: 20000; 
    top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.5); 
    align-items: center; justify-content: center; 
}

.modal-box { 
    background: white; padding: 20px 24px; border-radius: 0 !important; 
    width: 90%; max-width: 480px; min-width: 280px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
    text-align: center; box-sizing: border-box !important;
}

.modal-title { margin-top: 0; margin-bottom: 12px; font-weight: normal !important; color: #333399; font-family: 'Plus Jakarta Sans', sans-serif !important; font-size: 1.2rem !important; line-height: 1.2 !important; }
.modal-content { margin-bottom: 20px; font-family: 'Roboto', sans-serif !important; font-size: 0.85rem !important; line-height: 1.15 !important; color: #000000 !important; font-weight: normal !important; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; width: 100%; box-sizing: border-box; }

/* Styles dynamiques (Bordure supérieure 4px) */
.modal-info { border-top: 4px solid #333399 !important; }
.modal-info .modal-title { color: #333399 !important; }

.modal-saving { border-top: 4px solid #cc9966 !important; }
.modal-saving .modal-title { color: #cc9966 !important; }

.modal-warning { border-top: 4px solid #ff9933 !important; }
.modal-warning .modal-title { color: #ff9933 !important; }

.modal-danger { border-top: 4px solid #ff0000 !important; }
.modal-danger .modal-title { color: #ff0000 !important; }

.modal-success { border-top: 4px solid #3c763d !important; }
.modal-success .modal-title { color: #3c763d !important; }


/* --- 10. FILTRES TABLEAUX (Version corrigée) -------------------------------------------------------------------- */
.solum-filter-row th {
    padding: 3px 2px !important;
    height: 32px !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
    border-bottom: none !important;
}
.solum-search-container {
    width: 100% !important;
    height: 26px !important;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1px solid #cccccc !important;
    padding: 0 4px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
}
.solum-input-filter {
    border: none !important;
    outline: none !important;
    width: 100% !important;
    height: 100% !important;
    font-size: 13px !important; 
    color: #333333 !important;
    padding: 0 !important;
    background: transparent !important;
    box-sizing: border-box !important;
}
.btn-filter-validate, .btn-filter-clear { color: #28a745; cursor: pointer; font-size: 14px; margin-left: 2px; }
.btn-filter-clear { color: #dc3545; }
.solum-sort-icon { color: #888888; margin-left: 8px; font-size: 12px; }

/* --- STYLE TABLEAUX & LISTES DYNAMIQUES (Largeur dynamique 100% & Anti-chevauchement) --- */

/* Ajuster systématiquement les listes sous forme de tableau dans toute la largeur dynamique de l'encadré */
table {
    table-layout: auto;
    width: 100% !important;
    min-width: 100% !important;
    border-collapse: collapse;
    box-sizing: border-box;
}

#solum-table,
.solum-table,
.table-container table,
.table-full-width,
.table-anabase,
#table-anabase,
.table-cursus-responsive {
    table-layout: auto;
    width: 100% !important;
    min-width: 100% !important;
    border-collapse: collapse;
    box-sizing: border-box;
}

.solum-table-fixed, 
table.solum-table-fixed,
#solum-table.solum-table-fixed {
    table-layout: fixed !important;
    width: 100% !important;
    min-width: 100% !important;
}

.solum-table-fixed td, 
.solum-table-fixed th {
    min-width: 0 !important;
}

.table-container {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box !important;
    margin-bottom: 15px;
}

/* 1. Resserrer les lignes, espacements équilibrés et anti-chevauchement des contenus */
table th, 
table td {
    padding: 3px 8px !important; /* Espacement équilibré empêchant tout chevauchement */
    border-bottom: 1px solid #e0e0e0 !important; /* Ligne grise fine */
    text-align: left !important; /* Alignement forcé à gauche */
    vertical-align: middle;
    line-height: 1.2 !important; /* Hauteur de ligne équilibrée */
    white-space: nowrap !important; /* Supprime les renvois à la ligne des textes dans les listes */
    box-sizing: border-box !important;
}

/* On règle la largeur minimale des colonnes pour protéger la visibilité sans bloquer l'extension */
table td, 
table thead th:not(.solum-filter-row th) {
    min-width: auto;
}

/* Titres de colonnes : police lisible, pas de chevauchement avec l'icône de tri */
table thead th {
    text-align: left !important; 
    border-bottom: 1px solid #e0e0e0 !important;
    font-weight: bold;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.solum-sort-icon { 
    color: #888888; 
    margin-left: 6px; 
    font-size: 12px;
    display: inline-block;
    vertical-align: middle;
    user-select: none;
}

/* Harmonisation des tableaux d'officiers dans les fiches de renseignements (encarts) des loges */
.loge-card-encart table {
    table-layout: fixed !important;
    width: 100% !important;
}
.loge-card-encart table td,
.loge-card-encart table thead th:not(.solum-filter-row th) {
    min-width: 0 !important;
    white-space: normal !important;
    word-break: break-word !important;
}

/* Colonne des boutons d'actions spécifiques (Cursus, etc.) */
.col-cursus,
th.col-cursus,
td.col-cursus {
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    padding: 2px 2px !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

/* Réduire la taille de la colonne des cases à cocher uniquement */
.col-checkbox,
th.col-checkbox,
td.col-checkbox,
th.col-tight:has(input[type="checkbox"]),
td.col-tight:has(input[type="checkbox"]) {
    width: 28px !important;
    max-width: 28px !important;
    min-width: 28px !important;
    padding: 2px 2px !important;
    text-align: center !important;
    box-sizing: border-box !important;
}

/* Tableaux pleine largeur fluide et adaptatifs */
table.table-full-width,
table.table-anabase,
#table-anabase {
    width: 100% !important;
    min-width: 100% !important;
}

/* --- TABLEAU / LISTE ANABASE : SCROLLBAR VERTICAL À GAUCHE (COULEUR #58578b) --- */
.anabase-scroll-wrapper,
.anabase-container,
#anabase-scroll-wrapper {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: 520px;
    direction: rtl !important; /* Positionne l'ascenseur / scrollbar vertical à gauche de la colonne 1 */
    scrollbar-color: #58578b #ecebf8;
    scrollbar-width: thin;
    border: 1px solid #d0d0d5;
    border-radius: 0 !important;
    width: 100%;
    box-sizing: border-box;
}

/* Rétablir la direction normale de lecture gauche-à-droite pour le contenu de l'Anabase */
.anabase-scroll-wrapper > *,
.anabase-container > *,
#anabase-scroll-wrapper > * {
    direction: ltr !important;
}

/* Barre de défilement personnalisée WebKit pour l'Anabase uniquement */
.anabase-scroll-wrapper::-webkit-scrollbar,
.anabase-container::-webkit-scrollbar,
#anabase-scroll-wrapper::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
    display: block !important;
}

.anabase-scroll-wrapper::-webkit-scrollbar-track,
.anabase-container::-webkit-scrollbar-track,
#anabase-scroll-wrapper::-webkit-scrollbar-track {
    background: #ecebf8 !important;
    border-radius: 0 !important;
}

.anabase-scroll-wrapper::-webkit-scrollbar-thumb,
.anabase-container::-webkit-scrollbar-thumb,
#anabase-scroll-wrapper::-webkit-scrollbar-thumb {
    background-color: #58578b !important;
    border-radius: 0 !important;
}

.anabase-scroll-wrapper::-webkit-scrollbar-thumb:hover,
.anabase-container::-webkit-scrollbar-thumb:hover,
#anabase-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #43426e !important;
}

/* Styles communs pour le tableau Anabase */
.table-anabase,
#table-anabase {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: normal;
    color: #000000;
}
.table-anabase tr,
#table-anabase tr {
    height: 26px !important;
    box-sizing: border-box !important;
}
.table-anabase th,
.table-anabase td,
#table-anabase th,
#table-anabase td {
    height: 26px !important;
    padding: 3px 12px !important;
    font-size: 0.85rem !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}
.table-anabase th.col-anabase-date,
#table-anabase th.col-anabase-date {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 150px !important;
    white-space: nowrap !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 3px 10px !important;
    font-size: 0.85rem !important;
}
.table-anabase td.col-anabase-date,
#table-anabase td.col-anabase-date {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 150px !important;
    white-space: nowrap !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 3px 10px !important;
    font-size: 0.765rem !important;
}
.table-anabase th.col-anabase-event,
.table-anabase td.col-anabase-event,
#table-anabase th.col-anabase-event,
#table-anabase td.col-anabase-event {
    width: 35% !important;
    min-width: 240px !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    padding: 3px 12px !important;
    font-size: 0.85rem !important;
}
.table-anabase th.col-anabase-info,
.table-anabase td.col-anabase-info,
#table-anabase th.col-anabase-info,
#table-anabase td.col-anabase-info {
    width: auto !important;
    min-width: 280px !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    padding: 3px 12px !important;
    font-size: 0.85rem !important;
}
.table-anabase td,
#table-anabase td {
    font-size: 0.85rem !important;
    font-weight: normal !important;
    color: #000000;
}
.table-anabase tr.row-evenement-libre td,
.table-anabase tr.row-evenement-libre td *,
#table-anabase tr.row-evenement-libre td,
#table-anabase tr.row-evenement-libre td * {
    color: #58578b !important;
}
.table-anabase tr.row-module-title td,
#table-anabase tr.row-module-title td {
    background-color: #e7e6fd !important;
    font-weight: bold !important;
}

/* --- VERSION NUANCES DE GRIS POUR L'ANABASE (PAGE CONTACTS) --- */
.anabase-scroll-wrapper-gray {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: 520px;
    direction: rtl !important;
    scrollbar-color: #888888 #f1f2f4;
    scrollbar-width: thin;
    border: 1px solid #d0d0d5;
    border-radius: 0 !important;
    width: 100%;
    box-sizing: border-box;
}
.anabase-scroll-wrapper-gray > * {
    direction: ltr !important;
}
.anabase-scroll-wrapper-gray::-webkit-scrollbar {
    width: 8px !important;
    height: 8px !important;
    display: block !important;
}
.anabase-scroll-wrapper-gray::-webkit-scrollbar-track {
    background: #f1f2f4 !important;
    border-radius: 0 !important;
}
.anabase-scroll-wrapper-gray::-webkit-scrollbar-thumb {
    background-color: #b5b4b0 !important;
    border-radius: 0 !important;
}
.anabase-scroll-wrapper-gray::-webkit-scrollbar-thumb:hover {
    background-color: #888888 !important;
}

.table-anabase-gray {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: auto !important;
    border-collapse: collapse;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.85rem;
    font-weight: normal;
    color: #000000;
}
.table-anabase-gray tr {
    height: 26px !important;
    box-sizing: border-box !important;
}
.table-anabase-gray th,
.table-anabase-gray td {
    height: 26px !important;
    padding: 3px 12px !important;
    font-size: 0.85rem !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}
.table-anabase-gray th.col-anabase-date {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 150px !important;
    white-space: nowrap !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 3px 10px !important;
    font-size: 0.85rem !important;
}
.table-anabase-gray td.col-anabase-date {
    width: 140px !important;
    min-width: 140px !important;
    max-width: 150px !important;
    white-space: nowrap !important;
    text-align: center !important;
    box-sizing: border-box !important;
    padding: 3px 10px !important;
    font-size: 0.765rem !important;
}
.table-anabase-gray th.col-anabase-event,
.table-anabase-gray td.col-anabase-event {
    width: 35% !important;
    min-width: 240px !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    padding: 3px 12px !important;
    font-size: 0.85rem !important;
}
.table-anabase-gray th.col-anabase-info,
.table-anabase-gray td.col-anabase-info {
    width: auto !important;
    min-width: 280px !important;
    white-space: normal !important;
    box-sizing: border-box !important;
    padding: 3px 12px !important;
    font-size: 0.85rem !important;
}
.table-anabase-gray td {
    font-size: 0.85rem !important;
    font-weight: normal !important;
    color: #000000;
}
.table-anabase-gray tr.row-evenement-libre td,
.table-anabase-gray tr.row-evenement-libre td * {
    color: #495057 !important;
}
.table-anabase-gray tr.row-module-title td {
    background-color: #ebebeb !important;
    font-weight: bold !important;
    color: #212529 !important;
}

.btn-anabase-editer,
a.btn-anabase-editer,
a.btn-anabase-editer:link,
a.btn-anabase-editer:visited,
a.btn-anabase-editer:hover,
a.btn-anabase-editer:active,
a.btn-anabase-editer:focus {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    height: 20px !important;
    min-height: 20px !important;
    max-height: 20px !important;
    background-color: #cc9966 !important;
    background: #cc9966 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    text-decoration-line: none !important;
    outline: none !important;
    box-shadow: none !important;
    font-family: 'Plus Jakarta Sans', sans-serif !important;
    font-size: 0.60rem !important;
    font-weight: normal !important;
    border-radius: 0 !important;
}

/* --- SÉLECTION DES LIGNES DANS LES TABLEAUX LISTES --- */
/* Contraster le fond des lignes sélectionnées par une case à cocher */
table tbody tr:has(input[type="checkbox"]:checked) {
    background-color: #eceafc !important;
}
table tbody tr:has(input[type="checkbox"]:checked) td,
table tbody tr:has(input[type="checkbox"]:checked) th {
    background-color: #eceafc !important;
}
table tbody tr.is-selected {
    background-color: #eceafc !important;
}
table tbody tr.is-selected td,
table tbody tr.is-selected th {
    background-color: #eceafc !important;
}
table tbody tr:has(input[type="checkbox"]:checked):hover td,
table tbody tr.is-selected:hover td {
    background-color: #dfdcf8 !important;
}

/* Éviter que .col-tight force une largeur de 28px sur d'autres colonnes */
.col-tight:not(.col-checkbox):not(:has(input[type="checkbox"])):not(.col-cursus) {
    width: auto !important;
    max-width: none !important;
    min-width: max-content !important;
}

/* 2. Suppression des bordures grasses sur les titres */
table thead th {
    text-align: left !important; 
    border-bottom: 1px solid #e0e0e0 !important; /* Bordure fine identique au reste du tableau */
    font-weight: bold; /* Garde le gras pour la lisibilité, mais sans bordure épaisse */
}

/* 3. Ajustement de la largeur des champs de recherche */
.solum-search-container {
    width: 100% !important;
    height: 26px !important;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    border: 1px solid #cccccc !important;
    padding: 0 4px !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
}

/* --- 11. RÉDUCTION DE LA TAILLE DES TEXTES DE CONTENU (HORS TITRES, BOUTONS, TOASTS) --- */
/* On applique une taille de 0.85rem (environ 13.6px) pour le contenu global */
.main-content {
    font-size: 0.85rem !important;
}

/* On s'assure que tous les textes de contenu adoptent cette taille et utilise la couleur officielle pour les liens */
.main-content p,
.main-content span:not(.solum-sort-icon):not(.btn-filter-validate):not(.btn-filter-clear),
.main-content div:not(.solum-search-container):not(.panel),
.main-content li,
.main-content td,
.main-content th,
.main-content label,
.main-content legend,
.main-content option,
.main-content fieldset {
    font-size: 0.85rem !important;
}

/* Remplacer la couleur des liens par la couleur officielle des liens hypertexte (bleu standard #0000ee) */
.main-content a:not(.btn-nav):not(.btn-action):not(.btn-module):not(.btn-anabase-editer):not(.link-grey):not(.grey-link):not(.link-identity-contact):not(.link-no-underline) {
    font-size: 0.85rem !important;
    color: #0000ee !important;
    text-decoration: underline !important;
}
.main-content a:not(.btn-nav):not(.btn-action):not(.btn-module):not(.btn-anabase-editer):not(.link-grey):not(.grey-link):not(.link-identity-contact):not(.link-no-underline):hover {
    color: #0000aa !important;
}

/* Style systématique des liens gris soulignés dans le corps des pages (réduits d'une taille, couleur grise, et en italique) */
.main-content a.link-grey,
.main-content a.grey-link,
.main-content button.link-grey,
.main-content button.grey-link,
a.link-grey,
a.grey-link,
button.link-grey,
button.grey-link {
    font-size: 0.75rem !important;
    color: #7f8c8d !important;
    font-style: italic !important;
    text-decoration: underline !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-style: none !important;
    border-width: 0 !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer !important;
    display: inline-block !important;
    font-family: 'Roboto', sans-serif !important;
    font-weight: normal !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.main-content a.link-grey:hover,
.main-content a.grey-link:hover,
.main-content button.link-grey:hover,
.main-content button.grey-link:hover,
a.link-grey:hover,
a.grey-link:hover,
button.link-grey:hover,
button.grey-link:hover,
.main-content a.link-grey:focus,
.main-content a.grey-link:focus,
.main-content button.link-grey:focus,
.main-content button.grey-link:focus,
a.link-grey:focus,
a.grey-link:focus,
button.link-grey:focus,
button.grey-link:focus,
.main-content a.link-grey:active,
.main-content a.grey-link:active,
.main-content button.link-grey:active,
.main-content button.grey-link:active,
a.link-grey:active,
a.grey-link:active,
button.link-grey:active,
button.grey-link:active {
    color: #555555 !important;
    text-decoration: underline !important;
    background: transparent !important;
    background-color: transparent !important;
    border: none !important;
    border-style: none !important;
    border-width: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

/* On force également les champs de saisie à respecter la même proportion */
.main-content input[type="text"],
.main-content input[type="password"],
.main-content input[type="email"],
.main-content input[type="number"],
.main-content input[type="date"],
.main-content select {
    font-size: 0.85rem !important;
    padding: 5px 8px !important;
    height: 30px !important;
    box-sizing: border-box !important;
}
.main-content textarea {
    font-size: 0.85rem !important;
    padding: 5px 8px !important;
    box-sizing: border-box !important;
    height: auto !important;
}

/* S'assurer que la taille des titres (h1 à h6) reste intacte par rapport à la racine */
.main-content h1, .main-content .h1 { font-size: 1.8rem !important; }
.main-content h2, .main-content .h2, .panel h2 { font-size: 1.4rem !important; }
.main-content h3, .main-content .h3 { font-size: 1.15rem !important; }
.main-content h4, .main-content .h4 { font-size: 1rem !important; }

/* Les boutons dans le contenu doivent également conserver leur taille définie sans être réduits */
.main-content button,
.main-content .btn-nav,
.main-content .btn-action,
.main-content .btn-module {
    font-size: 0.95rem !important;
}

/* Les fenêtres modales et les toasts (modales de notifications) */
.modal-title {
    font-size: 1.15rem !important;
}
.modal-content {
    font-size: 14px !important;
    font-family: 'Roboto', sans-serif !important;
}
.modal-actions button {
    font-size: 0.9rem !important;
}

/* --- ANIMATIONS ET UTILITAIRES SOLUM --- */
@keyframes solumSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- RÈGLES D'IMPRESSION GLOBALES (SOLUM ERP) --- */
@media print {
    /* Masquage total des barres de défilement */
    html, body, *, ::-webkit-scrollbar {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }
    ::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }

    /* Masquage des éléments non imprimables (Zone IA Ollama, Sidebars, En-têtes, Boutons, Modales) */
    .sidebar, .sidebar-left, .sidebar-right, .sidebar-nav, .sidebar-actions,
    .sidebar-nav-resizer, .sidebar-actions-resizer, .nav-content, .actions-content,
    .actions-buttons-container, .main-header, header, .header-container, nav,
    button, .btn-nav, .btn-action, .btn-display, .btn-danger, .btn-module,
    .btn-sidebar-module, .btn-sidebar-secondary, .btn-sidebar-tertiary,
    .bouton_standard, .no-print, .noprint, #toggleBtn, .btn-toggle-sidebar,
    .solum-modal, #solumModal, #solumModalOverlay, .modal-backdrop, .modal-box,
    #solum-notifications-panel, #solum-notifications-list, #solum-help-link-container,
    #solum-events-zone, #solum-next-command-container,
    #solum-ai-module-container, #solum-ai-module, #solum-ai-module-body,
    #solum-ollama-btn-container, #btn-show-ollama, #btn-ollama-text,
    .solum-ai-container, #ai-ollama-container, #solumIAContainer, .solum-ia,
    .solum-ai-header, .solum-ai-footer, #solum-ai-drawer, .ai-chat-box, #ollama-status-modal,
    iframe {
        display: none !important;
    }

    /* Déverrouillage des hauteurs pour autoriser la pagination multi-pages */
    html, body, .app-wrapper, .main-content, #main-content, .repertoire-scroll-container, .repertoire-content-inner, .content-container, .panel, .container-fluid, .container {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        direction: ltr !important;
        position: static !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif !important;
        font-size: 11pt !important;
        line-height: 1.5 !important;
        padding-top: 0 !important;
    }

    a {
        color: #000000 !important;
        text-decoration: none !important;
    }

    table {
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: collapse !important;
    }

    tr, td, th, img, svg, canvas, .card {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }

    .panel, .cadre {
        page-break-inside: auto !important;
        break-inside: auto !important;
    }

    h1, h2, h3, h4, h5 {
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
}

