/* === CSS COMPLET - JOURNAL DE BORD GRAVURE LASER === */

:root {
    --primary: #2c3e50;
    --secondary: #1565c0;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --light: #ecf0f1;
    --dark: #34495e;
    --gray: #6b7280;
}

/*
 * Suppression des bordures grises dans les barres latérales
 * Les éléments de menu des catégories (pour les liens et le wiki) affichaient
 * de fines bordures grises. Nous les supprimons pour un rendu plus épuré.
 */
.links-sidebar .category-header,
.wiki-sidebar .category-header {
    border: none !important;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    overflow-x: hidden;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 14px;
}

.app-container {
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* ── Layout sidebar + contenu ── */
.app-body {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* Barre nav bas : cachée par défaut, activée via media query mobile */
.app-bottom-nav { display: none; }

/* ====== Responsive “plein écran” (TV / grands écrans) ======
   Objectif : réduire fortement la bordure violette et exploiter la largeur.
   Sur une TV, on préfère un rendu bord-à-bord (aucune perte de surface). */
@media (min-width: 1400px) {
  body { padding: 8px; }
  .app-container{
    max-width: none;
    width: calc(100vw - 16px);
    min-height: calc(100vh - 16px);
  }
}

@media (min-width: 1800px) {
  body { padding: 0; }
  .app-container{
    width: 100vw;
    min-height: 100vh;
    border-radius: 0;
  }
}

/* HEADER STYLISH */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--dark) 100%);
    color: white;
    padding: 25px 30px;
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.app-title {
    font-size: 28px;
    font-weight: 300;
}

.app-title strong {
    font-weight: 600;
    background: linear-gradient(45deg, #3498db, #2ecc71);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box input {
    padding: 10px 15px 10px 35px;
    border: none;
    border-radius: 20px;
    background: rgba(255,255,255,0.1);
    color: white;
    width: 250px;
    backdrop-filter: blur(10px);
}

.search-box::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255,255,255,0.7);
}

.manage-lists-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: background 0.3s;
    display: flex;
    align-items: center;
    gap: 5px;
}

.manage-lists-btn:hover {
    background: rgba(255,255,255,0.2);
}

/* ── SIDEBAR NAVIGATION (desktop) ── */
.app-tabs {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 8px;
    width: 185px;
    min-width: 185px;
    max-width: 185px;
    flex-shrink: 0;
    background: #f8f9fa;
    border-right: 1px solid #e1e8ed;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-tab {
    padding: 10px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    border-radius: 7px;
    font-weight: 500;
    font-size: 13px;
    line-height: 1.35;
    color: #6b7280;
    transition: all 0.2s ease;
    position: relative;
    white-space: normal;
    word-break: break-word;
}

.app-tab.active {
    color: #1565c0;
    border-left-color: #1565c0;
    background: #ebf5fb;
}

.app-tab:hover:not(.active) {
    color: var(--dark);
    background: #eef0f2;
}

/* ── Séparateurs de groupe dans la sidebar ── */
.app-tab-separator {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #64748b;
    padding: 12px 12px 4px;
    margin-top: 4px;
    border-top: 1px solid #f1f5f9;
    pointer-events: none;
    user-select: none;
}
.app-tab-separator:first-child { margin-top: 0; border-top: none; }

.app-tab .tab-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* MAIN CONTENT */
.app-main {
    padding: 30px;
    background: #f8f9fa;
    min-height: 0;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

/* =====================
   Projects actions (print button)
   ===================== */
.projects-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.projects-actions .btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

/* =====================
   Projects filters (tags & stage)
   ===================== */
.projects-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}
.tags-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tags-filter .tag-option {
    background: #f0f4f8;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    user-select: none;
    border: 1px solid #d9e2ec;
}
.tags-filter .tag-option.selected {
    background: #2684FF;
    color: #fff;
    border-color: #2684FF;
}
.stage-filter-wrapper select {
    padding: 4px 8px;
    font-size: 14px;
    border-radius: 6px;
    border: 1px solid #d9e2ec;
}

.tab-content {
    display: none !important;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block !important;
}

/* Modules qui ont besoin d'un layout flex quand actifs */
#clients.active {
    display: flex !important;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* QUICK ENTRY CARD */
.quick-entry {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 30px;
    border-left: 4px solid var(--secondary);
}

.entry-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.entry-title::before {
    content: "⚡";
    font-size: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.form-input, .form-select, .form-textarea {
    padding: 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--secondary);
    outline: none;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    grid-column: 1 / -1;
}

.tags-container {
    grid-column: 1 / -1;
}

.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.tag-option {
    padding: 6px 12px;
    background: #f8f9fa;
    border: 2px solid #e1e8ed;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.tag-option.selected {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8f9fa;
    color: var(--dark);
    border: 2px solid #e1e8ed;
}

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ÉDITEUR QUILL REDIMENSIONNABLE */
.quill-editor-container {
    grid-column: 1 / -1;
    margin-bottom: 20px;
}

.resizable-editor {
    min-height: 400px;
    resize: vertical;
    overflow: auto;
}

.resizable-editor .ql-toolbar {
    border-top: 2px solid #e1e8ed !important;
    border-left: 2px solid #e1e8ed !important;
    border-right: 2px solid #e1e8ed !important;
    border-bottom: none !important;
    border-radius: 8px 8px 0 0;
    background: #f8f9fa;
    padding: 12px !important;
}

.resizable-editor .ql-container {
    border-bottom: 2px solid #e1e8ed !important;
    border-left: 2px solid #e1e8ed !important;
    border-right: 2px solid #e1e8ed !important;
    border-top: none !important;
    border-radius: 0 0 8px 8px;
    font-size: 14px;
    min-height: 300px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.resizable-editor .ql-container:focus-within {
    border-color: var(--secondary) !important;
}

.resizable-editor .ql-toolbar:has(+ .ql-container:focus-within) {
    border-color: var(--secondary) !important;
}

/* Si plusieurs barres d'outils Quill sont insérées par inadvertance dans le même éditeur,
   masquer toutes les barres d'outils supplémentaires afin d'éviter la confusion. */
/* Si plusieurs barres d'outils Quill ou conteneurs de texte sont insérés
   par inadvertance dans le même éditeur, masquer toutes les occurrences
   au-delà de la première pour éviter la duplication visuelle. */
.resizable-editor .ql-toolbar:not(:first-of-type) {
    display: none !important;
}

.resizable-editor .ql-container:not(:first-of-type) {
    display: none !important;
}

/* Style des boutons de la toolbar */
.ql-toolbar .ql-formats {
    margin-right: 15px;
}

.ql-toolbar button {
    border-radius: 4px;
    margin: 2px;
}

.ql-toolbar button:hover {
    background: #e9ecef;
}

.ql-toolbar button.ql-active {
    background: var(--secondary);
    color: white;
}

/* SECTION PROJETS EN COURS */
.projects-en-cours-section {
    margin-bottom: 30px;
}

.projets-en-cours-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.projet-en-cours-card {
    background: white;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid var(--warning);
    border-top: 1px solid #e1e8ed;
}

.projet-en-cours-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border-left-color: var(--secondary);
}

.projet-en-cours-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.projet-en-cours-nom {
    font-weight: 600;
    color: var(--dark);
    font-size: 16px;
    line-height: 1.3;
    flex: 1;
}

.projet-en-cours-etape {
    font-size: 12px;
    color: white;
    background: var(--warning);
    padding: 4px 8px;
    border-radius: 10px;
    white-space: nowrap;
    margin-left: 10px;
    font-weight: 500;
}

.projet-en-cours-meta {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
}

.projet-en-cours-material {
    background: #e8f6f3;
    color: #16a085;
    padding: 3px 8px;
    border-radius: 8px;
}

.projet-en-cours-technique {
    background: #ebf5fb;
    color: #2980b9;
    padding: 3px 8px;
    border-radius: 8px;
}

.empty-projects {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray);
    background: white;
    border-radius: 10px;
    border: 2px dashed #e1e8ed;
}

/* BARRE DE PROGRESSION */
.progress-bar-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0;
    padding: 10px 0;
}

.progress-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--gray);
    background: white;
    position: relative;
    transition: all 0.3s ease;
}

.progress-circle.completed {
    background: var(--secondary);
    border-color: var(--secondary);
}

.progress-circle.current {
    border-color: var(--secondary);
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);

    background: white;
}

.progress-circle span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: var(--dark);
}

.progress-circle.future {
    opacity: 0.6;
}

.progress-connector {
    flex: 1;
    height: 3px;
    background: #e1e8ed;
    margin: 0 6px;
    position: relative;
}

.progress-connector.completed {
    background: var(--secondary);
}


/* BADGE : PROJET ABANDONNÉ (à la place de la barre de progression) */
.project-abandoned-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fecdca;
    margin: 12px 0;
}
/* SECTIONS DE PROJETS ET LISTES */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2::before {
    content: "📂";
    font-size: 22px;
}

.projects-container {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.project-card {
    background: white;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid var(--secondary);
    position: relative;
}

.project-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    border-left-color: var(--primary);
}

.project-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 12px;
}

.project-meta span {
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 12px;
}

.project-status {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    color: white;
}

.project-status.en-cours {
    background: var(--warning);
}

.project-status.termine {
    background: var(--success);
}

.project-status.en-attente {
    background: var(--gray);
}

/* PROJETS EN COURS - TIMELINE */
.projets-en-cours {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

/* DATA MANAGEMENT BUTTON */
.data-management {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 999;
}

.data-management button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Compatibilité avec les anciennes modales (.modal) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: none;                  /* caché par défaut */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;                  /* affiché quand la classe .show est ajoutée */
}

/* MODAL DE GESTION DES LISTES */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 25px;
    max-width: 900px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    position: relative;
}

.modal-content.large-modal {
    max-width: 1100px;
}

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

.modal-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.lists-management {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.lists-column {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #e1e8ed;
}

.lists-column h3 {
    font-size: 16px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lists-column h3::before {
    content: "•";
    font-size: 20px;
    color: var(--secondary);
}

.list-items {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
    border: 1px solid #e1e8ed;
}

.list-item span {
    flex: 1;
    font-size: 14px;
}

.list-item .btn-sm {
    padding: 4px 8px;
}

.new-list-item {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.new-list-item input {
    flex: 1;
}

/* JOURNAL - TABLEAU DE PROJETS */
.projects-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.project-tab {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #e1e8ed;
    background: white;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.project-tab.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.tab-count {
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 11px;
}

/* TABLEAU TYPE */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    font-size: 13px;
}

.table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e1e8ed;
}

.table tbody tr:nth-child(even) {
    background: #fcfcfc;
}

/* BADGES */
.badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    align-items: center;
    gap: 4px;
}

.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.badge-success {
    background: #e8f6f3;
    color: #16a085;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

/* ALERTES */
.alert {
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid transparent;
    margin-bottom: 15px;
    font-size: 14px;
}

.alert-info {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #0d47a1;
}

.alert-success {
    background: #e8f5e9;
    border-color: #a5d6a7;
    color: #1b5e20;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffeeba;
    color: #856404;
}

.alert-danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* ==================== */
/* FICHES TECHNIQUES */
/* ==================== */

.fiches-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    align-items: flex-start;
}

.materials-library {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    position: relative;
    min-height: 400px;
    border: 1px solid #e1e8ed;
}

/*
 * When there are many categories in the fiches library, allow the list
 * and its parent container to scroll. Without this, long lists extend
 * beyond the viewport and become inaccessible. We restrict the height of
 * the categories tree to a reasonable portion of the viewport and enable
 * vertical scrolling with a custom scrollbar. A small right padding
 * ensures the scrollbar does not overlap the content.
 */
.materials-library .categories-tree {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
}

/* Ensure the entire library container can scroll if its content exceeds
 * the available height on smaller screens. Setting a max-height relative
 * to the viewport prevents it from growing indefinitely. */
.materials-library {
    max-height: 70vh;
    overflow-y: auto;
}

.library-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f1f3f4;
}

.library-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
    background: white;
}

.library-header .btn {
    width: 100%;
    justify-content: center;
}

.categories-tree {
    list-style: none;
    max-height: none;
    overflow-y: visible;
    margin: 0;
    padding: 0;
}

.category-item {
    margin-bottom: 8px;
}

.category-header {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid #e1e8ed;
    font-size: 14px;
}

.category-header:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: translateY(-1px);
}

.category-header.active {
    background: #6c757d;
    color: white;
    border-color: #545b62;
}

.subcategories {
    list-style: none;
    margin-left: 15px;
    margin-top: 8px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0;
}

.subcategories.show {
    max-height: 2000px;
}

.subcategory-item {
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-size: 13px;
}

.subcategory-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.subcategory-item.active {
    background: #6c757d;
    color: white;
    border-color: #545b62;
    font-weight: 500;
}

.fiche-editor {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    height: auto;
    min-height: 600px;
    overflow: visible;
    border: 1px solid #e1e8ed;
}

.fiche-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    padding-bottom: 20px;
    border-bottom: 2px solid #f1f3f4;
}

.fiche-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
    display: flex;
    align-items: center;
    gap: 8px;
}

.params-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.param-group {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #e1e8ed;
    height: fit-content;
    transition: all 0.3s ease;
}

.param-group:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.param-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e1e8ed;
}

.param-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e1e8ed;
    min-height: 45px;
}

.param-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.param-label {
    font-weight: 500;
    color: var(--dark);
    flex: 1;
    font-size: 14px;
}

.param-group .form-input,
.param-group .form-select {
    width: auto;
    min-width: 140px;
    margin-left: 15px;
    font-size: 14px;
}

.param-group .form-input[type="number"] {
    text-align: right;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 15px;
}

.checkbox-group input {
    width: auto;
}

.param-group.full-width {
    grid-column: 1 / -1;
}

.param-group.full-width .form-textarea {
    width: 100%;
    min-height: 150px;
    font-size: 14px;
    line-height: 1.5;
}

#ficheNameInput {
    font-size: 1.8em;
    font-weight: 700;
    border: none;
    background: transparent;
    padding: 10px 0;
    margin-bottom: 20px;
    border-bottom: 3px solid #f1f3f4;
    width: 100%;
    color: var(--dark);
    transition: border-color 0.3s ease;
}

#ficheNameInput:focus {
    border-bottom-color: var(--secondary);
    outline: none;
}

.fiche-editor > div:only-child {
    text-align: center;
    padding: 80px 20px;
    color: var(--gray);
}

.fiche-editor > div:only-child h3 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--dark);
}

.fiche-editor > div:only-child p {
    font-size: 16px;
    line-height: 1.6;
}

/* Scrollbar pour fiches techniques */
.materials-library::-webkit-scrollbar {
    width: 6px;
}

.materials-library::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.materials-library::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.materials-library::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ==================== */
/* STOCKS */
/* ==================== */

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

.stocks-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.stock-search {
    position: relative;
}

.stock-search input {
    padding: 10px 15px 10px 35px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    width: 250px;
}

.stock-search::before {
    content: "🔍";
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.alerts-section {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    margin-bottom: 25px;
    border-left: 4px solid var(--warning);
}

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

.alert-count {
    background: var(--warning);
    color: #1a1a1a;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.alerts-grid {
    display: grid;
    gap: 12px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: #fffbf0;
    border-radius: 8px;
    border-left: 4px solid var(--warning);
}

.alert-item.alert-rupture {
    background: #feefef;
    border-left-color: var(--danger);
}

.alert-icon {
    font-size: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-details {
    font-size: 13px;
    color: #6b7280;
}

.alert-actions {
    display: flex;
    gap: 8px;
}

.stocks-table-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

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

.table-tabs {
    display: flex;
    gap: 5px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
}

.table-tab {
    padding: 8px 16px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
}

.table-tab.active {
    background: white;
    color: var(--secondary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table-actions {
    display: flex;
    gap: 10px;
}

.stocks-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 80px;
    padding: 10px 15px;
    align-items: center;
    border-bottom: 1px solid #e1e8ed;
    font-size: 13px;
}

.table-row.header {
    background: #f8f9fa;
    font-weight: 600;
}

.table-row:nth-child(even):not(.header) {
    background: #fcfcfc;
}

.table-cell {
    padding: 4px 8px;
}

.stock-name {
    font-weight: 600;
    color: var(--dark);
}

.stock-category {
    font-size: 12px;
    color: var(--gray);
}

.stock-quantity.low {
    color: var(--danger);
    font-weight: 600;
}

.stock-quantity.medium {
    color: var(--warning);
}

.stock-quantity.high {
    color: var(--success);
}

/* --- Machines (Paramètres) : éviter les débordements latéraux --- */
.machines-table {
    overflow-x: auto; /* au besoin, scroll horizontal plutôt que débordement */
}

.machines-table .table-row {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 180px;
}

.machines-table .table-cell.actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    white-space: nowrap;
}

/* ==================== */
/* WIKI / DOCUMENTATION */
/* ==================== */

.wiki-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    align-items: flex-start;
    height: auto;
}

.wiki-sidebar {
    background: white;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    border: 1px solid #e1e8ed;
    display: flex;
    flex-direction: column;
}

.wiki-sidebar-header {
    margin-bottom: 20px;
}

.wiki-search {
    margin-top: 15px;
}

.wiki-categories {
    max-height: 60vh;
    overflow-y: auto;
}

/* Mode lecture par défaut - Grille d'articles */
.articles-grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 10px;
}

.article-card {
    background: white;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-left: 4px solid var(--secondary);
    height: fit-content;
    max-height: 140px;
    overflow: hidden;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    border-left-color: var(--primary);
}

.article-card.active {
    background: #f0f7ff;
    border-color: var(--secondary);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.article-name {
    font-weight: 600;
    color: var(--dark);
    font-size: 15px;
    line-height: 1.3;
    flex: 1;
}

.article-date {
    font-size: 11px;
    color: var(--gray);
    background: #f8f9fa;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    margin-left: 10px;
}

.article-preview {
    font-size: 13px;
    color: #5a6c7d;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 8px;
    max-height: 55px;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--gray);
}

.article-category {
    background: #e8f6f3;
    color: #16a085;
    padding: 2px 8px;
    border-radius: 8px;
}

.article-length {
    font-style: italic;
}

/* Mode édition */
.wiki-editor {
    display: none;
    flex-direction: column;
    height: 100%;
}

.wiki-content-editor {
    min-height: 400px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    padding: 14px;
    margin-top: 15px;
}

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

/* ==================== */
/* RESPONSIVE DESIGN */
/* ==================== */

@media (max-width: 1024px) {
    .lists-management {
        grid-template-columns: 1fr;
    }
    
    .modal-content.large-modal {
        max-width: 95%;
        width: 95%;
    }
    
    .fiches-container {
        grid-template-columns: 280px 1fr;
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .app-tabs {
        overflow-x: auto;
        padding: 0 15px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .projets-en-cours-grid {
        grid-template-columns: 1fr;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .projects-tabs {
        width: 100%;
        overflow-x: auto;
    }
    
    .data-management {
        bottom: 15px;
        right: 15px;
    }
    
    .modal-content {
        margin: 20px;
        padding: 14px;
    }
    
    .modal-content.large-modal {
        margin: 10px;
        padding: 15px;
    }
    
    .lists-management {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .fiches-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .materials-library {
        height: auto; /* CHANGEMENT : hauteur automatique en mobile */
        position: static;
    }
    
    .fiche-editor {
        padding: 14px;
        min-height: auto;
    }
    
    .fiche-actions {
        flex-direction: column;
    }
    
    .fiche-actions .btn {
        width: 100%;
    }
    
    .param-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-bottom: 20px;
    }
    
    .param-group .form-input,
    .param-group .form-select {
        width: 100%;
        margin-left: 0;
        min-width: auto;
    }
    
    .checkbox-group {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }
    
    .param-group {
        padding: 14px;
    }
    
    .stocks-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stock-search input {
        width: 100%;
    }
    
    .table-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .table-row.header {
        display: none;
    }
    
    .wiki-container {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .wiki-sidebar {
        height: 300px;
    }
	
	/* ===== Vue détail d'un article (Documentation) ===== */

.article-content {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 5px 15px rgba(0,0,0,0.06);
    padding: 25px 30px 30px;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 20px;
}

.article-title-section {
    flex: 1;
}

.article-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark);
    margin: 5px 0 10px;
}

.article-meta-large {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: var(--gray);
}

.article-meta-large span {
    background: #f4f6f8;
    border-radius: 999px;
    padding: 4px 10px;
}

.article-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.article-body {
    font-size: 15px;
    line-height: 1.6;
    color: var(--dark);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f2f5;
}

.article-body p {
    margin-bottom: 0.7em;
}

.article-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #f0f2f5;
}

.nav-btn {
    border: 1px solid #d5dde5;
    background: #ffffff;
    border-radius: 999px;
    padding: 6px 14px;
    font-size: 13px;
    color: var(--dark);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.nav-btn:hover:not([disabled]) {
    background: #f4f9ff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.nav-btn[disabled] {
    opacity: 0.45;
    cursor: default;
    box-shadow: none;
}

.article-navigation .nav-info {
    font-size: 13px;
    color: var(--gray);
}

.article-navigation .nav-position {
    font-weight: 600;
}

    
    .articles-grid-view {
        grid-template-columns: 1fr;
    }
    
    .progress-bar-container {
        overflow-x: auto;
        padding: 10px 5px;
        justify-content: flex-start;
    }
    
    .progress-circle {
        width: 14px;
        height: 14px;
        flex-shrink: 0;
    }
    
    .progress-connector {
        min-width: 20px;
        flex-shrink: 0;
    }
    
    .projet-en-cours-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .projet-en-cours-etape {
        margin-left: 0;
        align-self: flex-start;
    }
    
    .app-main {
        padding: 15px;
    }
    
    .quick-entry {
        padding: 15px;
    }
    
    .project-card, .projet-en-cours-card {
        padding: 15px;
    }
    
    .progress-circle {
        width: 12px;
        height: 12px;
    }
    
    .progress-connector {
        min-width: 15px;
    }
    
    .project-tab {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .tab-count {
        font-size: 10px;
        padding: 1px 4px;
    }
    
    .fiches-container {
        gap: 12px;
    }
    
    .materials-library,
    .fiche-editor {
        padding: 15px;
        border-radius: 8px;
    }
    
    .param-group {
        padding: 15px;
    }
    
    .params-grid {
        gap: 15px;
    }
    
    .param-title {
        font-size: 15px;
        margin-bottom: 15px;
    }
    
    .param-row {
        margin-bottom: 12px;
        padding-bottom: 15px;
    }
    
    #ficheNameInput {
        font-size: 1.5em;
    }
}

/* ANIMATIONS ET INTERACTIONS SUPPLÉMENTAIRES */
.category-header,
.subcategory-item,
.param-group {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.category-header:active,
.subcategory-item:active {
    transform: scale(0.98);
}

/* Indicateur visuel pour les catégories avec sous-éléments */
.category-header:has(+ .subcategories:not(.show))::after {
    content: "▶";
    font-size: 10px;
    transition: transform 0.3s ease;
}

.category-header:has(+ .subcategories.show)::after {
    content: "▼";
    font-size: 10px;
    transition: transform 0.3s ease;
}

/* Style pour les états vides */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: var(--dark);
    font-size: 18px;
}

.empty-state p {
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Amélioration du scroll pour les modales */
.modal-content {
    scrollbar-width: thin;
    scrollbar-color: #c1c1c1 #f1f1f1;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Animation pour les changements d'onglets */
.projects-container {
    animation: fadeIn 0.3s ease;
}

/*
 * ============================================================================
 *  DESIGN SYSTEM & LIENS STYLES
 *
 *  Ces classes apportent une cohérence visuelle entre les modules du Journal
 *  (Documentation, Fiches, Stocks, Liens). Elles reprennent la mise en page
 *  des fiches techniques (cartes blanches arrondies, ombres douces) et
 *  l'appliquent aux panneaux et éléments du module Liens. Les classes
 *  ajoutées n'affectent pas les anciens styles existants, elles servent
 *  uniquement aux nouvelles sections où elles sont utilisées.
 *
 *  - .jdb-panel : conteneur type carte/panneau pour encadrer le contenu.
 *  - .links-grid et .link-card : mise en page de la grille de liens avec
 *    des cartes homogènes (fond blanc, bords arrondis, ombre légère).
 *  - .links-sidebar et .links-main : panneaux latéraux et principaux pour
 *    le module Liens, adoptent la même esthétique que les fiches techniques.
 */

/* Panneau générique réutilisable */
.jdb-panel {
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 5px 15px rgba(0,0,0,0.06);
    padding: 14px;
    margin-bottom: 20px;
}

/* Mise en page de la grille des liens */
.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* Carte de lien individuelle */
.link-card {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

/* Marqueurs pour les favoris et à lire plus tard */
.link-card.favorite {
    border-left: 4px solid var(--secondary);
}
.link-card.read-later {
    border-left: 4px solid var(--warning);
}

.link-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--dark);
}

.link-url {
    font-size: 13px;
    color: var(--secondary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-category {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 8px;
}

.link-preview {
    font-size: 13px;
    color: #5a6c7d;
    line-height: 1.4;
    flex-grow: 1;
    margin-bottom: 10px;
    overflow: hidden;
}

.link-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--gray);
}

.link-action-btn {
    border: none;
    background: none;
    padding: 0;
    margin-left: 5px;
    cursor: pointer;
    font-size: 16px;
    color: var(--gray);
    transition: color 0.2s ease;
}
.link-action-btn:hover {
    color: var(--secondary);
}

/* Styles pour la sidebar et le panneau principal du module Liens */
.links-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 25px;
    align-items: flex-start;
}

.links-sidebar {
    /* Lorsque la classe jdb-panel est ajoutée dans le HTML, ces styles seront complétés
       par .jdb-panel. Cette règle définit uniquement la largeur pour la grille. */
    width: 280px;
}
.links-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.links-sidebar h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark);
}

.links-sidebar .favorites-list .favorite-item,
.links-sidebar .readlater-list .readlater-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 13px;
}

.links-sidebar .favorite-item:hover,
.links-sidebar .readlater-item:hover {
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* Override pour la sélection dans les fiches techniques */
.fiches-container .category-header.active {
    background: #6c757d;
    color: white;
}

.fiches-container .subcategory-item.active {
    background: #6c757d;
    color: white;
}

/* =============================================================================
   Styles pour le module Liens
   Gestionnaire de liens (layout, sidebar, responsive)
============================================================================= */

.links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.links-header .section-title {
    margin: 0;
}

.links-header .section-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Barre d'outils (recherche + filtres) */
.links-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 auto;
}

.links-toolbar .search-box {
    position: relative;
    max-width: 260px;
    flex: 1 1 160px;
}

.links-toolbar .search-box input {
    width: 100%;
    padding-right: 2.25rem;
}

.links-toolbar .search-box .search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.9rem;
    opacity: 0.7;
}

.links-toolbar .toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Layout principal Liens */
.links-container {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.links-sidebar {
    flex: 0 0 260px;
}

.links-main {
    flex: 1 1 auto;
}

/* Sidebar catégories + sections */
.links-sidebar .sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.categories-tree {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Suppression des puces dans l'arborescence */
.categories-tree ul {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

.categories-tree li {
    padding: 2px 0;
}

.links-sidebar .sidebar-section {
    margin-top: 1.25rem;
}

.links-sidebar .sidebar-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

/* Listes de favoris et À lire */
.favorites-list,
.readlater-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.9rem;
}

/* Barre d'actions principale et grille */
.links-actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
}

/* Responsive : affichage smartphone */
@media (max-width: 900px) {
    .links-container {
        flex-direction: column;
    }

    .links-sidebar,
    .links-main {
        width: 100%;
        max-width: 100%;
    }

    .links-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .links-toolbar {
        width: 100%;
        justify-content: flex-start;
    }

    .links-toolbar .search-box {
        max-width: 100%;
    }

    .categories-tree {
        max-height: 50vh;
    }

    .links-sidebar .sidebar-section h3 {
        font-size: 0.9rem;
    }
}


/* --- PROJETS : VUE PILOTABLE (STEP 5) --- */
.projects-view-tabs{
    display:flex;
    gap:5px;
    flex-wrap:wrap;
    justify-content:flex-start;
    align-items:center;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 8px;
}
.project-view-tab{
    padding: 8px 16px;
    border: none;
    background: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray);
    display:flex;
    align-items:center;
    gap:6px;
}
.project-view-tab.active{
    background: #fff;
    color: var(--secondary);
    box-shadow: 0 2px 4px rgba(0,0,0,0.10);
}

.project-view-tab .tab-count{
    background: #e9ecef;
    color: var(--gray);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 11px;
}
.project-view-tab.active .tab-count{
    background: rgba(0,0,0,0.06);
    color: var(--secondary);
}
.projects-view-panel{ display:none; margin-top: 12px; }
.projects-view-panel.active{ display:block; }

.week-more-wrapper{
    margin-top:10px;
    display:flex;
    flex-direction:column;
    gap:10px;
}
.projects-compact-list{
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow:hidden;
    background: var(--bg-2);
}
.projects-compact-row{
    display:grid;
    grid-template-columns: 1.3fr 0.8fr 0.8fr 0.8fr auto;
    gap:10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    align-items:center;
    font-size: 13px;
}
.projects-compact-row:last-child{ border-bottom: none; }
.projects-compact-row .muted{ color: var(--gray); }
.projects-compact-row .pill{
    display:inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--bg);
    font-size: 12px;
}
.projects-compact-actions{
    display:flex;
    gap:6px;
    justify-content:flex-end;
}
.projects-compact-actions button{
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor:pointer;
}
.project-form-collapsible{ margin-top: 18px; }
.projects-search-section{ margin-top: 18px; }

/* ========================================================= */
/* ===================== PILOTAGE ========================== */
/* ========================================================= */
/* Make section titles readable (TV friendly) */
#pilotage .section-title{
    font-size: 13px;
    font-weight: 800;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

#pilotage .section-title::after{
    content: "";
    display: block;
    height: 2px;
    background: #e1e8ed;
    margin-top: 10px;
}

/* Extra contrast for bottom titles (TV readability) */
#pilotage .pilotage-bottom .section-title{
    font-size: 14px !important;
    font-weight: 900 !important;
    color: var(--secondary) !important;
    letter-spacing: 0.08em !important;
    padding: 8px 10px !important;
    background: #f8fafc;
    border-left: 4px solid var(--secondary);
    border-radius: 12px;
}

#pilotage .pilotage-bottom .section-title::after{
    display: none;
}
/* ---------------- Help Drawer ---------------- */
.help-overlay{position:fixed;inset:0;background:rgba(0,0,0,.35);display:none;z-index:9999;}
.help-overlay[aria-hidden="false"]{display:block;}
.help-drawer{position:absolute;top:0;right:0;height:100%;width:min(92vw,420px);background:#fff;box-shadow:-10px 0 30px rgba(0,0,0,.2);transform:translateX(100%);transition:transform .2s ease;display:flex;flex-direction:column;}
.help-drawer[aria-hidden="false"]{transform:translateX(0);}
.help-drawer-header{padding:14px 14px 10px;border-bottom:1px solid #e1e8ed;display:flex;gap:10px;align-items:flex-start;}
.help-drawer-title{font-weight:800;}
.help-drawer-sub{font-size:12px;color:var(--gray);margin-top:2px;flex:1;}
.help-drawer-close{border:1px solid #d7dee6;background:#fff;border-radius:10px;padding:8px 10px;font-weight:700;}
.help-drawer-body{padding:14px;overflow:auto;}
.help-drawer-body h1{font-size:18px;margin:0 0 10px;}
.help-drawer-body h2{font-size:16px;margin:16px 0 8px;}
.help-drawer-body h3{font-size:14px;margin:14px 0 6px;}
.help-drawer-body p{line-height:1.55;margin:0 0 10px;}
.help-drawer-body code{background:#f6f8fa;padding:2px 6px;border-radius:6px;}
.help-drawer-body pre{background:#f6f8fa;padding:10px;border-radius:10px;overflow:auto;}

/* ---------------- Module Topbar ---------------- */
.module-topbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:8px 0 14px;background:#fff;border-radius:12px;padding:10px 14px;border:1px solid #e1e8ed;}
.module-title{font-weight:800;}
.module-help-btn{border:1px solid #d7dee6;background:#fff;border-radius:10px;padding:8px 12px;font-weight:700;}
.module-help-btn:active{transform:translateY(1px);}

/* =====================================================
   FIX A7 - Styles des badges de tags sur les cartes projets
   Ajoutés car project-tag et ses variantes étaient utilisés
   dans le JS mais non définis dans le CSS.
   ===================================================== */

.project-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* Matériau (bleu doux) */
.project-tag.tag-material {
    background: #e8f4fd;
    color: #1a6fa8;
    border: 1px solid #b8d9f0;
}

/* Technique (violet doux) */
.project-tag.tag-technique {
    background: #f0ebff;
    color: #6b3fa0;
    border: 1px solid #d4c5f5;
}

/* Réussi (vert) */
.project-tag.tag-success {
    background: #e6f9ed;
    color: #1a7a42;
    border: 1px solid #a8e6be;
}

/* Problème (rouge) */
.project-tag.tag-problem {
    background: #fdecea;
    color: #b71c1c;
    border: 1px solid #f5b3ae;
}

/* Urgent (orange vif) */
.project-tag.tag-urgent {
    background: #fff3e0;
    color: #e65100;
    border: 1px solid #ffcc80;
    font-weight: 700;
}

/* Client important (doré) */
.project-tag.tag-client {
    background: #fffde7;
    color: #7a6000;
    border: 1px solid #ffe082;
}

/* À optimiser (jaune-ambre) */
.project-tag.tag-warning {
    background: #fef9c3;
    color: #856404;
    border: 1px solid #fde68a;
}

/* Commande (cyan) */
.project-tag.tag-commande {
    background: #e0f7fa;
    color: #006064;
    border: 1px solid #80deea;
}

/* Test (gris-bleu) */
.project-tag.tag-test {
    background: #eceff1;
    color: #455a64;
    border: 1px solid #b0bec5;
}
