:root {
    --color-bg: #f5f7fb;
    --color-surface: #ffffff;
    --color-primary: #2c9da6;
    --color-primary-soft: #e5f5f6;
    --color-primary-dark: #18737a;
    --color-accent: #f5b54b;
    --color-text: #1f2933;
    --color-muted: #6b7280;
    --color-border: #dde3f0;
    --shadow-soft: 0 8px 20px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
}

/* -------- Topbar -------- */

.topbar {
    position: fixed; /* Reste en haut au scroll */
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(255, 255, 255, 0.9); /* Un peu de transparence */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1100; /* Passe au-dessus de tout */
}

/* Ajoutez ceci juste après pour ne pas que le contenu passe sous la barre */
body {
    padding-top: 60px; 
}
.topbar-left {
    display: flex;
    align-items: center; /* Aligne verticalement le hamburger et le logo */
	height: 100%;        /* Prend toute la hauteur de la topbar */
    gap: 12px;           /* Espace précis entre le hamburger et le logo */
}
.logo {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.logo-text {
    font-size: 1rem;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.topnav-link {
    border-radius: 999px;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid transparent;
    color: var(--color-muted);
    transition: all 0.15s ease;
}

.topnav-link:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
}

.topnav-link--primary {
    background: var(--color-primary);
    color: #fff;
}

.topnav-link--primary:hover {
    background: var(--color-primary-dark);
    color: #fff;
}

.topnav-link--outline {
    border-color: var(--color-border);
}

/* -------- Layout principal -------- */

.layout {
    display: flex;
    min-height: calc(100vh - 56px); /* hauteur moins topbar */
}

/* Sidebar */

.sidebar {
    width: 220px;
    max-width: 100%;
    padding: 1.2rem 1rem;
    background: #ffffff;
    border-right: 1px solid var(--color-border);
}

.sidebar-section-title {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin-bottom: 0.4rem;
    margin-top: 0.6rem;
}

.sidebar-link {
    display: block;
    padding: 0.35rem 0.6rem;
    margin: 0.1rem 0;
    border-radius: 0.5rem;
    text-decoration: none;
    font-size: 0.85rem;
    color: var(--color-text);
    transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.sidebar-link:hover {
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    transform: translateX(2px);
}

/* Page */

.page {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Carte de contenu */

.card {
    background: var(--color-surface);
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
}

/* -------- Flash messages -------- */

.flash-container {
    margin-bottom: 0.7rem;
}

.flash {
    border-radius: 0.75rem;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.flash-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.flash-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.flash-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fed7aa;
}

.flash-danger,
.flash-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* -------- Boutons & formulaires -------- */
button,
input[type="submit"],
.btn {
    border-radius: 999px;
    border: none;
    background: var(--color-primary);
    color: #fff;
    padding: 0.35rem 0.9rem;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

button:hover,
input[type="submit"]:hover,
.btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-1px);
}

button:disabled,
input[type="submit"]:disabled {
    opacity: 0.5;
    cursor: default;
    box-shadow: none;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-danger {
    background: #dc2626;
}

/* Labels + champs */

label {
    font-size: 0.85rem;
    color: var(--color-muted);
    display: inline-block;
    margin-bottom: 0.2rem;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    max-width: 260px;
    padding: 0.4rem 0.6rem;
    border-radius: 0.6rem;
    border: 1px solid var(--color-border);
    font-size: 0.9rem;
    font-family: inherit;
    margin-bottom: 0.7rem;
    background: #f9fafb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px var(--color-primary-soft);
    background: #fff;
}

/* -------- Tableaux -------- */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

thead {
    background: #f3f4f6;
}

th, td {
    padding: 0.55rem 0.6rem;
    text-align: center;       /* centre horizontalement */
    vertical-align: middle;   /* centre verticalement */
    border-bottom: 1px solid #e5e7eb;
}

th {
    font-weight: 500;
    color: var(--color-muted);
}

tbody tr:nth-child(even) {
    background: #fafbff;
}

tbody tr:hover {
    background: #eef2ff;
}

/* -------- Footer -------- */

.footer {
    text-align: center;
    font-size: 0.75rem;
    color: var(--color-muted);
    padding: 0.5rem 1rem 1rem;
}

/* -------- Tags / Progress -------- */

.tag-list {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* clé pour l’alignement à gauche */
    text-align: left;
    list-style: none;
    padding: 0;
    margin: 0;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    font-size: 0.75rem;
    border: 1px solid rgba(44, 157, 166, 0.2);
    text-align: center;
}

.muted {
    color: var(--color-muted);
    font-size: 0.8rem;
}

.progress {
    width: 100%;
    max-width: 500px;
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
    margin-top: 0.15rem;
}

.progress-bar {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #16A34A, #4ADE80);
    transition: width 0.25s ease;
}

.progress-label {
    font-size: 0.75rem;
    color: var(--color-muted);
    margin-top: 0.15rem;
    text-align: center;
    width: 100%;
}

/* -------- Actions -------- */

/* Conteneur des actions */
.action-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    white-space: nowrap;   /* empêche le retour à la ligne sur grands écrans */
}

.actions-cell {
    vertical-align: middle;
    width: 1%;
    position: relative;
    overflow: visible;
}

/* Style de base pour tous les liens d'action */
.action-link {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: var(--color-primary-soft);
    color: var(--color-primary-dark);
    text-decoration: none;
    font-size: 0.85rem;
    transition: 0.2s ease;
}

.action-link:hover {
    background: var(--color-primary);
    color: white;
}

/* Bouton supprimer */
.action-delete {
    background: #d9534f33;
    color: #b7322d;
    border: 1px solid #d9534f55;
}

.action-link.disabled {
    opacity: 0.4;
    pointer-events: none;
    cursor: not-allowed;
}

button:disabled:hover,
.action-link.disabled:hover {
    background: inherit !important;
    color: inherit !important;
    text-decoration: none !important;
    box-shadow: none !important;
    transform: none !important;
}

.action-delete:hover {
    background: #d9534f;
    color: white;
}
/* Enlever totalement le pourtour des boutons form dans le dropdown */
.dropdown-menu button {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent;
}


/* -------- Formulaires complexes -------- */

.form-group {
    display: grid;
    grid-template-columns: 200px 80px 80px 80px;
    align-items: center;
    gap: 20px;
    max-width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(220px, 1fr));
    gap: 1rem 1.5rem;
    max-width: 800px;
}

.form-grid label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    font-weight: 500;
    color: #444;
}

/* Boutons sur toute la largeur */
.form-grid .action-links {
    grid-column: span 2;
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 1rem;
}

/* -------- Planning hebdo -------- */

.week-calendar {
    display: grid;
    grid-template-columns: repeat(6, minmax(160px, 1fr)); /* Lundi → Samedi */
    gap: 1rem;
    margin-top: 1.5rem;
}

.day-column {
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--color-border, #ddd);
    display: flex;
    flex-direction: column;
    min-height: 500px;
}

.day-header {
    font-weight: 600;
    text-align: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e1e4e8;
}

.course-card {
/*    background: #B5F5B5;*/
    border-radius: 0.6rem;
    margin-bottom: 0.4rem;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
    font-size: 0.8rem;
    overflow: hidden; /* pour que le lien occupe tout */
}

.course-link {
    display: block;
    padding: 0.4rem 0.55rem;
    color: inherit;
    text-decoration: none;
}

.course-link:hover {
    background: #f3f4ff;
}

.course-time {
    font-weight: 600;
    margin-bottom: 0.1rem;
}

.course-main {
    font-weight: 500;
}

.course-teacher {
    font-weight: 500;
}

.course-type {
    font-style: italic;
    opacity: 0.8;
}

.course-ref {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.1rem;
}

.no-course {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    text-align: center;
    color: #9ca3af;
}

/* -------- Responsive global -------- */

/* Réduction progressive de la sidebar et des colonnes */
@media (max-width: 1200px) {
    .layout {
        gap: 0;
    }
    .sidebar {
        width: 200px;
    }
}
/* --- Sur ordinateur : on cache la section compte de la sidebar --- */
.sidebar-mobile-actions {
    display: none;
}
/* Sidebar en haut + layout colonne */
@media (max-width: 900px) {
    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .sidebar-link {
        display: inline-flex;
    }

    .page {
        padding: 1.25rem;
    }

    .form-group {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }

    .week-calendar {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }
}

/* Tables défilables sur mobile */
@media (max-width: 768px) {
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    .actions-cell {
        width: auto;
        white-space: normal;
    }

    .action-links {
        flex-wrap: wrap;
        white-space: normal;
        justify-content: flex-start;
    }

    .action-link {
        flex: 1 1 48%;
        text-align: center;
    }

    .form-group {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
}

/* Mobile compact */
@media (max-width: 600px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }

    .topnav {
        justify-content: flex-start;
    }

    .page {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-grid .action-links {
        grid-column: span 1;
        justify-content: stretch;
        flex-direction: column;
    }

    .form-grid .action-link,
    .form-grid .btn {
        width: 100%;
        text-align: center;
    }

    .form-group {
        grid-template-columns: 1fr;
    }

    .action-links {
        flex-direction: column;
        align-items: stretch;
    }

    .action-link {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Planning hebdo : colonnes réduites */
@media (max-width: 1000px) {
    .week-calendar {
        grid-template-columns: repeat(3, minmax(160px, 1fr));
    }
}

@media (max-width: 640px) {
    .week-calendar {
        grid-template-columns: 1fr;
    }
}
.week-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.week-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: #e5e7eb;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  transition:
    background-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast);
}

.week-btn:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(111, 45, 189, 0.15);
}

.week-range {
  font-weight: bold;
}
.attendance-header,
.attendance-row {
    display: grid;
    grid-template-columns: 200px 200px 200px 200px 200px;
    align-items: center;
    margin-bottom: 6px;
}

.attendance-header span,
.attendance-header strong {
    text-align: center;
}

.attendance-header strong {
    text-align: left;
}

/* Centre parfaitement les boutons */
.attendance-row label {
    display: flex;
    justify-content: center;
    align-items: center;
}
/* ----------------------------
   CONTENEUR DES TABS
-----------------------------*/
.tabs-container {
    display: flex;
    gap: 6px;
    margin-bottom: 15px;
}

/* ----------------------------
   BOUTONS ONGLETS
-----------------------------*/
.tab-button {
    background: #f2f2f2;
    border: 1px solid #ccc;
    border-bottom: none;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: bold;
    color: #555;
    border-radius: 6px 6px 0 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.tab-button:hover {
    background: #e9e9e9;
}

/* Onglet actif */
.tab-button-active {
    background: white;
    color: #222;
    border-color: #999;
    border-bottom: 1px solid white;
}

/* ----------------------------
   CONTENU DES TABS
-----------------------------*/
.tab-pane {
    border: 1px solid #ccc;
    padding: 15px;
    background: white;
    border-radius: 0 6px 6px 6px;
}

/* ----------------------------
   RESPONSIVE MOBILE
-----------------------------*/
@media (max-width: 600px) {
    .tabs-container {
        flex-direction: column;
    }

    .tab-button {
        border-radius: 6px;
        border-bottom: 1px solid #ccc;
    }

    .tab-pane {
        border-radius: 6px;
    }
}
/* ---------- DROPDOWN ACTIONS ----------- */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: white;
    min-width: 180px;
    border: 1px solid #ccc;
    box-shadow: 0 6px 16px rgba(0,0,0,0.15);
    z-index: 9999;              /* 🔥 clé du problème */
    border-radius: 6px;

    overflow: visible;          /* ✅ PAS de scroll */
    white-space: nowrap;
}


.dropdown-menu a,
.dropdown-menu button {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    padding: 8px 12px;
    cursor: pointer;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background-color: #f2f2f2;
}

/* Bouton danger */
.dropdown-menu .action-delete {
    color: red;
}
.dropdown-disabled {
    display: block;
    padding: 8px 12px;
    color: #999;
    font-style: italic;
    cursor: not-allowed;
	text-align: left;
}
.ludela-form {
    max-width: 900px;
    margin: auto;
}

.credit-block {
    margin-bottom: 25px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

.credit-block h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.1em;
    color: #333;
}

.credit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px 15px;
    align-items: center;
}

.credit-grid label {
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
}

.credit-grid input {
    padding: 6px;
    width: 100%;
}

.credit.danger {
    background-color: #ffcccc;
    color: #900;
}

.credit.warning {
    background-color: #fff3cd;
    color: #856404;
}

.reference-block {
    margin: 25px 0;
}

.reference-block input {
    width: 50%;
    padding: 6px;
}
/* Important : autoriser le tooltip à "déborder" de la cellule */
td.cell-overflow {
  overflow: visible;
}

.tag-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.li-truncate {
  max-width: 260px;         /* ajuste */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tooltip sans markup (utilise l'attribut title) */
.li-tooltip {
  position: relative;
  cursor: help;
}

.li-tooltip:hover::after {
  content: attr(title);
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 6px;

  background: #fff;
  border: 1px solid #ccc;
  padding: 6px 8px;

  max-width: 420px;
  white-space: normal;
  z-index: 9999;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
/* --- Attendance block --- */
.attendance {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.attendance legend {
  padding: 0 10px;
  font-weight: 700;
}

.attendance-grid {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.9fr 1.4fr;
  gap: 10px 12px;
  align-items: center;
}

.attendance-head {
  font-size: 0.9rem;
  font-weight: 700;
  color: #374151;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.attendance-student {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 6px 0;
}

.attendance-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  user-select: none;
}

.attendance-choice input[type="radio"] {
  transform: scale(1.1);
}

/* Optionnel : meilleur feedback visuel */
.attendance-choice input[type="radio"]:checked + .choice-pill {
  border-color: #2563eb;
  background: #eff6ff;
}

/* Remark */
.attendance-remark input[type="text"] {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #f9fafb;
  color: #111827;
}

.attendance-remark input[disabled] {
  opacity: 0.9;
}

.student-course-topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.badge-inactive{
  font-size:0.85rem;
  font-weight:700;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #d1d5db;
  background:#f3f4f6;
  color:#374151;
  white-space:nowrap;
}

/* Carte inactive : grisée + légère désactivation visuelle */
.student-course-card--inactive{
  opacity:0.75;
  filter: grayscale(15%);
  border: 1px dashed #d1d5db;
}

/* Optionnel : table plus compacte */
.student-course-table{
  width:100%;
  border-collapse:collapse;
}
.student-course-table th,
.student-course-table td{
  padding:8px 10px;
  border-bottom:1px solid #e5e7eb;
}
.course-disabled {
    opacity: 0.8;
}

.course-disabled .course-link {
    pointer-events: none;   /* optionnel : empêche le clic */
}

/* --- Style du bouton Hamburger --- */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 44px;  /* Augmenté pour une meilleure zone de clic */
    height: 44px; /* Zone de clic standard recommandée par Apple/Google */
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px; /* Le padding agrandit la zone sensible */
    margin-right: 5px;
    outline: none;
    -webkit-tap-highlight-color: transparent; /* Enlève le carré gris au clic sur mobile */
}

/* On garde les barres à une taille élégante */
.menu-toggle span {
    width: 24px;
    height: 3px;
    background-color: var(--color-text);
    border-radius: 10px;
    transition: all 0.3s ease;
}

/* --- Ajustements Responsive (Mobile) --- */
@media (max-width: 900px) {
	/* Masque complètement le nom de l'utilisateur sur mobile */
    .topbar div:not(.topbar-left):not(.topnav) {
        display: none !important;
    }

    /* Optionnel : recentrer ou réorganiser l'espace si besoin */
    .topbar {
        justify-content: flex-start; /* Aligne le bloc hamburger + logo à gauche */
    }
    .menu-toggle {
        display: flex; /* Apparaît sur mobile */
    }

    .layout {
        position: relative;
    }

	.sidebar {
			position: fixed;
			top: 60px; /* Aligné sous la topbar */
			height: calc(100vh - 60px);
			left: -280px; /* Sa largeur */
			z-index: 1000;
			/* Gardez vos transitions et autres styles existants ici */
		}
		
		/* L'overlay doit aussi commencer sous la barre */
		.layout.active::after {
			top: 60px;
		}
	/* On affiche la section dans la sidebar */
		.sidebar-mobile-actions {
			display: block;
			margin-top: 20px;
			padding-top: 20px;
			border-top: 1px solid var(--color-border);
		}

		/* Cible le texte "Espace de xxx" */
			.topbar div:not(.topbar-left):not(.topnav) {
				font-size: 0.75rem;
				text-align: right;
				flex: 1;
				padding-right: 10px;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis; /* Ajoute "..." si le nom est trop long */
				max-width: 150px; /* Ajustez selon vos besoins */
			}

			/* Optionnel : réduire un peu le logo sur mobile pour gagner de la place */
			.logo-text {
				font-size: 0.9rem;
			}
		/* Quand on clique sur le bouton, le JS ajoute la classe .active à .layout */
		.layout.active .sidebar {
				transform: translateX(280px);
			}
    /* Animation du bouton en X (Optionnel) */
    .menu-toggle.is-active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .menu-toggle.is-active span:nth-child(2) { opacity: 0; }
    .menu-toggle.is-active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
    
    /* On cache aussi la topnav sur mobile pour gagner de la place si besoin */
    .topbar {
        justify-content: flex-start;
		height: 60px;
		display: flex;
		justify-content: flex-start; /* Aligne tout à gauche sur mobile */
		padding: 0 1rem;
    }
    .topnav {
        display: none; /* Cache les liens de droite sur très petit écran */
    }

    .sidebar {
        display: block; 
        position: fixed; /* Reste fixe pendant le scroll de la page */
        top: 0;
        left: -260px; /* Cachée à gauche de l'écran */
        width: 260px;
        height: 100vh;
        z-index: 1000;
        background: var(--color-surface);
        transition: transform 0.3s ease-in-out;
        padding-top: 60px; /* Espace pour le bouton de fermeture ou la topbar */
        overflow-y: auto; /* Permet de scroller dans le menu si trop de liens */
    }

    /* Transition fluide pour l'apparition */
    .layout.active .sidebar {
        transform: translateX(260px); /* Glisse vers la droite */
    }

    /* Liens plus grands (Touch-friendly) */
    .sidebar-link {
        padding: 0.8rem 1.2rem; /* Plus d'espace pour le doigt */
        margin: 0.3rem 0;
        font-size: 1rem; /* Un peu plus grand */
        border-radius: 0; /* Design plus "liste" sur mobile */
        border-bottom: 1px solid var(--color-bg);
    }

    /* Overlay : assombrit le reste de la page quand le menu est ouvert */
    .layout.active::after {
        content: "";
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4);
        z-index: 900;
        backdrop-filter: blur(2px);
    }
}
/* Annule l'effet de fond vert et le déplacement au survol/clic */
.menu-toggle:hover, 
.menu-toggle:active, 
.menu-toggle:focus {
    background: transparent !important; /* Force le fond transparent */
    transform: none !important;         /* Empêche le petit saut de 1px */
    box-shadow: none !important;      /* Enlève l'ombre si elle apparaît */
}

/* Assure que les barres restent de la couleur du texte */
.menu-toggle:hover span {
    background-color: var(--color-text);
}

/* --- CORRECTIF COMPLET POUR LES CARTES COMPTABILITÉ --- */

/* 1. Centrage absolu du contenu (Vertical et Horizontal) */
.kpi-body {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    min-height: 140px !important;
    padding: 1.5rem !important;
    width: 100% !important;
}

/* 2. Forcer le style des titres */
.kpi-title {
    font-size: 0.85rem !important;
    text-transform: uppercase !important;
    font-weight: 700 !important;
    margin-bottom: 0.75rem !important;
    letter-spacing: 0.05em !important;
}

/* 3. Forcer le style des montants */
.kpi-value {
    font-size: 2rem !important; /* Équivalent au display-6 */
    font-weight: 700 !important;
    margin: 0 !important;
}

/* 4. Forcer l'application des couleurs (Bordures et Textes) */
.kpi-card.kpi-solde {
    border: 1px solid var(--color-primary) !important;
}
.kpi-card.kpi-solde .kpi-title { color: var(--color-primary) !important; }

.kpi-card.kpi-recettes {
    border: 1px solid #16a34a !important; /* Vert */
}
.kpi-card.kpi-recettes .kpi-title, 
.kpi-card.kpi-recettes .kpi-value { color: #16a34a !important; }

.kpi-card.kpi-depenses {
    border: 1px solid #dc2626 !important; /* Rouge */
}
.kpi-card.kpi-depenses .kpi-title, 
.kpi-card.kpi-depenses .kpi-value { color: #dc2626 !important; }
/* Force l'alignement côte à côte sur ordinateur, peu importe les autres règles */
@media (min-width: 901px) {
    .row.flex-md-row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
    }

    .row.flex-md-row .col-md-4 {
        width: 33.3333% !important;
        max-width: 33.3333% !important;
        flex: 0 0 33.3333% !important;
    }
}
/* Supprime le soulignement des liens d'action et des boutons de tableaux */
.action-link, 
.action-links a, 
.table .btn, 
.table a {
    text-decoration: none !important;
}