/* ==========================================================================
   KE Entrepreneurs — Gestion des sessions de formation
   Palette tirée du logo : bleu pétrole (#164557) et bleu globe (#2090B8)
   ========================================================================== */

@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin-ext-wght-normal.woff2") format("woff2-variations");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Playfair Display"; src: url("../fonts/playfair-display-latin-400-italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --ink: #164557;
  --ink-deep: #0e3141;
  --ink-soft: #2a5a6d;
  --globe: #2090b8;
  --globe-deep: #17769a;
  --globe-soft: #e2f1f7;
  --paper: #f2f6f8;
  --surface: #ffffff;
  --line: #dbe5ea;
  --line-strong: #c3d3db;
  --text: #13303b;
  --muted: #5b7581;
  --faint: #8aa0aa;
  --amber: #c98411;
  --amber-soft: #fbf1dc;
  --green: #1f8a5b;
  --green-soft: #e1f3e9;
  --red: #c0453b;
  --red-soft: #fae6e3;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(14, 49, 65, .06), 0 4px 14px rgba(14, 49, 65, .05);
  --sidebar: 252px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  font-feature-settings: "tnum" 0;
}
img { max-width: 100%; display: block; }
a { color: var(--globe-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: 1.65rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 .8em; }
small, .small { font-size: .84rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .04em; }
:focus-visible { outline: 3px solid rgba(32, 144, 184, .45); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- Structure du back-office ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--ink) var(--sidebar), var(--paper) var(--sidebar)); }
.sidebar {
  background: var(--ink);
  color: #cfe0e7;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  padding: 18px 14px 16px;
}
.brand { display: block; background: #fff; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 22px; }
.brand img { height: 46px; width: auto; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  color: #cfe0e7; padding: 9px 11px; border-radius: 8px; font-weight: 600; font-size: .93rem;
}
.nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--globe); color: #fff; }
.nav-title { font-size: .76rem; font-weight: 700; color: #85a9b8; margin: 22px 11px 6px; }
.side-session { margin-top: 6px; background: rgba(255,255,255,.06); border-radius: var(--radius); padding: 12px; }
.side-session .code { font-size: .75rem; color: #8fb6c6; font-weight: 700; }
.side-session .title { color: #fff; font-weight: 700; font-size: .92rem; line-height: 1.3; margin: 2px 0 10px; }
.side-session .nav a { padding: 7px 9px; font-size: .88rem; }
.sidebar-foot { margin-top: auto; padding: 16px 11px 0; font-size: .76rem; color: #7fa2b1; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.switcher { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.switcher label { font-size: .82rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.switcher select { max-width: 520px; font-weight: 650; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--paper); }
.usermenu .who { line-height: 1.2; text-align: right; }
.usermenu .who strong { display: block; font-size: .9rem; }
.usermenu .who span { font-size: .76rem; color: var(--muted); }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30;
}
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 6px;
  color: var(--text); background: none; border: 0; font: inherit; font-size: .9rem; cursor: pointer; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--paper); text-decoration: none; }
.topbar .menu-toggle { display: none; }

.content { padding: 26px 28px 60px; max-width: 1360px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .sub { color: var(--muted); margin-top: 4px; font-size: .93rem; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--muted); margin-bottom: 8px; }

/* Onglets de session */
.tabs { display: flex; flex-wrap: wrap; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 22px; }
.tabs a {
  padding: 10px 14px; font-weight: 650; font-size: .9rem; color: var(--muted); white-space: nowrap;
  border-bottom: 2.5px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--ink); border-bottom-color: var(--globe); }

/* ---------- Composants ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; flex-wrap: wrap; }
.panel-head p { margin: 2px 0 0; color: var(--muted); font-size: .86rem; }
.panel-body { padding: 16px 20px 20px; }
.panel + .panel { margin-top: 18px; }
.grid { display: grid; gap: 18px; align-items: start; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 18px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; white-space: nowrap;
  background: var(--ink); color: #fff; transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--ink-deep); text-decoration: none; }
.btn.accent { background: var(--globe); }
.btn.accent:hover { background: var(--globe-deep); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--paper); border-color: var(--ink-soft); }
.btn.danger { background: var(--surface); color: var(--red); border-color: #e9c4bf; }
.btn.danger:hover { background: var(--red-soft); }
.btn.success { background: var(--green); }
.btn.sm { height: 31px; padding: 0 11px; font-size: .83rem; border-radius: 7px; }
.btn.lg { height: 48px; padding: 0 22px; font-size: 1rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.icon-btn { width: 31px; padding: 0; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--globe-deep); cursor: pointer; font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
form.inline { display: inline; }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 23px; padding: 0 9px; border-radius: 99px;
  font-size: .76rem; font-weight: 700; background: var(--paper); color: var(--muted); white-space: nowrap;
}
.pill.blue { background: var(--globe-soft); color: var(--globe-deep); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: #9a6408; }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.ink { background: var(--ink); color: #fff; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--globe-soft); color: var(--ink); font-weight: 800; font-size: .82rem;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 96px; height: 96px; font-size: 1.6rem; border-radius: 18px; }
.avatar.xl { width: 132px; height: 132px; font-size: 2rem; border-radius: 22px; }
.person { display: flex; align-items: center; gap: 11px; min-width: 0; }
.person .name { font-weight: 700; color: var(--text); line-height: 1.25; }
.person .meta { font-size: .8rem; color: var(--muted); }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th {
  text-align: left; font-size: .78rem; font-weight: 700; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #f8fafb;
}
.table td { padding: 11px 12px; border-bottom: 1px solid #edf2f4; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfd; }
.table .right { text-align: right; }
.table .center { text-align: center; }
.panel > .table-wrap .table th:first-child, .panel > .table-wrap .table td:first-child { padding-left: 20px; }
.panel > .table-wrap .table th:last-child, .panel > .table-wrap .table td:last-child { padding-right: 20px; }
.panel > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--radius-lg); }
.panel > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--radius-lg); }

/* Formulaires */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: .84rem; font-weight: 700; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--muted); }
.field .error, .error-text { font-size: .82rem; color: var(--red); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px;
  font: inherit; font-size: .93rem; color: var(--text); background: #fff;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; }
.input:focus { outline: none; border-color: var(--globe); box-shadow: 0 0 0 3px rgba(32,144,184,.16); }
.input.is-invalid { border-color: var(--red); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235b7581' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: .92rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--globe); flex: none; }
.check strong { display: block; font-size: .9rem; }
.check span { color: var(--muted); font-size: .84rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 6px; flex-wrap: wrap; }
fieldset.group { border: 0; padding: 0; margin: 0; }
.section-title { font-size: .95rem; font-weight: 750; color: var(--ink); margin: 0 0 12px; }

/* Messages */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); margin-bottom: 18px; font-weight: 600; font-size: .92rem; }
.flash.success { background: var(--green-soft); color: #145c3c; }
.flash.error { background: var(--red-soft); color: #8b2a22; }
.flash.info { background: var(--globe-soft); color: var(--ink); }
.flash ul { margin: 4px 0 0; padding-left: 18px; font-weight: 500; }

.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty h3 { margin-bottom: 6px; }
.empty .btn { margin-top: 14px; }

/* ---------- Tableau de bord ---------- */
.hero-session {
  background: var(--ink); color: #dbe9ef; border-radius: var(--radius-lg);
  padding: 24px 26px 22px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.hero-session h1 { color: #fff; font-size: 1.55rem; max-width: 46ch; }
.hero-session .meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: .88rem; margin-top: 8px; color: #a9c6d2; }
.hero-session .meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-session .top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.hero-session .code { font-weight: 800; font-size: .8rem; color: #8fc6dc; margin-bottom: 6px; }
.hero-session .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
.hero-session .btn.ghost:hover { background: rgba(255,255,255,.08); }

/* Ruban des journées : chaque jour se remplit selon son taux de présence (comme l'ampoule du logo) */
.ribbon { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(84px, 1fr); gap: 8px; margin-top: 22px; overflow-x: auto; padding-bottom: 2px; }
.day {
  position: relative; height: 92px; border-radius: 12px; overflow: hidden;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  display: flex; flex-direction: column; justify-content: space-between; padding: 8px 10px;
}
.day .fill { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, #34a6cf, var(--globe)); z-index: 0; transition: height .9s cubic-bezier(.2,.8,.2,1); }
.day > * { position: relative; z-index: 1; }
.day .d { font-size: .72rem; font-weight: 700; color: #a9c6d2; text-transform: capitalize; }
.day .n { font-size: 1.15rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.day.future { border-style: dashed; background: transparent; }
.day.future .n { color: #6f97a7; font-size: .85rem; font-weight: 700; }
.day.today { border-color: #fff; box-shadow: 0 0 0 1px #fff inset; }
.day .tag { position: absolute; top: 8px; right: 8px; font-size: .62rem; font-weight: 800; color: var(--ink); background: #fff; border-radius: 99px; padding: 1px 6px; z-index: 2; }
@media (prefers-reduced-motion: reduce) { .day .fill { transition: none; } }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 15px 17px 14px; }
.kpi .label { font-size: .8rem; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 7px; }
.kpi .value { font-size: 1.75rem; font-weight: 800; color: var(--ink); line-height: 1.15; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: .9rem; font-weight: 700; color: var(--muted); }
.kpi .foot { font-size: .8rem; color: var(--muted); margin-top: 3px; }
.kpi .bar { height: 5px; border-radius: 3px; background: #e7eef1; margin-top: 10px; overflow: hidden; }
.kpi .bar span { display: block; height: 100%; background: var(--globe); border-radius: 3px; }
.trend-up { color: var(--green); font-weight: 750; }
.trend-down { color: var(--red); font-weight: 750; }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 320px; }

.meter { display: flex; align-items: center; gap: 10px; }
.meter .track { flex: 1; height: 8px; background: #e8eff2; border-radius: 4px; overflow: hidden; min-width: 60px; }
.meter .track span { display: block; height: 100%; background: var(--globe); border-radius: 4px; }
.meter .track span.warn { background: var(--amber); }
.meter .track span.bad { background: var(--red); }
.meter .track span.good { background: var(--green); }
.meter .v { font-size: .84rem; font-weight: 750; min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf2f4; }
.list li:last-child { border-bottom: 0; }

.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick a {
  display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--line); color: var(--text); background: #fbfdfe;
}
.quick a:hover { border-color: var(--globe); text-decoration: none; background: #fff; }
.quick a strong { font-size: .9rem; }
.quick a span { font-size: .8rem; color: var(--muted); }
.quick svg.i { color: var(--globe); }

/* Matrice de présence */
.matrix th.day-col { text-align: center; min-width: 58px; font-size: .74rem; line-height: 1.2; }
.matrix th.day-col.today { color: var(--globe-deep); }
.matrix td.cell { text-align: center; padding: 6px; }
.cell-btn {
  width: 34px; height: 30px; border-radius: 7px; border: 1px dashed var(--line-strong); background: #fff;
  font: inherit; font-weight: 800; font-size: .78rem; color: var(--faint); cursor: pointer;
}
.cell-btn:hover { border-color: var(--globe); }
.cell-btn.present { background: var(--green-soft); color: var(--green); border: 1px solid #b6dfc8; }
.cell-btn.retard { background: var(--amber-soft); color: #9a6408; border: 1px solid #efd6a5; }
.cell-btn.absent { background: var(--red-soft); color: var(--red); border: 1px solid #efc7c2; }
.cell-btn.future { opacity: .35; cursor: not-allowed; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* Constructeur de quiz */
.q-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 14px; }
.q-card .q-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #f8fafb; border-radius: var(--radius) var(--radius) 0 0; }
.q-card .q-num { font-weight: 800; color: var(--ink); }
.q-card .q-body { padding: 14px; display: grid; gap: 12px; }
.opt { display: flex; align-items: center; gap: 10px; }
.opt .mark { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line-strong); background: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: transparent; flex: none; }
.opt .mark.on { background: var(--green); border-color: var(--green); color: #fff; }
.opt .input { flex: 1; }

/* ---------- Pages publiques & espace participant ---------- */
.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-top { background: #fff; border-bottom: 1px solid var(--line); }
.public-top .inner { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.public-top img { height: 44px; width: auto; }
.public-main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px 20px 48px; }
.public-main.narrow { max-width: 620px; }
.public-foot { border-top: 1px solid var(--line); background: #fff; font-size: .82rem; color: var(--muted); }
.app-copyright { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .75rem; color: var(--muted); text-align: center; }
.public-foot .inner.copyright { border-top: 1px solid var(--line); justify-content: center; font-size: .75rem; padding-top: 10px; padding-bottom: 14px; }
.public-foot .inner { max-width: 1080px; margin: 0 auto; padding: 16px 20px; display: flex; gap: 8px 24px; flex-wrap: wrap; justify-content: space-between; }

.home-hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 36px; align-items: center; padding: 26px 0 30px; }
.home-hero h1 { font-family: var(--serif); font-weight: 700; font-size: 2.6rem; line-height: 1.12; letter-spacing: -0.015em; }
.home-hero p.lead { font-size: 1.08rem; color: var(--muted); max-width: 46ch; margin-top: 14px; }
.code-card { background: var(--ink); color: #dbe9ef; border-radius: 20px; padding: 28px; }
.code-card h2 { color: #fff; font-size: 1.25rem; }
.code-card p { color: #a9c6d2; font-size: .92rem; margin-top: 6px; }
.code-input {
  width: 100%; height: 62px; border-radius: 12px; border: 2px solid transparent; background: #fff;
  font: inherit; font-size: 1.7rem; font-weight: 800; letter-spacing: .32em; text-align: center; text-transform: uppercase; color: var(--ink);
}
.code-input:focus { outline: none; border-color: var(--globe); }
.code-input::placeholder { color: #c0d0d7; letter-spacing: .32em; }
.paths { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 10px; }
.path { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; color: var(--text); display: flex; flex-direction: column; gap: 6px; }
.path:hover { border-color: var(--globe); text-decoration: none; }
.path strong { color: var(--ink); }
.path span { color: var(--muted); font-size: .88rem; }
.path svg.i { color: var(--globe); margin-bottom: 4px; }

.portal-head { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; }
.portal-head h1 { font-family: var(--serif); font-size: 1.85rem; font-weight: 700; }
.portal-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; }
.portal-card + .portal-card { margin-top: 14px; }
.portal-card h2 { font-size: 1.05rem; margin-bottom: 4px; }
.task { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-top: 1px solid #edf2f4; }
.task:first-of-type { border-top: 0; }
.task .ico { width: 40px; height: 40px; border-radius: 10px; background: var(--globe-soft); color: var(--globe-deep); display: flex; align-items: center; justify-content: center; flex: none; }
.task .ico.done { background: var(--green-soft); color: var(--green); }
.task .ico.locked { background: var(--paper); color: var(--faint); }
.task .txt { flex: 1; min-width: 0; }
.task .txt strong { display: block; color: var(--text); }
.task .txt span { font-size: .84rem; color: var(--muted); }
.days-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.days-strip span { width: 44px; text-align: center; padding: 6px 0; border-radius: 8px; font-size: .74rem; font-weight: 750; background: var(--paper); color: var(--faint); line-height: 1.2; }
.days-strip span.p { background: var(--green-soft); color: var(--green); }
.days-strip span.r { background: var(--amber-soft); color: #9a6408; }
.days-strip span.a { background: var(--red-soft); color: var(--red); }

/* Passage d'un quiz */
.qz-question { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 14px; }
.qz-question .q { font-weight: 750; font-size: 1.02rem; color: var(--ink); margin-bottom: 4px; }
.qz-question .t { font-size: .8rem; color: var(--muted); margin-bottom: 12px; }
.choice { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; margin-top: 8px; font-weight: 550; }
.choice:hover { border-color: var(--globe); }
.choice input { width: 20px; height: 20px; accent-color: var(--globe); flex: none; margin: 0; }
.choice:has(input:checked) { border-color: var(--globe); background: var(--globe-soft); }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.timer { position: sticky; top: 10px; z-index: 5; display: flex; justify-content: center; margin-bottom: 14px; }
.timer span { background: var(--ink); color: #fff; padding: 6px 16px; border-radius: 99px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer span.low { background: var(--red); }

.rating { display: flex; gap: 6px; }
.rating label { flex: 1; }
.rating input { position: absolute; opacity: 0; pointer-events: none; }
.rating span {
  display: flex; align-items: center; justify-content: center; height: 42px; border-radius: 9px; border: 1.5px solid var(--line);
  font-weight: 800; color: var(--muted); cursor: pointer; background: #fff;
}
.rating input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.rating input:focus-visible + span { outline: 3px solid rgba(32,144,184,.45); }
.crit { display: grid; grid-template-columns: 1fr 260px; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid #edf2f4; }
.crit:first-of-type { border-top: 0; }
.scale-hint { display: flex; justify-content: space-between; font-size: .74rem; color: var(--faint); margin-top: 3px; }

/* Vérification publique */
.verify-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.verify-status { padding: 16px 22px; display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.05rem; }
.verify-status.ok { background: var(--green); color: #fff; }
.verify-status.no { background: var(--red); color: #fff; }
.verify-status.wait { background: var(--amber); color: #fff; }
.verify-body { padding: 22px; display: flex; gap: 20px; align-items: flex-start; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: .92rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 650; }

/* ---------- Écrans projetés (pointage, quiz en direct) ---------- */
.screen { background: var(--ink); color: #dbe9ef; min-height: 100vh; display: flex; flex-direction: column; }
.screen-top { display: flex; align-items: center; justify-content: space-between; padding: 18px 32px; gap: 20px; }
.screen-top .logo { background: #fff; border-radius: 12px; padding: 8px 14px; }
.screen-top .logo img { height: 46px; width: auto; }
.screen-top .clock { font-size: 2rem; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.screen-main { flex: 1; display: grid; grid-template-columns: auto 1fr; gap: 48px; align-items: center; padding: 10px 48px 36px; }
.qr-frame { background: #fff; border-radius: 28px; padding: 22px; width: min(46vh, 460px); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; }
.qr-frame svg { width: 100%; height: 100%; }
.screen h1 { color: #fff; font-size: clamp(1.8rem, 3.4vw, 3rem); font-weight: 800; line-height: 1.1; }
.screen .big { font-size: clamp(3rem, 7vw, 6rem); font-weight: 800; color: #fff; line-height: 1; font-variant-numeric: tabular-nums; }
.screen .steps { margin: 22px 0 0; padding: 0; list-style: none; counter-reset: s; }
.screen .steps li { counter-increment: s; display: flex; gap: 14px; align-items: center; font-size: 1.15rem; margin-bottom: 12px; }
.screen .steps li::before { content: counter(s); width: 34px; height: 34px; border-radius: 50%; background: var(--globe); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.feed { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.feed .who { display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,.08); border-radius: 99px; padding: 5px 14px 5px 5px; font-weight: 650; color: #fff; }
.feed .who .avatar { width: 34px; height: 34px; background: #fff; }
.feed .who time { color: #8fc6dc; font-size: .82rem; }
.feed .who.new { animation: pop .6s ease-out; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .feed .who.new { animation: none; } }

/* Scanner */
.scanner-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
#reader { width: 100%; border-radius: var(--radius-lg); overflow: hidden; background: #0b2733; min-height: 320px; }
#reader video { border-radius: var(--radius-lg); }
.scan-result { border-radius: var(--radius-lg); padding: 20px; text-align: center; border: 1px solid var(--line); background: #fff; min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.scan-result.ok { background: var(--green-soft); border-color: #b6dfc8; }
.scan-result.deja { background: var(--globe-soft); border-color: #b9dcea; }
.scan-result.late { background: var(--amber-soft); border-color: #efd6a5; }
.scan-result.refuse, .scan-result.inconnu { background: var(--red-soft); border-color: #efc7c2; }
.scan-result .msg { font-weight: 800; font-size: 1.05rem; }

/* Certificats */
.checks { display: flex; gap: 6px; flex-wrap: wrap; }
.check-chip { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--paper); color: var(--faint); }
.check-chip.ok { background: var(--green-soft); color: var(--green); }
.check-chip.ko { background: var(--red-soft); color: var(--red); }

/* Connexion */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: var(--ink); color: #a9c6d2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-family: var(--serif); font-size: 2.2rem; color: #fff; font-weight: 700; line-height: 1.15; max-width: 16ch; }
.auth-side .logo { background: #fff; border-radius: 14px; padding: 12px 18px; align-self: flex-start; }
.auth-side .logo img { height: 52px; width: auto; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: #fff; }
.auth-form form { width: 100%; max-width: 380px; }

/* Pagination */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-weight: 700; font-size: .86rem; border: 1px solid var(--line); background: #fff; color: var(--text); }
.pagination span.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination span.disabled { opacity: .45; }

/* Recherche participant existant */
.suggest { border: 1px solid var(--line); border-radius: var(--radius); margin-top: 6px; background: #fff; max-height: 300px; overflow-y: auto; }
.suggest button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; border-bottom: 1px solid #edf2f4; }
.suggest button:hover { background: var(--paper); }
.photo-pick { display: flex; gap: 16px; align-items: center; }


/* ---------- Version 2 : structure, profils, filtres ---------- */
.nav-badge { background: var(--amber); color: #fff; font-size: .7rem; font-weight: 800; border-radius: 9px; padding: 1px 7px; line-height: 1.5; }
.nav a.active .nav-badge { background: #fff; color: var(--ink); }
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 9px; color: var(--ink); border: 1px solid var(--line); background: var(--surface); }
.bell:hover { background: var(--paper); text-decoration: none; }
.bell-dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--red); color: #fff; font-size: .68rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.sync-chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 4px 10px; border-radius: 16px; background: var(--amber-soft); color: #9a6408; white-space: nowrap; }
.sync-chip.offline { background: var(--red-soft); color: var(--red); }
.sync-chip.ok { background: var(--green-soft); color: var(--green); }
.project-card { display: block; padding: 18px 20px; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.project-card:hover { text-decoration: none; border-color: var(--globe); box-shadow: 0 4px 16px rgba(22,69,87,.08); }
.project-card h2 { margin: 4px 0 2px; font-size: 1.08rem; }
.mini-kpis { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 14px; font-size: .84rem; color: var(--muted); }
.mini-kpis strong { color: var(--ink); font-size: .98rem; margin-right: 2px; }
.mini-kpis a { color: var(--muted); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.filters .input { width: auto; min-width: 150px; flex: 0 1 220px; height: 36px; }
.filters .btn { height: 36px; }
.field-row { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
.field-row summary { cursor: pointer; list-style: none; }
.field-row summary::-webkit-details-marker { display: none; }
.menu-inline { position: relative; display: inline-block; }
.menu-inline summary { list-style: none; }
.menu-inline summary::-webkit-details-marker { display: none; }
.popover { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 300px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(14,49,65,.16); padding: 14px; text-align: left; white-space: normal; }
.popover.wide { width: 420px; }
.matrix-wrap { max-height: 72vh; overflow: auto; }
.perm-matrix th, .perm-matrix td { padding: 7px 10px; }
.perm-matrix thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; vertical-align: bottom; }
.perm-matrix .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; min-width: 260px; }
.perm-matrix thead .sticky-col { z-index: 3; }
.perm-matrix .center { text-align: center; }
.perm-matrix .role-col { font-size: .8rem; }
.perm-matrix .group-row td { background: var(--paper); font-weight: 800; color: var(--ink); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.perm-box { width: 17px; height: 17px; accent-color: var(--globe); cursor: pointer; }
.center { text-align: center; }
@media (max-width: 700px) {
  .filters .input { flex: 1 1 100%; }
  .popover, .popover.wide { position: fixed; left: 16px; right: 16px; top: 80px; width: auto; }
}

.req { color: var(--red); font-weight: 800; }
.dup-box { margin-top: 14px; border: 1px solid #f0d49b; background: var(--amber-soft); border-radius: var(--radius); padding: 12px 14px; font-size: .9rem; }
.dup-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid #f0dfb8; margin-top: 8px; flex-wrap: wrap; }
.compare { display: grid; grid-template-columns: 170px 1fr 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: .9rem; }
.compare > div { padding: 8px 12px; border-bottom: 1px solid #edf2f4; }
.compare .h { background: var(--paper); font-weight: 800; color: var(--ink); }
.compare .k { color: var(--muted); font-weight: 650; }
.compare .diff { background: #fff8e8; }
.qcheck { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid #edf2f4; }
.qcheck:last-child { border-bottom: 0; }
.qcheck .n { min-width: 64px; text-align: right; font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.qcheck .n.ok { color: var(--green); } .qcheck .n.warn { color: #9a6408; } .qcheck .n.bad { color: var(--red); }
.map-table td { vertical-align: top; }
.cell-err { background: var(--red-soft) !important; }
.cell-warn { background: var(--amber-soft) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1020px) {
  .app { grid-template-columns: 1fr; background: var(--paper); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
  .topbar .menu-toggle { display: inline-flex; }
  .g-main, .g-3, .scanner-layout { grid-template-columns: minmax(0, 1fr); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-hero { grid-template-columns: 1fr; }
  .screen-main { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 14.5px; }
  .content { padding: 18px 16px 48px; }
  .topbar { padding: 10px 16px; }
  .switcher label, .usermenu .who { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g-2, .g-4, .form-grid, .form-grid.three, .paths, .quick { grid-template-columns: 1fr; }
  .hero-session { padding: 20px 18px; }
  .hero-session h1 { font-size: 1.3rem; }
  .day .tag { display: none; }
  #reader { min-height: 240px; }
  .scan-result { min-height: 180px; }
  .home-hero h1 { font-size: 2rem; }
  .crit { grid-template-columns: 1fr; }
  .verify-body { flex-direction: column; align-items: center; text-align: center; }
  .dl { grid-template-columns: 1fr; text-align: left; }
  .public-main { padding: 20px 16px 40px; }
}
@media print {
  .sidebar, .topbar, .tabs, .page-head .actions, .no-print { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}
a.kpi { display: block; color: inherit; transition: border-color .15s; }
a.kpi:hover { text-decoration: none; border-color: var(--globe); }

/* ---------- Présences v2 ---------- */
.cell-btn { position: relative; }
.cell-btn.depart_anticipe { background: #fff3e0; color: #a3560a; border: 1px solid #f3cf9f; }
.cell-btn.partiel { background: #fdf6dc; color: #8a6d00; border: 1px dashed #e2c35a; }
.cell-btn.mini { width: 22px; height: 22px; min-width: 22px; font-size: .72rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; cursor: default; padding: 0; }
.flag-dot, .pend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); vertical-align: middle; }
.cell-btn .flag-dot { position: absolute; top: -3px; right: -3px; border: 2px solid #fff; width: 10px; height: 10px; }
.pend-dot { background: var(--globe); }
.cell-btn .pend-dot { position: absolute; bottom: -3px; right: -3px; border: 2px solid #fff; width: 10px; height: 10px; }
.dialog { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 64px rgba(14,49,65,.28); color: var(--text); }
.dialog::backdrop { background: rgba(14,49,65,.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); margin: 0; }
.dialog-body { padding: 14px 18px 18px; max-height: 75vh; overflow: auto; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 8px; font-weight: 700; font-size: .86rem; }
.seg input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--globe); outline-offset: 2px; }
.anomaly-group { margin-top: 6px; }
.anomaly-group h3 { font-size: .9rem; margin: 14px 0 6px; display: flex; align-items: center; gap: 8px; }
.anomaly-group li { padding: 5px 0; border-bottom: 1px solid #edf2f4; font-size: .88rem; list-style: none; }
.anomaly-group ul { margin: 0; padding: 0; }
.room-code { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: .18em; }
.mode-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.mode-switch button { border: 0; background: var(--surface); padding: 9px 16px; font: inherit; font-weight: 800; cursor: pointer; color: var(--ink); }
.mode-switch button.on { background: var(--ink); color: #fff; }
.mode-switch button.on.out { background: #a3560a; }

/* ---------- Questionnaires v2 ---------- */
.qz-question { border-width: 1px; }
fieldset.qz-question { min-width: 0; }
.qz-question legend.q { padding: 0; float: left; width: 100%; }
.qz-question legend.q + * { clear: both; }
.scale-row { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-pt { cursor: pointer; }
.scale-pt input { position: absolute; opacity: 0; pointer-events: none; }
.scale-pt span { display: inline-flex; width: 46px; height: 46px; align-items: center; justify-content: center; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 800; color: var(--ink); background: #fff; }
.scale-pt input:checked + span { background: var(--globe); border-color: var(--globe); color: #fff; }
.scale-pt input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }
.dist { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: #edf2f4; }
.dist span { display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; color: #fff; min-width: 0; }
.open-answers { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; }
.open-answers p { margin: 0; padding: 6px 0; border-bottom: 1px solid #edf2f4; font-size: .88rem; }
.open-answers p:last-child { border-bottom: 0; }

/* ---------- Supervision ---------- */
.sup-item { padding: 12px 0; border-bottom: 1px solid #edf2f4; }
.sup-item:last-child { border-bottom: 0; }
.sup-item.bad .sup-label { color: var(--red); }
.sup-label { font-weight: 650; margin-bottom: 8px; }
.sup-input { display: flex; flex-direction: column; gap: 8px; }
.sup-comment { height: 34px; font-size: .86rem; }
.finding-row { border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; background: #fffdf7; }
.attach-list { display: grid; gap: 10px; }
.attach { display: flex; flex-direction: column; gap: 4px; padding: 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.attach img { max-width: 100%; max-height: 180px; object-fit: cover; border-radius: 6px; }
.attach audio, .attach video { width: 100%; max-height: 220px; }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 14px 16px; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--globe); border: 2px solid #fff; }
.timeline li.statut::before { background: var(--ink); }
.timeline li.escalade::before { background: var(--red); }

/* ---------- Espace bénéficiaire v2 ---------- */
.portal-nav { display: flex; gap: 6px; flex-wrap: wrap; margin: -6px 0 16px; }
.portal-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 700; font-size: .88rem; }
.portal-nav a.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.portal-nav a:hover { text-decoration: none; border-color: var(--globe); }

/* ---------- Hors ligne ---------- */
.ke-toast { position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%); max-width: min(560px, calc(100vw - 32px)); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: .9rem; font-weight: 600; box-shadow: 0 12px 32px rgba(0,0,0,.25); transition: transform .25s; z-index: 200; }
.ke-toast.on { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .ke-toast { transition: none; } }

/* ---------- V3 : onglets de session sur petit écran (tout reste visible, plus de défilement caché) ---------- */
@media (max-width: 1020px) {
  .tabs.session-tabs { gap: 6px; border-bottom: 0; }
  .tabs.session-tabs a { padding: 7px 12px; font-size: .84rem; border: 1px solid var(--line); border-radius: 999px; margin: 0; background: var(--surface); }
  .tabs.session-tabs a.active { background: var(--ink); color: #fff; border-color: var(--ink); }
}

/* Bandeau lecture seule */
.readonly-banner { display: flex; align-items: center; gap: 8px; padding: 9px 14px; margin-bottom: 16px; border-radius: var(--radius); background: var(--globe-soft); color: var(--ink); font-size: .88rem; font-weight: 600; }

/* ---------- Galerie ---------- */
.gallery-layout { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.gallery-tree { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; position: sticky; top: 76px; max-height: calc(100vh - 100px); overflow: auto; }
.gallery-tree .tree-link { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); font-size: .86rem; line-height: 1.3; }
.gallery-tree .tree-link:hover { background: var(--paper); text-decoration: none; }
.gallery-tree .tree-link.on { background: var(--globe-soft); color: var(--ink); font-weight: 700; }
.gallery-tree .lvl1 { font-weight: 700; }
.gallery-tree .lvl2 { padding-left: 20px; }
.gallery-tree .lvl3 { padding-left: 34px; color: var(--muted); }
.gallery-tree .count { font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.gallery-grid.small-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gallery-item { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.small-grid .gallery-item { border: 0; background: none; }
.gallery-thumb { display: block; aspect-ratio: 4 / 3; background: var(--paper); cursor: zoom-in; border: 0; padding: 0; width: 100%; }
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item figcaption { padding: 8px 10px; font-size: .8rem; color: var(--muted); line-height: 1.35; flex: 1; }
.gallery-item figcaption strong { color: var(--text); display: block; font-size: .84rem; }
.gallery-actions { display: flex; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; }
.gallery-edit { padding: 0 10px 10px; }
.gallery-edit summary { cursor: pointer; font-size: .8rem; font-weight: 600; color: var(--globe-deep); }
.gallery-edit form { display: grid; gap: 6px; margin-top: 6px; }
#lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(8, 24, 32, .92); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 20px; }
#lightbox img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }
#lightbox figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; }
#lightbox figcaption { color: #dbe9ef; font-size: .9rem; text-align: center; max-width: 760px; display: flex; flex-direction: column; gap: 2px; }
#lightbox figcaption strong { color: #fff; }
#lightbox button { position: absolute; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 46px; height: 46px; border-radius: 50%; font-size: 1.5rem; cursor: pointer; }
#lightbox button:hover { background: rgba(255,255,255,.25); }
#lightbox .lb-close { top: 16px; right: 16px; }
#lightbox .lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
#lightbox .lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
@media (max-width: 1020px) {
  .gallery-layout { grid-template-columns: 1fr; }
  .gallery-tree { position: static; max-height: 260px; }
}
@media (max-width: 700px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; } }

/* ---------- Success stories ---------- */
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.story-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; color: var(--text); transition: box-shadow .15s, transform .15s; }
.story-card:hover { text-decoration: none; box-shadow: var(--shadow); transform: translateY(-1px); }
.story-cover { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--globe-soft), #f6fafc); display: flex; align-items: center; justify-content: center; color: var(--globe); }
.story-cover img { width: 100%; height: 100%; object-fit: cover; }
.story-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.story-body h3 { margin: 2px 0 0; font-family: var(--serif); font-size: 1.15rem; line-height: 1.25; color: var(--ink); }
.story-body p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.5; }
.story-text { font-size: .97rem; line-height: 1.7; }
.story-text .lead { font-size: 1.08rem; font-weight: 650; color: var(--ink); margin-top: 0; }
.story-text blockquote { margin: 18px 0; padding: 12px 18px; border-left: 4px solid var(--globe); background: var(--globe-soft); border-radius: 0 var(--radius) var(--radius) 0; font-family: var(--serif); font-style: italic; font-size: 1.1rem; color: var(--ink); }
.story-text h3 { font-size: 1rem; margin: 18px 0 6px; color: var(--ink); }

/* ---------- Tableau de bord : mes indicateurs ---------- */
.widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.widget.wide { grid-column: span 2; }
.widget-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.widget-head h3 { margin: 0; font-size: .95rem; color: var(--ink); }
.widget-head .sub { font-size: .76rem; color: var(--faint); }
.widget-tools { display: flex; gap: 2px; flex-shrink: 0; }
.widget-tools form { margin: 0; }
.widget-tools button { border: 0; background: none; color: var(--faint); width: 28px; height: 28px; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.widget-tools button:hover { background: var(--paper); color: var(--ink); }
.widget .big { font-size: 2rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
.widget .chart-box { position: relative; height: 230px; }
.widget table { width: 100%; font-size: .84rem; }
.widget-catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-top: 12px; }
.widget-catalogue label { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.widget-catalogue label:hover { border-color: var(--globe); }
.widget-catalogue strong { display: block; font-size: .88rem; color: var(--ink); }
.widget-catalogue span { font-size: .78rem; color: var(--muted); }
@media (max-width: 760px) { .widget.wide { grid-column: auto; } .widget-grid { grid-template-columns: 1fr; } }
.gallery-item .cap { display: block; color: var(--text); font-weight: 600; }
.gallery-item .meta { display: block; margin-top: 2px; }
.gallery-actions .gallery-edit { padding: 0; order: 3; }
.gallery-actions .gallery-edit[open] { flex-basis: 100%; }
.gallery-actions form { margin: 0; }
.gallery-actions .gallery-edit[open] summary { margin-bottom: 4px; }
.story-photos .gallery-grid.small-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
