:root {
  --bg: #f5f6f8;
  --paper: #ffffff;
  --ink: #15181d;
  --ink-2: #4b5260;
  --muted: #646b78;
  --line: #e1e4ea;
  /* bord des champs et zones à toucher : 3:1 minimum sur le blanc */
  --line-strong: #8a919e;
  --line-hover: #b9c0cc;
  --line-2: #eef0f4;
  --soft: #f8f9fb;
  --accent: #2456e8;
  --accent-hover: #1b47c9;
  --accent-ink: #ffffff;
  --accent-soft: #eaf0fe;
  --win: #157a43;
  --win-soft: #e7f6ee;
  --live: #b34700;
  --live-soft: #fdf0e7;
  --warn-bg: #fff6e5;
  --warn: #8a5300;
  --err: #c0302b;
  --err-hover: #a3241f;
  --err-soft: #fdeeed;
  /* espacements : une seule échelle pour toutes les pages */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 28px;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: none;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --chevron: 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 1.5l5 5 5-5' fill='none' stroke='%23646b78' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.015em; margin: 0; line-height: 1.25; }
h1 { font-size: 24px; }
h2 { font-size: 18px; margin-bottom: 12px; }
h3 { font-size: 15px; margin-bottom: 12px; }
.head h1, .head h2 { margin-bottom: 0; }

p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0.02em; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- structure ---------- */

.top {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.top .brand { font-weight: 650; font-size: 16px; color: var(--ink); text-decoration: none; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .spacer { flex: 1; }
.brand-block { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.3; }
.brand-block .brand, .brand-block .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.top button.link { font-size: 13px; }
.top a { display: inline-flex; align-items: center; min-height: 44px; }

.tabs {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tabs a {
  padding: 8px 12px 11px;
  text-decoration: none;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.team-main { max-width: 640px; }
.narrow { max-width: 420px; }

section { margin-top: 36px; }
section:first-child { margin-top: 0; }

.head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

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

.box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.box + .box { margin-top: 12px; }
.grid > .box, .pool-cols > .box, .court-board > .box { margin-top: 0; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.tables { grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); }

hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- formulaires ---------- */

label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 6px; }

.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 140px; min-width: 0; }

input[type=text], input[type=password], input[type=number], input[type=date],
select, textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:hover, select:hover, textarea:hover { border-color: var(--ink-2); }

/* liste déroulante : flèche dessinée, avec de la place à droite */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 40px;
  max-width: 100%;
  text-overflow: ellipsis;
  cursor: pointer;
}

textarea { min-height: 96px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button:focus-visible, .btn:focus-visible, a:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input.code { text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--mono); }

input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); flex: none; margin: 1px 0 0; cursor: pointer; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 400; color: var(--ink); margin-bottom: 10px; cursor: pointer; }

button, .btn {
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

button:hover, .btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }

button.ghost, .btn.ghost { background: var(--paper); color: var(--ink); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--line-hover); background: var(--soft); }

button.danger { background: var(--paper); color: var(--err); border-color: var(--line); }
button.danger:hover { border-color: var(--err); background: var(--err-soft); }

button.link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  font-weight: 500;
  color: var(--accent);
  white-space: normal;
  text-align: left;
}

button.link:hover { background: none; text-decoration: underline; }

button.small, .btn.small { min-height: 32px; padding: 4px 12px; font-size: 13px; }

/* désactivé : gris lisible plutôt qu'un bleu délavé */
button:disabled, button:disabled:hover { background: var(--line-2); border-color: var(--line-2); color: var(--muted); cursor: default; }
button.link:disabled, button.link:disabled:hover { background: none; }

/* au doigt, tous les boutons font au moins 44px de haut */
@media (pointer: coarse) {
  button.link, button.small, .btn.small, .filters select { min-height: 44px; }
}

.wide { width: 100%; }

.msg {
  border-radius: var(--radius-sm);
  background: var(--err-soft);
  color: var(--err);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.note {
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 50;
  max-width: calc(100% - 32px);
  box-shadow: 0 6px 20px rgba(16, 24, 40, 0.18);
}

.toast.err { background: var(--err); }

/* blocs repliables */
details.more > summary {
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 550;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before {
  content: '';
  width: 12px;
  height: 8px;
  background: var(--chevron) no-repeat center / 12px 8px;
  transform: rotate(-90deg);
  transition: transform 0.15s;
}
details.more[open] > summary::before { transform: none; }
details.more.box > summary { margin-top: 0; }

.inline-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- tableaux ---------- */

.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

table { border-collapse: collapse; width: 100%; font-size: 14px; }

th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: middle; }

th { font-weight: 550; color: var(--muted); font-size: 12px; background: var(--soft); border-bottom-color: var(--line); white-space: nowrap; }

tr:last-child td { border-bottom: 0; }

td.num, th.num { text-align: right; width: 1%; white-space: nowrap; }

tr.me td { background: var(--accent-soft); font-weight: 600; }
tr.cut td { border-bottom: 1px dashed var(--muted); }

.standings td.rank { width: 1%; color: var(--muted); }
.standings td.pts { font-weight: 650; }

.matches td.c { width: 1%; white-space: nowrap; color: var(--ink-2); }
.matches td.ph { width: 1%; white-space: nowrap; color: var(--ink-2); }
.matches td.teams { min-width: 180px; }
.matches .vs { color: var(--muted); }
.matches .w { font-weight: 650; }
.matches td.score { white-space: nowrap; font-weight: 550; }
.matches td.score .det { color: var(--muted); font-size: 12px; font-weight: 400; margin-left: 6px; }
.matches td.ref { color: var(--muted); font-size: 13px; }
.matches .ph-sm { display: none; }
.matches tr.click { cursor: pointer; }
.matches tr.click:hover td { background: var(--soft); }
.matches .tag { margin-left: 6px; }
.matches tr.slot td { background: var(--soft); font-weight: 650; font-size: 13px; padding-top: 12px; border-bottom-color: var(--line); }

.standings .dest { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.standings tr.me .dest { font-weight: 400; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 550;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--line-2);
  color: var(--ink-2);
  vertical-align: 1px;
  white-space: nowrap;
}

.tag.live { background: var(--live-soft); color: var(--live); }
.tag.wait { background: var(--warn-bg); color: var(--warn); }
.tag.err { background: var(--err-soft); color: var(--err); }
.tag.ok { background: var(--win-soft); color: var(--win); }

/* ---------- tableau à élimination ---------- */

.bk-sections { display: flex; flex-wrap: wrap; gap: 24px 32px; align-items: flex-start; }
.bk-section { min-width: 0; max-width: 100%; }
.bk-section.big { flex: 1 1 100%; }
.bk-section h3 { font-size: 14px; margin-bottom: 10px; }

.bracket {
  display: flex;
  gap: 24px;
  overflow-x: auto;
  padding: 2px 2px 12px;
}

.bracket .round { display: flex; flex-direction: column; flex: 0 0 210px; }
.bracket .round h4 { font-size: 12px; font-weight: 550; color: var(--muted); margin: 0 0 10px; }
.bracket .col { display: flex; flex-direction: column; justify-content: space-around; flex: 1; gap: 12px; }

.bm {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 13px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.bm.click { cursor: pointer; }
.bm.click:hover { border-color: var(--accent); }
.bm.me { border-color: var(--accent); }
.bm .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 24px; padding: 4px 10px; font-size: 11px; color: var(--muted); background: var(--soft); border-bottom: 1px solid var(--line-2); }
.bm .line { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; }
.bm .line > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bm .line + .line { border-top: 1px solid var(--line-2); }
.bm .line.w { font-weight: 650; }
.bm .line .tbd { color: var(--muted); }
.matches .mine, .bm .line.mine { color: var(--accent); font-weight: 650; }
.bm .line .s { color: var(--ink-2); }
.bm .seed { color: var(--muted); font-weight: 400; margin-right: 6px; }
.bm.bye { opacity: 0.5; }

/* ---------- cartes (page équipe, vue d'ensemble) ---------- */

.stack { display: grid; gap: 14px; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card.hot { border: 2px solid var(--accent); padding: 19px; }
.card-note { margin: 10px 0 0; }
.card-label { font-size: 13px; font-weight: 550; color: var(--muted); }
.card-big { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 4px; line-height: 1.25; }
.card .big-btn { margin-top: 14px; }

.big-btn { min-height: 52px; font-size: 16px; padding: 12px 22px; border-radius: var(--radius); }
.page-foot { margin-top: 28px; }

.turn { margin: 12px 0 0; font-weight: 600; color: var(--accent); }
.live-now { display: inline-block; margin-top: 10px; font-weight: 650; color: var(--live); }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stat-label { display: block; font-size: 12px; font-weight: 550; color: var(--muted); }
.stat-value { display: block; font-size: 22px; font-weight: 700; margin-top: 2px; }
.stat-value.mono { font-size: 20px; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}
.steps a:hover { border-color: var(--accent); text-decoration: none; }
.step-n { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 14px; background: var(--accent-soft); color: var(--accent); }
.steps li.ok .step-n { background: var(--win-soft); color: var(--win); }
.step-t { display: block; font-weight: 600; }
.step-d { display: block; font-size: 13px; color: var(--muted); }

/* ---------- feuille de score de l'arbitre ---------- */

body.scoring .top { display: none; }
body.scoring main { padding-top: 16px; }

.sc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.sc-set { text-align: center; font-size: 20px; font-weight: 700; }
.sc-prev { text-align: center; color: var(--muted); font-size: 14px; margin-top: 2px; }
.sc-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 12px; }
.sc-team { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sc-name { text-align: center; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-plus {
  min-height: 42vh;
  max-height: 340px;
  font-size: clamp(64px, 22vw, 120px);
  font-weight: 750;
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--line-strong);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.sc-plus:hover { background: var(--paper); border-color: var(--accent); }
.sc-plus:active { background: var(--accent-soft); border-color: var(--accent); }
.sc-minus { min-height: 44px; }
.sc-hint { text-align: center; min-height: 20px; margin-bottom: 12px; }
.sc-hint.key { color: var(--ink); font-weight: 650; }
.sc-sync { text-align: center; font-size: 13px; color: var(--muted); min-height: 20px; margin: 0 0 4px; }
.sc-sync.err { color: var(--err); font-weight: 600; }
.sc-undo { display: flex; margin: 14px auto 0; }
.recap { margin: 0 auto; }
.recap th { text-align: center; white-space: normal; font-size: 13px; color: var(--ink-2); }
.recap td { text-align: center; font-size: 32px; font-weight: 750; padding: 6px 14px; }
.d-foot .big-btn { flex: 1; }

/* ---------- divers ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 9px 0; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; align-items: center; }
.list li:last-child { border-bottom: 0; }
.list li .grow { flex: 1; min-width: 0; }

.order .pos { width: 28px; flex: none; color: var(--muted); font-size: 13px; }
.order .grow { overflow: hidden; text-overflow: ellipsis; }
.order .lbl { display: block; font-size: 12px; color: var(--muted); }
.order button { min-width: 36px; padding: 4px 8px; }

.sub-title { font-size: 16px; margin: 28px 0 12px; }
.sub-title:first-child { margin-top: 0; }

details.pool-matches { margin-top: 10px; }
details.pool-matches summary { cursor: pointer; font-size: 13px; font-weight: 550; color: var(--accent); margin-bottom: 10px; }

.seg { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.seg a { text-decoration: none; font-size: 14px; font-weight: 500; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink-2); }
.seg a.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.phase-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.phase-card + .phase-card { margin-top: 18px; }
.phase-card > header { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.phase-card > header .num { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); align-self: center; width: 100%; }
.phase-card > header .tools { display: flex; gap: 6px; margin-left: auto; align-self: flex-end; flex-wrap: wrap; }
/* « Retirer » à l'écart des flèches : pas de suppression par erreur */
.phase-card > header .tools .danger { margin-left: 16px; }
.phase-card > .body { padding: 18px; }
.phase-card h4 { font-size: 14px; font-weight: 650; margin: 22px 0 10px; }
.phase-card h4:first-child { margin-top: 0; }
.phase-card.closed > .body { display: none; }
.phase-card .summary-line { width: 100%; font-size: 13px; color: var(--ink-2); }

.div-row { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--soft); }
.div-row + .div-row { margin-top: 10px; }
.div-row .row > .field { margin-bottom: 10px; }
.div-row .src-text { font-size: 12px; color: var(--muted); }

.rules-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.rules-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; background: var(--soft); }
.rules-box .row > .field { margin-bottom: 10px; }
.rules-box h4 { margin-top: 0; }

.preset { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.preset select { width: auto; flex: 1 1 260px; min-width: 0; }
.preset label { margin: 0; }

.pool-cols { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.pool-cols .box { padding: 14px; }
.pool-cols h3 { margin-bottom: 8px; }
.pool-cols select { width: auto; min-height: 32px; padding: 4px 32px 4px 10px; background-position: right 10px center; font-size: 13px; }

.sets { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px 10px; align-items: center; }
.sets .h { font-size: 12px; font-weight: 550; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sets input { text-align: center; font-size: 18px; padding: 6px; }
.sets .n { font-size: 13px; color: var(--muted); }

dialog {
  border: 0;
  border-radius: 16px;
  padding: 0;
  width: min(480px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.25);
}

dialog::backdrop { background: rgba(16, 24, 40, 0.4); }

dialog .d-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
dialog .d-head h2 { margin: 0; }
dialog .d-body { padding: 18px 20px; }
dialog .d-foot { padding: 14px 20px; border-top: 1px solid var(--line-2); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; min-height: 36px; padding: 6px 36px 6px 12px; background-position: right 12px center; font-size: 13px; }

.center-page { min-height: 100vh; display: flex; flex-direction: column; }
.center-page main { flex: 1; width: 100%; padding-top: 10vh; }
.center-page h1 { margin-bottom: 6px; }
.center-page form.box { margin-top: 18px; }
.center-page form.box h2 { margin-bottom: 14px; }

.foot-links { margin-top: 14px; font-size: 14px; display: flex; gap: 4px 18px; flex-wrap: wrap; }
.foot-links a, .foot-links button.link { display: inline-flex; align-items: center; min-height: 44px; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* écran de suivi */

.court-board { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.court-board .box h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); font-weight: 650; margin: 0; }
.court-board .box.click { cursor: pointer; }
.court-board .box.click:hover { border-color: var(--accent); }
.court-board .box.cb-live { border: 2px solid var(--live); padding: 17px; }
.cb-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.cb-team { display: flex; align-items: baseline; gap: 12px; padding: 2px 0; }
.cb-name { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-sets { color: var(--muted); font-size: 16px; font-weight: 650; }
.cb-pts { min-width: 2ch; text-align: right; font-size: 28px; font-weight: 750; line-height: 1.1; }
.cb-team + .small { margin-top: 6px; }
.cb-empty { margin: 0; }
.court-board .after { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-2); }

.follow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.follow label { margin: 0; }
.follow select { width: auto; padding: 6px 36px 6px 12px; font-size: 14px; }
.head select { width: auto; }
.page-title { margin-bottom: 16px; }
.notes { margin-bottom: 24px; }

.next { background: var(--paper); border: 1px solid var(--accent); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; }
.next .big { font-size: 20px; font-weight: 700; margin: 4px 0; }

@media (max-width: 640px) {
  main { padding: 20px 16px 64px; }
  .hide-sm { display: none !important; }
  th, td { padding: 8px 10px; }
  h1 { font-size: 21px; }

  .top-inner { gap: 12px; padding: 12px 16px; }
  .top .brand { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top .sub, .top .spacer { display: none; }
  .brand-block .sub { display: block; }
  .tabs { padding: 0 8px; }

  /* la liste des matchs passe en fiches */
  table.matches thead { display: none; }
  table.matches, table.matches tbody { display: block; }
  table.matches tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "c s" "m s";
    gap: 2px 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line-2);
  }
  table.matches tr:last-child { border-bottom: 0; }
  table.matches td { display: block; padding: 0; border: 0; min-width: 0; width: auto; }
  .matches td.c { grid-area: c; font-size: 12px; color: var(--muted); }
  .matches td.ph, .matches td.ref { display: none; }
  .matches td.teams { grid-area: m; min-width: 0; }
  .matches td.score { grid-area: s; align-self: center; text-align: right; }
  .matches td.score .det { display: block; margin: 0; }
  .matches .ph-sm { display: block; font-size: 12px; color: var(--muted); }
  table.matches tr.slot { display: block; padding: 0; }
  table.matches tr.slot td { display: block; padding: 10px 14px 6px; }
  table.matches.by-slot tr:not(.slot) { grid-template-areas: "m s"; }

  .bracket .round { flex-basis: 180px; }
  .phase-card > header, .phase-card > .body { padding: 14px; }
  .card { padding: 18px; }
}

@media print {
  body { background: #fff; }
  .top, .tabs, .no-print, button { display: none !important; }
  main { padding: 0; max-width: none; }
  .table-wrap, .box { border: 0; box-shadow: none; }
  .print-only { display: block !important; }
}

.print-only { display: none; }

.court-pick { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.court-pick .check { margin: 0; font-size: 13px; }

.preview { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.preview h3 { margin-bottom: 8px; }
.preview ol { margin: 0; padding: 0; list-style: none; }
.preview li { padding: 8px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.preview li:first-child { border-top: 0; }
.preview .ph-name { font-weight: 650; }
.preview .bad { color: var(--err); }
.preview .total { margin-top: 10px; font-size: 13px; color: var(--ink-2); }

.src-row { border-left: 1px solid var(--line-strong); padding: 2px 0 2px 14px; margin: 4px 0 10px; }
.team-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 12px; max-height: 220px; overflow-y: auto; padding: 6px 0; }
.team-pick .check { margin: 0; font-size: 13px; }

/* ---------- écran (page publique en grand) ---------- */

/* tout est en em : la taille du texte suit la largeur de l'écran (24px sur un écran de 1920px) */
body.ecran { font-size: clamp(18px, 1.25vw, 40px); }
body.ecran main { max-width: none; padding: 1.2em 1.6em; }
body.ecran .top { display: none; }
body.ecran h1 { font-size: 1.6em; }
body.ecran h2 { font-size: 1.25em; }
body.ecran .small, body.ecran .after { font-size: 0.9em; }
body.ecran .tag { font-size: 0.85em; padding: 0.35em 0.7em; }
body.ecran table, body.ecran .bm { font-size: 0.85em; }
body.ecran th, body.ecran .bm .meta, body.ecran .standings .dest, body.ecran .matches td.score .det { font-size: 0.75em; }
/* rien à déplier sur un écran qu'on ne touche pas */
body.ecran details.pool-matches { display: none; }
body.ecran .court-board { grid-template-columns: repeat(auto-fit, minmax(16em, 1fr)); gap: 0.8em; }
body.ecran .court-board .box { padding: 0.8em 1em; }
body.ecran .court-board .box.cb-live { padding: calc(0.8em - 1px) calc(1em - 1px); }
body.ecran .court-board .box h3 { font-size: 1em; }
body.ecran .cb-name { font-size: 1.5em; }
body.ecran .cb-sets { font-size: 1.5em; }
body.ecran .cb-pts { font-size: 4.5em; line-height: 1; }
.ecran-bar { display: flex; justify-content: space-between; align-items: center; gap: 1em; margin-bottom: 0.8em; }
.ecran-join { display: flex; align-items: center; gap: 0.6em; font-size: 0.75em; color: var(--ink-2); line-height: 1.4; }
.ecran-join img { width: 5.5em; height: 5.5em; background: var(--paper); }
.ecran-panel { margin-top: 1.2em; }

/* ---------- fiches équipes à imprimer ---------- */

.sheets { display: none; }

@media print {
  body.printing-sheets > *:not(.sheets) { display: none !important; }
  body.printing-sheets .sheets { display: block; }
  body.printing-sheets .sheets.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; }
  .pcard { display: flex; justify-content: space-between; gap: 4mm; border: 1px solid #000; padding: 5mm; page-break-inside: avoid; height: 62mm; }
  .pcard img { width: 34mm; height: 34mm; align-self: center; }
  .card-t { font-size: 9pt; color: #444; }
  .card-name { font-size: 15pt; font-weight: 600; margin: 2mm 0 3mm; }
  .card-codes { font-size: 11pt; line-height: 1.6; }
  .card-help { font-size: 8pt; color: #444; margin-top: 3mm; }
}

/* ---------- fenêtre de confirmation ---------- */

dialog:has(.ask) { width: min(400px, calc(100% - 32px)); }
.ask .d-body { padding: 24px 24px 8px; }
.ask h2 { font-size: 18px; margin-bottom: 8px; }
.ask p { margin: 0 0 12px; font-size: 14px; line-height: 1.5; }
.ask input { margin: 4px 0 12px; }
.ask .d-foot { border-top: 0; padding: 12px 24px 22px; }
.ask .d-foot button { flex: 1 1 0; min-height: 44px; }

button.danger-fill { background: var(--err); border-color: var(--err); color: var(--paper); }
button.danger-fill:hover { background: var(--err-hover); border-color: var(--err-hover); }

@media (max-width: 640px) {
  .ask .d-foot { flex-direction: column-reverse; }
  .ask .d-foot button { flex: none; width: 100%; }
}

/* ---------- utilitaires (remplacent les styles en ligne ; !important comme un style en ligne) ---------- */

.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--s-1) !important; }
.mt-2 { margin-top: var(--s-2) !important; }
.mt-3 { margin-top: var(--s-3) !important; }
.mt-4 { margin-top: var(--s-4) !important; }
.mt-5 { margin-top: var(--s-5) !important; }
.mt-7 { margin-top: var(--s-7) !important; }
.mb-2 { margin-bottom: var(--s-2) !important; }
.mb-3 { margin-bottom: var(--s-3) !important; }
.mb-4 { margin-bottom: var(--s-4) !important; }
.mb-6 { margin-bottom: var(--s-6) !important; }
.p-0 { padding: 0 !important; }
.fw-normal { font-weight: 400 !important; }
.break { word-break: break-all; }
.measure { max-width: 760px; }
.spacer { flex: 1; }
.bar { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }
.bar.nowrap-bar { flex-wrap: nowrap; }
.bar.between { justify-content: space-between; }
.bar.baseline { align-items: baseline; }
.items-start { align-items: flex-start !important; }
.items-end { align-items: flex-end !important; }
.self-end { align-self: flex-end !important; }
.f-1 { flex: 1 1 90px !important; }
.f-2 { flex: 2 1 200px !important; }
.w-auto { width: auto !important; }
.w-num { width: 72px !important; }
.w-time { width: 64px; flex: none; }
.w-sm { max-width: 160px; }
.w-md { max-width: 320px; }

/* Champ mot de passe : bouton œil (js/pw-toggle.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap > input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 0; top: 0; bottom: 0; width: 44px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; padding: 0; color: var(--muted, var(--ink-3, currentColor)); cursor: pointer;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--ink, currentColor); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent, currentColor); outline-offset: -2px; }

.pw-caps { display: block; margin-top: 4px; font-size: 12px; color: var(--accent, currentColor); text-transform: none; letter-spacing: 0; }
.pw-caps[hidden] { display: none; }
