:root {
    --primary: #ef7908;
    --primary-dark: #c96306;
    --primary-light: #fff4e8;
    --dark: #121212;
    --text: #333333;
    --text-muted: #515151;
    --light: #e9e9e9;
    --surface: #ffffff;
    --success: #2d8a4e;
    --error: #cf2e2e;
    --border: #dddddd;
    --sidebar-w: 320px;
    --navbar-h: 57px;
}
* { box-sizing: border-box; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: var(--text);
    margin: 0;
    line-height: 1.6;
}
.navbar {
    background: var(--surface);
    color: var(--dark);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
    min-height: var(--navbar-h);
}
.navbar-brand {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1 1 auto;
    min-width: 0;
}
.navbar-logo-link {
    display: flex;
    align-items: center;
    line-height: 0;
    min-width: 0;
    flex-shrink: 1;
}
.navbar-logo {
    height: 36px;
    width: auto;
    max-width: 100%;
    display: block;
    object-fit: contain;
    object-position: left center;
}
.navbar-module {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary);
    border-left: 2px solid var(--border);
    padding-left: 16px;
}
.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    flex-shrink: 0;
}
.navbar-progress {
    font-size: 13px;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.2;
}
.navbar-sub { font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.navbar-dev-badge {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #5a6a7a;
    background: #eef2f6;
    border: 1px solid #cfd8e3;
    border-radius: 999px;
    padding: 4px 10px;
    white-space: nowrap;
}
.layout { display: flex; min-height: calc(100vh - var(--navbar-h)); }
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: var(--navbar-h);
    height: calc(100vh - var(--navbar-h));
    overflow: hidden;
}
.sidebar-search { padding: 16px; border-bottom: 1px solid var(--border); }
.sidebar-search input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 14px;
    background: var(--light);
}
.sidebar-search input:focus { border-color: var(--primary); outline: none; background: white; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-section { margin-bottom: 8px; }
.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 8px 16px 4px;
    letter-spacing: 0.05em;
}
.sidebar-link {
    display: block;
    padding: 8px 16px 8px 20px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
}
.sidebar-link:hover { background: var(--light); }
.sidebar-link.active {
    background: var(--primary-light);
    border-left-color: var(--primary);
    color: var(--dark);
    font-weight: 600;
}
.sidebar-link.done::after { content: ' ✓'; color: var(--success); font-size: 12px; }
.sidebar-link.quiz-done::after { content: ' ★'; color: var(--primary); font-size: 12px; }
.sidebar-link.locked { opacity: 0.55; cursor: not-allowed; }
.sidebar-link.locked::before { content: '🔒 '; font-size: 11px; }
.sidebar-link.hidden { display: none; }
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.sidebar-footer a { color: var(--text); text-decoration: none; font-weight: 500; }
.sidebar-footer a:hover { color: var(--primary); }
.sidebar-footer-sep { color: var(--border); margin: 0 6px; }
.main { flex: 1; padding: 28px; max-width: 900px; }
.hidden { display: none !important; }

.welcome-panel {
    background: var(--surface);
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.welcome-kicker {
    margin: 0 0 8px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
}
.welcome-panel h2 {
    color: var(--dark);
    margin: 0 0 16px;
    font-size: 28px;
    font-weight: 500;
    line-height: 1.25;
}
.welcome-lead { color: var(--text-muted); margin: 0 0 8px; font-size: 16px; }
.welcome-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin: 28px 0;
}
.stat-card {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 16px;
    text-align: center;
}
.stat-card .num { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-card .lbl { font-size: 13px; color: var(--text-muted); }

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-nav {
    background: var(--light);
    border: 1px solid var(--border);
    padding: 10px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
}
.btn-nav:hover { border-color: var(--primary); color: var(--primary-dark); }

.article-view {
    background: var(--surface);
    padding: 36px;
    border-radius: 4px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.article-header { margin-bottom: 24px; }
.article-ref {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 8px;
}
.article-title { color: var(--dark); margin: 0; font-size: 26px; font-weight: 500; }

.badge-loi {
    background: var(--light);
    color: var(--dark);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-inst {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.loi-content { margin: 20px 0; }
.loi-content p { margin: 0.8em 0; }
.loi-content ul { margin: 0.5em 0; padding-left: 1.5em; }
.loi-content .notification {
    background: var(--light);
    border-left: 4px solid var(--primary);
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
}
.loi-content img {
    max-height: 80px;
    vertical-align: middle;
    margin: 4px 8px 4px 0;
}

.instructeur-box {
    background: var(--primary-light);
    border: 1px solid #f5c98a;
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: 0 4px 4px 0;
    margin: 24px 0;
}
.instructeur-box h3 { margin-top: 0; font-size: 14px; }

.quiz-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid var(--primary);
}
.quiz-section h3 { color: var(--dark); font-weight: 500; }
.quiz-card {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 20px;
    margin: 16px 0;
}
.quiz-card.done { border-color: var(--success); }
.option-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    text-align: left;
    transition: border-color 0.15s;
}
.option-btn:hover:not(:disabled) { border-color: var(--primary); }
.option-btn:disabled { cursor: default; }
.option-btn.correct { background: var(--success); color: white; border-color: var(--success); }
.option-btn.incorrect { background: var(--error); color: white; border-color: var(--error); }
.quiz-feedback {
    margin-top: 12px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}
.quiz-feedback.show { display: block; }
.quiz-feedback.ok { background: #d4edda; color: #155724; }
.quiz-feedback.ko { background: #f8d7da; color: #721c24; }

.gate-banner {
    background: var(--primary-light);
    border: 1px solid #f5c98a;
    border-left: 4px solid var(--primary);
    padding: 14px 18px;
    border-radius: 0 4px 4px 0;
    margin: 0 0 20px;
    font-size: 14px;
}
.gate-banner-success {
    background: #e8f5ec;
    border-color: #a8d5b5;
    border-left-color: var(--success);
    color: #155724;
}
.gate-banner-soft {
    background: #f0f4f8;
    border-color: #d0d8e0;
    border-left-color: #8a9bab;
    color: var(--text-muted);
}
.gate-soft-notice {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0 0 12px;
    font-style: italic;
}
.gate-banner-link {
    background: none;
    border: none;
    color: var(--primary-dark);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
    font-size: inherit;
}
.gate-quiz-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 3px solid var(--primary);
}
.gate-quiz-section h3 { color: var(--dark); font-weight: 500; margin-top: 0; }
.gate-score-bar {
    height: 8px;
    background: var(--light);
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0 8px;
}
.gate-score-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}
.gate-score-text { font-size: 14px; color: var(--text-muted); margin: 0 0 16px; }
.gate-success-msg {
    background: #d4edda;
    color: #155724;
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-weight: 600;
}
.btn-nav:disabled, .btn-nav-locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.article-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
    gap: 12px;
}
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(239,121,8,0.35);
}
.site-footer {
    text-align: center;
    padding: 16px;
    font-size: 11px;
    color: var(--text-muted);
    opacity: 0.65;
}
.site-footer small { letter-spacing: 0.02em; }

@media (max-width: 900px) {
    :root { --navbar-h: 48px; }
    .navbar {
        padding: 8px 12px;
        gap: 8px;
    }
    .navbar-module { display: none; }
    .navbar-brand { gap: 0; }
    .navbar-logo { height: 28px; max-width: min(160px, 58vw); }
    .navbar-sub { display: none; }
    .navbar-progress-label { display: none; }
    .navbar-progress {
        font-size: 12px;
        padding: 5px 10px;
        min-width: 44px;
        text-align: center;
    }
    .navbar-dev-badge { display: none; }
    .sidebar {
        position: fixed;
        left: 0;
        top: var(--navbar-h);
        z-index: 150;
        height: calc(100vh - var(--navbar-h));
        transform: translateX(-100%);
        transition: transform 0.25s;
        box-shadow: 4px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .main { padding: 16px; }
    .article-view { padding: 20px; }
    .welcome-panel { padding: 24px; }
}

@media (max-width: 380px) {
    .navbar-logo { max-width: min(130px, 52vw); height: 26px; }
}
