/* Bleu = cible, orange = niveau atteint (même convention que le modèle Excel).
   Dégradé indigo pour les niveaux 0 à 4 ; vert / ambre / rouge pour l'état de couverture. */
:root {
  color-scheme: light;
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #e9edf4;
  --text: #172033;
  --muted: #5b667c;
  --border: #d6dce7;
  --accent: #172033;
  --accent-text: #ffffff;
  --target: #2f5bd3;
  --target-soft: rgb(47 91 211 / 0.14);
  --actual: #e0782b;
  --actual-soft: rgb(224 120 43 / 0.2);
  --ok: #1f8a5b; --ok-bg: #dff3e9;
  --warn: #a86400; --warn-bg: #fdf0d8;
  --bad: #c2382f; --bad-bg: #fbe3e1;
  --sim: #6b3fc4; --sim-bg: #efe8fc;
  --l0: #eef0f5; --l1: #9aaae0; --l2: #5b72c4; --l3: #23367f; --l4: #23367f;
  --l-ring: #8a98c9;
  --l-ink-low: #172033; --l-ink-high: #ffffff;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420;
  --surface: #171e2d;
  --surface-2: #1f2839;
  --text: #e6eaf3;
  --muted: #9aa5bb;
  --border: #2c3649;
  --accent: #e6eaf3;
  --accent-text: #0f1420;
  --target: #7d9cff;
  --target-soft: rgb(125 156 255 / 0.16);
  --actual: #f39a52;
  --actual-soft: rgb(243 154 82 / 0.22);
  --ok: #4fc58d; --ok-bg: #173527;
  --warn: #f0b552; --warn-bg: #3a2c12;
  --bad: #f07a70; --bad-bg: #3d1d1b;
  --sim: #b49aff; --sim-bg: #2b2245;
  --l0: #1f2839; --l1: #3d5296; --l2: #6680dc; --l3: #a8bbff; --l4: #a8bbff;
  --l-ring: #6f7fb8;
  --l-ink-low: #e6eaf3; --l-ink-high: #0f1420;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--target); outline-offset: 2px; }

.eyebrow { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); }
.muted { color: var(--muted); }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.intro { color: var(--muted); max-width: 70ch; }

/* ---------------------------------------------------------------- Contrôles */

.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  min-width: 0;
}
.button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-weight: 550;
  white-space: nowrap;
}
.button:hover { border-color: var(--muted); }
.button-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.button-small { padding: 4px 10px; font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.del {
  background: none;
  border: none;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.2;
  white-space: nowrap;
}
.del:hover { color: var(--bad); background: var(--bad-bg); }
.del.is-armed { color: #fff; background: var(--bad); font-size: 12px; font-weight: 650; }

/* ---------------------------------------------------------------- En-tête */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 20px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px 18px;
}
.brand-block { display: grid; gap: 4px; }
.brand { display: flex; align-items: center; gap: 12px; font-size: clamp(1.5rem, 4vw, 2.1rem); font-weight: 800; letter-spacing: -0.02em; }
.brand-mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 26px; height: 26px; flex: none; }
.brand-mark i { border-radius: 3px; }
.brand-mark i:nth-child(1) { background: var(--l4); }
.brand-mark i:nth-child(2) { background: var(--l3); }
.brand-mark i:nth-child(3) { background: var(--l2); }
.brand-mark i:nth-child(4) { background: var(--actual); }
.topbar-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.whoami { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.whoami #join-name { width: 170px; }

.theme-toggle {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.banner {
  max-width: 1168px;
  margin: 0 auto 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn);
  font-weight: 550;
}
@media (max-width: 1200px) { .banner { margin: 0 16px 12px; } }

/* ---------------------------------------------------------------- Écrans */

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; }
.screen { display: grid; gap: 20px; }
.status-text { margin: 18vh auto 0; text-align: center; color: var(--muted); max-width: 32em; }
.status-text.is-error { color: var(--bad); }

/* ---------------------------------------------------------------- Synthèse */

.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
}
.summary.is-sim { border-color: var(--sim); box-shadow: 0 0 0 3px var(--sim-bg); }
.score, .sim-box { display: grid; gap: 12px; align-content: start; }
.score-main { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.score-big { font-size: 56px; line-height: 1; font-weight: 800; letter-spacing: -0.03em; }
.score-big small { font-size: 26px; color: var(--muted); font-weight: 650; }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 90px minmax(0, 1fr) 54px; gap: 10px; align-items: center; font-size: 14px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--ok); border-radius: 99px; transition: width 0.3s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface-2); border-radius: 99px; padding: 4px 12px; font-size: 14px; }
.chip[aria-pressed="true"] { background: var(--sim); border-color: var(--sim); color: var(--l-ink-high); text-decoration: line-through; }
.sim-note { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 14px; color: var(--sim); font-weight: 600; }

/* ---------------------------------------------------------------- Onglets */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--text); }
.tab .count { font-family: var(--font-mono); font-size: 12px; background: var(--bad-bg); color: var(--bad); border-radius: 99px; padding: 0 7px; margin-left: 6px; }
.panel { display: grid; gap: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { width: 14px; height: 14px; border-radius: 3px; display: inline-block; }
.toggle { display: inline-flex; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}
.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  display: grid;
  gap: 8px;
  justify-items: center;
}

/* ---------------------------------------------------------------- Matrice */

.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: center; vertical-align: middle; }
thead th { font-size: 13px; font-weight: 650; color: var(--muted); background: var(--surface); }
th.group { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; border-bottom: none; padding-bottom: 0; }
.sticky { position: sticky; left: 0; background: var(--surface); text-align: left; z-index: 1; min-width: 200px; }
tbody tr:last-child td { border-bottom: none; }
.member-h { min-width: 66px; max-width: 110px; overflow-wrap: anywhere; }
.member-h.is-me { color: var(--text); }
.member-h .you { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--actual); }
.member-h.is-off { text-decoration: line-through; opacity: 0.5; }
.skill-cell { display: flex; gap: 4px; align-items: center; }

/* Glisser-déposer des lignes et des colonnes */
.drag-handle {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 26px; padding: 0;
  border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted);
  cursor: grab; touch-action: none; opacity: 0.45;
}
.drag-handle.is-column { width: 26px; height: 18px; margin: 0 auto 2px; transform: rotate(90deg); }
tr:hover .drag-handle, th:hover .drag-handle, .drag-handle:focus-visible { opacity: 1; }
.drag-handle:hover { border-color: var(--border); background: var(--surface); color: var(--text); }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.is-dragged { opacity: 0.4; }
tr.drop-before > td { box-shadow: inset 0 3px 0 var(--target); }
tr.drop-after > td { box-shadow: inset 0 -3px 0 var(--target); }
th.drop-before, td.drop-before { box-shadow: inset 3px 0 0 var(--target); }
th.drop-after, td.drop-after { box-shadow: inset -3px 0 0 var(--target); }
.member-h .drag-handle { display: grid; }
.member-name { display: block; }
.name-view, .name-edit { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; }
.name-text { font-weight: 550; overflow-wrap: break-word; hyphens: auto; min-width: 0; padding: 4px 2px; }
.name-view.is-strong .name-text { font-weight: 700; font-size: 16px; }
.name-view.is-large .name-text { font-weight: 750; font-size: 1.15rem; }
.name-edit .field { flex: 1; min-width: 0; width: 100%; padding: 5px 8px; }
.name-edit.is-large .field, .name-edit.is-strong .field { font-weight: 700; }
.icon-button {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px;
  border: 1px solid transparent; border-radius: 6px; background: none; color: var(--muted);
}
.icon-button:hover { border-color: var(--border); color: var(--text); background: var(--surface); }
.icon-button.is-save { color: var(--ok); }
.name-view .icon-button { opacity: 0.55; }
.name-view:hover .icon-button, .name-view .icon-button:focus-visible { opacity: 1; }
td.me-col { background: var(--actual-soft); }

.lvl {
  position: relative;
  width: 40px; height: 34px;
  margin: 0 auto;
  border-radius: 7px;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-weight: 650;
  font-size: 15px;
}
.lvl.empty { border: 1px dashed var(--border); color: var(--muted); }
.lvl.l0 { background: var(--l0); color: var(--l-ink-low); }
.lvl.l1 { background: var(--l1); color: var(--l-ink-low); }
.lvl.l2 { background: var(--l2); color: var(--l-ink-low); }
.lvl.l3 { background: var(--l3); color: var(--l-ink-high); }
.lvl.l4 { background: var(--l4); color: var(--l-ink-high); }
.lvl.is-editable { box-shadow: 0 0 0 2px var(--actual); cursor: pointer; }
.lvl.is-off { opacity: 0.3; }
.lvl.small { width: 30px; height: 26px; font-size: 13px; margin: 0; flex: none; }
/* Le menu natif couvre la case : clic, clavier et sélecteur du téléphone fonctionnent tels quels. */
.lvl select, .tgt select { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.role { display: grid; gap: 1px; justify-items: center; min-width: 96px; }
.role-lvl { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-weight: 650; }
.role.is-ko .role-lvl { color: var(--bad); }
.role.is-ok .role-lvl { color: var(--ok); }
.role-name { font-size: 12px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-block; font-size: 12px; font-weight: 650; border-radius: 99px; padding: 3px 10px; white-space: nowrap; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.bad { background: var(--bad-bg); color: var(--bad); }

.add-row td { background: var(--surface-2); text-align: left; }
.add-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-form .grow { flex: 1 1 220px; }
.add-form label { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }

.scale { display: grid; gap: 4px; font-size: 14px; }
.scale > div { display: flex; gap: 8px; align-items: center; }

/* Niveaux : cercles remplis par tiers, « ne souhaite pas progresser » hachuré */
.lvc-svg { display: block; flex: none; }
.lvc-svg .ring { fill: var(--surface); stroke: var(--l-ring); stroke-width: 1.6; }
.lvc-svg .ring-empty { fill: none; stroke: var(--border); stroke-width: 1.6; stroke-dasharray: 3 3; }
.lvc-svg .fill-1 { fill: var(--l1); }
.lvc-svg .fill-2 { fill: var(--l2); }
.lvc-svg .fill-3 { fill: var(--l3); }
.lvc-svg.is-target .ring { stroke: var(--target); stroke-width: 2; }
.lvc-svg .fill-t { fill: var(--target); fill-opacity: 0.4; }
.cell-lvl {
  position: relative; display: inline-grid; place-items: center; width: 44px; height: 38px; margin: 0 auto;
  padding: 0; border: 1px solid transparent; border-radius: 8px; background: none; color: inherit; vertical-align: middle;
}
.cell-lvl.is-small { width: 30px; height: 26px; margin: 0; }
.cell-lvl.is-editable { border: 2px solid var(--actual); cursor: pointer; }
.cell-lvl.is-editable:hover { background-color: var(--actual-soft); }
.cell-lvl.is-stalled { background: repeating-linear-gradient(135deg, var(--surface-2) 0 4px, var(--surface) 4px 8px); }
.cell-lvl.is-stalled .lvc-svg { opacity: 0.55; }
.lvc-x { position: absolute; top: 1px; right: 3px; font-size: 10px; font-weight: 700; line-height: 1; color: var(--muted); }
.cell-lvl.is-off { opacity: 0.3; }
.role-lvl .sep { color: var(--muted); margin: 0 2px; }
.tgt { position: relative; display: inline-grid; place-items: center; width: auto; height: auto; border: none; background: none; border-radius: 50%; }
.tgt:hover .lvc-svg .ring { stroke-width: 3; }
.legend span { gap: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Choix du niveau */
.dialog.level-dialog { width: min(92vw, 400px); text-align: left; }
.level-head { display: grid; gap: 2px; font-size: 13px; }
.level-head h2 { font-size: 1.25rem; }
.level-options { display: grid; gap: 6px; }
.level-option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer;
}
.level-option span { display: grid; gap: 1px; }
.level-option .muted { font-size: 12px; }
.level-option:hover { border-color: var(--target); }
.level-option.is-selected { border: 2px solid var(--target); background: var(--target-soft); }
.level-wants { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 14px; cursor: pointer; }
.level-wants input { width: 18px; height: 18px; margin: 0; accent-color: var(--target); }
.level-dialog .dialog-actions { align-items: center; }
.level-dialog .link-button { margin-right: auto; }

/* ---------------------------------------------------------------- Radars */

.radars { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.radar svg { width: 100%; height: auto; display: block; }
.radar text { fill: var(--muted); font-family: var(--font); font-size: 11px; }
.radar .grid { fill: none; stroke: var(--border); }
.radar .axis { stroke: var(--border); }
.radar .t-poly { fill: var(--target-soft); stroke: var(--target); stroke-width: 2; }
.radar .a-poly { fill: var(--actual-soft); stroke: var(--actual); stroke-width: 2; }
.radar .a-dot { fill: var(--actual); }
.radar .a-dot.is-ko { fill: var(--bad); }
.radar text.is-ko { fill: var(--bad); font-weight: 650; }

/* ---------------------------------------------------------------- Équipe */

.team { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.member-card { grid-template-columns: minmax(0, 1fr); }
.member-card .head { display: flex; gap: 8px; align-items: center; min-width: 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px; display: grid; }
.stat b { font-family: var(--font-mono); font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.3; }
.impact { border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.impact.bad { background: var(--bad-bg); color: var(--bad); }
.impact.ok { background: var(--ok-bg); color: var(--ok); }
.impact.sim { background: var(--sim-bg); color: var(--sim); }
.impact ul { margin: 4px 0 0; padding-left: 18px; color: var(--text); }
.progress { font-size: 13px; color: var(--muted); }

/* ---------------------------------------------------------------- Plan de formation */

.plan { display: grid; gap: 12px; }
.plan-item { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }
.gaps, .cands { display: grid; gap: 6px; font-size: 14px; align-content: start; }
.cand { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag { font-size: 11px; font-weight: 650; border-radius: 99px; padding: 1px 8px; background: var(--actual-soft); }

.foot { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; border-top: 1px solid var(--border); padding-top: 16px; font-size: 14px; color: var(--muted); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-text);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 20;
  max-width: calc(100% - 32px);
}

/* ---------------------------------------------------------------- Équipes */

.home-link { text-decoration: none; }
.home-link:hover { color: var(--text); text-decoration: underline; }
.button { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.button-danger { color: var(--bad); }
.button-danger:hover { border-color: var(--bad); }
.button.is-armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.link-button { background: none; border: none; padding: 0; color: var(--target); text-decoration: underline; font-size: inherit; }
.link-button:hover { color: var(--text); }
.count-neutral { background: var(--surface-2) !important; color: var(--muted) !important; }

.team-bar { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; justify-content: space-between; }
.team-main { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; flex: 1 1 320px; min-width: 0; }
.team-name-field { display: grid; gap: 4px; max-width: 460px; }
.join-card { display: flex; align-items: center; gap: 16px; flex: 0 1 520px; padding: 14px; min-width: 0; }
.join-text { min-width: 0; display: grid; gap: 2px; }
.join-hint { font-size: 14px; }
.join-url { font-weight: 650; overflow-wrap: anywhere; }
.join-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 14px; }
.qr-button { flex: none; width: 116px; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: #fff; cursor: zoom-in; }
.qr-button:hover { border-color: var(--target); }
.qr-button .qr { width: 100%; padding: 4px; margin: 0; }

.team-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.home-grid .inline-form .grow, .card .inline-form .grow { flex: 1 1 180px; }
.team-list { list-style: none; margin: 0; padding: 0; display: grid; }
.team-row { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: none; }
.team-link, .team-name { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.team-link { text-decoration: none; }
.team-link:hover { color: var(--target); text-decoration: underline; }
.team-row .link-button { margin-left: auto; font-size: 13px; }
.team-row .button { margin-left: auto; }
.home-note { text-align: center; }
.home-note a { color: var(--target); }

.trash-table th, .trash-table td { padding: 10px 12px; }
.trash-table .left { text-align: left; }
.trash-table .actions { text-align: right; white-space: nowrap; }
.trash-table .actions .button + .button { margin-left: 6px; }
.trash-table a { color: var(--text); }

.dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 24px;
  width: min(92vw, 460px);
  text-align: center;
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.35);
}
.dialog::backdrop { background: rgb(0 0 0 / 0.55); }
.dialog h2 { margin-bottom: 4px; }
.dialog .qr { width: min(70vw, 70vh, 340px); }
.dialog > * + * { margin-top: 12px; }
.qr { display: block; width: min(70vw, 300px); margin-inline: auto; background: #fff; border-radius: 10px; padding: 10px; line-height: 0; }
.qr svg { display: block; width: 100%; height: auto; }
.share-link { display: flex; gap: 8px; }
.share-qr-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-link .field { flex: 1; min-width: 0; font-size: 13px; }
.share-status { min-height: 1.5em; color: var(--ok); font-size: 14px; }

.narrow { max-width: 640px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.admin-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-stats .stat { min-width: 150px; }

/* ---------------------------------------------------------------- Import Excel */

.excel-actions { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; font-size: 14px; }
.dialog-wide { width: min(94vw, 620px); text-align: left; }
.dialog-wide h2 { text-align: left; }
.import-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.import-errors { background: var(--bad-bg); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-size: 14px; }
.import-errors .import-list { color: var(--text); }
.import-list { margin: 6px 0 0; padding-left: 20px; max-height: 220px; overflow-y: auto; font-size: 14px; }
details { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
details summary { cursor: pointer; font-weight: 600; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------------------------------------------------------------- Corbeille discrète */

.trash-corner { display: flex; justify-content: flex-end; }
.trash-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 5px 9px; color: var(--muted); font-size: 13px;
}
.trash-toggle:hover:not(:disabled) { border-color: var(--border); color: var(--text); }
.trash-toggle[aria-expanded="true"] { border-color: var(--border); background: var(--surface); color: var(--text); }
.trash-toggle:disabled { opacity: 0.5; cursor: default; }
.icon { display: block; flex: none; }
.tab-icon { display: inline-flex; align-items: center; gap: 2px; }
.tab-icon .count { margin-left: 4px; }

/* ---------------------------------------------------------------- Téléphone */

@media (max-width: 760px) {
  .topbar { align-items: flex-start; }
  .summary, .plan-item { grid-template-columns: 1fr; }
  .score-big { font-size: 44px; }
  .sticky { min-width: 180px; }
  .whoami #join-name { width: 100%; }
  .whoami, .whoami .inline-form { width: 100%; }
  .whoami .inline-form .field { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
