:root {
  --orange: #FF6B35; --vert: #06D6A0; --bleu: #118AB2; --jaune: #FFD166; --rouge: #EF233C;
  --ink: #1a1a2e; --muted: #6B7280; --line: #E5E7EB; --bg: #F4F6FA; --card: #fff; --soft: #F9FAFB;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ink: #F1F2F6; --muted: #9CA3AF; --line: #2E3445; --bg: #12141C; --card: #1C2030; --soft: #232838; }
}
:root[data-theme="dark"] { --ink: #F1F2F6; --muted: #9CA3AF; --line: #2E3445; --bg: #12141C; --card: #1C2030; --soft: #232838; }

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Nunito', system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.45; }
a { color: var(--bleu); }
h1 { font-size: 1.6rem; margin: 0 0 4px; font-weight: 800; }
h2 { font-size: 1.15rem; margin: 0; font-weight: 800; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--ink); color: #fff; flex-wrap: wrap; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .topbar { background: #0B0D13; } }
.topbar a { color: #fff; text-decoration: none; font-weight: 700; }
.brand { font-size: 1.2rem; font-weight: 800; }
.topbar nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.who { background: var(--vert); color: #06302A; padding: 2px 10px; border-radius: 99px; font-weight: 800; }

.flash { background: #E6FBF5; border: 2px solid var(--vert); color: #065F46; padding: 10px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 700; }
.error { background: #FFF5F5; border: 2px solid #FED7D7; color: var(--rouge); padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 700; }

.card { background: var(--card); border-radius: 16px; padding: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.06); margin-bottom: 16px; }
.form-narrow { max-width: 480px; }
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 10px; }
input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; font: inherit; background: var(--soft); color: var(--ink); margin-top: 4px;
}
textarea { min-height: 60px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--orange); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 120px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: .85rem; margin: 6px 0; }
.check input { width: auto; }

.btn { display: inline-block; border: 0; border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 800; cursor: pointer; background: var(--soft); color: var(--ink); border: 2px solid var(--line); }
.btn-primary { background: linear-gradient(135deg, var(--vert), var(--bleu)); color: #fff; border-color: transparent; }
.btn-danger { color: var(--rouge); }
.btn-small { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; padding: 14px; font-size: 1rem; }
form.inline { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0; }
form.inline input, form.inline select { width: auto; margin: 0; padding: 6px 8px; }

.login-card { max-width: 380px; margin: 10vh auto; background: var(--card); padding: 28px; border-radius: 20px; box-shadow: 0 8px 32px rgba(0,0,0,.08); text-align: center; }
.login-card form { text-align: left; }
.login-logo { font-size: 3rem; }
.login-card h1 { margin-bottom: 18px; }

.periodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.periode-card { background: var(--card); border-radius: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.06); border-left: 6px solid var(--line); }
.periode-card.encours { border-color: var(--vert); }
.periode-card.avenir { border-color: var(--orange); }
.periode-link { display: flex; flex-direction: column; gap: 2px; padding: 16px; color: inherit; text-decoration: none; }
.periode-link strong { font-size: 1.1rem; }
.periode-badge { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 800; color: var(--muted); }
.periode-admin { padding: 0 16px 12px; }
.periode-admin summary { cursor: pointer; color: var(--muted); font-size: .85rem; }

.page-head { margin-bottom: 12px; }
.back { text-decoration: none; font-weight: 700; font-size: .9rem; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 2px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 800; white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a.active { color: var(--ink); border-color: var(--orange); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { padding: 6px 12px; border-radius: 99px; background: var(--card); border: 2px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700; font-size: .85rem; }
.chip.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips-groupes .chip.active { background: var(--vert); border-color: var(--vert); color: #06302A; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 10px; flex-wrap: wrap; }

.semaine-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 900px) { .semaine-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.jour { background: var(--card); border-radius: 16px; box-shadow: 0 2px 12px rgba(0,0,0,.06); overflow: hidden; }
.jour-titre { background: var(--ink); color: var(--bg); padding: 8px 12px; font-weight: 800; text-transform: capitalize; }
.creneau { padding: 10px 12px; border-top: 1px solid var(--line); }
.creneau-titre { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--muted); margin-bottom: 6px; display: flex; justify-content: space-between; }
.creneau-matin .creneau-titre { color: #C2410C; }
.creneau-aprem .creneau-titre, .creneau-soir .creneau-titre { color: var(--bleu); }
.count { background: var(--soft); border-radius: 99px; padding: 0 8px; color: var(--ink); }
.activite { background: var(--soft); border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; border-left: 4px solid var(--orange); }
.creneau-aprem .activite { border-color: var(--bleu); }
.activite-titre { font-weight: 800; }
.activite-anim, .activite-details { font-size: .85rem; color: var(--muted); }
.activite details summary { font-size: .8rem; color: var(--muted); cursor: pointer; margin-top: 4px; }
details.ajout summary { cursor: pointer; color: var(--vert); font-weight: 800; font-size: .9rem; padding: 4px 0; }
details form { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
details form input, details form textarea { margin: 0; }

.noms { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.nom { display: inline-flex; align-items: center; gap: 4px; background: var(--soft); border: 2px solid var(--line); border-radius: 99px; padding: 3px 4px 3px 12px; font-weight: 700; }
.nom small { color: var(--muted); font-weight: 600; }
.x { border: 0; background: none; color: var(--rouge); font-size: 1.1rem; cursor: pointer; padding: 0 6px; line-height: 1; }

.ajout-besoin { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ajout-besoin input, .ajout-besoin select { margin: 0; width: auto; }
.ajout-besoin .grow { flex: 1; min-width: 180px; }
.qte { width: 80px !important; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.recap .total { font-weight: 800; white-space: nowrap; }
.tag { display: inline-block; background: var(--soft); border-radius: 6px; padding: 1px 8px; margin: 1px 0; }
.scroll-x { overflow-x: auto; }
.vue-ensemble td { min-width: 150px; font-size: .85rem; }
.mini { padding: 2px 0; }
.mini b { color: #C2410C; }
.mini-aprem b { color: var(--bleu); }
.no-screen { display: none; }

@media print {
  .no-print, .topbar, .tabs, details, .back { display: none !important; }
  .no-screen { display: table-cell; }
  body { background: #fff; color: #000; font-size: 12px; }
  .wrap { max-width: none; padding: 0; }
  .card, .jour { box-shadow: none; border: 1px solid #ccc; }
  .semaine-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .jour-titre { background: #eee; color: #000; }
  .page-break { break-before: page; }
}

.row-btns { display: flex; gap: 8px; align-items: start; }
.export { position: relative; }
.export summary { list-style: none; }
.export summary::-webkit-details-marker { display: none; }
.export-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--card); border: 2px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; min-width: 280px; }
.export-menu a { display: block; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .9rem; }
.export-menu a:hover { background: var(--soft); }
.aide ol li { margin-bottom: 10px; }
.aide code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
tr.inactif td { opacity: .55; }
.blog-ok { text-decoration: none; font-weight: 800; color: #059669; }
.blog-ko { color: var(--rouge); font-weight: 800; }
.blog-futur { color: var(--muted); }
.blog-table td { text-align: center; }
.blog-table td:first-child, .blog-table th:first-child { text-align: left; }
.reunion-titre { font-size: 1rem; font-weight: 800; margin: 18px 0 8px; }
.reunion th small { font-weight: 800; text-transform: none; letter-spacing: 0; }
.reunion .col-auj { background: rgba(255,107,53,.10); }
.reunion th.col-auj { color: var(--orange); }
.reunion .col-demain { background: rgba(17,138,178,.08); }
.reunion th.col-demain { color: var(--bleu); }
@media print { .reunion-titre { break-after: avoid; } }

/* ---------- Publication photos ---------- */
.pub-form { max-width: 640px; margin: 0 auto; }
.cat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.cat-label { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: var(--soft); font-weight: 800; cursor: pointer; margin: 0; }
.cat-label:has(input:checked) { background: var(--vert); border-color: var(--vert); color: #06302A; }
.cat-label input { width: auto; margin: 0; }
.galerie input[type=text] { margin-bottom: 10px; }
.bloc-titre { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 8px; }
.zone-fichiers { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 3px dashed var(--line); border-radius: 14px; padding: 20px; text-align: center; background: var(--soft); cursor: pointer; font-weight: 600; margin: 0; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 6px; margin-top: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 3px solid transparent; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.une { border-color: var(--jaune); }
.thumb.une::after { content: '⭐'; position: absolute; top: 2px; right: 4px; }
.btn-ajout { margin-bottom: 16px; border-style: dashed; }
.btn-publier { font-size: 1.15rem; padding: 16px; margin-bottom: 30px; }
.pub-succes { text-align: center; }
.pub-succes-icone { font-size: 3.5rem; }
.overlay { position: fixed; inset: 0; background: rgba(26,26,46,.92); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; z-index: 100; padding: 16px; text-align: center; }
.overlay[hidden] { display: none; }
.spinner { width: 54px; height: 54px; border: 5px solid rgba(255,255,255,.25); border-top-color: var(--vert); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.overlay-titre { font-size: 1.3rem; font-weight: 800; }
.barre { width: min(260px, 80vw); height: 10px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; }
.barre div { height: 100%; width: 0; background: linear-gradient(90deg, var(--vert), var(--bleu)); transition: width .3s; }
.overlay-note { margin-top: 12px; background: rgba(255,255,255,.12); border-radius: 12px; padding: 12px 16px; font-size: .88rem; line-height: 1.6; }
