:root {
  /* Thème "court de padel" : bleu + blanc, accent jaune balle de padel. */
  --court: #1e6fd9;         /* bleu principal : boutons, liens, éléments actifs */
  --court-dark: #0b4f8a;    /* bleu foncé : header/nav, hover, titres importants */
  --court-light: #5b9ee8;   /* bleu clair-moyen : dégradés, accents secondaires */
  --bg: #ffffff;            /* blanc dominant : fond de page */
  --bg-secondary: #e6f2fb;  /* bleu clair : fonds de cartes/éléments secondaires */
  --text: #171717;
  --muted: #8e9aaa;         /* gris clair : texte secondaire, bordures, séparateurs */
  --border: #8e9aaa;
  --accent: #c9e265;        /* jaune balle de padel : accent ponctuel (badge uniquement) */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.topbar {
  background: var(--court-dark);
  color: #fff;
  position: relative;
}
.topbar-inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}
.brand { font-size: 1.15rem; font-weight: 700; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.5rem;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nav-toggle::-webkit-details-marker { display: none; }
.nav-toggle:hover { background: rgba(0,0,0,0.15); }
.nav-menu[open] .nav-toggle { background: rgba(0,0,0,0.15); }

.nav-menu nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  background: #fff;
  color: var(--text);
  border-top: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  z-index: 30;
}
.nav-menu nav a {
  padding: 0.7rem 0.75rem;
  border-radius: 0.4rem;
  font-size: 1rem;
}
.nav-menu nav a:hover { background: var(--bg-secondary); }
.nav-menu nav a.active { background: var(--bg-secondary); color: var(--court-dark); font-weight: 600; }
.account-slot { margin-left: auto; position: relative; display: flex; align-items: center; }
.account-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.account-toggle::-webkit-details-marker { display: none; }
.account-toggle:hover { background: rgba(0,0,0,0.15); }
.account-menu[open] .account-toggle { background: rgba(0,0,0,0.15); }
.account-menu-list {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  padding: 0.65rem 0.8rem;
  min-width: 12rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 30;
}
.account-menu-name { font-size: 0.78rem; color: var(--muted); }
.account-menu-list a { color: var(--court); text-decoration: underline; font-size: 0.9rem; }

.page {
  max-width: 64rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.stack { display: flex; flex-direction: column; gap: 1.5rem; }
.stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.row .input { flex: 1 1 12rem; min-width: 0; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

h1 { margin: 0 0 0.25rem; font-size: 1.5rem; }
.h2 { margin: 0; font-size: 1.1rem; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 0.8rem; }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text-right { text-align: right; }

.input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d4d4d4;
  border-radius: 0.5rem;
  font-size: 0.9rem;
}
.input:focus { outline: none; border-color: var(--court); box-shadow: 0 0 0 1px var(--court); }
input[type="date"].input,
input[type="time"].input { -webkit-appearance: none; appearance: none; }
.small-input { width: 5rem; }
.label { display: block; margin-bottom: 0.25rem; font-size: 0.85rem; font-weight: 500; color: #525252; }

.btn, .btn-light, .btn-outline, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
}
.btn { background: var(--court); color: #fff; }
.btn:hover { background: var(--court-dark); }
.btn-light { background: #fff; color: var(--court-dark); }
.btn-outline { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.6); }
.btn-secondary { background: #fff; border: 1px solid #d4d4d4; color: #404040; }
.btn-secondary.small, .link-btn { font-size: 0.75rem; padding: 0.3rem 0.6rem; }
.link-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 0; }
.link-btn:hover { color: #dc2626; }
.link { color: var(--court); text-decoration: underline; font-size: 0.9rem; }

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 0.4rem 0; }

.inline-edit summary {
  list-style: none;
  cursor: pointer;
}
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit[open] summary .link-btn { color: var(--court-dark); }
.inline-edit-form { margin-top: 0.5rem; }

.calendar-menu { position: relative; display: inline-block; }
.calendar-menu summary {
  list-style: none;
  cursor: pointer;
}
.calendar-menu summary::-webkit-details-marker { display: none; }
.calendar-menu-list {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  min-width: 13rem;
  z-index: 20;
}
.calendar-menu-list a {
  padding: 0.55rem 0.7rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
}
.calendar-menu-list a:hover { background: var(--bg-secondary); }
.balance-row, .debt-row { background: var(--bg-secondary); border-radius: 0.5rem; padding: 0.5rem 0.75rem; }

.badge {
  /* Seul usage du jaune balle de padel dans l'appli, réservé à ce badge. */
  background: var(--accent);
  color: var(--court-dark);
  font-weight: 700;
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
  font-size: 0.7rem;
  margin-left: 0.4rem;
}

.negative { color: #dc2626; font-weight: 600; }
.positive { color: var(--court-dark); font-weight: 600; }

.error { background: #fef2f2; color: #dc2626; padding: 0.5rem 0.75rem; border-radius: 0.5rem; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.match-row .winner { font-weight: 600; color: var(--court-dark); }

.session-card { display: block; transition: border-color 0.15s, box-shadow 0.15s; }
.session-card:hover { border-color: var(--court); box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.next-session-banner {
  display: block;
  border-left: 4px solid var(--court);
  transition: box-shadow 0.15s;
}
.next-session-banner:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.next-session-body { margin-top: 0.6rem; }
.next-session-date { font-size: 1.2rem; font-weight: 700; }

.countdown {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--border);
}
.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
}
.countdown-value {
  display: inline-block;
  min-width: 2.3rem;
  padding: 0.35rem 0.25rem;
  background: linear-gradient(160deg, var(--court-light), var(--court-dark));
  color: #fff;
  border-radius: 0.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: 0 2px 6px rgba(11, 79, 138, 0.35);
}
.countdown-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.countdown-sep {
  margin-top: 0.3rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--muted);
  animation: countdown-blink 1s steps(1) infinite;
}
@keyframes countdown-blink {
  50% { opacity: 0.2; }
}
.countdown-today {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--court-dark);
  padding: 0.3rem 0;
}

.preview-box:not(:empty) { background: var(--bg-secondary); border-radius: 0.5rem; padding: 0.75rem; font-size: 0.9rem; }
.suggestion { color: var(--court-dark); margin: 0.5rem 0 0; }

/* --- Ajouter un match : sélection d'équipes par chips --- */
.chip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.chip {
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  border-radius: 0.65rem;
  padding: 0.65rem 0.5rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.15s, background 0.15s, color 0.15s;
}
.chip:active { transform: scale(0.96); }
.chip.selected { background: var(--court); border-color: var(--court); color: #fff; }
.chip.other-team { background: var(--bg-secondary); border-color: var(--court-light); color: var(--text); cursor: default; opacity: 0.75; }
.chip.shake { animation: chip-shake 0.28s ease; }
@keyframes chip-shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

.reset-link {
  background: none; border: none; color: var(--muted); font-size: 0.78rem;
  text-decoration: underline; cursor: pointer; padding: 0.4rem 0 0; display: inline-block;
}

.team-preview {
  display: none;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.9rem;
  padding: 0.7rem 0.6rem;
  background: var(--bg-secondary);
  border-radius: 0.6rem;
  font-size: 0.85rem;
}
.team-preview.show { display: flex; }
.team-preview .side { flex: 1; text-align: center; }
.team-preview .side .tag { display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 0.2rem; }
.team-preview .side strong { font-size: 0.92rem; }
.team-preview .vs { color: var(--muted); font-size: 0.75rem; font-weight: 700; }

/* --- Ajouter un match : score par set --- */
.set-row {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
}
.set-row .set-no { color: var(--muted); font-size: 0.78rem; }
.stepper { display: flex; align-items: center; justify-content: center; gap: 0.4rem; }
.stepper button {
  width: 1.9rem; height: 1.9rem;
  border-radius: 0.4rem;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.stepper button:active { background: var(--bg-secondary); }
.stepper .count {
  min-width: 1.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1rem;
}
.stepper.winning .count { color: var(--court-dark); }
.set-sep { text-align: center; color: var(--muted); }
.set-remove {
  justify-self: end;
  font-size: 0.72rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  padding: 0.2rem;
}
.confirm-remove {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.confirm-remove button {
  border: none; background: none; cursor: pointer; font-size: 0.78rem; text-decoration: underline; padding: 0;
}
.confirm-remove .yes { color: #dc2626; }

.quick-win-row { display: flex; gap: 0.5rem; padding-left: 2.2rem; }
.quick-win-btn {
  flex: 1;
  font-size: 0.7rem;
  padding: 0.3rem 0.4rem;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 0.4rem;
  cursor: pointer;
}
.quick-win-btn:active { background: var(--bg-secondary); }

.tiebreak-block { padding: 0.3rem 0 0.1rem; }
.tiebreak-grid {
  display: grid;
  grid-template-columns: 2.2rem 1fr auto 1fr auto;
  align-items: center;
  gap: 0.4rem;
}
.tiebreak-input {
  width: 100%;
  max-width: 3.2rem;
  margin: 0 auto;
  display: block;
  padding: 0.25rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.tiebreak-label {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.tiebreak-hint-line {
  font-size: 0.75rem;
  color: var(--court-dark);
  font-weight: 600;
  padding-left: 2.2rem;
  margin-top: 0.2rem;
}
.tiebreak-hint-line.warning { color: #b45309; font-weight: 500; }

.match-summary {
  padding: 0.6rem 0.7rem;
  background: var(--bg-secondary);
  border-radius: 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--court-dark);
  display: none;
}
.match-summary.show { display: block; }

.pronostics-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  list-style: none;
}
.pronostics-summary::-webkit-details-marker { display: none; }
.pronostics-title { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.pronostics-title .chevron {
  display: inline-block;
  font-size: 0.8em;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.pronostics-details[open] .pronostics-title .chevron { transform: rotate(90deg); }
.pronostics-body { margin-top: 0.9rem; }

.prediction-block {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.prediction-list { display: flex; flex-direction: column; gap: 0.2rem; }

.prediction-score-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  max-width: 13rem;
}
.prediction-score .quick-win-row { padding-left: 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 30rem; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid var(--border); }
td { padding: 0.5rem 1rem 0.5rem 0; border-bottom: 1px solid #f5f5f5; }
tr:last-child td { border-bottom: none; }
