[hidden] { display: none !important; }
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #17202e;
  --muted: #5b6472;
  --border: #e2e7ef;
  --accent: #1f4e79;
  --accent-2: #2f6fab;
  --accent-soft: #e6eef7;
  --ok: #1d7a4c;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --journal: #6b4fbb;
  --journal-soft: #efeafb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --sidebar: 240px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b; --surface: #171e27; --surface-2: #1d2530; --text: #e7ecf3; --muted: #9aa5b4;
    --border: #2a3441; --accent: #7fb2e5; --accent-2: #9cc4ec; --accent-soft: #1b2d42;
    --ok: #6fd3a0; --ok-soft: #133024; --warn: #f0b75c; --warn-soft: #3a2b12;
    --danger: #f28b82; --danger-soft: #3a1a18; --journal: #b8a4f0; --journal-soft: #2a2240;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .2rem 0 .3rem; }
h2 { font-size: 1.1rem; margin: 0 0 .8rem; }
h3 { font-size: 1rem; margin: .2rem 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Navigation */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 1rem .8rem; gap: 2px; overflow-y: auto; z-index: 20; }
.sidebar a { padding: .55rem .75rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.sidebar a:hover { background: var(--surface-2); text-decoration: none; }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); }
.nav-sep { margin: 1rem .75rem .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.nav-user { margin-top: auto; padding: .8rem .75rem 0; border-top: 1px solid var(--border); }
.nav-user .user-name { padding: 0; display: block; }
.role { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 700; color: var(--text); }
.side-brand { margin-bottom: 1rem; padding: .3rem .5rem !important; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
  color: #fff; font-size: .8rem; font-weight: 800; letter-spacing: .02em; }
.brand-mark.big { width: 52px; height: 52px; font-size: 1.2rem; border-radius: 14px; }
.topbar { display: none; }
.main { margin-left: var(--sidebar); padding: 1.8rem 2rem 3rem; max-width: calc(1240px + var(--sidebar)); }
.main-public { padding: 1rem; }

@media (max-width: 900px) {
  .topbar { display: flex; align-items: center; gap: .6rem; position: sticky; top: 0; z-index: 30; padding: .6rem 1rem;
    background: var(--surface); border-bottom: 1px solid var(--border); }
  .menu-btn { font-size: 1.3rem; background: none; border: 0; color: var(--text); cursor: pointer; padding: .2rem .4rem; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side-brand { display: none !important; }
  body.nav-open .sidebar { transform: none; }
  .main { margin-left: 0; padding: 1.2rem 1rem 3rem; }
}

/* Composants */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.3rem; box-shadow: var(--shadow); margin-bottom: 1.2rem; }
.card.narrow { max-width: 560px; }
.card.empty { text-align: center; padding: 2.5rem 1rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.3rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem 1rem; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0f141b; } }
.btn-danger { color: var(--danger); border-color: var(--danger-soft); background: var(--danger-soft); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-small { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: .3rem 0; color: var(--muted); font: inherit; cursor: pointer; }
.link-btn:hover { color: var(--danger); }

label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .9rem; }
input, select, textarea { display: block; width: 100%; margin-top: .3rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-2); color: var(--text); font: inherit; font-weight: 400; }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 .35rem 0 0; accent-color: var(--accent); }
.check, .statut-toggle { font-weight: 500; display: flex; align-items: baseline; gap: .2rem; flex-wrap: wrap; }

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-weight: 500; }
.flash-success { background: var(--ok-soft); color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }

.pills { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .3rem; }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: .15rem .55rem; border-radius: 99px; text-transform: uppercase; letter-spacing: .03em; }
.pill-projet { background: var(--accent-soft); color: var(--accent); }
.pill-journal { background: var(--journal-soft); color: var(--journal); }
.pill-draft { background: var(--warn-soft); color: var(--warn); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.tags { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.tag { display: inline-block; font-size: .8rem; padding: .15rem .55rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); margin: 0 .2rem .2rem 0; }

/* Tableau de bord */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .9rem; margin-bottom: 1.2rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.1rem; color: var(--muted); box-shadow: var(--shadow); }
.stat:hover { text-decoration: none; border-color: var(--accent); }
.stat-n { display: block; font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.stat-warn .stat-n { color: var(--warn); }
.grid-2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.2rem; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }
.bloc-progress { margin-bottom: 1.1rem; }
.bloc-progress-head { display: flex; gap: .4rem; margin-bottom: .35rem; }
.bloc-progress-head .muted { margin-left: auto; font-weight: 600; }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.todo { display: block; font-size: .85rem; color: var(--danger); margin-top: .3rem; }
.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

/* Liste des fiches */
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; padding: .9rem; }
.filters input, .filters select { margin: 0; width: auto; flex: 1 1 160px; }
.filters input[type=search] { flex: 3 1 260px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.fiche-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.fiche-card:hover { text-decoration: none; border-color: var(--accent); }
.fiche-cover { width: 100%; height: 150px; object-fit: cover; display: block; background: var(--surface-2); }
.fiche-cover.placeholder { display: grid; place-items: center; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; font-size: .8rem;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2)); }
.fiche-body { padding: .9rem 1rem 1rem; }
.fiche-body h3 { font-size: 1.02rem; }

/* Vue fiche */
.fiche-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .fiche-layout { grid-template-columns: 1fr; } }
.prose h2 { margin-top: 1.4rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); color: var(--accent); }
.prose h2:first-child { margin-top: 0; }
.prose p { margin: 0 0 .5rem; }
.prose ul { margin: .2rem 0 .7rem; padding-left: 1.3rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 160px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); display: block; }
.gallery figcaption { font-size: .85rem; color: var(--muted); margin-top: .35rem; }
.comp-item { padding: .55rem 0; border-bottom: 1px solid var(--border); }
.comp-item:last-of-type { border-bottom: 0; }
.comp-item p { margin: .25rem 0 0; color: var(--muted); }
.side-actions { display: grid; gap: .5rem; margin-top: 1rem; }

/* Formulaire de fiche */
.row-3 { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: .8rem; }
@media (max-width: 700px) { .row-3 { grid-template-columns: 1fr; } }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-top: .4rem; }
.segmented label { margin: 0; padding: .45rem .9rem; cursor: pointer; font-weight: 600; background: var(--surface); }
.segmented label:has(input:checked) { background: var(--accent-soft); color: var(--accent); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.fiche-form[data-kind="journal"] .only-projet { display: none; }
.fiche-form[data-kind="projet"] .only-journal { display: none; }
.comp-picker { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
@media (max-width: 1100px) { .comp-picker { position: static; max-height: none; } }
.comp-bloc h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 1rem 0 .4rem; }
.comp-check { padding: .45rem .5rem; border-radius: 8px; }
.comp-check:has(input:checked) { background: var(--accent-soft); }
.comp-check label { margin: 0; font-weight: 500; display: flex; align-items: baseline; }
.comp-note { display: none; font-size: .85rem; padding: .4rem .55rem; }
.comp-check:has(input:checked) .comp-note { display: block; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 1.4rem; text-align: center; cursor: pointer; font-weight: 500; color: var(--muted); }
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { display: none; }
.photo-preview { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.photo-preview img { width: 90px; height: 70px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.annex-edit { display: grid; gap: .7rem; margin-bottom: 1rem; }
.annex-row { display: grid; grid-template-columns: 110px 1fr auto; gap: .8rem; align-items: center; padding: .6rem; border: 1px solid var(--border); border-radius: 10px; }
.annex-row img { width: 110px; height: 80px; object-fit: cover; border-radius: 6px; }
.annex-fields { display: grid; grid-template-columns: 1fr 90px; gap: .6rem; }
.annex-fields label { margin: 0; }
@media (max-width: 700px) { .annex-row { grid-template-columns: 80px 1fr; } .annex-row img { width: 80px; height: 60px; } .annex-fields { grid-template-columns: 1fr; } }

/* Matrice */
.table-wrap { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; }
.matrix th, .matrix td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.matrix th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.matrix .num { text-align: center; width: 70px; }
.matrix tr.missing td:first-child a { color: var(--danger); }
.count { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 99px; background: var(--ok-soft); color: var(--ok); font-weight: 800; }
.count-0 { background: var(--danger-soft); color: var(--danger); }

/* Référentiel */
.row-bloc, .row-comp { display: grid; grid-template-columns: 110px 1fr auto; gap: .7rem; align-items: end; }
.row-comp { padding-left: 1.2rem; }
.row-bloc label, .row-comp label { margin-bottom: .6rem; }
.row-bloc .btn, .row-comp .btn { margin-bottom: .6rem; }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: .8rem 0; justify-content: flex-end; }

/* Chronologie */
.timeline { border-left: 2px solid var(--border); margin-left: .6rem; padding-left: 1.4rem; }
.tl-month h2 { margin: 1.2rem 0 .6rem; color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.tl-item { position: relative; display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .9rem; margin-bottom: .6rem; color: var(--text); }
.tl-item:hover { text-decoration: none; border-color: var(--accent); }
.tl-dot { position: absolute; left: calc(-1.4rem - 7px); top: 1.1rem; width: 12px; height: 12px; border-radius: 99px; background: var(--accent); border: 2px solid var(--bg); }
.tl-journal .tl-dot { background: var(--journal); }

/* Comptes */
.users li { display: flex; flex-direction: column; gap: .3rem; }
.inline-form { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.inline-form input { flex: 1 1 200px; margin: 0; }
summary { cursor: pointer; color: var(--accent); }

/* Connexion */
.login-wrap { min-height: calc(100vh - 2rem); display: grid; place-items: center; }
.login-card { width: 100%; max-width: 380px; text-align: center; padding: 2rem; }
.login-card label { text-align: left; }
.login-brand { display: flex; justify-content: center; margin-bottom: .6rem; }

/* Photos insérées dans le texte */
.inline-fig { margin: .9rem 0 1.1rem; text-align: center; }
.inline-fig img { max-width: 100%; max-height: 480px; border-radius: 8px; border: 1px solid var(--border); }
.inline-fig figcaption { font-size: .85rem; color: var(--muted); margin-top: .35rem; }
.annex-thumb { position: relative; }
.annex-id { position: absolute; left: 4px; bottom: 4px; font-size: .7rem; font-weight: 700; background: rgba(0,0,0,.65); color: #fff; padding: 1px 6px; border-radius: 4px; }
.annex-btns { display: grid; gap: .4rem; }
.photo-preview figure { margin: 0; text-align: center; font-size: .7rem; color: var(--muted); }
textarea.drop-target { outline: 2px dashed var(--accent); }
.mt { margin-top: 1.4rem; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: .3rem; justify-content: flex-end; }
@media (max-width: 700px) { .annex-btns { grid-column: 1 / -1; grid-template-columns: 1fr 1fr; } }

.drag-photo { cursor: grab; }
.drag-photo:active { cursor: grabbing; }
.photo-preview img.drag-photo { outline: 2px solid var(--accent-soft); }

/* Éditeur */
.editor { margin-bottom: 1.1rem; }
.editor-head { display: flex; justify-content: space-between; align-items: flex-end; gap: .5rem; flex-wrap: wrap; margin-bottom: .3rem; }
.editor-label { font-weight: 600; font-size: .9rem; }
.toolbar { display: flex; gap: 2px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.toolbar button { border: 0; background: transparent; color: var(--text); font: inherit; font-size: .82rem; padding: .25rem .55rem; border-radius: 6px; cursor: pointer; }
.toolbar button:hover { background: var(--accent-soft); color: var(--accent); }
.editor textarea { margin-top: 0; }
.rich-preview { margin-top: .4rem; padding: .7rem .9rem; border: 1px dashed var(--border); border-radius: 9px; background: var(--surface); font-size: .92rem; }
.rich-preview::before { content: "Aperçu"; display: block; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .3rem; }
.rich-preview h3 { font-size: .95rem; margin: .5rem 0 .25rem; }
.rich-preview .inline-fig img { max-height: 260px; }
.missing-photo { color: var(--danger); font-size: .85rem; }
.sticky-head { position: sticky; top: 0; z-index: 15; background: var(--bg); padding: .6rem 0; margin-top: -.6rem; }
@media (max-width: 900px) { .sticky-head { top: 52px; } }
.save-status { min-width: 0; }
.st-ok { color: var(--ok); }
.st-warn { color: var(--warn); }
.st-err { color: var(--danger); }
.preview-toggle { margin: 0; font-size: .85rem; }

/* Retouche photo */
.modal { position: fixed; inset: 0; background: rgba(10, 15, 25, .6); z-index: 100; display: grid; place-items: center; padding: 1rem; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: var(--radius); padding: 1rem 1.2rem; max-width: min(1060px, 100%); max-height: 100%; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-head, .modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal-head h2 { margin: 0; }
.modal-foot { margin-top: .8rem; }
.retouch-tools { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: .8rem 0 .3rem; }
.retouch-tools .sep { width: 1px; height: 22px; background: var(--border); margin: 0 .2rem; }
.retouch-tools .tool.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.retouch-help { margin: .2rem 0 .6rem; }
.retouch-stage { display: grid; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0% 25%, var(--bg) 0% 50%) 50% / 20px 20px; border-radius: 8px; padding: .5rem; }
.retouch-stage canvas { max-width: 100%; cursor: crosshair; touch-action: none; }

/* À faire */
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-list li { display: flex; gap: .6rem; align-items: baseline; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.todo-list li:last-child { border-bottom: 0; }
.todo-ico { flex: none; width: 1.4rem; text-align: center; }
.todo-done { color: var(--ok); font-weight: 600; }

/* Calendrier */
:root { --c-ecole: #dbe8fb; --c-distance: #e7defa; --c-entreprise: #e5f4ea; --c-fermeture: #fbe1dc; --c-conges: #fdf0c8; --c-examen: #f9d3d0; }
@media (prefers-color-scheme: dark) {
  :root { --c-ecole: #1c3150; --c-distance: #30264a; --c-entreprise: #17321f; --c-fermeture: #3d2420; --c-conges: #3a3216; --c-examen: #4a1f1c; }
}
.segmented a, .segmented button { display: inline-block; padding: .45rem .9rem; font-weight: 600; color: var(--text); background: var(--surface); border: 0; font: inherit; cursor: pointer; }
.segmented a:hover { text-decoration: none; }
.segmented a.on, .segmented button.on { background: var(--accent-soft); color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.lg { font-size: .78rem; padding: .2rem .6rem; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); }
.lg.k-ecole { background: var(--c-ecole); } .lg.k-distance { background: var(--c-distance); }
.lg.k-entreprise { background: var(--c-entreprise); } .lg.k-fermeture { background: var(--c-fermeture); }
.lg.k-conges { background: var(--c-conges); } .lg.k-examen { background: var(--c-examen); }
.lg.ferie { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 4px, var(--border) 4px, var(--border) 6px); }
.lg.ev-rappel, .lg.ev-tache, .lg.ev-butoir { color: #fff; border: 0; }
.ev-rappel { background: #2f6fab; } .ev-tache { background: #7a5bc4; } .ev-butoir { background: #c0392b; }

.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--border); gap: 1px; margin-bottom: .8rem; user-select: none; }
.month-head { background: var(--surface-2); text-align: center; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .45rem 0; }
.month .day { background: var(--surface); min-height: 108px; padding: .35rem .4rem; display: flex; flex-direction: column; gap: 3px; cursor: pointer; position: relative; }
.month .day.other { opacity: .45; }
.day.weekend { background: var(--surface-2); }
.day.k-ecole { background: var(--c-ecole); } .day.k-distance { background: var(--c-distance); }
.day.k-entreprise { background: var(--c-entreprise); } .day.k-fermeture { background: var(--c-fermeture); }
.day.k-conges { background: var(--c-conges); } .day.k-examen { background: var(--c-examen); }
.day.ferie { background-image: repeating-linear-gradient(135deg, transparent, transparent 6px, rgba(0,0,0,.05) 6px, rgba(0,0,0,.05) 9px); }
.day.today .day-n { background: var(--accent); color: #fff; border-radius: 99px; padding: 0 .4rem; }
.day.selecting { outline: 2px solid var(--accent); outline-offset: -2px; }
.day.drop-over { outline: 2px dashed var(--accent); outline-offset: -3px; }
.day-top { display: flex; justify-content: space-between; align-items: baseline; gap: .3rem; }
.day-n { font-weight: 700; font-size: .85rem; }
.ferie-label { font-size: .68rem; color: var(--danger); font-weight: 600; text-align: right; line-height: 1.1; }
.period-label { font-size: .74rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.fiche-chip { font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.ev-chip { font: inherit; font-size: .72rem; color: #fff; border: 0; border-radius: 5px; padding: 1px 5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; }
.ev-chip.done { opacity: .5; text-decoration: line-through; }
@media (max-width: 700px) {
  .month .day { min-height: 64px; padding: .2rem; }
  .period-label, .fiche-chip, .ferie-label { font-size: .6rem; }
  .ev-chip { font-size: .6rem; }
  .month-head { font-size: .62rem; }
}
.year-stats { display: flex; gap: 1.2rem; flex-wrap: wrap; margin-bottom: 1rem; color: var(--muted); }
.year-stats strong { color: var(--text); font-size: 1.1rem; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.mini { padding: .8rem; margin: 0; }
.mini h2 { font-size: .95rem; margin-bottom: .4rem; }
.mini-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-head { text-align: center; font-size: .65rem; color: var(--muted); font-weight: 700; }
.mini-grid .day { aspect-ratio: 1; display: grid; place-items: center; font-size: .7rem; border-radius: 4px; color: var(--text); position: relative; }
.mini-grid .day:hover { outline: 1px solid var(--accent); text-decoration: none; }
.mini-grid .day.other { visibility: hidden; }
.mini-grid .day.ferie { color: var(--danger); font-weight: 700; }
.mini-grid .day.has-ev::after { content: ""; position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 99px; background: #c0392b; }
.cal-setup summary { cursor: pointer; }
.cal-setup h3 { margin-top: 1rem; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.narrow-modal { width: min(480px, 100%); }
.tabs { margin: .8rem 0; }

/* Tableau de bord : aujourd'hui */
.today-card { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.today-badge { padding: .6rem .9rem; border-radius: 10px; font-weight: 700; background: var(--surface-2); }
.today-badge.k-ecole { background: var(--c-ecole); } .today-badge.k-distance { background: var(--c-distance); }
.today-badge.k-entreprise, .today-badge.k-fermeture { background: var(--c-entreprise); }
.today-badge.k-conges { background: var(--c-conges); } .today-badge.k-examen { background: var(--c-examen); }
.up-list { list-style: none; margin: 0; padding: 0; }
.up-list li { display: flex; gap: .5rem; align-items: center; padding: .3rem 0; }
.up-dot { width: 9px; height: 9px; border-radius: 99px; flex: none; }
.up-late { color: var(--danger); font-weight: 600; }
@media (max-width: 700px) { .today-card { grid-template-columns: 1fr; } }

.steps { padding-left: 1.2rem; margin: .4rem 0 1rem; }
.steps li { margin-bottom: .35rem; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 0 .3rem; font-size: .85em; word-break: break-all; }

.src-internet { background: var(--warn-soft); color: var(--warn); }
.src-local { background: var(--ok-soft); color: var(--ok); }
.src-tailscale { background: var(--accent-soft); color: var(--accent); }
.log tr.ev-row-login_fail td, .log tr.ev-row-login_blocked td, .log tr.ev-row-api_refused td { background: var(--danger-soft); }
.log tr.ev-row-visit td { color: var(--muted); }
.check { flex-wrap: nowrap; align-items: flex-start; }
.check input[type=checkbox] { margin-top: .3rem; flex: none; }

/* Ajout rapide (téléphone) */
body.quick { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.quick-main { max-width: 480px; margin: 0 auto; padding: 1rem; }
.quick-main h1 { font-size: 1.7rem; }
.quick input, .quick textarea { font-size: 17px; }
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: 1rem; }
.ev-pick { margin: 0; }
.ev-pick input { position: absolute; opacity: 0; }
.ev-pick span { display: block; text-align: center; padding: .7rem .3rem; border-radius: 10px; border: 2px solid var(--border); background: var(--surface-2); color: var(--text); font-size: .9rem; }
.ev-pick input:checked + span { color: #fff; border-color: transparent; }
.ev-pick.ev-rappel, .ev-pick.ev-tache, .ev-pick.ev-butoir { background: none; }
.ev-pick.ev-rappel input:checked + span { background: #2f6fab; }
.ev-pick.ev-tache input:checked + span { background: #7a5bc4; }
.ev-pick.ev-butoir input:checked + span { background: #c0392b; }
.quick-dates { display: flex; gap: .4rem; margin: -.4rem 0 1rem; flex-wrap: wrap; }
.quick-dates button { font: inherit; font-size: .85rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 99px; padding: .35rem .8rem; }
.btn.big { padding: .9rem; font-size: 1.05rem; }

/* Ajout rapide : correctifs iPhone (Safari) */
.quick-main input, .quick-main textarea, .quick-main select { -webkit-appearance: none; appearance: none; min-height: 48px; border-radius: 10px; }
.quick-main input[type=date], .quick-main input[type=time] { display: block; width: 100%; min-width: 0; text-align: left; line-height: 1.2; padding: .7rem .8rem; }
.quick-main input::-webkit-date-and-time-value { text-align: left; margin: 0; }
.quick-main textarea { min-height: 80px; }
.quick-main label { margin-bottom: 1rem; }
.field { margin-bottom: 1rem; }
.field-label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .4rem; }
.row-2.tight { gap: .5rem; grid-template-columns: 3fr 2fr; }
.row-2.tight input { margin-top: 0; }
.hint { margin: .35rem 0 0; }
.quick-dates { margin: 0 0 .5rem; }
.quick-dates button.on { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); font-weight: 600; }
.seg3 label, .seg4 label { position: relative; }
.seg4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: .4rem; }
.pick { margin: 0; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: block; text-align: center; padding: .6rem .3rem; border-radius: 10px; border: 2px solid var(--border); background: var(--surface-2); font-size: .9rem; font-weight: 500; }
.pick input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.ev-pick span { font-weight: 600; min-height: 48px; display: flex; align-items: center; justify-content: center; }
.pad { padding: .5rem .7rem; border-radius: 8px; margin-top: .5rem; }
.up-list li { align-items: baseline; }
.up-dot { align-self: center; }
.up-when { flex: none; font-variant-numeric: tabular-nums; min-width: 5.2em; }
.up-title { min-width: 0; overflow-wrap: anywhere; }
.ev-chip b { font-weight: 800; margin-right: 2px; }
.quick-main .quick-dates { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.quick-main .quick-dates button { padding: .5rem .2rem; font-size: .82rem; }
