:root {
    --primary: #2563eb; --primary-dark: #1e40af;
    --bg-app: #f8fafc; --bg-card: #ffffff;
    --text-main: #0f172a; --text-muted: #64748b;
    --border: #e2e8f0;
    --safe-bottom: env(safe-area-inset-bottom, 20px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: var(--bg-app); color: var(--text-main); font-size: 16px; }
a { text-decoration: none; color: inherit; transition: 0.2s; }

/* SIDEBAR PC */
.sidebar { width: 280px; height: 100vh; background: #0f172a; color: white; position: fixed; top: 0; left: 0; display: flex; flex-direction: column; z-index: 1000; padding: 0 15px; }
.logo { font-size: 1.5rem; font-weight: 800; text-align: center; padding: 30px 0; color: white; } .logo span { color: #3b82f6; }
.nav-links { flex: 1; overflow-y: auto; }
.sidebar-footer { padding: 20px 0; border-top: 1px solid rgba(255,255,255,0.05); text-align: center; color: #64748b; font-size: 0.8rem; margin-top: auto; }

/* MODULES TIROIRS */
.module-drawer { margin-bottom: 12px; border-radius: 12px; overflow: hidden; border: 1px solid transparent; }
.module-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px; background: rgba(255, 255, 255, 0.03); color: #e2e8f0; cursor: pointer; border-radius: 12px; }
.module-header:hover { background: rgba(255, 255, 255, 0.08); }
.module-title { font-weight: 700; font-size: 0.9rem; display: flex; align-items: center; gap: 12px; }
.module-title i { color: var(--primary); font-size: 1rem; width: 20px; text-align: center; }
.module-badge { font-size: 0.65rem; background: rgba(16, 185, 129, 0.15); color: #34d399; padding: 3px 8px; border-radius: 6px; font-weight: 800; margin-left: auto; margin-right: 10px; }
.arrow { font-size: 0.75rem; color: #64748b; transition: transform 0.3s; }
.module-content { max-height: 0; overflow: hidden; background: rgba(0, 0, 0, 0.2); transition: max-height 0.4s ease-out; }
.module-content a { display: block; padding: 10px 15px 10px 50px; color: #94a3b8; font-size: 0.9rem; border-left: 2px solid transparent; }
.module-content a:hover { color: white; }
.module-drawer.open .module-header { background: rgba(37, 99, 235, 0.1); color: white; }
.module-drawer.open .arrow { transform: rotate(90deg); color: var(--primary); }
.module-drawer.open .module-content { max-height: 500px; padding: 5px 0 10px 0; }
.module-drawer.locked { opacity: 0.5; filter: grayscale(1); cursor: not-allowed; border: 1px dashed #334155; }
.lock-icon { color: #fca5a5; }

/* CONTENU */
.main-content { margin-left: 280px; padding: 40px; min-height: 100vh; }
.header-page { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
.header-page h1 { margin: 0; font-size: 1.8rem; font-weight: 800; }
.card { background: var(--bg-card); padding: 25px; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border: 1px solid var(--border); margin-bottom: 20px; }
.btn { display: inline-flex; align-items: center; gap: 8px; background: var(--primary); color: white; padding: 10px 20px; border-radius: 10px; font-weight: 600; border: none; cursor: pointer; }

/* TABLEAUX & GRILLES */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 15px; background: #f8fafc; color: #64748b; font-weight: 600; border-bottom: 1px solid var(--border); }
td { padding: 15px; border-bottom: 1px solid var(--border); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
input, select, textarea { width: 100%; padding: 12px; border: 1px solid #cbd5e1; border-radius: 10px; font-size: 1rem; }

/* MOBILE */
@media (max-width: 992px) {
    .sidebar { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 15px !important; padding-bottom: 110px !important; width: 100% !important; }
    .header-page { flex-direction: column; align-items: flex-start; gap: 10px; }
    .header-page .btn { display: none; }
    
    /* Bottom Nav */
    .bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: calc(70px + var(--safe-bottom)); background: rgba(255, 255, 255, 0.98); backdrop-filter: blur(20px); border-top: 1px solid rgba(0,0,0,0.05); display: grid; grid-template-columns: repeat(5, 1fr); z-index: 5000; padding-bottom: var(--safe-bottom); box-shadow: 0 -5px 20px rgba(0,0,0,0.05); }
    .nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #94a3b8; font-size: 10px; font-weight: 600; }
    .nav-item i { font-size: 22px; margin-bottom: 5px; }
    .nav-item.active { color: var(--primary); }
    .nav-item.locked-item { opacity: 0.5; color: #cbd5e1; }
    .nav-item.locked-item i { color: #ef4444; }
    
    .nav-fab-wrapper { position: relative; top: -25px; display: flex; justify-content: center; }
    .nav-fab { width: 60px; height: 60px; background: var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 26px; box-shadow: 0 10px 25px rgba(37,99,235,0.4); border: 4px solid var(--bg-app); }

    /* Tables Mobile = Cartes */
    table, thead, tbody, th, td, tr { display: block; } thead { display: none; }
    table tr { background: white; border-radius: 18px; margin-bottom: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.05); padding: 20px; }
    table td { padding: 6px 0; border: none; display: flex; justify-content: space-between; align-items: center; text-align: right; }
    table td:first-child { font-size: 1.1rem; font-weight: 800; color: #1e293b; display: block; text-align: left; border-bottom: 1px solid #f1f5f9; padding-bottom: 10px; margin-bottom: 10px; }
    
    /* Menu Overlay */
    .mobile-menu-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-app); z-index: 6000; overflow-y: auto; padding-bottom: 120px; padding: 25px; }
    .mobile-menu-overlay .module-drawer { background: white; border: 1px solid #e2e8f0; }
    .mobile-menu-overlay .module-header { background: white; color: #333; }
}
@media (min-width: 993px) { .bottom-nav { display: none; } }