:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #e3e6eb;
  --text: #1b1f27;
  --muted: #697284;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f0fe;
  --danger: #c93a3a;
  --danger-soft: #fdecec;
  --ok: #1f8a4c;
  --ok-soft: #e6f5ec;
  --warn: #b26a00;
  --warn-soft: #fff4e0;
  --bubble-mine: #1f6feb;
  --bubble-other: #eef0f4;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1d2129;
    --border: #2a2f3a;
    --text: #e7e9ee;
    --muted: #8d95a5;
    --accent: #4c8dff;
    --accent-soft: #1b2a45;
    --danger: #ef6b6b;
    --danger-soft: #3a1c1f;
    --ok: #4cc27d;
    --ok-soft: #173023;
    --warn: #f0a83c;
    --warn-soft: #3a2c14;
    --bubble-mine: #2f6fe0;
    --bubble-other: #232833;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1d2129;
    --border: #2a2f3a;
    --text: #e7e9ee;
    --muted: #8d95a5;
    --accent: #4c8dff;
    --accent-soft: #1b2a45;
    --danger: #ef6b6b;
    --danger-soft: #3a1c1f;
    --ok: #4cc27d;
    --ok-soft: #173023;
    --warn: #f0a83c;
    --warn-soft: #3a2c14;
    --bubble-mine: #2f6fe0;
    --bubble-other: #232833;
    --shadow: none;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2 { line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; display: flex; align-items: center; gap: .5rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp { position: absolute; left: -9999px; }

/* ------------------------------------------------------------- Topbar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 24px; min-height: 58px; }
.brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, var(--accent), #7a5cff); display: inline-block; position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 8px; top: 6px; border-left: 8px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav > a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.nav > a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav > a.on { color: var(--accent); background: var(--accent-soft); }
.nav-user { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.nav-user > a { display: flex; align-items: center; gap: 8px; color: var(--text); padding: 4px 8px; border-radius: 8px; }
.nav-user > a:hover, .nav-user > a.on { background: var(--surface-2); text-decoration: none; }
.who { display: flex; flex-direction: column; line-height: 1.15; font-size: .9rem; }
.who small { color: var(--muted); font-size: .75rem; }
.navtoggle { display: none; }
.navbtn { display: none; cursor: pointer; margin-left: auto; padding: 8px; }
.navbtn span { display: block; width: 20px; height: 2px; background: var(--text); margin: 4px 0; border-radius: 2px; }

@media (max-width: 860px) {
  .topbar-inner { flex-wrap: wrap; gap: 0; }
  .navbtn { display: block; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 8px 0 12px; }
  .navtoggle:checked ~ .nav { display: flex; }
  .nav-user { margin: 8px 0 0; border-top: 1px solid var(--border); padding-top: 10px; justify-content: space-between; }
}

/* ------------------------------------------------------------- Layout */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 16px 60px; }
.page-title { font-size: 1.5rem; margin: 0 0 .25rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .page-title, .page-head h2 { margin: 0; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card > :last-child { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.span-2 { grid-column: span 2; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.empty { text-align: center; padding: 40px 18px; }
.prose { white-space: normal; }

/* ------------------------------------------------------------- Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; color: var(--text); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat:hover { border-color: var(--accent); text-decoration: none; }
.stat b { font-size: 1.8rem; line-height: 1.1; }
.stat span { color: var(--muted); font-size: .9rem; }
.stat.warn { border-color: var(--warn); background: var(--warn-soft); }
.stat.warn b { color: var(--warn); }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------------------- Lists */
.list { list-style: none; margin: 0 0 12px; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.list li:last-child { border-bottom: 0; }

/* ------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--danger); font-size: .85rem; }
.nav-user .linkbtn { color: var(--muted); font-size: .9rem; }
form.inline { display: inline; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------- Forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .92rem; }
.form label.check, label.check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
label.check input { margin-top: 4px; }
input:not([type=checkbox]):not([type=radio]), textarea, select {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 11px; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
input:disabled { opacity: .7; }
textarea { resize: vertical; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.searchbar { display: flex; gap: 8px; min-width: 260px; }

/* ------------------------------------------------------------- Alerts / pills */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alert-success { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }
.alert-info { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.badge { display: inline-flex; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; align-items: center; justify-content: center; }
.count { font-size: .8rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; font-weight: 500; }
.pill { display: inline-block; font-size: .75rem; font-weight: 600; padding: 2px 9px; border-radius: 10px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); vertical-align: middle; }
.pill-superadmin { background: #efe8ff; color: #6a3fd6; border-color: transparent; }
.pill-admin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.st-active { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.st-pending { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.st-disabled { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill-superadmin { background: #2c2147; color: #b49bff; } }
:root[data-theme="dark"] .pill-superadmin { background: #2c2147; color: #b49bff; }

/* ------------------------------------------------------------- Avatars */
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar.lg { width: 60px; height: 60px; font-size: 1.2rem; }

/* ------------------------------------------------------------- Tabs / tables */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--border); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.tabs::-webkit-scrollbar { height: 4px; }
.tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.tabs a { padding: 9px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; display: flex; gap: 6px; align-items: center; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.table-wrap { padding: 0; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th.right, .table td.right { text-align: right; }
@media (max-width: 700px) { .hide-sm { display: none; } .table td, .table th { padding: 10px; } }

/* ------------------------------------------------------------- Videos */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.video-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; transition: transform .12s, border-color .12s; }
.video-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.thumb { aspect-ratio: 16 / 9; background: linear-gradient(135deg, #1e2a44, #3a2f63); display: flex; align-items: center; justify-content: center; }
.play { width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, .9); position: relative; }
.play::after { content: ""; position: absolute; left: 19px; top: 14px; border-left: 14px solid #1e2a44; border-top: 10px solid transparent; border-bottom: 10px solid transparent; }
.video-meta { padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.video-meta .muted { font-size: .85rem; }
.video-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .video-layout { grid-template-columns: 1fr; } }
.player { background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.player video { display: block; width: 100%; max-height: 72vh; aspect-ratio: 16 / 9; background: #000; }
.assign-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; background: var(--surface-2); }
.assign-list label { padding: 6px 0; border-bottom: 1px solid var(--border); }
.assign-list label:last-child { border-bottom: 0; }
.assign-list small { display: block; }
.assign-tools { display: flex; gap: 14px; font-size: .85rem; }

.progress { position: relative; height: 26px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); opacity: .25; transition: width .2s; }
.progress-label { position: relative; display: block; text-align: center; font-size: .82rem; line-height: 24px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- Comments / notes */
.comment { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-of-type { border-bottom: 0; }
.comment-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.comment-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 2px; }
.comment-head form { margin-left: auto; }
.comment-form { margin-top: 12px; }
.comment-form .btn { align-self: flex-end; }
.note { padding: 12px; margin-top: 10px; background: var(--warn-soft); border-radius: 8px; border-left: 3px solid var(--warn); overflow-wrap: anywhere; }
.profile-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------- Messages */
.thread-list { padding: 0; }
.thread { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); }
.thread:last-child { border-bottom: 0; }
.thread:hover { background: var(--surface-2); text-decoration: none; }
.thread.unread strong { color: var(--accent); }
.thread-top { display: flex; justify-content: space-between; gap: 8px; }
.chat { padding: 0; display: flex; flex-direction: column; }
.chat-log { padding: 18px; height: min(60vh, 560px); overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-day { align-self: center; font-size: .75rem; color: var(--muted); background: var(--surface-2); padding: 2px 10px; border-radius: 10px; margin: 8px 0; }
.bubble { max-width: min(75%, 560px); padding: 9px 13px; border-radius: 14px; background: var(--bubble-other); align-self: flex-start; overflow-wrap: anywhere; border-bottom-left-radius: 4px; }
.bubble.mine { background: var(--bubble-mine); color: #fff; align-self: flex-end; border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.bubble-who { font-size: .75rem; font-weight: 600; color: var(--accent); margin-bottom: 2px; }
.bubble-time { font-size: .7rem; opacity: .7; text-align: right; margin-top: 3px; }
.chat-form { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { flex: 1; }

/* ------------------------------------------------------------- Auth */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 1.35rem; margin: 0 0 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 20px; color: var(--muted); }
.auth-foot { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: .92rem; }
.auth-wrap > .alert { width: 100%; max-width: 400px; }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; }
.checklist li { padding: 5px 0; }
.checklist .ok { color: var(--ok); }
.checklist .ko { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------- Mode d'inscription */
.regbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.regbar select { width: auto; min-width: 250px; }
.reg-auto { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.reg-validation { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.reg-closed { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.assign-list.short { max-height: 200px; }
.via { display: inline-block; font-size: .75rem; color: var(--ok); background: var(--ok-soft); border-radius: 8px; padding: 0 7px; margin-top: 2px; }
.groups-pick { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.groups-pick legend { font-weight: 500; font-size: .92rem; padding: 0 4px; }

/* ------------------------------------------------------------- Personnalisation */
.brand-logo { height: 32px; width: auto; max-width: 180px; object-fit: contain; display: block; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.auth-brand .brand-logo { height: 40px; max-width: 220px; }
.site-footer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: .88rem; text-align: center; width: 100%; }
.auth-wrap .site-footer { max-width: 400px; border-top: 0; margin-top: 20px; }
.site-footer .prose p { margin: .2rem 0; }
.prose { overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h2 { font-size: 1.3rem; margin: 1.2em 0 .4em; display: block; }
.prose h3 { font-size: 1.1rem; margin: 1.1em 0 .4em; }
.prose h4 { font-size: 1rem; margin: 1em 0 .3em; }
.prose p { margin: 0 0 .8em; }
.prose ul, .prose ol { margin: 0 0 .8em; padding-left: 1.4em; }
.prose li { margin: .2em 0; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: inline-block; vertical-align: middle; }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.intro { margin-bottom: 16px; }
.auth-card .intro { margin: -4px 0 16px; color: var(--muted); }

.settings-tabs { margin-top: 4px; }
.set-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 10px 24px; align-items: start; }
.set-grid > .lbl { font-weight: 600; padding-top: 9px; }
.set-grid > .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: .82rem; margin-top: 2px; }
.set-grid > .fld { min-width: 0; }
.set-sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 8px 0; }
@media (max-width: 760px) { .set-grid { grid-template-columns: 1fr; gap: 4px; } .set-grid > .lbl { padding-top: 10px; } }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--text); }
input[type=color] { width: 46px; height: 34px; padding: 2px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.logo-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.logo-preview img { max-height: 56px; max-width: 220px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 6px; }
.inline-fields { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline-fields input[type=number] { width: 120px; }
.radio-row { display: flex; gap: 18px; flex-wrap: wrap; padding-top: 8px; }
.radio-row label { display: flex; gap: 6px; align-items: center; font-weight: 400; cursor: pointer; }
.help { color: var(--muted); font-size: .82rem; margin-top: 4px; }
.sticky-save { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0 0; margin-top: 14px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }

/* Éditeur */
.rich-wrap { border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.rich-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.rich-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--border); background: var(--surface); align-items: center; }
.rich-bar button { background: none; border: 0; border-radius: 6px; padding: 5px 9px; font: inherit; font-size: .85rem; color: var(--text); cursor: pointer; min-width: 30px; }
.rich-bar button:hover { background: var(--surface-2); }
.rich-bar button.on { background: var(--accent-soft); color: var(--accent); }
.rich-bar .sep { width: 1px; align-self: stretch; background: var(--border); margin: 3px 4px; }
.rich-bar .grow { flex: 1; }
.rich-wrap textarea { border: 0 !important; border-radius: 0; background: transparent; outline: none !important; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.55; min-height: 90px; }
.rich-preview { padding: 12px 14px; min-height: 90px; background: var(--surface); }
.rich-preview:empty::before { content: "Rien à afficher."; color: var(--muted); }

.page-list .table td { vertical-align: middle; }
.drag { cursor: grab; color: var(--muted); user-select: none; }
.page-view { max-width: 820px; }
.page-view .page-title { margin-bottom: 14px; }

.who { white-space: nowrap; }
.nav { min-width: 0; }
.nav-links { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; flex: 0 1 auto; }
.nav-links > a { color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; flex-shrink: 0; }
.nav-links > a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-links > a.on { color: var(--accent); background: var(--accent-soft); }
.nav-more { position: relative; flex-shrink: 0; }
.nav-more > summary { list-style: none; cursor: pointer; color: var(--muted); padding: 8px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary::after { content: " ▾"; font-size: .8em; }
.nav-more > summary:hover, .nav-more[open] > summary { background: var(--surface-2); color: var(--text); }
.nav-more.has-on > summary { color: var(--accent); background: var(--accent-soft); }
.more-menu { position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(16, 24, 40, .14); padding: 6px; z-index: 20; display: flex; flex-direction: column; }
.more-menu > a { color: var(--text); padding: 8px 12px; border-radius: 6px; white-space: nowrap; }
.more-menu > a:hover { background: var(--surface-2); text-decoration: none; }
.more-menu > a.on { color: var(--accent); background: var(--accent-soft); }
.nav-user a.btn-primary { color: var(--accent-ink); padding: 6px 14px; }
.form .radio-row label { flex-direction: row; }
.swatches input[type=color] { width: 46px; flex: none; padding: 2px; }
.nav-user { flex-shrink: 0; }
@media (max-width: 1240px) { .who { display: none; } }
@media (max-width: 1080px) {
  .topbar-inner { flex-wrap: wrap; gap: 0; }
  .navbtn { display: block; }
  .nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; padding: 8px 0 12px; }
  .navtoggle:checked ~ .nav { display: flex; }
  .nav-links { flex-direction: column; align-items: stretch; overflow: visible; }
  .nav-more { display: none; }
  .nav-user { margin: 8px 0 0; border-top: 1px solid var(--border); padding-top: 10px; justify-content: space-between; }
  .who { display: flex; }
}

.extra-list { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0; font-size: .92rem; }
.extra-list dt { color: var(--muted); }
.extra-list dd { margin: 0; overflow-wrap: anywhere; }

.pill-moderateur { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

/* ------------------------------------------------------------- Planning */
.next-event { display: flex; flex-direction: column; gap: 2px; color: var(--text); border-left: 4px solid var(--accent); }
.next-event:hover { text-decoration: none; border-color: var(--accent); }
.next-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); font-weight: 700; }
.next-event strong { font-size: 1.1rem; }
.next-event span:last-child { color: var(--muted); }
.cal { padding: 14px; }
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { margin: 0; min-width: 170px; text-align: center; justify-content: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.cal-dow { font-size: .75rem; font-weight: 600; text-transform: uppercase; color: var(--muted); padding: 6px 8px; background: var(--surface-2); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cal-day { min-height: 104px; padding: 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .cal-num { opacity: .45; }
.cal-num { font-size: .82rem; font-weight: 600; padding: 2px 4px; }
.cal-num a { color: inherit; display: inline-block; min-width: 24px; border-radius: 6px; text-align: center; }
.cal-num a:hover { background: var(--accent-soft); color: var(--accent); text-decoration: none; }
.cal-day.today .cal-num, .cal-day.today .cal-num a { color: var(--accent-ink); }
.cal-day.today .cal-num { background: var(--accent); border-radius: 6px; display: inline-block; align-self: flex-start; padding: 2px 6px; }
.cal-ev { display: block; font-size: .76rem; line-height: 1.3; padding: 3px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev:hover { text-decoration: none; filter: brightness(.95); }
.cal-ev b { font-weight: 700; }
@media (max-width: 700px) {
  .cal { padding: 10px; }
  .cal-day { min-height: 54px; align-items: center; }
  .cal-ev { width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--accent); font-size: 0; }
  .cal-day.has { background: var(--accent-soft); }
  .cal-dow { padding: 6px 2px; text-align: center; font-size: .68rem; }
}
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-list li { border-bottom: 1px solid var(--border); }
.ev-list li:last-child { border-bottom: 0; }
.ev-list a { display: flex; gap: 14px; align-items: center; padding: 10px 4px; color: var(--text); }
.ev-list a:hover { background: var(--surface-2); text-decoration: none; }
.ev-list .past { opacity: .55; }
.ev-date { width: 48px; flex-shrink: 0; text-align: center; background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 4px 0; font-size: .72rem; text-transform: uppercase; display: flex; flex-direction: column; line-height: 1.2; }
.ev-date b { font-size: 1.25rem; }
.ev-body { display: flex; flex-direction: column; min-width: 0; }
.event-view { max-width: 820px; }
.event-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.fact { display: flex; gap: 10px; align-items: flex-start; }
.fact-ico { font-size: 1.3rem; line-height: 1.2; }

/* ------------------------------------------------------------- Dossiers */
.folder-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.on .count { background: rgba(255, 255, 255, .25); color: inherit; border-color: transparent; }
.chip-ghost { border-style: dashed; color: var(--muted); }
.folder-admin { list-style: none; margin: 0; padding: 0; }
.folder-admin li { padding: 8px 0; border-top: 1px solid var(--border); }
.folder-tag { font-size: .78rem; color: var(--muted); }
.video-item, .photo-item, .album-item { position: relative; }
.video-item > .video-card { height: 100%; }
.pick { position: absolute; top: 8px; left: 8px; z-index: 2; width: 30px; height: 30px; border-radius: 8px; background: rgba(255, 255, 255, .92); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); display: flex; align-items: center; justify-content: center; cursor: pointer; opacity: 0; transition: opacity .12s; }
.pick input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.video-item:hover .pick, .photo-item:hover .pick, .picking .pick, .picked .pick { opacity: 1; }
@media (hover: none) { .pick { opacity: 1; } }
.picked .video-card, .picked > a { outline: 3px solid var(--accent); outline-offset: -3px; }
.bulk-bar { position: sticky; top: 66px; z-index: 5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; box-shadow: 0 6px 18px rgba(16, 24, 40, .12); }
.bulk-bar select { width: auto; }
.bulk-count { font-weight: 600; }

/* ------------------------------------------------------------- Photos */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.album-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.album-card:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-2px); }
.album-cover { aspect-ratio: 4 / 3; background: var(--surface-2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.album-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-empty { font-size: 2.4rem; opacity: .5; }
.album-order { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.album-item:hover .album-order { opacity: 1; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.photo-item > a { display: block; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo-item > a:hover img { transform: scale(1.04); }
@media (max-width: 560px) { .photo-grid { grid-template-columns: repeat(3, 1fr); gap: 4px; } .album-grid { grid-template-columns: 1fr 1fr; gap: 10px; } }
.dropzone { display: flex !important; flex-direction: row !important; align-items: center; justify-content: center; text-align: center; border: 2px dashed var(--border); border-radius: 10px; padding: 26px 16px; cursor: pointer; background: var(--surface-2); font-weight: 400 !important; position: relative; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8, 10, 14, .94); display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lightbox img { max-width: 92vw; max-height: calc(92vh - 40px); object-fit: contain; border-radius: 4px; }
.lightbox figcaption { color: #cfd5e1; font-size: .88rem; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }
.lightbox figcaption a { color: #fff; }
.lightbox button { position: absolute; background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 50%; width: 46px; height: 46px; font-size: 1.6rem; line-height: 1; cursor: pointer; }
.lightbox button:hover { background: rgba(255, 255, 255, .25); }
.lb-close { top: 14px; right: 14px; font-size: 1.1rem !important; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) { .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; } }

.no-save img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.lb-dl[hidden] { display: none; }

.thread-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.thread-meta .pill { font-size: .72rem; }

.msg-del { margin-left: 6px; opacity: 0; transition: opacity .12s; }
.msg-del .linkbtn { font-size: .8rem; color: inherit; }
.bubble:hover .msg-del { opacity: 1; }
@media (hover: none) { .msg-del { opacity: .7; } }

/* ------------------------------------------------------------- Application téléphone */
.tabbar { display: none; }
@media (max-width: 760px) {
  body.has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--border);
            padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(16, 24, 40, .06); }
  .tabbar > a, .tabbar > label { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border-radius: 10px;
            color: var(--muted); font-size: .7rem; font-weight: 600; cursor: pointer; min-width: 0; }
  .tabbar > a:hover { text-decoration: none; }
  .tabbar .ti { font-size: 1.25rem; line-height: 1.2; position: relative; filter: grayscale(1); opacity: .75; }
  .tabbar .on { color: var(--accent); }
  .tabbar .on .ti { filter: none; opacity: 1; }
  .tabbar .tl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tabbar .badge { position: absolute; top: -4px; right: -12px; min-width: 17px; height: 17px; font-size: .65rem; padding: 0 4px; }
  .navtoggle:checked ~ .nav { max-height: calc(100vh - 140px); overflow-y: auto; }
  .container { padding-bottom: 24px; }
}
.standalone .topbar { padding-top: env(safe-area-inset-top); }
.install-btn[hidden] { display: none !important; }
.install-banner { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; background: var(--surface); border: 1px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); display: flex; gap: 10px; align-items: center; font-size: .9rem; }
.install-banner img { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; }
.install-banner .grow { line-height: 1.35; }
.install-banner .x { background: none; border: 0; font-size: 1.2rem; color: var(--muted); cursor: pointer; padding: 4px; }
@media (min-width: 761px) { .install-banner { left: auto; right: 20px; bottom: 20px; max-width: 380px; } }
.app-steps { margin: .4em 0 0; padding-left: 1.3em; }
.app-steps li { margin: .25em 0; }

/* Page de présentation */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
form[data-layout="standard"] .pres-only, form[data-layout="presentation"] .std-only { display: none; }
.pres { max-width: 980px; margin: 0 auto; }
.pres-tools { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-bottom: 8px; }
.pres-hero { text-align: center; padding: 28px 16px 36px; margin-bottom: 18px; border-radius: calc(var(--radius) * 1.6);
  background: radial-gradient(ellipse at top, var(--accent-soft), transparent 70%); }
.pres-logo { display: block; margin: 0 auto 18px; max-width: min(340px, 78vw); max-height: 260px; width: auto; height: auto; object-fit: contain; }
.pres-logo-default { width: 120px; height: 120px; border-radius: 28px; background: linear-gradient(135deg, var(--accent), #7a5cff); position: relative; }
.pres-logo-default::after { content: ""; position: absolute; left: 47px; top: 36px; border-style: solid; border-width: 24px 0 24px 38px; border-color: transparent transparent transparent #fff; }
.pres-name { font-size: clamp(1.9rem, 6vw, 3rem); line-height: 1.1; margin: 0; letter-spacing: -.02em; overflow-wrap: anywhere; }
.pres-tagline { color: var(--muted); font-size: clamp(1rem, 2.6vw, 1.2rem); margin: 10px 0 0; }
.pres-hint { color: var(--muted); font-size: .88rem; margin: 14px 0 0; }
.pres-section { margin-bottom: 28px; }
.pres-title { font-size: 1.45rem; margin: 0 0 12px; display: flex; align-items: center; gap: 10px; }
.pres-title::before { content: ""; width: 6px; height: 1.1em; border-radius: 3px; background: var(--accent); }
.pres-about { font-size: 1.05rem; line-height: 1.65; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.team-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 16px; text-align: center; }
.team-photo { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.team-card .team-photo { display: flex; margin: 0 auto 12px; box-shadow: 0 0 0 4px var(--accent-soft); }
.team-initials { background: linear-gradient(135deg, var(--accent), #7a5cff); color: #fff; font-weight: 700; font-size: 2rem; }
.team-name { font-weight: 700; font-size: 1.08rem; }
.team-role { color: var(--accent); font-weight: 600; font-size: .92rem; margin-top: 2px; }
.team-bio { color: var(--muted); font-size: .92rem; margin-top: 8px; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .team-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .team-card { padding: 16px 10px; }
  .team-photo { width: 84px; height: 84px; }
  .team-initials { font-size: 1.5rem; }
}
.team-admin { padding: 6px 18px; }
.team-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.team-row:last-child { border-bottom: 0; }
.team-row .team-photo { width: 48px; height: 48px; font-size: 1rem; }
.team-row-info { flex: 1; min-width: 140px; }
.team-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.team-row-actions button[disabled] { opacity: .35; cursor: default; }

/* En ligne */
.dot-online { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 2px var(--surface); margin: 0 4px 1px 6px; vertical-align: middle; }
.online-list { display: flex; flex-wrap: wrap; gap: 8px; }
.online-chip { display: inline-flex; align-items: center; gap: 2px; padding: 5px 12px 5px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-size: .92rem; }
a.online-chip:hover { border-color: var(--accent); text-decoration: none; }
.online-chip small { margin-left: 4px; }

/* Présences */
.att-counts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; padding: 12px; }
.att-count { text-align: center; padding: 8px 4px; border-radius: 8px; background: var(--surface-2, var(--accent-soft)); }
.att-count b { display: block; font-size: 1.5rem; line-height: 1.1; }
.att-count span { font-size: .78rem; color: var(--muted); }
.att-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.att-tools .filter { flex: 1; min-width: 200px; }
.att-list { padding: 0 16px; }
.att-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); margin: 0; }
.att-row:last-child { border-bottom: 0; }
.att-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.att-who strong { overflow-wrap: anywhere; }
.att-btns { display: flex; gap: 6px; }
.att-b { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; padding: 6px 6px 5px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; font: inherit; line-height: 1.1; }
.att-b span { font-size: 1.15rem; filter: grayscale(1); opacity: .55; }
.att-b small { font-size: .7rem; font-weight: 600; }
.att-b:hover { border-color: var(--muted); }
.att-b[aria-pressed="true"] span { filter: none; opacity: 1; }
.att-b.att-present[aria-pressed="true"] { border-color: #16a34a; background: #dcfce7; color: #166534; }
.att-b.att-late[aria-pressed="true"] { border-color: #d97706; background: #fef3c7; color: #92400e; }
.att-b.att-excused[aria-pressed="true"] { border-color: #2563eb; background: #dbeafe; color: #1e40af; }
.att-b.att-absent[aria-pressed="true"] { border-color: #dc2626; background: #fee2e2; color: #991b1b; }
.att-note { grid-column: 1 / -1; display: none; }
.att-row[data-status="late"] .att-note, .att-row[data-status="excused"] .att-note, .att-row[data-status="absent"] .att-note { display: block; }
.att-row.saving { opacity: .6; }
.att-reset { text-align: center; margin: 8px 0 20px; }
.att-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.att-summary .grow { flex: 1; min-width: 200px; }
.att-mini { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 4px; font-size: .92rem; }
.att-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--accent-soft); color: var(--muted); white-space: nowrap; }
.att-pill.att-present { background: #dcfce7; color: #166534; }
.att-pill.att-late { background: #fef3c7; color: #92400e; }
.att-pill.att-excused { background: #dbeafe; color: #1e40af; }
.att-pill.att-absent { background: #fee2e2; color: #991b1b; }
.att-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.att-head h2 { margin: 0; }
.att-rate { font-weight: 700; }
.att-rate.big { font-size: 1.4rem; }
.att-rate.good { color: #16a34a; } .att-rate.mid { color: #d97706; } .att-rate.low { color: #dc2626; }
.att-recent li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.att-matrix .att-col { text-align: center; padding-left: 4px; padding-right: 4px; white-space: nowrap; }
.att-matrix th.att-col a { font-size: .8rem; }
.att-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .att-b.att-present[aria-pressed="true"], :root:not([data-theme="light"]) .att-pill.att-present { background: #14351f; color: #86efac; }
  :root:not([data-theme="light"]) .att-b.att-late[aria-pressed="true"], :root:not([data-theme="light"]) .att-pill.att-late { background: #3a2a0c; color: #fcd34d; }
  :root:not([data-theme="light"]) .att-b.att-excused[aria-pressed="true"], :root:not([data-theme="light"]) .att-pill.att-excused { background: #172a4d; color: #93c5fd; }
  :root:not([data-theme="light"]) .att-b.att-absent[aria-pressed="true"], :root:not([data-theme="light"]) .att-pill.att-absent { background: #3d1515; color: #fca5a5; }
}
:root[data-theme="dark"] .att-b.att-present[aria-pressed="true"], :root[data-theme="dark"] .att-pill.att-present { background: #14351f; color: #86efac; }
:root[data-theme="dark"] .att-b.att-late[aria-pressed="true"], :root[data-theme="dark"] .att-pill.att-late { background: #3a2a0c; color: #fcd34d; }
:root[data-theme="dark"] .att-b.att-excused[aria-pressed="true"], :root[data-theme="dark"] .att-pill.att-excused { background: #172a4d; color: #93c5fd; }
:root[data-theme="dark"] .att-b.att-absent[aria-pressed="true"], :root[data-theme="dark"] .att-pill.att-absent { background: #3d1515; color: #fca5a5; }
@media (max-width: 640px) {
  .att-row { grid-template-columns: 1fr; }
  .att-btns { display: grid; grid-template-columns: repeat(4, 1fr); }
  .att-b { min-width: 0; padding: 8px 2px; }
  .att-counts { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 8px; }
  .att-count b { font-size: 1.2rem; }
  .att-count span { font-size: .66rem; }
}

/* Événements réservés à l'équipe */
.pill-staff { background: #ede9fe; color: #5b21b6; font-size: .72rem; vertical-align: middle; }
.cal-ev.staff { background: repeating-linear-gradient(135deg, #ede9fe 0 6px, #f5f3ff 6px 12px); color: #5b21b6; border-left-color: #7c3aed; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pill-staff { background: #2e2350; color: #c4b5fd; }
  :root:not([data-theme="light"]) .cal-ev.staff { background: repeating-linear-gradient(135deg, #2e2350 0 6px, #251c42 6px 12px); color: #c4b5fd; }
}
:root[data-theme="dark"] .pill-staff { background: #2e2350; color: #c4b5fd; }
:root[data-theme="dark"] .cal-ev.staff { background: repeating-linear-gradient(135deg, #2e2350 0 6px, #251c42 6px 12px); color: #c4b5fd; }

/* Photos de profil */
img.avatar { object-fit: cover; padding: 0; background: var(--surface-2); }
.avatar.xl { width: 96px; height: 96px; font-size: 1.8rem; }
.photo-card { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.photo-card .form { flex: 1; min-width: 220px; gap: 8px; }
.photo-pick { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--surface-2); }
.photo-pick input[type=file] { margin-top: 6px; max-width: 100%; }
.photo-drop { width: 84px; height: 84px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); font-size: 2rem; cursor: pointer; overflow: hidden; margin: 0; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.cand-cell { display: flex; align-items: center; gap: 10px; }
.photo-nag { display: block; text-decoration: none; }
.photo-nag:hover { text-decoration: none; filter: brightness(.98); }
.profile-head .avatar.xl { flex: none; }
.alert-warn { background: #fff7e6; color: #8a5a00; border-color: #f0b44c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .alert-warn { background: #3a2a0c; color: #fcd34d; border-color: #a16207; } }
:root[data-theme="dark"] .alert-warn { background: #3a2a0c; color: #fcd34d; border-color: #a16207; }
.cgu-box { max-height: 55vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; background: var(--surface-2); margin-bottom: 14px; }
.cgu-check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; }
.cgu-check input { margin-top: 3px; flex: none; }
.pill-noimg { background: #fee2e2; color: #991b1b; font-size: .72rem; vertical-align: middle; }
.text-danger { color: var(--danger); }
.form label.cgu-check { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; cursor: pointer; }
.chat { position: relative; }
.new-msg-tip { position: absolute; left: 50%; transform: translateX(-50%); bottom: 92px; z-index: 3; border: 0; border-radius: 999px; padding: 7px 14px; background: var(--accent); color: var(--accent-ink); font: inherit; font-size: .85rem; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }

/* Journal d'activité */
.log-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px; }
.log-filters select, .log-filters input[type=search] { width: auto; min-width: 0; flex: 1 1 160px; }
.log-filters .check { flex: none; }
.log-table td { vertical-align: top; }
.log-table tr.log-warn td { background: var(--danger-soft); }
.log-table tr.log-warn td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.log-cat { display: inline-block; width: 1.4em; }
.show-sm { display: none; }
@media (max-width: 700px) { .show-sm { display: block; } }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 12px 0; }

/* Réponse présent / absent */
.rsvp-card { display: flex; flex-direction: column; gap: 10px; }
.rsvp-btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rsvp-b { padding: 12px 10px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.rsvp-b:hover { border-color: var(--muted); }
.rsvp-b.yes[aria-pressed="true"] { border-color: #16a34a; background: #dcfce7; color: #166534; }
.rsvp-b.no[aria-pressed="true"] { border-color: #dc2626; background: #fee2e2; color: #991b1b; }
.rsvp-reason { display: flex; flex-direction: column; gap: 8px; }
.rsvp-reason label { display: flex; flex-direction: column; gap: 5px; font-size: .92rem; font-weight: 500; }
.rsvp-reason .btn { align-self: flex-start; }
.rsvp-pill { font-size: .75rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.rsvp-pill.yes { background: #dcfce7; color: #166534; } .rsvp-pill.no { background: #fee2e2; color: #991b1b; } .rsvp-pill.ask { background: var(--accent-soft); color: var(--accent); }
.abs-card { border-color: var(--danger); }
.abs-card .new { background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rsvp-b.yes[aria-pressed="true"], :root:not([data-theme="light"]) .rsvp-pill.yes { background: #14351f; color: #86efac; } :root:not([data-theme="light"]) .rsvp-b.no[aria-pressed="true"], :root:not([data-theme="light"]) .rsvp-pill.no { background: #3d1515; color: #fca5a5; } }
:root[data-theme="dark"] .rsvp-b.yes[aria-pressed="true"], :root[data-theme="dark"] .rsvp-pill.yes { background: #14351f; color: #86efac; }
:root[data-theme="dark"] .rsvp-b.no[aria-pressed="true"], :root[data-theme="dark"] .rsvp-pill.no { background: #3d1515; color: #fca5a5; }
@media (max-width: 420px) { .rsvp-btns { grid-template-columns: 1fr; } }
.abs-card .list li { flex-direction: row; align-items: flex-start; gap: 10px; }
.abs-card .list .grow { min-width: 0; }
.log-filter { font-size: .8rem; text-decoration: none; opacity: .6; margin-left: 2px; } .log-filter:hover { opacity: 1; }
.pill-hidden { background: #1f2937; color: #e5e7eb; font-size: .72rem; vertical-align: middle; }

/* Email à un candidat, rappels */
.email-card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; }
.email-card > summary::-webkit-details-marker { display: none; }
.email-card > summary h2 { margin: 0; }
.email-card > summary::after { content: "▾"; color: var(--muted); }
.email-card[open] > summary::after { content: "▴"; }
.email-card[open] > summary { margin-bottom: 12px; }
.radio-list { display: grid; gap: 6px; }
.copy-field { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text); margin: 6px 0; }

/* Fichiers par candidat */
.cf-list { list-style: none; margin: 0 0 14px; padding: 0; }
.card.cf-list { padding: 4px 16px; }
.cf-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.cf-row:first-child { border-top: 0; }
.cf-row:target { background: var(--accent-soft); border-radius: 8px; }
.cf-icon { font-size: 1.6rem; line-height: 1; padding-top: 2px; }
.cf-main { flex: 1; min-width: 180px; overflow-wrap: anywhere; }
.cf-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.cf-mini { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; font-size: .88rem; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-b { border: 0; background: var(--surface); color: var(--muted); padding: 6px 10px; font: inherit; font-size: .85rem; cursor: pointer; border-left: 1px solid var(--border); }
.seg-b:first-child { border-left: 0; }
.seg-b:hover { background: var(--surface-2); color: var(--text); }
.seg-b.on { font-weight: 600; color: var(--text); }
.seg-b.on.cf-admins { background: rgba(168,85,247,.16); color: #9333ea; }
.seg-b.on.cf-hidden { background: rgba(120,130,150,.18); }
.seg-b.on.cf-view { background: rgba(59,130,246,.16); color: #3b82f6; }
.seg-b.on.cf-download { background: rgba(34,197,94,.16); color: #16a34a; }
.cf-pill { display: inline-block; font-size: .8rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.cf-upload { border-top: 1px dashed var(--border); padding-top: 14px; }
.cf-upload h3 { margin: 0; font-size: 1rem; }
.cf-viewer { padding: 8px; text-align: center; }
.cf-viewer iframe { width: 100%; height: 78vh; border: 0; border-radius: 8px; background: #fff; }
.cf-viewer iframe.cf-text { height: 60vh; }
.cf-viewer img, .cf-viewer video { max-width: 100%; max-height: 80vh; border-radius: 8px; user-select: none; -webkit-user-drag: none; }
.cf-viewer audio { width: 100%; }
@media (max-width: 640px) {
  .cf-actions { align-items: stretch; width: 100%; }
  .cf-mini { justify-content: flex-start; }
  .seg { width: 100%; }
  .seg-b { flex: 1; padding: 8px 4px; }
  .seg-b span { display: block; font-size: .72rem; }
}
.app-url { margin: 4px 0 12px; }
.app-url-row { display: flex; gap: 8px; align-items: center; }
.app-url-row .copy-field { margin: 4px 0; }
.pill-restricted { background: rgba(245,158,11,.16); color: #d97706; }
/* Événements sur plusieurs jours dans le calendrier */
.cal-ev.multi { border-left: 3px solid var(--accent); }
.cal-ev.multi.cont { opacity: .85; }
.cal-ev.multi.cont b { font-weight: 600; color: var(--muted); }
/* Alertes (nouvelle inscription) */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.has-tabbar .toasts { bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (min-width: 1081px) { .has-tabbar .toasts { bottom: 16px; } }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 12px 12px 12px 14px; box-shadow: 0 8px 28px rgba(0,0,0,.18); transform: translateY(12px); opacity: 0; transition: transform .25s, opacity .25s; }
.toast.show { transform: none; opacity: 1; }
.toast-ico { font-size: 1.4rem; }
.toast-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.toast-body span { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.toast-x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 4px; }

/* Photo de profil agrandie */
img.avatar-img[data-zoom] { cursor: zoom-in; }
.nav-user img.avatar-img[data-zoom] { cursor: pointer; }
.avatar-zoom { position: fixed; inset: 0; z-index: 400; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; padding: 24px; cursor: zoom-out; animation: azIn .15s ease-out; }
.avatar-zoom figure { margin: 0; text-align: center; }
.avatar-zoom img { display: block; max-width: min(90vw, 640px); max-height: 80vh; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5); user-select: none; -webkit-user-drag: none; }
.avatar-zoom figcaption { color: #fff; margin-top: 12px; font-weight: 600; }
.avatar-zoom-x { position: absolute; top: 14px; right: 16px; background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 1.1rem; cursor: pointer; }
@keyframes azIn { from { opacity: 0; } to { opacity: 1; } }
/* Rôles personnalisés */
.pill-custom { background: color-mix(in srgb, var(--rc, #6366f1) 16%, transparent); color: var(--rc, #6366f1); border: 1px solid color-mix(in srgb, var(--rc, #6366f1) 35%, transparent); font-weight: 600; }
.role-list { list-style: none; margin: 0; padding: 0; }
.role-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.role-list li:first-child { border-top: 0; }
.role-list .grow { flex: 1; min-width: 0; }
/* Bandeau des partenaires */
.partners-marquee { overflow: hidden; position: relative; margin: 0 0 18px; padding: 12px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.pm-track { display: flex; align-items: center; gap: 48px; width: max-content; margin: 0; padding: 0 24px; list-style: none; animation: pm-scroll var(--pm-dur, 30s) linear infinite; }
.partners-marquee:hover .pm-track, .partners-marquee:focus-within .pm-track { animation-play-state: paused; }
.pm-track li { flex: 0 0 auto; }
.pm-track img { display: block; height: 56px; width: auto; max-width: 180px; object-fit: contain; filter: grayscale(.15); transition: filter .2s, transform .2s; user-select: none; }
.pm-track a:hover img { filter: none; transform: scale(1.06); }
@keyframes pm-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .pm-track { animation: none; flex-wrap: wrap; width: auto; justify-content: center; } .pm-track li[aria-hidden] { display: none; } }
@media (max-width: 640px) { .pm-track { gap: 32px; } .pm-track img { height: 42px; max-width: 130px; } }
.partner-admin { list-style: none; margin: 0; padding: 0; }
.partner-admin li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.partner-admin li:first-child { border-top: 0; }
.partner-admin img { height: 48px; width: 110px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); padding: 4px; }
.partner-fields { display: flex; gap: 8px; flex: 1; min-width: 240px; flex-wrap: wrap; }
.partner-fields input { flex: 1; min-width: 140px; }
.partner-actions { display: flex; gap: 6px; }
/* Trombinoscope */
.trombi-section { margin: 22px 0; }
.trombi-title { font-size: 1.35rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.trombi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.trombi-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px; text-align: center; position: relative; }
.trombi-card:target { outline: 2px solid var(--accent); }
.trombi-photo { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; background: var(--surface-2); }
.trombi-initials { display: flex; align-items: center; justify-content: center; font-size: 2.6rem; font-weight: 700; color: var(--muted); }
.trombi-noimg { position: absolute; top: 18px; left: 18px; font-size: .72rem; }
.trombi-name { font-weight: 700; margin-top: 10px; overflow-wrap: anywhere; }
.trombi-name a { color: inherit; }
.trombi-role { color: var(--accent); font-size: .9rem; font-weight: 600; margin-top: 2px; }
.trombi-edit { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.trombi-edit input { flex: 1 1 100%; font-size: .85rem; padding: 6px 8px; }
.trombi-edit select { flex: 1; font-size: .85rem; padding: 4px 6px; }
.trombi-tools { display: flex; justify-content: space-between; gap: 6px; margin-top: 8px; }
.trombi-search { display: flex; gap: 8px; margin-bottom: 12px; }
.trombi-search input { flex: 1; }
.trombi-results { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow: auto; }
.trombi-results li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.trombi-results li:first-child { border-top: 0; }
.trombi-results .grow { flex: 1; min-width: 160px; }
.tab-add { display: flex; gap: 6px; align-items: center; margin-left: auto; padding: 4px 0; }
.tab-add input { width: 96px; padding: 5px 8px; }
@media (max-width: 640px) { .trombi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; } }
.trombi-photo-form { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.trombi-file { cursor: pointer; }
/* Coordonnées des partenaires */
.partner-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.partner-grid .span-2 { grid-column: 1 / -1; }
.partner-admin .partner-fields { flex: 1; min-width: 260px; }
.partner-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.partner-card { display: flex; gap: 14px; align-items: flex-start; scroll-margin-top: 80px; }
.partner-card:target { outline: 2px solid var(--accent); }
.partner-card img { width: 84px; height: 84px; object-fit: contain; background: #fff; border-radius: 10px; border: 1px solid var(--border); padding: 6px; flex-shrink: 0; }
.partner-contacts { list-style: none; margin: 6px 0 0; padding: 0; font-size: .92rem; display: grid; gap: 4px; overflow-wrap: anywhere; }
@media (max-width: 640px) { .partner-grid { grid-template-columns: 1fr; } }
