/* ===== Thème sombre et sobre, avec une couleur par rubrique ===== */
:root {
    --bg: #111318;
    --surface: #181b22;
    --surface-2: #20242d;
    --border: #2a2f3a;
    --text: #e6e8ee;
    --muted: #8b92a3;
    --primary: #7c8cff;
    --primary-soft: rgba(124, 140, 255, .14);
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, .13);
    --warn: #fbbf24;
    --warn-soft: rgba(251, 191, 36, .13);
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .13);
    --radius: 12px;

    /* Couleurs des rubriques */
    --c-accueil: #7c8cff;
    --c-cours: #38bdf8;
    --c-matieres: #facc15;
    --c-notes: #a78bfa;
    --c-devoirs: #fb923c;
    --c-rdv: #f472b6;
    --c-sport: #4ade80;
    --c-status: #2dd4bf;

    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.55 var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; font-weight: 700; }
h2 { font-size: 1rem; font-weight: 600; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-family: var(--font-mono); font-size: .88em; }
::selection { background: var(--primary); color: #0b0d12; }

/* ===== Mise en page ===== */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 12px;
}
.sidebar .brand { display: block; font-weight: 700; font-size: 1.15rem; color: var(--text); padding: 0 12px 20px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: var(--muted); font-weight: 500;
}
.sidebar li a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sidebar li a.active { background: var(--primary-soft); color: var(--primary); }
.sidebar .ico { width: 18px; text-align: center; }

.content { flex: 1; min-width: 0; padding: 28px 32px 48px; max-width: 1200px; }

.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 24px;
}
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: .9rem; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; margin-bottom: 20px; }
.card-wide { grid-column: 1 / -1; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 20px;
}
.grid > .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head a { font-size: .9rem; }

/* ===== Lignes de liste ===== */
.row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--border);
    color: var(--text);
}
.card-head + .row, .card-head + .stats + .row, .done > .row:first-child { border-top: 0; }
.row-link:hover { text-decoration: none; background: var(--surface-2); margin: 0 -10px; padding-inline: 10px; border-radius: 8px; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--text); }
.row-main:hover { text-decoration: none; }
.row-main small { color: var(--muted); }
.row .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; min-width: 92px; }
.done .row-main strong { text-decoration: line-through; color: var(--muted); }

.empty { color: var(--muted); margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.date-chip {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    width: 46px; height: 46px; border-radius: 10px;
    background: var(--primary-soft); color: var(--primary); line-height: 1.1;
}
.date-chip b { font-size: 1.1rem; }
.date-chip small { font-size: .7rem; text-transform: uppercase; }

/* ===== Badges ===== */
.badge {
    display: inline-block; padding: 2px 8px; border-radius: 999px;
    font-size: .75rem; font-weight: 600; white-space: nowrap;
    background: var(--surface-2); color: var(--muted);
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warning { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

/* ===== Cases à cocher (formulaires POST) ===== */
.toggle-form { margin: 0; }
.check {
    width: 22px; height: 22px; padding: 0;
    border: 2px solid var(--border); border-radius: 6px;
    background: var(--surface); color: #fff; font-size: 13px; font-weight: 700;
    cursor: pointer;
}
.check:hover { border-color: var(--primary); }
.check.checked { background: var(--ok); border-color: var(--ok); }

/* ===== Statistiques ===== */
.stats { display: flex; gap: 12px; margin-bottom: 8px; }
.stats > div { flex: 1; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.stats b { display: block; font-size: 1.3rem; }
.stats small { color: var(--muted); }

/* ===== Emploi du temps ===== */
.week { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.day { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 160px; }
.day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.day h3 { font-size: .9rem; margin-bottom: 10px; color: var(--muted); }
.day.today h3 { color: var(--primary); }
.course {
    display: flex; flex-direction: column;
    padding: 8px 10px; margin-bottom: 8px;
    border-left: 3px solid var(--primary); border-radius: 6px;
    background: var(--primary-soft); color: var(--text);
}
.course:hover { text-decoration: none; filter: brightness(.97); }
.course .time { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.course small { color: var(--muted); }

/* Entraînements dans l'emploi du temps */
.course-sport { border-left-color: var(--ok); background: var(--ok-soft); }
.course-coach { border-left-color: var(--warn); background: var(--warn-soft); }
.badge-coach { background: var(--warn-soft); color: var(--warn); }

/* ===== Notes de cours ===== */
.notes-layout { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.notes-filters { position: sticky; top: 20px; }
.notes-filters h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
.search input {
    width: 100%; padding: 9px 11px; font: inherit;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text);
}
.search input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.filter-list { list-style: none; margin: 0; padding: 0; }
.filter-list a {
    display: flex; justify-content: space-between; gap: 8px;
    padding: 6px 10px; border-radius: 8px; color: var(--text);
}
.filter-list a:hover { background: var(--surface-2); text-decoration: none; }
.filter-list a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.filter-list span { color: var(--muted); font-size: .85rem; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: .8rem; padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.tag:hover, .tag.active { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.note-tags { margin: -12px 0 16px; }
.filter-summary { margin: 0 0 12px; }
.matiere-link { color: var(--text); }
.chapitre {
    font-size: .8rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--primary); margin: 14px 0 2px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.card-head + .chapitre { border-top: 0; padding-top: 0; margin-top: 0; }
.chapitre + .row { border-top: 0; }
.note-row small { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.star, .is-fav { color: var(--warn); }
.badge-file { background: var(--primary-soft); color: var(--primary); }

.markdown { line-height: 1.7; padding: 24px 32px; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1 { font-size: 1.5rem; margin: 1.4em 0 .5em; }
.markdown h2 { font-size: 1.25rem; margin: 1.4em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.markdown h3 { font-size: 1.05rem; margin: 1.2em 0 .4em; }
.markdown blockquote { margin: 1em 0; padding: 8px 16px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 8px 8px 0; }
.markdown blockquote p { margin: 0; }
.markdown pre { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.markdown pre code { background: none; padding: 0; }
.markdown table { border-collapse: collapse; margin: 1em 0; }
.markdown th, .markdown td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.markdown th { background: var(--surface-2); }
.markdown img { max-width: 100%; }
.markdown hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }

.file-preview { width: 100%; height: 80vh; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.file-preview-img { max-width: 100%; border-radius: 8px; display: block; }
.note-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.note-nav .btn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }

.form-card-wide { max-width: 900px; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field textarea.editor { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .9rem; line-height: 1.6; resize: vertical; }
.field input[type=file] { font: inherit; color: var(--text); }
.current-file { background: var(--surface-2); padding: 8px 12px; border-radius: 8px; margin: 0 0 16px; }
.btn-link { background: none; border: 0; padding: 0 0 0 8px; font: inherit; color: var(--danger); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

.dropzone {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    padding: 28px 16px; margin-bottom: 16px; text-align: center; cursor: pointer;
    border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.tree { background: var(--surface-2); padding: 12px 14px; border-radius: 8px; font-size: .85rem; overflow-x: auto; }

@media print {
    .sidebar, .page-header .header-actions, .note-nav, .flash { display: none; }
    .content { padding: 0; }
    .card { border: 0; padding: 0; }
}

/* ===== Status serveur ===== */
.status-pill { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.status-pill .dot, .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.status-up .status-pill, .status-pill.status-up { background: var(--ok-soft); color: var(--ok); }
.status-pill.status-up .dot, .dot.ok { background: var(--ok); }
.status-pill.status-degraded { background: var(--warn-soft); color: var(--warn); }
.status-pill.status-degraded .dot { background: var(--warn); }
.status-pill.status-down { background: var(--danger-soft); color: var(--danger); }
.status-pill.status-down .dot, .dot.ko { background: var(--danger); }
.status-hero .status-pill { font-size: 1.1rem; padding: 6px 16px; }
.status-hero p { margin: 10px 0 0; }
.server-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.card-head + .check-row { border-top: 0; }

/* ===== Boutons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }

/* ===== Formulaires ===== */
.form-card { max-width: 640px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.field input[type=text], .field input[type=number], .field input[type=date],
.field input[type=datetime-local], .field select, .field textarea {
    width: 100%; padding: 9px 11px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); color: var(--text); font: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.field-checkbox { display: flex; align-items: center; gap: 8px; }
.field-checkbox label { margin: 0; font-weight: 500; }
.field-checkbox input { width: 18px; height: 18px; accent-color: var(--primary); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.error { color: var(--danger); font-size: .85rem; margin: 4px 0 0; }
.help { color: var(--muted); font-size: .85rem; margin: 4px 0 0; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
.delete-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== Messages flash ===== */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

/* ===== Mobile ===== */
@media (max-width: 760px) {
    .layout { flex-direction: column; }
    .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 12px; }
    .sidebar .brand { padding: 0 8px 8px; }
    .sidebar ul { display: flex; gap: 4px; overflow-x: auto; }
    .sidebar li a { white-space: nowrap; padding: 6px 10px; }
    .content { padding: 20px 16px 40px; }
    .grid { grid-template-columns: 1fr; }
    .notes-layout, .form-cols { grid-template-columns: 1fr; }
    .notes-filters { position: static; }
    .markdown { padding: 16px; }
}

/* =====================================================================
   Thème : sombre et sobre, une couleur par rubrique.
   --c = couleur de la rubrique ; elle devient --primary sur sa page.
   ===================================================================== */
.section-accueil, .nav-accueil, .tint-accueil { --c: var(--c-accueil); }
.section-cours,   .nav-cours,   .tint-cours   { --c: var(--c-cours); }
.section-matieres, .nav-matieres { --c: var(--c-matieres); }
.section-donnees, .nav-donnees { --c: #94a3b8; }
.section-notes,   .nav-notes,   .tint-notes   { --c: var(--c-notes); }
.section-devoirs, .nav-devoirs, .tint-devoirs { --c: var(--c-devoirs); }
.section-rdv,     .nav-rdv,     .tint-rdv     { --c: var(--c-rdv); }
.section-sport,   .nav-sport,   .tint-sport   { --c: var(--c-sport); }
.section-status,  .nav-status,  .tint-status  { --c: var(--c-status); }

[class*="section-"], .tint-cours, .tint-notes, .tint-devoirs, .tint-rdv, .tint-sport, .tint-status {
    --primary: var(--c);
    --primary-soft: color-mix(in srgb, var(--c) 14%, transparent);
}

/* ----- Barre latérale ----- */
.sidebar { background: #14161c; border-right-color: var(--border); }
.sidebar .brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
    background: conic-gradient(from 180deg, var(--c-cours), var(--c-notes), var(--c-rdv), var(--c-devoirs), var(--c-sport), var(--c-cours));
}
.sidebar li a { color: var(--muted); }
.sidebar li .ico { color: var(--c); opacity: .85; }
.sidebar li a:hover { background: var(--surface-2); color: var(--text); }
.sidebar li a.active {
    background: color-mix(in srgb, var(--c) 14%, transparent);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--c);
}
.sidebar li a.active .ico { opacity: 1; }

/* ----- Cartes ----- */
.card, .day { background: var(--surface); border-color: var(--border); }
.card[class*="tint-"] { border-top: 3px solid var(--c); }
.card-head h2 { color: var(--text); }
.tint-cours .card-head h2::before, .tint-notes .card-head h2::before, .tint-devoirs .card-head h2::before,
.tint-rdv .card-head h2::before, .tint-sport .card-head h2::before, .tint-status .card-head h2::before {
    content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    background: var(--c); margin-right: 8px; vertical-align: middle;
}
.page-header h1 { color: var(--text); }
.eyebrow { color: var(--primary); font-weight: 500; }

/* ----- Emploi du temps ----- */
.day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.course { background: color-mix(in srgb, var(--c-cours) 12%, var(--surface)); border-left-color: var(--c-cours); }
.course-sport { background: color-mix(in srgb, var(--c-sport) 12%, var(--surface)); border-left-color: var(--c-sport); }
.course-coach { background: color-mix(in srgb, var(--warn) 12%, var(--surface)); border-left-color: var(--warn); }
.course:hover { filter: brightness(1.15); }

/* ----- Boutons et contrôles ----- */
.btn-primary { background: var(--primary); color: #0b0d12; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost { background: transparent; }
.check { background: transparent; color: #0b0d12; }
.check.checked { color: #0b0d12; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus { outline-color: var(--primary); }
.field input::-webkit-calendar-picker-indicator { filter: invert(.8); }
.date-chip { background: var(--primary-soft); color: var(--primary); }
.stats b { color: var(--primary); }
.row-link:hover { background: var(--surface-2); }

/* ----- Notes ----- */
.chapitre { color: var(--primary); }
.badge-file { background: color-mix(in srgb, var(--c-notes) 16%, transparent); color: var(--c-notes); }
.markdown blockquote { border-left-color: var(--primary); background: var(--primary-soft); }

/* ===== Couleur par matière (--h = teinte, filtre Twig « teinte ») ===== */
.course-matiere, .matiere-card, .matiere-titre, .tl-cours {
    --mc: hsl(var(--h) 75% 66%);
}
.course-matiere { background: color-mix(in srgb, var(--mc) 13%, var(--surface)); border-left-color: var(--mc); }
.course-annule { opacity: .55; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); }
.course-annule strong { text-decoration: line-through; }
.annule-tag { color: var(--danger); font-weight: 600; }
.pastille { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mc); flex-shrink: 0; }

.matieres-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.matiere-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 16px 18px; border-radius: var(--radius); color: var(--text);
    background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--mc);
    transition: transform .12s, border-color .12s;
}
.matiere-card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--mc); }
.matiere-card-head { display: flex; align-items: center; gap: 8px; font-size: 1.02rem; }
.matiere-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); margin-top: 4px; }
.matiere-stats b { color: var(--text); }
.matiere-stats .a-faire b { color: var(--c-devoirs); }
.matiere-card .prochain { color: var(--mc); font-size: .82rem; margin-top: auto; padding-top: 6px; }
.matiere-titre { display: flex; align-items: center; gap: 12px; }
.matiere-titre .pastille { width: 14px; height: 14px; }
.matiere-infos { margin: 6px 0 0; }

.badge-btn { cursor: pointer; font: inherit; font-size: .75rem; font-weight: 600; border: 1px solid var(--border); background: transparent; color: var(--muted); }
.badge-btn:hover { color: var(--danger); border-color: var(--danger); }
button.badge { cursor: pointer; border: 0; font-family: inherit; }

/* Pastilles de choix rapide (ex. date du prochain cours) */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.chips .help { margin: 0 4px 0 0; }
.chip {
    font: inherit; font-size: .8rem; padding: 3px 10px; border-radius: 999px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

@media (max-width: 760px) {
    .sidebar li a.active { box-shadow: inset 0 -2px 0 var(--c); }
}

@media print {
    body { background: #fff; color: #000; }
    .card { border: 0; }
}

/* ===== Accueil : « En ce moment / Ensuite / Météo » ===== */
.hero {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius);
    overflow: hidden; margin-bottom: 20px;
}
.hero-block { background: var(--surface); padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-block:first-child { background: linear-gradient(135deg, color-mix(in srgb, var(--c-accueil) 16%, var(--surface)), var(--surface) 70%); }
.hero-label { margin: 0; font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hero-title { font-size: 1.3rem; font-weight: 700; color: var(--text); line-height: 1.25; }
.hero-title:hover { text-decoration: none; color: var(--primary); }
.muted-title { color: var(--muted); }
.hero-sub { margin: 0; color: var(--muted); font-size: .88rem; }
.hero-countdown { margin: 6px 0 0; font-size: 1.05rem; font-weight: 600; color: var(--c-accueil); }
.progress { height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin: 8px 0 4px; }
.progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c-sport); transition: width 1s linear; }

.meteo-now { display: flex; align-items: center; gap: 12px; }
.meteo-icon { font-size: 2.2rem; line-height: 1; }
.meteo-now b { display: block; font-size: 1.6rem; line-height: 1.1; }
.meteo-now small { color: var(--muted); }
.meteo-heures { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.meteo-heures span {
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    min-width: 44px; padding: 5px 4px; border-radius: 8px; background: var(--surface-2); font-size: .9rem;
}
.meteo-heures small { color: var(--muted); font-size: .7rem; }
.meteo-heures b { font-size: .8rem; }
.meteo-heures .pluie { color: var(--c-cours); }

/* ===== Frise du jour ===== */
.timeline { position: relative; display: flex; flex-direction: column; }
.tl-item {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 8px 8px 8px 0; border-radius: 8px; color: var(--text);
}
.tl-item:hover { text-decoration: none; background: var(--surface-2); }
.tl-time { display: flex; flex-direction: column; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: .9rem; }
.tl-time small { color: var(--muted); font-weight: 400; font-size: .75rem; }
.tl-dot {
    --tc: var(--c-cours);
    position: relative; align-self: stretch; width: 12px; flex-shrink: 0;
}
.tl-dot::before { content: ""; position: absolute; left: 5px; top: -8px; bottom: -8px; width: 2px; background: var(--border); }
.tl-dot::after {
    content: ""; position: absolute; left: 0; top: 50%; translate: 0 -50%;
    width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 3px solid var(--tc);
}
.tl-item:first-child .tl-dot::before { top: 50%; }
.tl-item:last-child .tl-dot::before { bottom: 50%; }
.tl-cours .tl-dot { --tc: hsl(var(--h, 199) 75% 66%); }
.tl-sport .tl-dot { --tc: var(--c-sport); }
.tl-coach .tl-dot { --tc: var(--warn); }
.tl-rdv .tl-dot { --tc: var(--c-rdv); }
.tl-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-body small { color: var(--muted); }
.tl-passe { opacity: .5; }
.tl-annule { opacity: .5; }
.tl-annule strong { text-decoration: line-through; }
.tl-en-cours { background: var(--ok-soft); }
.tl-en-cours .tl-dot::after { background: var(--tc); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc) 30%, transparent); }

.demain { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }
.demain p { margin: 0 0 6px; }
.demain-devoir { display: block; font-size: .88rem; color: var(--c-devoirs); padding: 2px 0; }

/* ===== Minuteur de révision ===== */
.pomo-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.pomo-temps { font-size: 3.2rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: .02em; margin: 14px 0 6px; }
.pomo-barre { height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.pomo-barre span { display: block; height: 100%; width: 0; background: var(--primary); }
.pomo-actions { justify-content: center; margin-top: 14px; }
.pomo-actif .pomo-temps { color: var(--primary); }

kbd {
    font-family: var(--font-mono); font-size: .7rem; padding: 1px 5px; border-radius: 4px;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--muted);
}

/* ===== Recherche globale (Ctrl+K) ===== */
.nav-search {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    margin: 0 0 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer;
    border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); font: inherit; font-size: .88rem;
}
.nav-search:hover { color: var(--text); border-color: var(--muted); }
.palette {
    width: min(640px, calc(100vw - 32px)); margin: 12vh auto auto; padding: 0;
    border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55);
}
.palette::backdrop { background: rgba(5, 6, 10, .6); backdrop-filter: blur(3px); }
.palette input {
    width: 100%; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--border);
    background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; outline: none;
}
.palette-results { list-style: none; margin: 0; padding: 6px; max-height: 52vh; overflow-y: auto; }
.palette-groupe { padding: 10px 10px 4px; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-item.actif, .palette-item:hover { background: var(--primary-soft); }
.palette-icone { width: 22px; text-align: center; color: var(--primary); flex-shrink: 0; }
.palette-texte { display: flex; flex-direction: column; min-width: 0; }
.palette-texte small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-vide { padding: 16px; color: var(--muted); text-align: center; }
.palette-help { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); font-size: .75rem; color: var(--muted); }
.palette-help kbd { margin-right: 2px; }
@media (max-width: 760px) { .nav-search { display: none; } }

/* Fiche matière : toute la page prend la couleur de la matière */
.theme-matiere { --primary: hsl(var(--h) 75% 66%); --primary-soft: hsl(var(--h) 75% 66% / .14); --mc: var(--primary); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.hero-actions .btn { padding: 6px 12px; font-size: .82rem; }

/* ===== Devoirs ===== */
.matiere-tag {
    --mc: hsl(var(--h) 75% 66%);
    font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
    color: var(--mc); background: color-mix(in srgb, var(--mc) 14%, transparent);
}
.matiere-tag:hover { text-decoration: none; filter: brightness(1.15); }
.devoirs-danger { border-left: 3px solid var(--danger); }
.devoirs-warning { border-left: 3px solid var(--warn); }
details.card > summary { list-style: none; cursor: pointer; margin-bottom: 0; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2::after { content: " ▸"; color: var(--muted); }
details.card[open] > summary { margin-bottom: 12px; }
details.card[open] > summary h2::after { content: " ▾"; }
@media (max-width: 760px) { .row .matiere-tag { display: none; } }

[hidden] { display: none !important; }

/* ===== Révision par fiches ===== */
.revision-filtres { margin-bottom: 16px; }
.revision-filtres .chip { text-decoration: none; }
.flashcards { max-width: 760px; }
.fc-entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.fc-boites { display: flex; gap: 4px; }
.fc-b { min-width: 26px; text-align: center; font-size: .72rem; font-weight: 600; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); }
.fc-b1 { color: var(--danger); } .fc-b2 { color: var(--c-devoirs); } .fc-b3 { color: var(--warn); } .fc-b4 { color: var(--c-cours); } .fc-b5 { color: var(--ok); }
.fc-carte {
    min-height: 220px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px;
    padding: 28px 24px; text-align: center; cursor: pointer; border-radius: var(--radius);
    background: linear-gradient(160deg, var(--surface-2), var(--surface)); border: 1px solid var(--border);
}
.fc-carte:focus { outline: 2px solid var(--primary); }
.fc-matiere { color: var(--primary); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; }
.fc-question { font-size: 1.35rem; font-weight: 600; line-height: 1.4; }
.fc-reponse { font-size: 1.1rem; color: var(--ok); padding-top: 14px; border-top: 1px dashed var(--border); width: 100%; line-height: 1.5; }
.fc-actions { justify-content: center; margin-top: 16px; }
.fc-non { border-color: var(--danger); color: var(--danger); }
.fc-oui { background: var(--ok); }
.fc-fin { text-align: center; padding: 24px 0 8px; }
.fc-fin .actions { justify-content: center; }

/* ===== Emploi du temps : grille horaire (1 ligne = 5 minutes) ===== */
.edt {
    display: grid;
    grid-template-columns: 44px repeat(var(--colonnes), minmax(0, 1fr));
    grid-template-rows: auto repeat(var(--lignes), 4.5px);
    column-gap: 8px;
    margin-bottom: 12px;
}
.edt-coin { grid-column: 1; grid-row: 1; }
.edt-jour {
    grid-row: 1; padding: 0 4px 10px; font-size: .85rem; color: var(--muted); font-weight: 500;
}
.edt-jour b { color: var(--text); font-size: 1rem; margin-left: 2px; }
.edt-jour.today, .edt-jour.today b { color: var(--primary); }
.edt-fond {
    grid-row: 2 / -1; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border);
}
.edt-fond.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.edt-trait { grid-column: 2 / -1; border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent); align-self: start; z-index: 1; pointer-events: none; }
.edt-heure { grid-column: 1; font-size: .72rem; color: var(--muted); text-align: right; translate: 0 -.6em; font-variant-numeric: tabular-nums; }
.edt-bloc {
    position: relative; z-index: 2; margin: 1px 0; padding: 5px 8px; min-height: 0; overflow: hidden;
    width: calc((100% - 4px) / var(--voies));
    margin-left: calc(var(--voie) * (100% / var(--voies)) + 2px);
    gap: 1px;
}
.edt-bloc strong { font-size: .86rem; line-height: 1.2; }
.edt-bloc small { font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edt-bloc .time { font-size: .72rem; }
.edt-court { padding-block: 2px; }
.edt-court small { display: none; }
.edt-maintenant { position: relative; z-index: 3; align-self: start; border-top: 2px solid var(--danger); pointer-events: none; }
.edt-maintenant::before { content: ""; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }

.course-rdv { background: color-mix(in srgb, var(--c-rdv) 13%, var(--surface)); border-left-color: var(--c-rdv); }
.legende { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.leg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.leg-sport { background: var(--c-sport); } .leg-coach { background: var(--warn); } .leg-rdv { background: var(--c-rdv); }

.week { display: none; }
@media (max-width: 900px) {
    .edt { display: none; }
    .week { display: grid; }
}

/* Saisie rapide d'un devoir (accueil) */
.saisie-rapide { display: flex; gap: 6px; margin-bottom: 8px; }
.saisie-rapide input {
    flex: 1; min-width: 0; padding: 7px 10px; font: inherit; font-size: .9rem;
    border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
}
.saisie-rapide input[name=matiere] { flex: 0 0 34%; }
.saisie-rapide input:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.saisie-rapide .btn { padding: 6px 14px; font-size: 1.1rem; }
.saisie-rapide + .row { border-top: 0; }

/* ===== PRONOTE ===== */
.badge-pronote { background: color-mix(in srgb, #22c55e 14%, transparent); color: #4ade80; font-size: .65rem; vertical-align: middle; }
.pronote-auto { margin: -4px 0 8px; }
.pronote-erreur { color: var(--danger); }
.liste-aide { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.liste-aide li::marker { color: var(--primary); }
#pin { max-width: 140px; font-size: 1.3rem; letter-spacing: .4em; text-align: center; font-family: var(--font-mono); }

/* ===== Résultats (notes PRONOTE) ===== */
.section-resultats, .nav-resultats, .tint-resultats { --c: #a3e635; }
.tint-resultats { --primary: var(--c); --primary-soft: color-mix(in srgb, var(--c) 14%, transparent); }
.resultats-haut { display: grid; grid-template-columns: minmax(220px, 1fr) 3fr; gap: 20px; margin-bottom: 20px; }
.resultats-haut > .card { margin-bottom: 0; }
.moyenne-generale { display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.moyenne-chiffre { margin: 0; font-size: 3rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.moyenne-chiffre small { font-size: 1rem; color: var(--muted); font-weight: 500; margin-left: 2px; }
.moyenne-ecart { margin: 0; font-size: .88rem; font-weight: 600; }
.moyenne-ecart.positif, .texte-ok { color: var(--ok); }
.moyenne-ecart.negatif, .texte-danger { color: var(--danger); }

/* Graphique : couleurs validées (fond sombre #181b22) */
.serie-moi { --serie: #3a8fd9; }
.serie-classe { --serie: #b87a28; }
.legende-graph { display: flex; gap: 14px; font-size: .82rem; color: var(--muted); }
.legende-graph span, .g-bulle span { display: inline-flex; align-items: center; gap: 6px; }
i.serie { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--serie); }
i.serie.serie-classe { background: repeating-linear-gradient(90deg, var(--serie) 0 4px, transparent 4px 7px); }
.graph { position: relative; height: 220px; }
.graph svg { display: block; overflow: visible; }
.g-grille { stroke: var(--border); stroke-width: 1; }
.g-dix { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.g-axe { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.g-ligne { fill: none; stroke: var(--serie); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.g-ligne.serie-classe { stroke-dasharray: 6 4; }
.g-point { fill: var(--serie); stroke: var(--surface); stroke-width: 2; }
.g-reticule { stroke: var(--muted); stroke-width: 1; }
.g-bulle {
    position: absolute; top: 4px; z-index: 5; pointer-events: none;
    display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; min-width: 150px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; font-size: .8rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.tableau-donnees { margin-top: 8px; }
.tableau-donnees table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: 6px; }
.tableau-donnees th, .tableau-donnees td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }

.matieres-resultats { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 20px; }
.matieres-resultats > .card { margin-bottom: 0; --mc: hsl(var(--h) 75% 66%); border-top: 3px solid var(--mc); }
.matiere-titre-petit { display: flex; align-items: center; gap: 8px; }
.matiere-titre-petit a { color: var(--text); }
.moyenne-matiere { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.moyenne-matiere small { font-size: .8rem; color: var(--muted); font-weight: 500; }
.echelle { position: relative; height: 10px; margin: 4px 0 6px; border-radius: 999px; background: var(--surface-2); }
.echelle-plage { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: color-mix(in srgb, var(--mc) 25%, transparent); }
.echelle-classe { position: absolute; top: -3px; width: 2px; height: 16px; margin-left: -1px; background: #b87a28; }
.echelle-moi { position: absolute; top: -2px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #3a8fd9; border: 2px solid var(--surface); }
.echelle-legende { margin: 0 0 6px; }
.note-ligne strong { font-variant-numeric: tabular-nums; }
.note-ligne .badge { margin-left: 4px; vertical-align: middle; }

@media (max-width: 900px) { .resultats-haut { grid-template-columns: 1fr; } }
.statut-tag { color: var(--warn); font-weight: 600; }
.vacances-chip { margin: 8px 0 0; display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .88rem; background: color-mix(in srgb, var(--c-cours) 12%, transparent); color: var(--text); }
.vacances-chip b { color: var(--c-cours); }
.note-pastille {
    --mc: hsl(var(--h) 75% 66%);
    display: flex; align-items: baseline; justify-content: center; min-width: 58px; padding: 6px 8px; border-radius: 10px;
    font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums;
    background: color-mix(in srgb, var(--mc) 14%, transparent); color: var(--mc);
}
.note-pastille small { font-size: .7rem; font-weight: 500; opacity: .8; }

/* ===== Status : historique ===== */
.historique-head { margin-top: 18px; }
.bande-etat { display: flex; gap: 1px; height: 10px; border-radius: 4px; overflow: hidden; margin-top: 2px; }
.bande-etat span { min-width: 1px; }
.bande-up, .leg-up { background: var(--ok); }
.bande-degraded, .leg-degraded { background: var(--warn); }
.bande-down, .leg-down { background: var(--danger); }
.dot.warn { background: var(--warn); }
#graph-serveur { height: 180px; }

/* ===== Équipe -15G et matchs ===== */
.section-match, .nav-match, .tint-match { --c: #f87171; }
.tint-match { --primary: var(--c); --primary-soft: color-mix(in srgb, var(--c) 14%, transparent); }
.course-match { background: color-mix(in srgb, #f87171 13%, var(--surface)); border-left-color: #f87171; }
.tl-match .tl-dot { --tc: #f87171; }
.leg-match { background: #f87171; }
.btn-petit { padding: 5px 10px; font-size: .8rem; }
.tableau-scroll { overflow-x: auto; }
.effectif { width: 100%; border-collapse: collapse; font-size: .92rem; }
.effectif th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.effectif td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.effectif .num { text-align: right; font-variant-numeric: tabular-nums; width: 48px; }
.effectif a { color: var(--text); }
.effectif tr.inactif { opacity: .5; }
.assiduite { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.assiduite-barre { display: inline-block; width: 80px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.assiduite-barre span { display: block; height: 100%; border-radius: inherit; }
.assiduite-barre .bon { background: var(--ok); } .assiduite-barre .moyen { background: var(--warn); } .assiduite-barre .faible { background: var(--danger); }

.forme { display: inline-block; width: 20px; height: 20px; line-height: 20px; text-align: center; border-radius: 5px; font-size: .7rem; font-weight: 700; margin-right: 2px; color: #0b0d12; }
.forme-V { background: var(--ok); } .forme-N { background: var(--muted); } .forme-D { background: var(--danger); }
.serie-forme { display: flex; gap: 2px; }
.score { font-weight: 700; font-variant-numeric: tabular-nums; padding: 3px 10px; border-radius: 8px; white-space: nowrap; }
.score-V { background: var(--ok-soft); color: var(--ok); } .score-N { background: var(--surface-2); color: var(--text); } .score-D { background: var(--danger-soft); color: var(--danger); }
.badge-equipe-moi { background: color-mix(in srgb, #f87171 15%, transparent); color: #f87171; }
.badge-equipe-coach { background: var(--warn-soft); color: var(--warn); }
.match-ligne small .badge { margin-right: 4px; }

/* Appel : choix segmenté par joueur */
.appel-ligne { flex-wrap: wrap; }
.segmente { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 6px 10px; font-size: .8rem; color: var(--muted); border-left: 1px solid var(--border); }
.seg:first-child span { border-left: 0; }
.seg:hover span { background: var(--surface-2); color: var(--text); }
.seg input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: -2px; }
.seg-present input:checked + span { background: var(--ok); color: #0b0d12; font-weight: 600; }
.seg-retard input:checked + span { background: var(--warn); color: #0b0d12; font-weight: 600; }
.seg-excuse input:checked + span { background: var(--c-cours); color: #0b0d12; font-weight: 600; }
.seg-blesse input:checked + span { background: var(--c-notes); color: #0b0d12; font-weight: 600; }
.seg-absent input:checked + span { background: var(--danger); color: #0b0d12; font-weight: 600; }

/* Formulaire de match */
.form-cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.field > div > div { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
.field input[type=radio] { accent-color: var(--primary); width: 16px; height: 16px; }
.field input[type=radio] + label { display: inline; margin: 0; font-weight: 500; }
.buteurs { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; }
.buteurs legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.buteurs-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 14px; }
.buteur { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .88rem; }
.buteur input { width: 64px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); font: inherit; }
@media (max-width: 760px) { .form-cols-3 { grid-template-columns: 1fr; } .segmente { width: 100%; } .seg { flex: 1; text-align: center; } }

/* =====================================================================
   Sécurité : connexion, coffre, partage
   ===================================================================== */
.section-partage, .nav-partage { --c: #22d3ee; }
.section-coffre, .nav-coffre { --c: #fbbf24; }
.section-securite, .nav-securite { --c: #94a3b8; }

.sidebar { display: flex; flex-direction: column; }
.sidebar-compte { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.sidebar-compte a { color: var(--muted); }
.sidebar-compte a:hover { color: var(--danger); }

/* Pages de connexion */
.page-auth { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(ellipse 60% 50% at 50% 0%, color-mix(in srgb, var(--c-accueil) 14%, transparent), transparent 70%), var(--bg); }
.auth { width: min(440px, calc(100vw - 32px)); padding: 40px 0; }
.auth-marque { display: flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; font-size: 1.2rem; margin-bottom: 20px; }
.auth-carte { padding: 28px; }
.auth-titre { font-size: 1.4rem; margin-bottom: 14px; }
.auth-pied { text-align: center; margin-top: 14px; }
.auth-liens { margin: 16px 0 0; text-align: center; }
.btn-large { width: 100%; justify-content: center; padding: 11px 16px; font-size: 1rem; }
.champ-mdp { display: flex; gap: 6px; }
.champ-mdp input { flex: 1; min-width: 0; }
.btn-oeil { flex-shrink: 0; width: 40px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; }
.btn-oeil:hover { border-color: var(--primary); }
.field input[type=email], .field input[type=password], .field input[type=url], .field input:not([type]) {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit;
}
.champ-code { font-family: var(--font-mono); font-size: 1.5rem !important; letter-spacing: .35em; text-align: center; }
.jauge { height: 5px; border-radius: 999px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.jauge span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.regles { margin: 0 0 16px; padding-left: 18px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.qr-totp { width: 220px; margin: 14px auto; padding: 10px; background: #fff; border-radius: 12px; }
.qr-totp svg { display: block; width: 100%; height: auto; }
.cle-totp { font-size: 1rem; letter-spacing: .05em; word-break: break-all; }
.codes-secours { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.codes-secours code { font-size: 1.05rem; text-align: center; padding: 8px; background: var(--surface-2); border-radius: 8px; letter-spacing: .08em; }
.carte-alerte { border-color: var(--warn); }
.protections { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.form-confirmation .form-cols { gap: 0 12px; }

/* Coffre */
.coffre-verrou { text-align: center; margin: 40px auto; }
.coffre-verrou form { text-align: left; }
.verrou-icone { font-size: 2.6rem; }
.coffre-barre { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.coffre-recherche { flex: 1; min-width: 220px; padding: 10px 12px; font: inherit; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.coffre-recherche:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.coffre-sante { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.coffre-liste { display: flex; flex-direction: column; gap: 8px; }
.coffre-entree { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.coffre-entree:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); }
.coffre-entree strong .badge { margin-left: 4px; vertical-align: middle; }
.coffre-avatar { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; font-weight: 700; background: var(--primary-soft); color: var(--primary); }
.coffre-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.coffre-actions form { margin: 0; }
.coffre-pied { margin-top: 18px; }
.btn-link-neutre { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: underline; }
.btn-link-neutre:hover { color: var(--text); }
.modale { width: min(560px, calc(100vw - 32px)); padding: 22px 24px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: 0 24px 60px rgba(0, 0, 0, .55); }
.modale::backdrop { background: rgba(5, 6, 10, .65); backdrop-filter: blur(3px); }
.modale h2 { margin-bottom: 14px; font-size: 1.15rem; }
.generateur-sortie { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.generateur-sortie code { flex: 1; font-size: 1.05rem; padding: 10px 12px; word-break: break-all; }
.field input[type=range] { width: 100%; accent-color: var(--primary); }
.chip input { accent-color: var(--primary); margin-right: 4px; vertical-align: middle; }

/* Partage */
.partage-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 10px 0; font-size: .88rem; color: var(--muted); }
.partage-options select { margin-left: 6px; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; }
.partage-options .field-checkbox { margin: 0; }
.progression { margin-top: 10px; }
.partage-icone { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px; background: var(--primary-soft); color: var(--primary); font-size: 1.1rem; }
.partage-texte { margin: 6px 0 0; padding: 8px 10px; max-height: 140px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: 8px; font-size: .85rem; }
.partage-ligne { align-items: flex-start; }
@media (max-width: 760px) { .coffre-entree, .partage-ligne { flex-wrap: wrap; } .coffre-actions { width: 100%; justify-content: flex-end; } .sidebar-compte { display: none; } }

/* =====================================================================
   Classeurs à intercalaires
   ===================================================================== */
.etagere { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 22px; }
.classeur-couverture {
    --mc: hsl(var(--h) 60% 55%);
    position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 250px; padding: 18px 16px 16px 40px;
    border-radius: 6px 14px 14px 6px; color: #fff; text-decoration: none;
    background: linear-gradient(90deg, color-mix(in srgb, var(--mc) 65%, #000) 0 22px, var(--mc) 22px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, .35), inset -6px 0 0 rgba(0, 0, 0, .12);
    transition: transform .15s, box-shadow .15s;
}
.classeur-couverture:hover { text-decoration: none; transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 16px 30px rgba(0, 0, 0, .45); }
.classeur-anneaux { position: absolute; left: 6px; top: 0; bottom: 0; display: flex; flex-direction: column; justify-content: space-evenly; }
.classeur-anneaux i { width: 12px; height: 12px; border-radius: 50%; background: #d1d5db; box-shadow: inset 0 -2px 0 #9ca3af, 0 1px 2px rgba(0, 0, 0, .4); }
.classeur-etiquette { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 6px; background: #fffef7; color: #1f2937; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.classeur-etiquette strong { font-size: 1.02rem; line-height: 1.25; }
.classeur-etiquette small { color: #6b7280; }
.classeur-contenu { margin-top: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.classeur-contenu .badge { background: rgba(0, 0, 0, .25); color: #fff; }
.classeur-contenu small { color: rgba(255, 255, 255, .85); }

.classeur-corps { display: grid; grid-template-columns: 1fr 210px; gap: 0; align-items: start; }
.classeur-feuilles { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius) 0 var(--radius) var(--radius); padding: 18px; min-height: 420px; }
.classeur-feuilles-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.feuilles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.feuille {
    position: relative; display: flex; flex-direction: column; border-radius: 4px; overflow: hidden; color: #1f2937; text-decoration: none;
    background: #fffef9; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .12s, box-shadow .12s; cursor: grab;
}
.feuille:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 8px 16px rgba(0, 0, 0, .45); }
.feuille.glissee { opacity: .4; }
.feuille-trous { position: absolute; left: 6px; top: 0; bottom: 34%; display: flex; flex-direction: column; justify-content: space-around; z-index: 1; }
.feuille-trous i { width: 9px; height: 9px; border-radius: 50%; background: var(--surface); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.feuille-apercu { aspect-ratio: 1 / 1.3; display: grid; place-items: center; overflow: hidden; background: #fffef9; border-bottom: 1px solid #e5e7eb; }
.feuille-apercu img, .feuille-apercu canvas { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.feuille-texte {
    align-self: start; width: 100%; height: 100%; padding: 14px 10px 10px 22px; font-size: .72rem; line-height: 18px; color: #334155;
    background: repeating-linear-gradient(transparent 0 17px, #c7d2e5 17px 18px), linear-gradient(90deg, transparent 18px, #f2b8bf 18px 19px, transparent 19px);
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 14; -webkit-box-orient: vertical;
}
.feuille-vide { color: #9ca3af; font-size: .85rem; }
.feuille-legende { display: flex; flex-direction: column; padding: 8px 10px; background: #fff; }
.feuille-legende strong { font-size: .82rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feuille-legende small { color: #6b7280; font-size: .72rem; }
.feuille-ajout { cursor: pointer; align-items: center; justify-content: center; gap: 6px; min-height: 240px; background: transparent; color: var(--muted); border: 2px dashed var(--border); box-shadow: none; }
.feuille-ajout span { font-size: 2rem; }
.feuille-ajout:hover { color: var(--primary); border-color: var(--primary); box-shadow: none; }

/* Onglets des intercalaires, qui dépassent du classeur */
.onglets { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; }
.onglet {
    display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-left: -1px;
    padding: 10px 12px 10px 14px; border-radius: 0 10px 10px 0; color: #111827; font-weight: 600; font-size: .85rem; text-decoration: none;
    background: color-mix(in srgb, var(--oc) 75%, #fff); box-shadow: 2px 2px 4px rgba(0, 0, 0, .3); transition: transform .12s, padding .12s;
}
.onglet span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.onglet small { font-weight: 500; background: rgba(255, 255, 255, .55); border-radius: 999px; padding: 0 7px; font-size: .72rem; }
.onglet:hover { text-decoration: none; transform: translateX(3px); }
.onglet.ouvert { background: var(--oc); padding-left: 20px; box-shadow: 3px 3px 6px rgba(0, 0, 0, .4); }
.onglet.cible { outline: 3px dashed var(--text); outline-offset: 2px; }
.onglet.recu { animation: recu .8s; }
@keyframes recu { 50% { transform: translateX(8px) scale(1.04); } }
.onglet-nouveau input { width: 100%; padding: 8px 10px; font: inherit; font-size: .85rem; border: 1px dashed var(--border); border-radius: 0 10px 10px 0; background: transparent; color: var(--text); }
.onglet-nouveau input:focus { outline: 2px solid var(--primary); border-style: solid; }
.onglet-reglages { margin-top: 10px; font-size: .85rem; }
.onglet-reglages summary { cursor: pointer; }
.onglet-reglages input[type=text] { width: 100%; margin: 8px 0; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; }
.onglet-couleurs { display: flex; flex-wrap: wrap; gap: 5px; }
.onglet-couleurs label { width: 20px; height: 20px; border-radius: 50%; background: var(--oc); cursor: pointer; }
.onglet-couleurs input { opacity: 0; }
.onglet-couleurs label:has(input:checked) { outline: 2px solid var(--text); outline-offset: 2px; }

/* =====================================================================
   Éditeur de dessin et annotation des PDF
   ===================================================================== */
.editeur-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.editeur-titre { flex: 1; min-width: 200px; padding: 6px 10px; font: inherit; font-size: 1.25rem; font-weight: 700; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); }
.editeur-titre:hover, .editeur-titre:focus { border-color: var(--border); background: var(--surface); outline: none; }
.editeur-titre-fixe { flex: 1; font-weight: 700; font-size: 1.1rem; }
.editeur-aide { margin: 6px 0 0; }
.barre-dessin {
    position: sticky; top: 8px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    padding: 8px 10px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 92%, transparent);
    border: 1px solid var(--border); box-shadow: 0 8px 20px rgba(0, 0, 0, .35); backdrop-filter: blur(6px);
}
.barre-groupe { display: flex; align-items: center; gap: 3px; padding-right: 10px; border-right: 1px solid var(--border); }
.barre-groupe:last-of-type { border-right: 0; }
.barre-dessin button, .barre-dessin select {
    min-width: 34px; height: 34px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px;
    background: transparent; color: var(--text); font: inherit; font-size: .95rem; cursor: pointer;
}
.barre-dessin button:hover { background: var(--surface-2); }
.barre-dessin .outil.actif, .barre-dessin .epaisseur.actif { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.barre-dessin select { border-color: var(--border); background: var(--surface); font-size: .82rem; }
.pastille-couleur { min-width: 24px !important; width: 24px; height: 24px !important; padding: 0 !important; border-radius: 50% !important; background: var(--pc) !important; border: 2px solid var(--surface) !important; box-shadow: 0 0 0 1px var(--border); }
.pastille-couleur.actif { box-shadow: 0 0 0 2px var(--text); }
.barre-dessin input[type=color] { width: 28px; height: 28px; padding: 0; border: 0; background: none; cursor: pointer; }
.epaisseur span { display: block; width: 18px; height: var(--w); border-radius: 999px; background: currentColor; }
.barre-etat { margin-left: auto; }

.feuilles-editeur { display: flex; flex-direction: column; align-items: center; gap: 24px; margin: 18px auto 40px; max-width: 900px; }
.page-feuille { position: relative; width: 100%; background: #fffef9; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); border-radius: 2px; line-height: 0; }
.page-feuille canvas { display: block; }
.page-feuille canvas[data-outil="gomme"] { cursor: cell; }
.page-feuille canvas[data-outil="deplacer"] { cursor: move; }
.page-feuille canvas[data-outil="texte"] { cursor: text; }
.page-feuille canvas:not([data-outil="gomme"]):not([data-outil="deplacer"]):not([data-outil="texte"]) { cursor: crosshair; }
.page-pdf { background: #fff; }
.pdf-fond { display: block; width: 100%; height: auto; }
.pdf-calque { position: absolute; inset: 0; }
.page-numero { position: absolute; right: 8px; bottom: -22px; line-height: 1; font-size: .75rem; color: var(--muted); }
.page-lecture { max-width: 820px; margin: 0 auto; }
.saisie-texte {
    position: absolute; z-index: 5; min-width: 160px; min-height: 1.6em; padding: 2px 4px; line-height: 1.25;
    border: 1px dashed #6366f1; border-radius: 4px; background: rgba(255, 255, 255, .9); font-family: Inter, "Segoe UI", sans-serif; resize: both; outline: none;
}
.form-cols-4 { grid-template-columns: repeat(4, 1fr); }
.graphe-apercu { margin: 6px 0 12px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; line-height: 0; }
.graphe-apercu canvas { width: 100%; }

@media (max-width: 900px) {
    .classeur-corps { grid-template-columns: 1fr; }
    .onglets { flex-direction: row; flex-wrap: wrap; order: -1; padding: 0 0 8px; }
    .onglet { border-radius: 10px 10px 0 0; margin: 0; }
    .classeur-feuilles { border-radius: var(--radius); }
    .form-cols-4 { grid-template-columns: 1fr 1fr; }
}

@media print {
    .editeur-tete, .barre-dessin, .editeur-aide, .sidebar, .page-numero { display: none !important; }
    .feuilles-editeur { margin: 0; max-width: none; gap: 0; }
    .page-feuille { box-shadow: none; page-break-after: always; }
}

/* Assistant */
.section-assistant, .nav-assistant { --c: #e879f9; }
.assistant-etat { margin-bottom: 16px; }
.assistant-etat p { margin: 4px 0 0; }
.assistant { display: flex; flex-direction: column; gap: 10px; }
.assistant-fil { display: flex; flex-direction: column; gap: 12px; min-height: 280px; max-height: calc(100vh - 340px); overflow-y: auto; padding: 4px 2px; }
.assistant-accueil { margin: auto; max-width: 560px; text-align: center; color: var(--muted); }
.assistant-accueil .chips { justify-content: center; }
.assistant-bulle { max-width: min(760px, 92%); padding: 10px 14px; border-radius: var(--radius); overflow-wrap: anywhere; }
.assistant-moi { align-self: flex-end; background: var(--primary-soft); white-space: pre-wrap; }
.assistant-lui { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.assistant-texte p { margin: 0 0 8px; line-height: 1.55; }
.assistant-texte p:last-child { margin-bottom: 0; }
.assistant-texte ul { margin: 0 0 8px; padding-left: 20px; }
.assistant-attente { margin: 0; }
.assistant-renvoi { display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 6px; background: var(--primary-soft); font-size: .78rem; text-align: center; text-decoration: none; }
.assistant-sources { margin-top: 8px; font-size: .9rem; }
.assistant-sources summary { cursor: pointer; color: var(--muted); }
.assistant-source { margin-top: 8px; }
.assistant-source p { margin: 2px 0 0; white-space: pre-line; }
.assistant-agenda { list-style: none; margin: 8px 0 0; padding: 0; }
.assistant-agenda li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 3px 0; }
.assistant-jour { margin-top: 8px; color: var(--muted); font-size: .85rem; }
.assistant-heure { font-family: var(--font-mono); font-size: .85rem; }
.assistant-fiche { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; min-width: min(520px, 100%); }
.assistant-fiche > strong, .assistant-fiche > p, .assistant-fiche > .assistant-actions, .assistant-fiche > .field:first-of-type { grid-column: 1 / -1; }
.assistant-fiche .field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.assistant-fiche p { margin: 0; }
.assistant-fiche input { width: 100%; padding: 9px 12px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; color-scheme: dark; }
.assistant-alerte { color: var(--warn); }
.assistant-ok { margin: 0; color: var(--ok); }
.assistant-saisie { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.assistant-saisie textarea { width: 100%; resize: vertical; background: transparent; border: 0; color: var(--text); font: inherit; }
.assistant-saisie textarea:focus { outline: none; }
.assistant-saisie select { max-width: 240px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; font: inherit; }
.assistant-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.assistant-actions select { margin-right: auto; }
.assistant-note { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }