/* ==========================================================================
   Pavu — design system : violet / rose / jaune / noir, Bungee + Nunito,
   contours noirs épais, ombres décalées, pastilles et autocollants.
   ========================================================================== */

:root {
  --violet: #5b24d6;
  --violet-dark: #431aa3;
  --rose: #ff5cf5;
  --jaune: #ffe600;
  --noir: #0a0a0a;
  --blanc: #ffffff;

  --bg: var(--violet);
  --surface: var(--blanc);
  --surface-2: #f4efff;
  --text: var(--noir);
  --text-soft: #4b4560;
  --border: var(--noir);
  --stage: #ede6ff;
  --title: var(--violet);
  --on-bg: #efe9ff;

  --radius: 18px;
  --radius-sm: 12px;
  --bw: 2.5px;
  --shadow: 4px 4px 0 var(--noir);
  --shadow-sm: 3px 3px 0 var(--noir);

  --font-display: "Bungee", "Arial Black", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14093a;
    --surface: #2b1e63;
    --surface-2: #3a2a80;
    --text: #f5f1ff;
    --text-soft: #c4bce0;
    --stage: #1b1145;
    --title: #ffe600;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14093a;
  --surface: #2b1e63;
  --surface-2: #3a2a80;
  --text: #f5f1ff;
  --text-soft: #c4bce0;
  --stage: #1b1145;
  --title: #ffe600;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1.4px, transparent 1.6px);
  background-size: 22px 22px;
  min-height: 100vh;
  overflow-x: hidden;
}

svg { width: 1.1em; height: 1.1em; flex: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--jaune); outline-offset: 2px; }

.hint { margin: 0; font-size: 12.5px; color: var(--text-soft); }
.on-violet { margin: 0; color: var(--on-bg); font-size: 14px; }
.on-violet-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 18px; color: var(--jaune); }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px;
  padding: 10px 20px;
  background: var(--bg);
  border-bottom: 3px solid var(--noir);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { display: block; width: 42px; height: 42px; }
.wordmark {
  font-family: var(--font-display); font-size: 26px; line-height: 1;
  color: var(--jaune); text-shadow: 3px 3px 0 var(--noir); letter-spacing: 1px;
  -webkit-text-stroke: 1.5px var(--noir); paint-order: stroke fill;
}
.steps { display: flex; gap: 8px; flex: 1 1 auto; justify-content: center; flex-wrap: wrap; }
.step {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 13px; text-transform: uppercase;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  border: var(--bw) solid var(--noir); background: var(--surface); color: var(--text);
  box-shadow: 2px 2px 0 var(--noir);
}
.step span {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--noir); background: var(--surface-2); color: var(--text);
}
.step[aria-current="step"] { background: var(--jaune); color: var(--noir); }
.step[aria-current="step"] span { background: var(--noir); color: var(--jaune); }
.step:disabled { opacity: 0.5; }
.local-badge { white-space: nowrap; }

@media (max-width: 720px) {
  .topbar { padding: 8px 16px; gap: 8px 12px; }
  .brand img { width: 34px; height: 34px; }
  .wordmark { font-size: 20px; }
  .steps { order: 3; flex-basis: 100%; justify-content: flex-start; gap: 6px; }
  .step { font-size: 11px; padding: 3px 10px 3px 3px; gap: 6px; }
  .step span { width: 22px; height: 22px; }
}

/* ---------- Labels / badges ---------- */
.label {
  display: inline-flex; align-items: center;
  font-family: var(--font-display); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 4px 10px; border-radius: 8px; border: 2px solid var(--noir); color: var(--noir);
}
.label-black { background: var(--noir); color: var(--blanc); }

/* ---------- Cartes, titres ---------- */
.card {
  background: var(--surface);
  border: var(--bw) solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-title {
  margin: 0;
  font-family: var(--font-display); font-weight: 400; font-size: 14px; text-transform: uppercase;
  color: var(--title);
  display: flex; align-items: center; gap: 8px;
}
.section-title .count, .count-pill {
  font-family: var(--font-body); font-weight: 900; font-size: 12px;
  border: 2px solid var(--noir); border-radius: 999px; padding: 0 8px;
}
.section-title .count { background: var(--jaune); color: var(--noir); }
.count-pill { background: var(--noir); color: var(--blanc); }
.sub-title { margin: 6px 0 0; font-family: var(--font-display); font-weight: 400; font-size: 12px; text-transform: uppercase; color: var(--text-soft); }
.page-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 26px; color: var(--title); }

/* ---------- Pages ---------- */
.page { padding: 18px 20px 48px; }
@media (max-width: 520px) { .page { padding: 14px 16px 40px; } }

/* 1. Importer */
.page-import { display: flex; flex-direction: column; align-items: center; gap: 28px; padding-top: 36px; }
.dropzone {
  width: 100%; max-width: 920px;
  padding: 40px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  border-style: dashed; box-shadow: 6px 6px 0 var(--noir);
  background-image: radial-gradient(rgba(91, 36, 214, 0.1) 1.5px, transparent 1.8px);
  background-size: 18px 18px;
}
.dropzone.dragover, .queue.dragover { background-color: #fff9c2; color: var(--noir); }
.dropzone p { max-width: 540px; }
.dropzone > p:not(.hint) { margin: 0; color: var(--text-soft); }
.dz-icon {
  width: 72px; height: 72px; padding: 12px;
  background: var(--rose); color: var(--noir);
  border: 3px solid var(--noir); border-radius: 18px; box-shadow: var(--shadow-sm);
}
.dz-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(22px, 4vw, 34px); text-transform: uppercase; color: var(--title); }
.dz-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.scenarios { width: 100%; max-width: 920px; display: flex; flex-direction: column; gap: 12px; }
.scenario-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.scenario-cards > div {
  display: flex; flex-direction: column; gap: 6px; text-align: left;
  padding: 14px; border-radius: 16px;
  border: 3px solid var(--noir); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.scenario-cards b { font-family: var(--font-display); font-weight: 400; font-size: 16px; }
.scenario-cards span { font-size: 13px; line-height: 1.35; color: var(--text-soft); }

/* 2. Vérifier */
.page-verify {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 340px;
  gap: 18px; align-items: start;
}
@media (max-width: 1180px) {
  .page-verify { grid-template-columns: 220px minmax(0, 1fr); }
  .inspector { grid-column: 1 / -1; display: grid !important; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
}
@media (max-width: 760px) {
  .page-verify { grid-template-columns: minmax(0, 1fr); }
}

.queue { padding: 14px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 76px; max-height: calc(100vh - 92px); }
.queue-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; padding: 2px 4px 4px 2px; min-height: 0; }
.q-row { position: relative; }
.q-pick {
  width: 100%; display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 7px 28px 7px 7px; border-radius: 12px;
  border: 2px solid var(--noir); background: var(--surface); color: var(--text);
  box-shadow: 2px 2px 0 var(--noir); text-align: left;
}
.q-row.current .q-pick { background: var(--jaune); color: var(--noir); box-shadow: none; transform: translate(1px, 1px); }
.q-thumb {
  flex: none; width: 46px; height: 36px; border-radius: 8px; border: 2px solid var(--noir);
  background: var(--surface-2) center / cover no-repeat; position: relative;
}
.q-thumb.is-video::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
  background: var(--noir) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5v14l11-7z' fill='white'/%3E%3C/svg%3E") center / 10px no-repeat;
}
.q-text { display: flex; flex-direction: column; min-width: 0; }
.q-name { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-tag { font-size: 11px; font-weight: 800; color: var(--text-soft); }
.q-row.current .q-tag { color: #3a3450; }
.q-tag.done { color: var(--violet); }
.q-tag.working { color: #b0129f; }
.q-tag.error { color: #b0129f; }
:root[data-theme="dark"] .q-row:not(.current) .q-tag.done { color: var(--jaune); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .q-row:not(.current) .q-tag.done { color: var(--jaune); } }
.q-remove {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
  width: 20px; height: 20px; padding: 0; border-radius: 50%;
  border: 2px solid var(--noir); background: var(--surface); color: var(--text);
  font-size: 10px; font-weight: 900; line-height: 1; opacity: 0; transition: opacity 0.15s;
}
.q-row:hover .q-remove, .q-remove:focus-visible { opacity: 1; }
.q-remove:hover { background: var(--rose); color: var(--noir); }
@media (hover: none) { .q-remove { opacity: 1; } }
@media (max-width: 760px) {
  .queue { position: static; max-height: none; }
  .queue-list { flex-direction: row; overflow-x: auto; }
  .q-row { flex: 0 0 200px; }
}

.stage-card { padding: 14px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stage-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.stage-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.file-name { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40ch; }
.status-tag {
  font-family: var(--font-display); font-size: 10px; text-transform: uppercase;
  padding: 3px 8px; border-radius: 7px; border: 2px solid var(--noir); background: var(--jaune); color: var(--noir);
}
.redo-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px 8px 14px; border: 2px solid var(--noir); border-radius: 12px;
  background: #ffe0fc; color: var(--noir); font-weight: 800; font-size: 13.5px;
}

.stage {
  position: relative;
  display: grid; place-items: center;
  min-height: 280px;
  background-color: var(--stage);
  background-image: linear-gradient(45deg, rgba(91, 36, 214, 0.08) 25%, transparent 25%, transparent 75%, rgba(91, 36, 214, 0.08) 75%),
    linear-gradient(45deg, rgba(91, 36, 214, 0.08) 25%, transparent 25%, transparent 75%, rgba(91, 36, 214, 0.08) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  border: var(--bw) solid var(--noir);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.stage canvas {
  display: block; max-width: 100%; max-height: min(64vh, 720px);
  width: auto; height: auto;
  touch-action: none; cursor: crosshair;
}
.stage-busy, .stage-error {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px;
  background: rgba(91, 36, 214, 0.55);
  color: var(--blanc); font-weight: 900; font-size: 16px; text-shadow: 1px 1px 0 var(--noir); text-align: center; padding: 16px;
}
.stage-error { background: var(--stage); color: var(--text); text-shadow: none; }
.spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 5px solid var(--noir); border-top-color: var(--jaune); border-right-color: var(--rose);
  animation: spin 0.8s linear infinite; background: var(--blanc);
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.analysis { display: flex; align-items: center; gap: 10px; }
.analysis .progress { flex: 1; }
.progress {
  position: relative; height: 26px;
  border: var(--bw) solid var(--noir); border-radius: 999px; background: var(--surface-2); overflow: hidden;
}
.progress span {
  position: absolute; inset: 0 auto 0 0; width: 0%;
  background: repeating-linear-gradient(-45deg, var(--rose) 0 12px, #ff8af8 12px 24px);
  border-right: 2px solid var(--noir);
  transition: width 0.2s;
}
.progress em {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 0 10px;
  font-style: normal; font-weight: 900; font-size: 12.5px; color: var(--noir);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.progress-lg { height: 32px; }

.video-controls { display: flex; flex-direction: column; gap: 8px; }
.timeline { display: flex; align-items: center; gap: 12px; }
.timeline input { flex: 1; min-width: 0; }
.time { font-weight: 900; font-variant-numeric: tabular-nums; font-size: 13px; padding: 4px 10px; border-radius: 10px; border: 2px solid var(--noir); background: var(--surface-2); white-space: nowrap; }
.icon-btn {
  width: 42px; height: 42px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  border: var(--bw) solid var(--noir); background: var(--violet); color: var(--blanc);
  box-shadow: 2px 2px 0 var(--noir);
}
.icon-btn:disabled { opacity: 0.5; }
.icon-btn svg { width: 16px; height: 16px; grid-area: 1 / 1; }
.icon-btn .ic-pause, .icon-btn.playing .ic-play { display: none; }
.icon-btn.playing .ic-pause { display: block; }
.lanes { display: flex; flex-direction: column; gap: 4px; padding-left: 54px; --playhead: 0%; }
.lane { display: flex; align-items: center; gap: 8px; }
.lane-name { width: 30px; flex: none; font-size: 11px; font-weight: 800; }
.lane-track { position: relative; flex: 1; height: 10px; border-radius: 999px; background: var(--surface-2); border: 2px solid var(--noir); }
.lane-fill { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: var(--rose); }
.lane-fill.off { background: #c9c2dc; }
.lane-head { position: absolute; top: -5px; bottom: -5px; left: var(--playhead); width: 3px; background: var(--text); }
@media (max-width: 520px) { .lanes { padding-left: 0; } }

.meta-line { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.meta-line:empty { display: none; }
.meta-title { font-weight: 900; margin-right: 2px; }
.meta-item { padding: 1px 8px; border-radius: 8px; border: 2px dashed var(--noir); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--rose); }
.meta-item.danger { background: #ffe0fc; color: var(--noir); }

.stage-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.stage-foot .hint { flex: 1 1 260px; font-size: 13px; }
@media (max-width: 560px) { .stage-foot .btn-lg { width: 100%; } }

/* Inspecteur */
.inspector { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.pills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.pills-wrap { display: flex; flex-wrap: wrap; }
.pills button {
  font-weight: 800; font-size: 12.5px; padding: 6px 10px; border-radius: 999px;
  border: 2px solid var(--noir); background: var(--surface); color: var(--text); box-shadow: 2px 2px 0 var(--noir);
}
.pills button.active { background: var(--rose); color: var(--noir); box-shadow: none; transform: translate(1px, 1px); }

.style-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.style-grid button {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 4px; border-radius: 14px;
  border: 2px solid var(--noir); background: var(--surface); color: var(--text);
  box-shadow: 2px 2px 0 var(--noir); font-weight: 900; font-size: 12px; line-height: 1.15; text-align: center;
}
.style-grid button.active { background: var(--rose); color: var(--noir); box-shadow: none; transform: translate(1px, 1px); }
.swatch {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--noir);
  font-size: 22px; line-height: 1; overflow: hidden;
}
.sw-blur { background: radial-gradient(circle, #e2a98a 30%, #f3d9cb 75%); filter: blur(1.2px); }
.sw-pixel { background: repeating-conic-gradient(#d39a7c 0 25%, #a8705a 0 50%) 0 0 / 10px 10px; }
.sw-solid { background: var(--noir); }
.sw-sticker { background: var(--jaune); }
.sw-head {
  background: var(--violet) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Crect x='7' y='12' width='20' height='8' rx='3' fill='%23FFE600' stroke='%230A0A0A' stroke-width='2'/%3E%3Ccircle cx='13' cy='16' r='1.8' fill='%230A0A0A'/%3E%3Ccircle cx='21' cy='16' r='1.8' fill='%230A0A0A'/%3E%3Crect x='12' y='23' width='10' height='2.5' rx='1.2' fill='%230A0A0A'/%3E%3C/svg%3E") center / cover;
}
.sw-photo {
  background: #c98f6b url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 34 34'%3E%3Cpath d='M2 15 Q5 2 17 2 Q29 2 32 15 Q27 8 17 8 Q7 8 2 15z' fill='%231d1410'/%3E%3Cellipse cx='12' cy='17' rx='2.4' ry='1.4' fill='%232a1b14'/%3E%3Cellipse cx='22' cy='17' rx='2.4' ry='1.4' fill='%232a1b14'/%3E%3Cpath d='M12 25 Q17 27 22 25' fill='none' stroke='%23a0453a' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / cover;
}

.field { display: grid; gap: 6px; }
.field-label { font-weight: 800; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.field-label output {
  font-weight: 900; font-size: 12px; min-width: 34px; text-align: center;
  background: var(--surface-2); border: 2px solid var(--noir); border-radius: 8px; padding: 0 6px; color: var(--text);
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 12px; margin: 6px 0;
  background: var(--surface-2);
  border: 2px solid var(--noir); border-radius: 999px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--rose); border: 2.5px solid var(--noir);
  box-shadow: 2px 2px 0 var(--noir);
}
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--rose); border: 2.5px solid var(--noir);
}
input[type="range"]:disabled { opacity: 0.5; }

.seg { display: flex; border: 2px solid var(--noir); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button {
  flex: 1; min-width: 0; padding: 7px 4px;
  border: 0; border-left: 2px solid var(--noir);
  background: transparent; font-weight: 800; font-size: 12px; line-height: 1.15;
}
.seg button:first-child { border-left: 0; }
.seg button.active { background: var(--violet); color: var(--blanc); }
.is-disabled { pointer-events: none; opacity: 0.5; }

.emoji-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emoji-grid button {
  font-size: 21px; aspect-ratio: 1; border-radius: 10px; padding: 0;
  border: 2px solid var(--noir); background: var(--surface);
}
.emoji-grid button.active { background: var(--jaune); box-shadow: 2px 2px 0 var(--noir); }
.file-btn { justify-content: flex-start; text-transform: none; letter-spacing: 0; font-weight: 800; min-width: 0; }
.file-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mask-image-preview { width: 26px; height: 26px; object-fit: contain; border-radius: 6px; background: var(--surface-2); flex: none; }
.mesh-preview { width: 100%; max-height: 200px; object-fit: contain; border: 2px solid var(--noir); border-radius: 10px; background: var(--surface-2); }

details.more { border-top: 2px dashed color-mix(in srgb, var(--text-soft) 40%, transparent); padding-top: 8px; }
details.more summary { cursor: pointer; font-weight: 900; font-size: 13px; }
details.more[open] { display: grid; gap: 8px; }

.switch { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 13px; cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  flex: none; width: 42px; height: 24px; border-radius: 999px;
  border: 2px solid var(--noir); background: var(--surface-2); position: relative;
}
.switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--blanc); border: 2px solid var(--noir); transition: transform 0.15s;
}
.switch input:checked + .switch-track { background: var(--violet); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: var(--jaune); }
.switch input:focus-visible + .switch-track { outline: 3px solid var(--jaune); outline-offset: 2px; }

/* Personnes, zones */
.doubt { font-size: 12px; font-weight: 800; color: #b0129f; }
.people-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding: 2px 4px 4px 2px; }
.person {
  display: flex; align-items: center; gap: 8px;
  padding: 7px; border: 2px solid var(--noir); border-radius: 12px; background: var(--surface);
}
.person.off { background: var(--surface-2); opacity: 0.8; }
.avatar {
  flex: none; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--noir);
  overflow: hidden; background: var(--stage);
}
.avatar canvas { display: block; width: 100%; height: 100%; }
.person-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.person-name { font-weight: 900; font-size: 13px; }
.person-sub { font-size: 11.5px; color: var(--text-soft); }
.tag-warn { font-family: var(--font-display); font-size: 9px; padding: 1px 5px; border-radius: 5px; border: 2px solid var(--noir); background: var(--jaune); color: var(--noir); white-space: nowrap; }
.toggle {
  flex: none; position: relative; width: 44px; height: 26px; padding: 0;
  border-radius: 999px; border: 2px solid var(--noir); background: var(--surface-2);
}
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--noir); background: var(--blanc); transition: transform 0.15s;
}
.toggle[aria-checked="true"] { background: var(--violet); }
.toggle[aria-checked="true"]::after { transform: translateX(18px); background: var(--jaune); }
.toggle:disabled { opacity: 0.5; }
.mini-btn {
  flex: none; border: 2px solid var(--noir); border-radius: 999px; background: var(--surface); color: var(--text);
  font-weight: 800; font-size: 11.5px; padding: 3px 9px;
}
.mini-btn:hover:not(:disabled) { background: var(--jaune); color: var(--noir); }
.mini-btn.danger:hover:not(:disabled) { background: var(--rose); }
.mini-btn:disabled { opacity: 0.5; }
.zone-list { display: flex; flex-direction: column; gap: 8px; }
.zone { padding: 8px 10px; border: 2px solid var(--noir); border-radius: 12px; display: grid; gap: 6px; background: #ffe0fc; color: var(--noir); }
.zone-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 900; font-size: 13px; }
.zone-range { font-size: 12px; font-variant-numeric: tabular-nums; font-weight: 700; }
.zone-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.zone .mini-btn { background: var(--blanc); color: var(--noir); }

/* Réglages experts */
.expert { padding: 12px 14px; }
.expert summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; list-style: none; }
.expert summary::-webkit-details-marker { display: none; }
.expert summary .section-title::after { content: "▸"; font-family: var(--font-body); }
.expert[open] summary .section-title::after { content: "▾"; }
.expert-body { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: 0.3px;
  text-decoration: none;
  border: var(--bw) solid var(--noir); border-radius: 999px;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer; user-select: none;
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--noir); }
.btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--noir); }
.btn:disabled { opacity: 0.45; }
.btn-sm { padding: 6px 12px; font-size: 12px; box-shadow: 2px 2px 0 var(--noir); }
.btn-lg { padding: 12px 22px; font-size: 16px; font-family: var(--font-display); font-weight: 400; text-transform: none; }
.btn-yellow { background: var(--jaune); color: var(--noir); }
.btn-pink { background: var(--rose); color: var(--noir); }
.btn-violet { background: var(--violet); color: var(--blanc); }
.btn-dashed { border-style: dashed; background: var(--surface-2); box-shadow: none; }
.btn-toggle[aria-pressed="true"] { background: var(--noir); color: var(--blanc); }

/* 3. Exporter */
.page-export { display: flex; flex-direction: column; align-items: center; gap: 16px; padding-top: 32px; }
.export-card { width: 100%; max-width: 860px; padding: 24px; display: flex; flex-direction: column; gap: 18px; box-shadow: 6px 6px 0 var(--noir); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.tile { border: 2px solid var(--noir); border-radius: 14px; padding: 12px; background: var(--surface-2); display: flex; flex-direction: column; }
.tile b { font-family: var(--font-display); font-weight: 400; font-size: 26px; line-height: 1.2; }
.tile span { font-size: 13px; font-weight: 700; }
.tile-yellow { background: var(--jaune); color: var(--noir); }
.tile-pink { background: var(--rose); color: var(--noir); }
.export-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.export-opts fieldset { border: 2px solid var(--noir); border-radius: 14px; padding: 10px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.export-opts legend { font-family: var(--font-display); font-size: 13px; color: var(--title); padding: 0 6px; }
.export-note { margin: 0; padding: 8px 12px; border: 2px dashed var(--noir); border-radius: 12px; font-size: 13.5px; font-weight: 700; background: var(--surface-2); }
.export-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.export-running { display: flex; align-items: center; gap: 10px; }
.export-running .progress { flex: 1; }
.export-results { display: flex; flex-direction: column; gap: 12px; }
.results-head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border: 3px solid var(--noir); border-radius: 16px; background: var(--jaune); color: var(--noir);
}
.results-head b { font-weight: 900; font-size: 16px; }
.results-head .btn { background: var(--blanc); color: var(--noir); }
.results-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.result-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 2px 4px 4px 2px; }
.result-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 2px solid var(--noir); border-radius: 12px; }
.result-text { display: flex; flex-direction: column; min-width: 0; }
.result-name { font-weight: 900; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-sub { font-size: 12px; color: var(--text-soft); }
.footnote { font-size: 13px; text-align: center; max-width: 860px; }
@media (max-width: 560px) {
  .export-card { padding: 16px; }
  .export-actions .btn-lg, .results-actions, .results-actions .btn { width: 100%; }
}

/* ---------- Chargement, toast ---------- */
.loader { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(10, 10, 10, 0.35); z-index: 50; padding: 16px; }
.loader-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: var(--bw) solid var(--noir); box-shadow: 6px 6px 0 var(--noir);
  font-weight: 900;
}
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 140%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 18px; border-radius: 14px;
  background: var(--noir); color: var(--blanc); border: var(--bw) solid var(--noir); box-shadow: 4px 4px 0 var(--rose);
  font-weight: 800; z-index: 60; transition: transform 0.25s, visibility 0.25s;
  visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.toast.error { background: var(--rose); color: var(--noir); box-shadow: 4px 4px 0 var(--noir); }
