:root {
  --red: #e3000b;
  --blue: #0055bf;
  --yellow: #f2b705;
  --green: #237841;
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e4ded3;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 14px rgb(0 0 0 / 6%);
  font-family: 'Nunito', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-height: 100vh; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
p { margin: .25em 0; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: .75rem; }
.hidden { display: none !important; }

/* ------------------------------------------------ Mise en page */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .6rem 1.25rem;
  background: var(--surface); border-bottom: 4px solid var(--team, var(--yellow));
  box-shadow: var(--shadow);
}
.topbar .brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.1rem; }
.topbar .phase { font-weight: 700; }
.container { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  background: var(--surface); border-radius: var(--radius); padding: 1rem;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card.tinted { border-top: 6px solid var(--c, var(--line)); }
.hint {
  background: #fff8e1; border: 1px solid #f5d77a; border-radius: var(--radius);
  padding: .6rem .9rem; margin-bottom: 1rem;
}

/* ------------------------------------------------ Tenons façon Lego */
.stud {
  display: inline-block; width: 1.1em; height: 1.1em; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, rgb(255 255 255 / 55%), transparent 45%), var(--c, var(--red));
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 20%);
  vertical-align: middle;
}
.logo { display: inline-flex; gap: 3px; }

/* ------------------------------------------------ Boutons et champs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  border: 0; border-radius: 8px; padding: .5rem .9rem;
  font: inherit; font-weight: 700; cursor: pointer;
  background: var(--ink); color: #fff;
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / 25%);
  transition: transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--blue); }
.btn.success { background: var(--green); }
.btn.danger { background: var(--red); }
.btn.warn { background: var(--yellow); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; border: 1px solid var(--line); }
.btn.sm { padding: .25rem .55rem; font-size: .85rem; }
.btn.lg { padding: .8rem 1.4rem; font-size: 1.1rem; }
input, textarea, select {
  font: inherit; padding: .5rem .65rem; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); width: 100%;
}
textarea { resize: vertical; min-height: 4em; }
label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .25rem; }
.field { margin-bottom: .75rem; }
.inline-input { display: flex; gap: .5rem; }
.inline-input input { flex: 1; }

/* ------------------------------------------------ Onglets */
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 2px solid var(--line); }
.tab {
  border: 0; background: none; font: inherit; font-weight: 700; color: var(--muted);
  padding: .6rem 1rem; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--ink); border-bottom-color: var(--team, var(--blue)); }
.tab .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--red); margin-left: 4px; vertical-align: middle; }

/* ------------------------------------------------ Badges */
.badge {
  display: inline-block; padding: .1rem .5rem; border-radius: 999px;
  font-size: .75rem; font-weight: 800; background: var(--line); color: var(--ink); white-space: nowrap;
}
.badge.prio { color: #fff; background: var(--c); }
.badge.ok { background: #d8f0df; color: var(--green); }
.badge.ko { background: #fde0e0; color: var(--red); }
.badge.info { background: #dfe9fb; color: var(--blue); }
.badge.owner { color: #fff; background: var(--c); }
.estimate {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.2rem; height: 2.2rem; padding: 0 .4rem; border-radius: 8px;
  background: var(--yellow); font-weight: 900; box-shadow: inset 0 -3px 0 rgb(0 0 0 / 15%);
}
.estimate.empty { background: var(--line); color: var(--muted); }

/* ------------------------------------------------ Stories */
.story {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .75rem; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
}
.story + .story { margin-top: .5rem; }
.story .body { flex: 1; min-width: 0; }
.story .title { font-weight: 800; }
.story .criteria { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .85rem; color: var(--muted); }
.story.taken { opacity: .55; }
.story.selected { outline: 3px solid var(--team, var(--blue)); }
.story .actions { display: flex; flex-direction: column; gap: .35rem; align-items: flex-end; }

/* ------------------------------------------------ Tableau */
.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: .75rem; min-height: 200px; border: 1px solid var(--line); }
.column h3 { display: flex; justify-content: space-between; }
.postit {
  background: var(--postit, #fff7a8); border-radius: 4px; padding: .6rem; margin-bottom: .6rem;
  box-shadow: 0 2px 6px rgb(0 0 0 / 12%); position: relative;
}
.postit .title { font-weight: 800; }
.postit .moves { display: flex; gap: .35rem; margin-top: .4rem; }

/* ------------------------------------------------ Rétro */
.retro { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .75rem; }
.retro .column { min-height: 160px; }
.retro .column.action { background: #eaf6ee; border-color: #b9e0c5; }
.note {
  background: #fff; border-radius: 8px; padding: .5rem .6rem; margin-bottom: .5rem;
  border-left: 4px solid var(--team, var(--blue)); box-shadow: 0 1px 3px rgb(0 0 0 / 8%);
}
.note .meta { display: flex; gap: .35rem; align-items: center; font-size: .75rem; color: var(--muted); margin-top: .25rem; }
.radar-form { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem 1rem; align-items: center; }
.radar-form input[type=range] { padding: 0; }

/* ------------------------------------------------ Minuteur */
.timer { display: inline-flex; flex-direction: column; align-items: center; font-variant-numeric: tabular-nums; }
.timer-value { font-weight: 900; }
.timer-bar { width: 100%; height: 5px; background: var(--line); border-radius: 3px; overflow: hidden; }
.timer-bar div { height: 100%; background: var(--green); transition: width .25s linear; }
.timer.warn .timer-value { color: #c77700; }
.timer.warn .timer-bar div { background: var(--yellow); }
.timer.over .timer-value { color: var(--red); animation: blink 1s steps(2) infinite; }
.timer.paused .timer-value { opacity: .6; }
.timer-sm .timer-value { font-size: 1.4rem; }
.timer-md .timer-value { font-size: 2.4rem; }
.timer-xl .timer-value { font-size: clamp(4rem, 14vw, 11rem); line-height: 1; }
.timer-xl .timer-bar { height: 12px; border-radius: 6px; }
.timer-sm .timer-bar { min-width: 80px; }
@keyframes blink { 50% { opacity: .35; } }

/* ------------------------------------------------ Bandeaux et notifications */
.event-banner {
  display: flex; gap: .75rem; align-items: flex-start;
  background: #231f20; color: #fff; border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem;
  border-left: 8px solid var(--yellow); animation: pop .4s ease-out;
}
.event-banner .btn.ghost { color: #fff; border-color: #fff4; }
.event-banner div { flex: 1; }
.event-banner.big { font-size: 1.6rem; padding: 1.25rem 1.5rem; }
.event-icon { font-size: 1.6em; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 100; }
.toast { background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 8px; box-shadow: var(--shadow); max-width: 360px; }
.toast-error { background: var(--red); }
.toast-success { background: var(--green); }
.offline { position: fixed; top: 0; left: 0; right: 0; background: var(--red); color: #fff; text-align: center; padding: .35rem; z-index: 200; font-weight: 700; }
.po-away { background: #fde0e0; border-color: #f4a6a6; }

/* ------------------------------------------------ Graphiques */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.chart { margin: 0; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .bar-label { fill: var(--ink); font-size: 11px; font-weight: 700; }
.legend { display: flex; gap: 1rem; justify-content: center; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); }
th { font-size: .8rem; color: var(--muted); text-transform: uppercase; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------ Accueil / connexion */
.hero { max-width: 760px; margin: 3rem auto; padding: 0 1.25rem; }
.hero h1 { font-size: 2.4rem; }
.team-pick { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; }
.team-pick button {
  border: 3px solid transparent; border-radius: var(--radius); padding: 1rem; font: inherit; font-weight: 800;
  background: var(--c); color: #fff; cursor: pointer; box-shadow: inset 0 -5px 0 rgb(0 0 0 / 25%); text-align: left;
}
.team-pick button.selected { border-color: var(--ink); transform: translateY(-2px); }
.team-pick button small { display: block; font-weight: 600; opacity: .85; }
.members { display: flex; flex-wrap: wrap; gap: .35rem; }
.member { display: inline-flex; align-items: center; gap: .3rem; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .85rem; }
.member .online { width: 8px; height: 8px; border-radius: 50%; background: #bbb; }
.member .online.on { background: #2fbf55; }
.member.sm { border-color: var(--ink); font-weight: 800; }
.vision { white-space: pre-line; line-height: 1.5; }

/* ------------------------------------------------ Facilitateur */
.stepper { display: flex; flex-wrap: wrap; gap: .25rem; }
.step {
  border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: .3rem .55rem;
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; color: var(--muted);
}
.step.done { background: #eef5f0; color: var(--green); }
.step.current { background: var(--ink); color: #fff; border-color: var(--ink); }
.step-group { display: flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-2); }
.agenda li { display: grid; grid-template-columns: 4rem 1fr 3.5rem; gap: .5rem; padding: .4rem .5rem; border-radius: 6px; cursor: pointer; }
.agenda { list-style: none; padding: 0; margin: 0; }
.agenda li.current { background: var(--ink); color: #fff; }
.agenda li.past { color: var(--muted); text-decoration: line-through; }
.drift { font-weight: 800; }
.drift.late { color: var(--red); }
.drift.early { color: var(--green); }
.review-item { display: flex; gap: .75rem; align-items: center; padding: .6rem; border-radius: 8px; border: 1px solid var(--line); margin-bottom: .5rem; background: var(--surface-2); }
.review-item .body { flex: 1; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .5rem; }
.photos figure { margin: 0; position: relative; }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 8px; display: block; }
.photos figcaption { font-size: .75rem; color: var(--muted); }
.photos .del { position: absolute; top: 4px; right: 4px; }

/* ------------------------------------------------ Écran projeté */
.screen { min-height: 100vh; display: flex; flex-direction: column; }
.screen-head { display: flex; align-items: center; gap: 2rem; padding: 1.5rem 2.5rem; background: var(--surface); box-shadow: var(--shadow); }
.screen-head .phase-title { font-size: clamp(1.6rem, 3.5vw, 3rem); font-weight: 900; }
.screen-head .phase-hint { font-size: clamp(1rem, 1.6vw, 1.4rem); color: var(--muted); }
.screen-body { flex: 1; padding: 1.5rem 2.5rem; }
.screen-body.center-content { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.big-timer { display: flex; justify-content: center; padding: 1rem 0 2rem; }
.city { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .75rem; }
.city .lot { border-radius: 10px; padding: .75rem; background: var(--surface); border: 2px dashed var(--line); min-height: 88px; }
.city .lot.progress { border-style: solid; border-color: var(--c); }
.city .lot.delivered { background: var(--c); color: #fff; border: 0; box-shadow: inset 0 -5px 0 rgb(0 0 0 / 22%); }
.city .lot .title { font-weight: 800; }
.city .lot small { display: block; opacity: .85; }
.debrief-q { font-size: clamp(2rem, 4.5vw, 4rem); font-weight: 900; max-width: 1100px; line-height: 1.2; }
.qr { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 12px; }
.join-url { font-size: clamp(1.5rem, 3vw, 2.6rem); font-weight: 900; }
.kpis { display: flex; gap: 1rem; flex-wrap: wrap; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: .75rem 1.25rem; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 2rem; }
.kpi span { color: var(--muted); font-size: .85rem; }

@media (max-width: 720px) {
  .board { grid-template-columns: 1fr; }
  .container { padding: .75rem; }
  .screen-head, .screen-body { padding: 1rem; }
}

.story > .estimate { flex: 0 0 2.8rem; }

/* ------------------------------------------------ Mur de post-it (écran projeté) */
.timer-lg .timer-value { font-size: clamp(2.6rem, 5vw, 4.5rem); line-height: 1; }
.timer-lg .timer-bar { height: 8px; border-radius: 4px; min-width: 160px; }
.wall { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .9rem; align-items: start; }
.wall-col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; min-height: 55vh; }
.wall-col.action { background: #eaf6ee; border-color: #b9e0c5; }
.wall-col.backlog { background: transparent; border-style: dashed; }
.wall-col h3 { display: flex; justify-content: space-between; gap: .5rem; }
.sticky {
  background: color-mix(in srgb, var(--c) 24%, #fffdf5); border-top: 7px solid var(--c);
  border-radius: 3px; padding: .55rem .65rem; margin-bottom: .6rem;
  box-shadow: 0 3px 8px rgb(0 0 0 / 14%); transform: rotate(var(--r, 0deg));
  animation: stick .55s cubic-bezier(.2, 1.4, .4, 1);
}
.sticky.blank { background: #fffdf5; border-top-color: #d9d2c4; box-shadow: 0 1px 3px rgb(0 0 0 / 8%); opacity: .85; }
.sticky-title { font-weight: 800; font-size: clamp(.9rem, 1.1vw, 1.15rem); line-height: 1.25; }
.sticky-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; margin-top: .3rem; color: #3b3f48; }
@keyframes stick {
  0% { transform: translateY(-24px) scale(.7) rotate(-10deg); opacity: 0; }
  100% { transform: rotate(var(--r, 0deg)); opacity: 1; }
}
@media (max-width: 900px) { .wall { grid-template-columns: 1fr 1fr; } }

/* ------------------------------------------------ Questions au maire */
.questions { margin-top: .5rem; }
.questions summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--blue); }
.qa { background: #fff; border-radius: 8px; padding: .45rem .6rem; margin-top: .4rem; border-left: 4px solid var(--blue); font-size: .9rem; }
.qa .answer { margin-top: .2rem; }
.needs { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .85rem; }
.needs li { margin-top: .1rem; }
.question-card textarea { min-height: 3.5em; }

/* ------------------------------------------------ Fenêtre modale */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgb(20 20 30 / 55%);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.modal { width: min(560px, 100%); animation: pop .2s ease-out; }

/* Case à cocher alignée avec son libellé */
label.row { flex-wrap: nowrap; align-items: flex-start; }
label.row input[type=checkbox] { flex: 0 0 auto; margin-top: .2rem; }

.join-code { font-size: clamp(1.3rem, 2.4vw, 2rem); }
.join-code b { letter-spacing: .25em; font-size: 1.4em; }
