:root {
    --primary: #3498db;
    --secondary: #27ae60;
    --dark: #2c3e50;
    --text: #333;
    --bg: #f4f7f6;
    --muted: #7f8c8d;
}

* { box-sizing: border-box; }

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    margin: 0;
}

a { color: var(--primary); }

.adminbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1.1rem;
    background: var(--dark);
    color: white;
    padding: 0.45rem 1.25rem;
    font-size: 0.88rem;
}

.adminbar-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
}

.adminbar a {
    color: white;
    text-decoration: none;
}

.adminbar a:hover { color: #d6eaf8; }

.adminbar form { margin: 0 0 0 auto; }

.adminbar button {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 999px;
    padding: 0.12rem 0.75rem;
    font-size: 0.82rem;
}

.adminbar button:hover { background: rgba(255, 255, 255, 0.12); }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.25rem 0;
}

.brand {
    color: var(--dark);
    font-weight: 700;
    text-decoration: none;
}

.topbar nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.who { color: var(--muted); font-size: 0.92rem; }

.button, button {
    background: var(--primary);
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    text-decoration: none;
    font: inherit;
    cursor: pointer;
}

.button.quiet, button.quiet {
    background: transparent;
    color: var(--dark);
    border: 1px solid #d5dde3;
}

.page {
    max-width: 960px;
    margin: 1rem auto 2rem;
    background: white;
    padding: 2.2rem 2.4rem;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

h1 {
    color: var(--dark);
    text-align: center;
    border-bottom: 3px solid var(--primary);
    padding-bottom: 0.7rem;
    margin-top: 0;
}

.badge {
    background: #e67e22;
    color: white;
    font-size: 0.45em;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    vertical-align: middle;
    letter-spacing: 0.04em;
}

.intro, .note {
    background: #e8f4fd;
    padding: 1.2rem 1.4rem;
    border-radius: 10px;
    border-left: 6px solid var(--primary);
}

.note { margin-bottom: 1.4rem; }

.menu-grid, .vision-grid, .manifeste-grid {
    display: grid;
    gap: 0.9rem;
}

.menu-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin: 1.6rem 0;
}

.card, a.card {
    display: block;
    border: 2px solid #ecf0f1;
    padding: 1.3rem 0.8rem;
    border-radius: 12px;
    text-align: center;
    background: #fff;
    color: inherit;
    text-decoration: none;
}

a.card.disponible:hover {
    border-color: var(--primary);
    background: #f0f9ff;
    transform: translateY(-4px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.15);
}

.card.disabled { opacity: 0.6; cursor: not-allowed; background: #fafafa; }

.ops { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.4rem; }
.ops a {
    background: var(--dark);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    padding: 0.45rem 0.8rem;
    font-size: 0.9rem;
}

.crumb { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.8rem; }
.crumb a { font-weight: 700; text-decoration: none; }

.course-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}
.course-head h1 { border: 0; text-align: left; margin: 0; padding: 0; }
.course-head p { margin: 0.25rem 0 0; color: var(--muted); }

.action-zones { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tool-zone {
    background: #f0f7ff;
    border: 1px dashed var(--primary);
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
}
.tool-zone.teacher { background: #fff5f5; border-color: #e74c3c; }
.tool-zone p {
    margin: 0 0 0.4rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary);
}
.tool-zone.teacher p { color: #e74c3c; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.btn-row form { margin: 0; }
.tool-btn {
    background: var(--primary);
    color: white;
    text-decoration: none;
    border: 0;
    border-radius: 6px;
    padding: 0.4rem 0.65rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}
.tool-btn.drills { background: #16a085; }
.tool-btn.evaluate { background: #8e44ad; }
.tool-btn.poll, .tool-btn.switch { background: #e74c3c; }

.folder {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 0.8rem;
    overflow: hidden;
}
.folder[open] { border-color: var(--primary); box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.folder summary {
    padding: 0.85rem 1rem;
    font-weight: 700;
    color: var(--dark);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    background: #f8f9fa;
}
.folder summary::-webkit-details-marker { display: none; }
.folder summary::after { content: "📁"; }
.folder[open] summary::after { content: "📂"; }
.folder summary:hover { background: #f0f9ff; }
.details-content { padding: 0.4rem 1rem 1rem; border-top: 1px solid #eee; }
.details-content h2 {
    text-align: left;
    border: 0;
    border-left: 4px solid var(--primary);
    padding: 0 0 0 0.6rem;
    margin: 1rem 0 0.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #2980b9;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.8rem;
}
.doc-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 0.75rem 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: inherit;
    background: white;
}
.doc-card:hover { border-color: var(--primary); background: #f0f9ff; }
.doc-card .icon { font-size: 1.25rem; margin: 0; }
.doc-name { flex: 1; }
.badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: 12px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.badge.syllabus { background: var(--dark); color: white; }
.badge.exos { background: #2ecc71; color: white; }
.badge.eleve { background: #16a085; color: white; }
.badge.diapo { background: #9b59b6; color: white; }
.badge.plan { background: #e74c3c; color: white; }

.card h2 { margin: 0.4rem 0; color: #2980b9; font-size: 1.15rem; }
.card .icon { font-size: 2.2rem; display: block; }
.card .status { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: #95a5a6; }
.card.disponible { border-color: var(--secondary); }
.card.disponible .status { color: var(--secondary); }
.card.bientot .status { color: #e67e22; }
.card.reflexion { opacity: 0.7; background: #fafafa; }

.vision, .manifeste { margin-top: 1.5rem; }
.vision { border: 1px solid #e0e0e0; padding: 1.4rem; border-radius: 12px; }
.vision h2, .manifeste h2 { margin-top: 0; }
.vision-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.vision-item { background: #f8f9fa; padding: 1rem; border-radius: 10px; border-left: 4px solid var(--primary); }
.vision-item h3 { margin: 0 0 0.4rem; color: #2980b9; }

.manifeste { background: var(--dark); color: white; padding: 1.4rem; border-radius: 12px; }
.manifeste h2 { color: var(--primary); }
.manifeste-grid { grid-template-columns: 1fr 1fr; }
.tag {
    background: rgba(52, 152, 219, 0.2);
    color: var(--primary);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-family: monospace;
}

.section-title { margin-top: 2rem; }

.board { display: flex; flex-direction: column; gap: 1rem; }

.matiere-card {
    border: 1px solid #e4ebf0;
    border-radius: 16px;
    background: white;
    overflow: hidden;
}

.matiere-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    background: #f7fafc;
    border-bottom: 1px solid #e4ebf0;
}

.matiere-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: inherit;
    text-decoration: none;
    font-size: 1.15rem;
}

.matiere-title .icon { font-size: 1.6rem; }
.matiere-title .status { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.matiere-title .status.disponible { color: var(--secondary); }
.matiere-title .status.bientot { color: #e67e22; }
.matiere-title .status.reflexion { color: #95a5a6; }

.track-block { padding: 0.9rem 1.1rem 1.05rem; }
.track-block + .track-block { border-top: 1px solid #f0f3f5; }
.track-block h3 { margin: 0 0 0.65rem; color: #2980b9; font-size: 0.98rem; }

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

.uaa {
    border: 1px solid #ecf0f1;
    border-radius: 12px;
    padding: 0.75rem 0.8rem 0.85rem;
    background: #fff;
}

.uaa h4 { margin: 0 0 0.45rem; color: var(--dark); }

.doc-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.doc-pair span {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.chip {
    display: inline-block;
    margin: 0.15rem 0.25rem 0 0;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: #eaf4fb;
    color: #1a5276;
    font-size: 0.8rem;
    text-decoration: none;
}

.chip:hover { background: #d6eaf8; }

.empty-track { margin: 0; padding: 0.9rem 1.1rem 1rem; color: var(--muted); }

.level { color: var(--dark); font-size: 0.95rem; margin: 0.8rem 0 0.3rem; }

.doc-list { list-style: none; padding: 0; margin: 0.35rem 0 0; text-align: left; font-size: 0.92rem; }
.doc-list li { margin: 0.15rem 0; }

fieldset {
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    margin: 0 0 0.8rem;
    padding: 0.6rem 0.9rem 0.8rem;
}

legend { font-weight: 700; color: var(--dark); padding: 0 0.3rem; }

.access-level {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.8rem;
    margin-top: 0.35rem;
}

.access-level .level { margin: 0; min-width: 3rem; }

.access-level label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 400;
}

.shelf-head { text-align: center; margin-bottom: 1.2rem; }
.shelf-head p { color: var(--muted); margin: 0.3rem 0 0; }

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

.resource {
    border: 2px solid #ecf0f1;
    border-radius: 12px;
    padding: 1.1rem 1rem 1rem;
    text-align: left;
}

a.resource { display: block; }
a.resource:hover { border-color: var(--primary); }
.resource h2 { margin: 0.2rem 0 0.4rem; color: var(--dark); font-size: 1.15rem; }
.resource p { margin: 0; color: #555; font-size: 0.95rem; }
.resource .icon { font-size: 1.6rem; }

.form p { margin: 0 0 0.9rem; }
.form label { display: block; font-weight: 600; }
.form input, .form select, .form textarea {
    width: 100%;
    max-width: 22rem;
    padding: 0.45rem 0.55rem;
    border: 1px solid #d5dde3;
    border-radius: 8px;
    font: inherit;
    background: white;
}

.form .help {
    display: block;
    max-width: 36rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.logo-preview { height: 36px; width: auto; vertical-align: middle; }
.logo-preview.large { height: 72px; margin: 0.4rem 0 1rem; }

.danger-row { margin-top: 1.8rem; }

button.danger {
    background: transparent;
    color: #c0392b;
    border: 1px solid #e6b0aa;
}

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li {
    background: #e8f8ef;
    border-left: 6px solid var(--secondary);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-bottom: 0.5rem;
}
.messages .error {
    background: #fdecea;
    border-left-color: #c0392b;
}
.errorlist { color: #c0392b; padding-left: 1.1rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.7rem;
    margin: 1.2rem 0 1.6rem;
}

.stat {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 0.8rem 0.7rem;
    text-align: center;
    border-top: 3px solid var(--primary);
}

.stat-n {
    display: block;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.1;
}

.stat-l { color: var(--muted); font-size: 0.85rem; }

.sheet {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.sheet th, .sheet td {
    text-align: left;
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.sheet th { color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }

footer {
    margin-top: 2rem;
    text-align: center;
    color: var(--muted);
    border-top: 1px solid #eee;
    padding-top: 1.2rem;
    font-size: 0.92rem;
}

@media (max-width: 640px) {
    .page { padding: 1.4rem 1rem; border-radius: 0; }
    .manifeste-grid { grid-template-columns: 1fr; }
    .menu-grid { grid-template-columns: 1fr 1fr; }
}
