/* Charte Sondia : couleurs prises du logo (docs/logo.png). */
:root {
  --navy: #00377a; --brand: #006fd0; --brand-dark: #0058a8; --brand-soft: #e6f1fb;
  --green: #45ab1c; --green-deep: #027f54; --green-soft: #e8f5e1; --orange: #f59a00; --orange-soft: #fff4dc;
  --ink: #16243a; --muted: #5b6b80; --line: #d9e2ee; --bg: #f3f7fb; --danger: #b3261e; --danger-soft: #fbe9e7;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; line-height: 1.5; color: var(--ink);
}
body { margin: 0; background: var(--bg); }
main { max-width: 26rem; margin: 1.5rem auto; padding: 1.5rem 1.4rem; background: #fff; border: 1px solid var(--line); border-radius: 1rem; box-shadow: 0 1px 2px rgba(0,55,122,.05), 0 8px 24px rgba(0,55,122,.06); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--navy); }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
label { display: block; font-weight: 600; margin-top: 1rem; }
input { width: 100%; box-sizing: border-box; padding: .7rem; font-size: 1rem; border: 1px solid #b6c4d6; border-radius: .5rem; background: #fff; color: var(--ink); }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(0,111,208,.35); outline-offset: 1px; border-color: var(--brand); }
button { margin-top: 1.5rem; width: 100%; padding: .8rem; font-size: 1rem; font-weight: 600; border: 0; border-radius: .5rem; background: var(--brand); color: #fff; cursor: pointer; }
button:hover { background: var(--brand-dark); }
.errorlist { color: var(--danger); list-style: none; padding: 0; margin: .3rem 0 0; }
.notice { padding: .8rem 1rem; border-radius: .5rem; background: var(--green-soft); border: 1px solid #cfe8c3; }
.notice.error { background: var(--danger-soft); border-color: #f1c7c2; }

/* Éditeur de questionnaire */
main.wide { max-width: 48rem; background: transparent; border: 0; box-shadow: none; padding: 1.2rem 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1.05rem; margin: 0 0 .25rem; }
.plain { list-style: none; padding: 0; margin: 0; }
.muted { color: var(--muted); font-size: .85rem; }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 1rem; background: var(--brand-soft); font-size: .8rem; }
.q-card { background: #fff; border: 1px solid var(--line); border-radius: .5rem; padding: .75rem 1rem; margin: 0 0 .75rem; }
.q-card.dragging { opacity: .5; }
.drop-zone { min-height: 1.5rem; padding: .25rem 0; }
.drop-zone.over { outline: 2px dashed var(--brand); outline-offset: 2px; }
.section-block { border-left: 4px solid var(--brand); padding-left: .75rem; margin: 1.5rem 0; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
.row form, form.inline { display: inline-block; margin: 0; }
.row button, form.inline button { margin-top: 0; width: auto; padding: .4rem .8rem; }
.check { font-weight: 400; display: flex; gap: .5rem; align-items: center; }
.check input { width: auto; }
button.danger { background: var(--danger); }
.publish button { background: var(--navy); }
form.inline input { width: auto; }

/* Aperçu téléphone */
.editor-grid { display: block; }
@media (min-width: 64rem) {
  main.wide { max-width: 72rem; }
  .editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 2rem; align-items: start; }
  .editor-side { position: sticky; top: 1rem; }
}
.phone { margin: 1.5rem auto; max-width: 21rem; }
.phone-screen { border: 10px solid #222; border-radius: 1.8rem; background: #fff; padding: 1rem; max-height: 38rem; overflow-y: auto; }
.w-question { margin: 0 0 1.1rem; }
.w-label { font-weight: 600; margin: 0 0 .3rem; }
.w-choices .check { margin: .25rem 0; }
.w-choices.scale { display: flex; gap: .75rem; flex-wrap: wrap; }
.w-section h3 { border-bottom: 1px solid #ddd; padding-bottom: .25rem; }
.required { color: var(--danger); }
.field-error { color: var(--danger); font-size: .9rem; margin: .25rem 0 0; }
.notice.warn { background: var(--orange-soft); border-color: #f5d99a; }
.w-consent { background: var(--brand-soft); border-radius: .5rem; padding: .75rem; }
textarea { width: 100%; box-sizing: border-box; padding: .7rem; font: inherit; border: 1px solid #999; border-radius: .4rem; }
.template-card { background: #fff; border: 1px solid var(--line); border-radius: .5rem; padding: .75rem 1rem; margin: 0 0 .75rem; }
.template-card p { margin: .25rem 0 .5rem; }

/* --- En-tête : marine → bleu, symbole sur pastille blanche --- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .55rem 1.4rem; background: linear-gradient(100deg, var(--navy) 0%, #05509f 55%, #0a6cc0 100%); color: #fff; box-shadow: 0 2px 14px rgba(0,55,122,.28); border-bottom: 3px solid var(--green); }
.topbar .brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: #fff; font-weight: 800; letter-spacing: .08em; font-size: 1.05rem; }
.badge-logo { display: grid; place-items: center; width: 2.9rem; height: 2.9rem; background: #fff; border-radius: .8rem; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.badge-logo img { width: 2.2rem; height: auto; display: block; }
.topbar nav { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1; margin-left: .6rem; }
.topbar nav a { color: rgba(255,255,255,.9); text-decoration: none; font-weight: 600; padding: .45rem .95rem; border-radius: 2rem; transition: background .15s; }
.topbar nav a:hover { background: rgba(255,255,255,.16); color: #fff; }
.topbar nav a[aria-current="page"] { background: #fff; color: var(--navy); }
.topbar .who { display: flex; align-items: center; gap: .8rem; color: rgba(255,255,255,.85); font-size: .9rem; }
.topbar .who form { margin: 0; }
.topbar .who button { margin: 0; width: auto; padding: .4rem .95rem; background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.55); font-weight: 600; border-radius: 2rem; }
.topbar .who button:hover { background: rgba(255,255,255,.16); }

/* --- Pages d'entrée : fond de marque, logo sur pastille blanche --- */
body.auth { min-height: 100vh; background: radial-gradient(1200px 500px at 15% -10%, rgba(69,171,28,.35), transparent 60%), radial-gradient(900px 500px at 100% 0%, rgba(245,154,0,.22), transparent 55%), linear-gradient(165deg, var(--navy) 0%, #05509f 50%, #0a6cc0 100%); }
.brand-hero { text-align: center; margin: 2.2rem auto 0; background: #fff; border-radius: 1.4rem; padding: 1rem 1.6rem 1.1rem; width: 13.5rem; max-width: 70%; box-shadow: 0 10px 30px rgba(0,25,60,.35); }
.brand-hero img { width: 100%; height: auto; display: block; }
body.auth main { box-shadow: 0 18px 50px rgba(0,25,60,.4); border: 0; }
body.auth main a { color: var(--brand-dark); }

/* --- Accueil : bandeau, chiffres, enquêtes --- */
.hero { position: relative; overflow: hidden; background: linear-gradient(120deg, var(--navy) 0%, #05509f 60%, #0d7f6a 130%); color: #fff; border-radius: 1.2rem; padding: 1.5rem 1.8rem; margin-bottom: 1.3rem; box-shadow: 0 8px 24px rgba(0,55,122,.22); }
.hero::before { content: ""; position: absolute; right: -2.5rem; top: -3rem; width: 11rem; height: 11rem; border-radius: 50%; background: rgba(69,171,28,.55); }
.hero::after { content: ""; position: absolute; right: 5.5rem; bottom: -3.2rem; width: 7rem; height: 7rem; border-radius: 50%; background: rgba(245,154,0,.6); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin: 0 0 .2rem; font-size: 1.7rem; }
.hero p, .hero .muted { color: rgba(255,255,255,.85); margin: 0; }
.hero .actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.hero .actions a { text-decoration: none; }
.hero .actions button { margin: 0; width: auto; padding: .65rem 1.2rem; }
button.cta { background: var(--orange); color: var(--navy); box-shadow: 0 2px 8px rgba(245,154,0,.45); }
button.cta:hover { background: #ffad1f; }
button.ghost { background: rgba(255,255,255,.14); color: #fff; border: 1.5px solid rgba(255,255,255,.6); }
button.ghost:hover { background: rgba(255,255,255,.26); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; margin: 0 0 1.4rem; }
.figure { display: grid; grid-template-columns: auto 1fr; gap: .1rem .9rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem 1.1rem; box-shadow: 0 2px 8px rgba(0,55,122,.06); }
.figure .icon { grid-row: span 2; display: grid; place-items: center; width: 2.9rem; height: 2.9rem; border-radius: .9rem; background: var(--brand-soft); color: var(--brand); }
.figure:nth-child(2) .icon { background: var(--green-soft); color: var(--green-deep); }
.figure:nth-child(3) .icon { background: var(--orange-soft); color: #b46f00; }
.figure:nth-child(4) .icon { background: #e4eaf4; color: var(--navy); }
.figure .icon svg { width: 1.5rem; height: 1.5rem; }
.figure strong { display: block; font-size: 1.9rem; line-height: 1; color: var(--navy); }
.figure span.label { color: var(--muted); font-size: .88rem; line-height: 1.25; }
.figure.alert { background: linear-gradient(180deg, #fffaf0, var(--orange-soft)); border-color: #f5d99a; }
h2 { color: var(--navy); }
h2.section { display: flex; align-items: center; gap: .6rem; margin-top: 1.8rem; }
h2.section::before { content: ""; width: .35rem; height: 1.2rem; border-radius: .2rem; background: var(--green); }
.survey-row { background: #fff; border: 1px solid var(--line); border-left: 6px solid #9aa9bd; border-radius: .9rem; padding: 1rem 1.2rem; margin: 0 0 .9rem; box-shadow: 0 2px 8px rgba(0,55,122,.06); transition: box-shadow .15s, transform .15s; }
.survey-row.status-running { border-left-color: var(--green); } .survey-row.status-draft { border-left-color: var(--orange); } .survey-row.status-closed { border-left-color: var(--navy); }
.survey-row:hover { box-shadow: 0 8px 22px rgba(0,55,122,.13); transform: translateY(-1px); }
.survey-row h3 { margin: 0 0 .25rem; }
.tools { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .6rem; }
.tools a { text-decoration: none; padding: .25rem .7rem; border: 1px solid var(--line); border-radius: 2rem; font-size: .9rem; font-weight: 600; background: #fff; }
.tools a:hover { background: var(--brand-soft); border-color: #b6c9e3; }
.meter { height: .5rem; background: #e3eaf3; border-radius: .25rem; overflow: hidden; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--green)); }

table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: .5rem; overflow: hidden; font-size: .95rem; }
th { text-align: left; background: var(--brand-soft); color: var(--navy); padding: .5rem .7rem; }
td { padding: .5rem .7rem; border-top: 1px solid var(--line); }
.badge { background: var(--brand-soft); color: var(--navy); font-weight: 600; }
button.danger { background: var(--danger); } button.danger:hover { background: #8f1d17; }
.publish button { background: var(--green-deep); }

.badge.running { background: var(--green-soft); color: #1d6b0c; } .badge.draft { background: var(--orange-soft); color: #8a5500; } .badge.closed { background: #e4eaf4; color: var(--navy); }
.tools a { color: var(--brand-dark); } .tools a:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.card, .summary-item { border-radius: .9rem; box-shadow: 0 2px 8px rgba(0,55,122,.05); }
h1 { letter-spacing: -.01em; }

/* --- Pages intérieures : bandeau de titre, panneaux, listes, formulaires --- */
.page-head { position: relative; overflow: hidden; background: linear-gradient(120deg, var(--navy) 0%, #05509f 62%, #0d7f6a 135%); color: #fff; border-radius: 1.1rem; padding: 1.1rem 1.5rem 1.2rem; margin: 0 0 1.3rem; box-shadow: 0 6px 20px rgba(0,55,122,.2); }
.page-head::before { content: ""; position: absolute; right: -1.8rem; top: -2.4rem; width: 8rem; height: 8rem; border-radius: 50%; background: rgba(69,171,28,.5); }
.page-head::after { content: ""; position: absolute; right: 4.6rem; bottom: -2.6rem; width: 5rem; height: 5rem; border-radius: 50%; background: rgba(245,154,0,.55); }
.page-head > * { position: relative; z-index: 1; }
.page-head h1 { color: #fff; margin: .35rem 0 0; font-size: 1.55rem; }
.page-head .badge { background: rgba(255,255,255,.2); color: #fff; vertical-align: middle; }
a.crumb { display: inline-block; color: rgba(255,255,255,.92); text-decoration: none; font-size: .88rem; font-weight: 600; background: rgba(255,255,255,.16); padding: .2rem .75rem; border-radius: 2rem; }
a.crumb:hover { background: rgba(255,255,255,.3); color: #fff; }
p.crumbs { margin: 0 0 .8rem; } p.crumbs a.crumb { background: var(--brand-soft); color: var(--brand-dark); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: 1.3rem 1.5rem; max-width: 34rem; box-shadow: 0 2px 8px rgba(0,55,122,.06); }
main.wide > h2, main.wide .panel h2, main.wide #editor h2 { display: flex; align-items: center; gap: .6rem; color: var(--navy); }
main.wide > h2::before, main.wide .panel h2::before, main.wide #editor h2::before { content: ""; width: .32rem; height: 1.1rem; border-radius: .2rem; background: var(--green); flex: none; }
.chart h2::before, .card h2::before, .q-card h2::before { display: none; }
main.wide > p, main.wide > form, main.wide > ul { max-width: 100%; }
select, textarea { padding: .6rem .7rem; font: inherit; border: 1px solid #b6c4d6; border-radius: .5rem; background: #fff; color: var(--ink); max-width: 100%; box-sizing: border-box; }
select { min-width: 8rem; }
.panel button { margin-top: 1rem; }
fieldset { border: 1px solid var(--line); border-radius: .7rem; padding: .6rem .9rem; background: #fafcff; }
legend { font-weight: 700; color: var(--navy); padding: 0 .4rem; }
ul.plain > li { padding: .55rem 0; border-bottom: 1px solid #edf1f7; } ul.plain > li:last-child { border-bottom: 0; }
main.wide > ul.plain, main.wide > section > ul.plain, .card ul.plain { background: #fff; border: 1px solid var(--line); border-radius: .8rem; padding: .2rem 1rem; }
.card ul.plain { border: 0; padding: 0; }
dl.card dt { font-weight: 700; color: var(--navy); margin-top: .7rem; } dl.card dt:first-child { margin-top: 0; } dl.card dd { margin: .15rem 0 0; }
.q-card { border-radius: .9rem; box-shadow: 0 2px 8px rgba(0,55,122,.05); }
.section-block { border-left-color: var(--green); }
.notice { border-radius: .8rem; }
details.filters { background: #fff; border: 1px solid var(--line); border-radius: .8rem; padding: .6rem 1rem; }
button.alt, .row button:not(.cta):not(.danger) { background: var(--brand); }
.row button.danger, form.inline button.danger { background: var(--danger); }
input[type=checkbox], input[type=radio] { accent-color: var(--brand); }
.panel li form { display: inline-block; margin: 0 .4rem 0 0; }
.panel li button, .panel li select { width: auto; margin-top: .4rem; padding: .35rem .8rem; }
.panel li { padding: .5rem 0; }
.panel ul { padding-left: 1.1rem; }
input[type=checkbox], input[type=radio] { width: auto; }
label:has(> input[type=checkbox]), label:has(> input[type=radio]) { display: flex; gap: .55rem; align-items: center; font-weight: 400; }
main.wide > form:not(.inline), main.wide > section > form:not(.inline) { background: #fff; border: 1px solid var(--line); border-radius: 1rem; padding: .4rem 1.3rem 1.2rem; max-width: 40rem; box-shadow: 0 2px 8px rgba(0,55,122,.06); margin-bottom: 1rem; }
main.wide form.row, main.wide form.card { max-width: none; }
@media (max-width: 40rem) {
  .topbar { gap: .4rem .6rem; padding: .5rem .8rem; }
  .topbar .who { margin-left: auto; } .topbar .who span { display: none; }
  .topbar nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; margin-left: 0; padding-bottom: .1rem; }
  .topbar nav a { white-space: nowrap; }
  .page-head { padding: 1rem 1.1rem; } .page-head h1 { font-size: 1.3rem; }
  .hero { padding: 1.2rem 1.2rem; } .panel { padding: 1rem; }
}

/* Comptes de démonstration (page de connexion, DEMO_MODE) */
.demo { margin-top: 1.4rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.demo h2 { margin: 0 0 .4rem; font-size: 1.05rem; color: var(--navy); }
.demo-list { list-style: none; margin: .6rem 0 0; padding: 0; }
.demo-list li { padding: .5rem 0; border-top: 1px solid var(--line); }
.demo-list strong, .demo-list code { display: block; }
.demo code { overflow-wrap: anywhere; }
