@import "pico-theme-KxJ0Fr6.css";

/* App shell : sidebar + contenu principal */
.app-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.app-shell--no-sidebar {
  grid-template-columns: 1fr;
}

.app-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-content > main.container {
  flex: 1;
  padding: 1.5rem 2rem 2rem;
  max-width: none;
  width: 100%;
}

@media (max-width: 768px) {
  .app-content > main.container {
    padding: 1rem 1rem 1.5rem;
  }
}

.app-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
  text-align: center;
  color: var(--pico-muted-color);
}

/* Sidebar */
.sidebar {
  background: var(--pico-card-background-color);
  border-right: 1px solid var(--pico-muted-border-color);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  font-size: 1.05rem;
}

.sidebar-brand-icon {
  font-size: 1.4rem;
}

.sidebar-close {
  display: none;
  background: transparent;
  border: 0;
  color: var(--pico-muted-color);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  width: auto;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  color: var(--pico-color);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a:focus-visible {
  background: var(--pico-secondary-background);
  color: var(--pico-color);
}

.sidebar-nav a.active {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-left-color: var(--pico-primary);
  font-weight: 600;
}

.sidebar-icon {
  display: inline-flex;
  width: 1.5rem;
  justify-content: center;
  font-size: 1.05rem;
}

.sidebar-section-title {
  padding: 1rem 1rem 0.4rem;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--pico-muted-color);
  font-weight: 600;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--pico-del-color, #c0392b);
  color: #fff;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-footer {
  border-top: 1px solid var(--pico-muted-border-color);
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.sidebar-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1rem;
  color: var(--pico-color);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-footer-link:hover,
.sidebar-footer-link:focus-visible {
  background: var(--pico-secondary-background);
  color: var(--pico-color);
}

.sidebar-footer-link.active {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-left-color: var(--pico-primary);
  font-weight: 600;
}

.sidebar-footer-link--danger {
  color: var(--pico-del-color, #c0392b);
}

.sidebar-footer-link--danger:hover {
  color: #fff;
  background: var(--pico-del-color, #c0392b);
}

/* Topbar : mobile only quand logged, sinon public */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  background: var(--pico-background-color);
  border-bottom: 1px solid var(--pico-muted-border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar--mobile {
  display: none;
  justify-content: space-between;
}

.topbar--public {
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-brand {
  font-size: 1.1rem;
}

.topbar-spacer {
  width: 2rem;
}

.topbar-theme {
  padding: 0.4rem 0.7rem;
  width: auto;
  margin: 0;
}

/* Sélecteur de saison dans la sidebar */
.sidebar-season {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.sidebar-season form {
  margin: 0;
}

.sidebar-season label {
  margin: 0;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--pico-muted-color);
  font-weight: 600;
}

.sidebar-season-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sidebar-season-controls select {
  margin: 0;
  padding: 0.35rem 1.75rem 0.35rem 0.5rem;
  font-size: 0.85rem;
  background-position: right 0.5rem center;
}

.sidebar-season-controls button {
  margin: 0;
  width: auto;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.sidebar-season-badge {
  margin: 0;
  align-self: flex-start;
  background: var(--pico-mark-background-color);
  color: var(--pico-mark-color);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.sidebar-season-reset {
  margin: 0;
  padding: 0;
  width: auto;
  background: none;
  border: 0;
  color: var(--pico-muted-color);
  font-size: 0.75rem;
  text-decoration: underline;
  cursor: pointer;
}

.topbar-season {
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

/* Bandeau des saisons archivées */
.archived-notice {
  margin-bottom: 1rem;
  padding: 0.6rem 0.9rem;
  border-left: 4px solid var(--pico-mark-background-color);
  background: var(--pico-card-sectioning-background-color);
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

/* Bouton Ajouter dans la sidebar */
.sidebar-actions {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.sidebar-add {
  margin: 0;
}

.sidebar-add > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.5rem 0.75rem;
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border: 0;
  border-radius: var(--pico-border-radius);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.sidebar-add > summary::-webkit-details-marker {
  display: none;
}

.sidebar-add > summary::after {
  display: none;
}

.sidebar-add > summary:hover {
  background: var(--pico-primary-hover-background);
}

.sidebar-add ul {
  margin: 0.25rem 0 0;
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: 0;
  color: var(--pico-color);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  width: auto;
  margin: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.sidebar-backdrop.open {
  display: block;
}

.impersonation-banner {
  background: #f59e0b;
  color: #000;
  padding: 0.5rem 1rem;
  text-align: center;
}

/* Mobile : sidebar en drawer + topbar visible */
@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(280px, 80vw);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.3);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .topbar--mobile {
    display: flex;
  }

  body.sidebar-locked {
    overflow: hidden;
  }
}

/* Calendrier */
.calendar-page {
  max-width: 1400px;
  margin: 0 auto;
}

.calendar-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.calendar-header h1 {
  margin-bottom: 1rem;
}

.calendar-nav {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.calendar-nav-btn,
.calendar-nav-today {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--pico-border-radius);
  text-decoration: none;
  font-size: 0.95rem;
  background: var(--pico-secondary-background);
  color: var(--pico-color);
  border: 1px solid var(--pico-muted-border-color);
}

.calendar-nav-today {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  border-color: var(--pico-primary-border);
  font-weight: 600;
}

.calendar-nav-btn:hover,
.calendar-nav-today:hover {
  filter: brightness(1.05);
}

.calendar-actions {
  margin: 0;
}

/* Grille mensuelle */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--pico-muted-border-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  overflow: hidden;
}

.weekday-header {
  background: var(--pico-primary-background);
  color: var(--pico-primary-inverse);
  padding: 0.6rem 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.calendar-day {
  background: var(--pico-card-background-color);
  min-height: 110px;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.calendar-day.empty {
  background: var(--pico-background-color);
}

.calendar-day.today {
  outline: 2px solid var(--pico-primary);
  outline-offset: -2px;
}

.day-number {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pico-color);
}

.calendar-day.today .day-number {
  color: var(--pico-primary);
}

.day-events {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow: hidden;
}

/* Items événement (utilisés grille + agenda) */
.event-item {
  display: block;
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  text-decoration: none;
  color: var(--pico-color);
  background: var(--pico-secondary-background);
  border-left: 3px solid var(--pico-muted-color);
  line-height: 1.3;
  transition: filter 0.15s ease;
}

.event-item:hover {
  filter: brightness(1.1);
}

.event-time {
  font-weight: 700;
  margin-right: 0.3rem;
}

.event-title {
  display: inline;
}

.event-event { border-left-color: #2196f3; }
.event-team_match { border-left-color: #4caf50; }
.event-tournament { border-left-color: #ff9800; }
.event-tournament_match { border-left-color: #9c27b0; }

[data-theme="light"] .event-event { background: #e3f2fd; }
[data-theme="light"] .event-team_match { background: #e8f5e9; }
[data-theme="light"] .event-tournament { background: #fff3e0; }
[data-theme="light"] .event-tournament_match { background: #f3e5f5; }

/* Vue agenda (mobile) */
.calendar-agenda {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.agenda-day {
  margin: 0;
  padding: 0.75rem 1rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
}

.agenda-day.today {
  border-left: 4px solid var(--pico-primary);
}

.agenda-day-header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0;
  background: transparent;
  border: 0;
}

.agenda-day-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pico-primary);
  line-height: 1;
}

.agenda-day-name {
  color: var(--pico-muted-color);
  font-size: 0.95rem;
}

.agenda-day-badge {
  margin-left: auto;
  background: var(--pico-primary);
  color: var(--pico-primary-inverse);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.agenda-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.agenda-events .event-item {
  font-size: 0.85rem;
  padding: 0.5rem 0.75rem;
}

.agenda-events .event-title {
  display: block;
  font-weight: 600;
  margin-top: 0.1rem;
}

.event-details {
  display: block;
  font-size: 0.75rem;
  color: var(--pico-muted-color);
  margin-top: 0.15rem;
}

.agenda-empty {
  text-align: center;
  color: var(--pico-muted-color);
  padding: 2rem 1rem;
  background: var(--pico-card-background-color);
  border-radius: var(--pico-border-radius);
}

/* Légende */
.calendar-legend {
  margin-top: 2rem;
  padding: 1rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
}

.calendar-legend strong {
  display: block;
  margin-bottom: 0.6rem;
}

.legend-items {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.legend-color {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--pico-secondary-background);
  border-left: 3px solid var(--pico-muted-color);
}

/* Mobile : agenda visible, grille cachée */
@media (max-width: 768px) {
  .calendar-grid {
    display: none;
  }

  .calendar-agenda {
    display: flex;
  }

  .calendar-nav-label {
    display: none;
  }

  .calendar-nav-btn {
    padding: 0.5rem 0.8rem;
  }
}

/* Page "événements à venir" - timeline */
.upcoming-page {
  max-width: 900px;
  margin: 0 auto;
}

.upcoming-page h1 {
  margin-bottom: 1.5rem;
}

.no-events {
  text-align: center;
  padding: 2rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  color: var(--pico-muted-color);
}

.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--pico-muted-border-color);
}

.timeline-date {
  margin: 1.5rem 0 0.75rem;
}

.timeline-date h3 {
  color: var(--pico-primary);
  font-size: 1.05rem;
  margin: 0;
}

.timeline-item {
  position: relative;
  margin-bottom: 1rem;
  padding-left: 1.25rem;
}

.timeline-marker {
  position: absolute;
  left: -1.65rem;
  top: 0.5rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--pico-muted-color);
  border: 2px solid var(--pico-background-color);
}

.timeline-event .timeline-marker { background: #2196f3; }
.timeline-team_match .timeline-marker { background: #4caf50; }
.timeline-tournament .timeline-marker { background: #ff9800; }
.timeline-tournament_match .timeline-marker { background: #9c27b0; }

.timeline-content {
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  padding: 0.75rem 1rem;
  border-radius: var(--pico-border-radius);
}

.timeline-time {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.timeline-title {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.timeline-title a {
  color: var(--pico-color);
  text-decoration: none;
  font-weight: 600;
}

.timeline-title a:hover {
  color: var(--pico-primary);
}

.timeline-details {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

.badge,
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  /* Pastille : le rayon suit la hauteur, quel que soit le libellé */
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--pico-secondary-background);
  color: var(--pico-color);
}

.badge {
  text-transform: uppercase;
}

.badge-event,
.status-scheduled { background: rgba(33, 150, 243, 0.18); color: #2196f3; }
.badge-team_match { background: rgba(76, 175, 80, 0.18); color: #4caf50; }
.badge-tournament,
.status-in_progress,
.status-pending,
.status-partial { background: rgba(255, 152, 0, 0.18); color: #ff9800; }
.badge-tournament_match { background: rgba(156, 39, 176, 0.18); color: #9c27b0; }
.status-completed,
.status-registration_open,
.status-done,
.status-paid { background: rgba(76, 175, 80, 0.18); color: #4caf50; }
/* Une saison sans tarif n'a pas de pastille dédiée : le gris neutre est le rendu voulu */
.status-not_done,
.status-unpaid { background: rgba(244, 67, 54, 0.18); color: #f44336; }

@media (max-width: 768px) {
  .timeline {
    padding-left: 1.25rem;
  }

  .timeline-item {
    padding-left: 0.75rem;
  }

  .timeline-marker {
    left: -1.4rem;
  }
}

/* Tablette : grille compacte */
@media (min-width: 769px) and (max-width: 1024px) {
  .calendar-day {
    min-height: 90px;
    padding: 0.3rem;
  }

  .event-item {
    font-size: 0.7rem;
    padding: 0.15rem 0.3rem;
  }

  .event-title {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--pico-muted-color); }

/* Danger button */
.btn-danger {
  background-color: #c0392b !important;
  border-color: #c0392b !important;
  color: #fff !important;
}
.btn-danger:hover,
.btn-danger:focus {
  background-color: #a93226 !important;
  border-color: #a93226 !important;
}

/* Tableau de suivi des adhésions */
.amount-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.amount-cell input {
  margin: 0;
  width: 6rem;
  padding: 0.35rem 0.5rem;
  text-align: right;
}

.amount-cell span {
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

.row-error {
  color: var(--pico-del-color, #c0392b);
}

.membership-summary {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--pico-muted-border-color);
  font-weight: 600;
}

/* Formulaires longs : regroupement en sections */
.form-section {
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem 0.25rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
}

.form-section > legend {
  padding: 0 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pico-muted-color);
}

/* Les cases à cocher ne s'alignent pas sur une grille de champs texte */
.form-section .grid > label:has(input[type="checkbox"]) {
  align-self: end;
}

.form-required {
  margin-left: 0.2rem;
  color: var(--pico-del-color, #c0392b);
  text-decoration: none;
  border: 0;
  cursor: help;
}

.form-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

/* Form actions bar */
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

/* Filters bar */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding: 1rem;
  margin-bottom: 1.5rem;
  background: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
}

.filters label {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.filters label:has(input[type="checkbox"]) {
  flex: 0;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.filters button,
.filters a[role="button"] {
  flex: 0;
  white-space: nowrap;
}

/* Danger zone (delete area) */
.danger-zone {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--pico-muted-border-color);
  display: flex;
  justify-content: flex-end;
}

/* Actions d'une ligne de liste : réduites à leur icône, libellé porté par
   aria-label/title. Le conteneur gère l'espacement, pas les marges des enfants. */
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* Boîte de dialogue des échéances.
   Pico stylise déjà dialog ; on ne règle ici que la largeur et l'en-tête. */
.modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal > article {
  width: min(46rem, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  margin: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

/* Le retour vers la liste n'a pas de sens dans la popup */
.modal turbo-frame > a[href*="/admin/membership"] {
  display: none;
}

/* Rappel du membre et du tarif, au-dessus de la saisie */
.payments-context {
  margin: 0 0 1rem;
  color: var(--pico-muted-color);
  font-size: 0.9rem;
}

/* La saisie précède l'historique : c'est l'action attendue à l'ouverture */
.payments-form {
  margin-bottom: 1rem;
}

.modal .payments-form {
  padding: 1rem;
}

/* Sprite d'icônes : présent dans le DOM pour les <use>, jamais rendu lui-même */
.icon-sprite {
  display: none;
}

/* Icône en trait, alignée sur la couleur et la taille du texte environnant */
.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.2em;
}

/* Bouton d'action d'une ligne de tableau.
   2.25rem au repos, 2.75rem au doigt : en dessous de 44px la cible tactile est
   trop petite pour être visée de façon fiable. */
.icon-action {
  /* Pico redéfinit ces variables sur les boutons — sans ce recalage, un <button>
     hérite de la couleur inverse et d'une ombre que le <a> voisin n'a pas. */
  --pico-color: inherit;
  --pico-background-color: transparent;
  --pico-box-shadow: none;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  /* Taille figée : sans flex none, un lien placé directement dans la barre en flex
     se comprime alors que le bouton, protégé par son formulaire, garde sa taille. */
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  margin: 0;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
  box-shadow: none;
  color: inherit;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  appearance: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.icon-action:hover {
  background: var(--pico-secondary-background);
  border-color: var(--pico-secondary);
}

.icon-action:active {
  transform: translateY(1px);
}

.icon-action:focus-visible {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

.icon-action--danger:hover {
  background: rgba(244, 67, 54, 0.14);
  border-color: rgba(244, 67, 54, 0.55);
}

.icon-action--success:hover {
  background: rgba(76, 175, 80, 0.14);
  border-color: rgba(76, 175, 80, 0.55);
}

@media (max-width: 1024px) {
  .icon-action {
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.1rem;
  }
}

/* Tableau qui se replie en cartes sur petit écran.
   Chaque cellule porte un data-label, repris en intitulé une fois l'en-tête masqué :
   un tableau de saisie à cinq colonnes est illisible sur un téléphone. */
@media (max-width: 768px) {
  .table--stacked thead {
    /* Masqué à l'œil, conservé pour les lecteurs d'écran */
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .table--stacked,
  .table--stacked tbody,
  .table--stacked tr,
  .table--stacked td {
    display: block;
    width: 100%;
  }

  .table--stacked tr {
    margin-bottom: 0.75rem;
    padding: 0.75rem 0.9rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    background: var(--pico-card-background-color);
  }

  .table--stacked td {
    display: grid;
    grid-template-columns: minmax(6rem, 35%) 1fr;
    align-items: center;
    gap: 0.75rem;
    padding: 0.3rem 0;
    border: 0;
  }

  .table--stacked td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pico-muted-color);
  }

  /* Cellules sans intitulé utile : le contenu prend toute la largeur */
  .table--stacked td[data-label=""]::before {
    content: none;
  }

  .table--stacked td[data-label=""] {
    grid-template-columns: 1fr;
  }

  .table--stacked td select,
  .table--stacked td input:not([type="checkbox"]) {
    width: 100%;
    margin: 0;
  }

  .table--stacked .table-actions {
    justify-content: flex-end;
  }

  /* La cellule cotisation garde son montant et sa pastille sur une seule ligne
     en tableau ; en carte elle doit pouvoir passer à la ligne. */
  .table--stacked .amount-cell {
    flex-wrap: wrap;
    white-space: normal;
  }
}

/* Pagination */
.pagination {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0 0;
}

.pagination ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pagination li {
  margin: 0;
}

.pagination a,
.pagination .is-disabled {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  height: 2.5rem;
  padding: 0 0.6rem;
  border: 1px solid var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  background: var(--pico-card-background-color);
  color: var(--pico-color);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.pagination a:hover {
  background: var(--pico-secondary-background);
  border-color: var(--pico-secondary);
}

.pagination a:focus-visible {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

.pagination a.is-current {
  background: var(--pico-primary-background);
  border-color: var(--pico-primary);
  color: var(--pico-primary-inverse);
  font-weight: 600;
}

.pagination .is-disabled {
  opacity: 0.4;
  cursor: default;
}

.pagination-total {
  margin: 0;
  font-size: 0.8rem;
  color: var(--pico-muted-color);
}

/* Compteur affiché à la place des numéros quand la largeur manque */
.pagination-counter {
  display: none;
  padding: 0 0.5rem;
  font-size: 0.85rem;
  color: var(--pico-muted-color);
}

@media (max-width: 640px) {
  .pagination-page {
    display: none;
  }

  .pagination-counter {
    display: inline-flex;
    align-items: center;
  }

  .pagination a,
  .pagination .is-disabled {
    min-width: 2.75rem;
    height: 2.75rem;
  }
}

/* Formulaire réduit à un bouton, aligné dans une barre d'actions.
   inline-flex et non inline : dans une barre en flex, un formulaire inline crée une
   ligne de texte qui décale son bouton par rapport aux liens voisins. */
.inline-form {
  display: inline-flex;
  flex: none;
  margin: 0;
}

/* Messages flash : la couleur porte le niveau, une erreur ne doit pas se lire
   comme un succès. Bordure latérale plutôt qu'un fond plein, plus sobre. */
.flash {
  border-left: 4px solid var(--pico-muted-border-color);
}

.flash--success { border-left-color: #4caf50; }
.flash--warning { border-left-color: #ff9800; }
.flash--error,
.flash--verify_email_error { border-left-color: #f44336; }

/* Confrontation : les deux participants et le séparateur, centrés */
.versus {
  text-align: center;
}

.versus-separator {
  color: var(--pico-muted-color);
}

/* Barre d'actions d'un formulaire qui en précède une autre */
.form-actions--spaced {
  margin-bottom: 1rem;
}

/* Champ conditionné par une case à cocher : grisé tant qu'elle est décochée */
.dependent-field.is-disabled {
  opacity: 0.5;
}

.form-actions--top {
  margin-top: 1rem;
}

/* Panneau étroit centré : connexion, mot de passe oublié, inscription */
.narrow-panel {
  max-width: 500px;
  margin: 2rem auto;
}


/* Grille de cartes auto-ajustée : effectif d'équipe, listes de profils */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.roster-card h3 {
  margin-bottom: 0.75rem;
}

/* Classement : mise en avant du leader et couleur des colonnes de résultat */
.is-leader {
  font-weight: 600;
}

.score-win {
  color: var(--pico-accent, #4caf50);
  font-weight: 700;
}

.score-loss {
  color: #f44336;
}

/* Tableau de tournoi */
.bracket-vs {
  text-align: center;
  color: var(--pico-muted-color);
  font-size: 0.85rem;
}

.bracket-record {
  margin-top: 0.5rem;
}

/* Tuiles de chiffres clés */
.stat-tile {
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
}

.stat-value--sm {
  font-size: 2rem;
}

.text-muted-sm {
  font-size: 0.75rem;
  color: var(--pico-muted-color);
}

/* Série de résultats récents */
.form-streak {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.streak-win,
.streak-loss {
  padding: 0.4rem 0.9rem;
  font-weight: 700;
  text-decoration: none;
}

.plain {
  text-decoration: none;
}

/* Avatar en initiales */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--pico-primary);
  color: #fff;
  font-weight: 700;
  margin: 0 auto;
}

.avatar--lg {
  width: 150px;
  height: 150px;
  font-size: 3rem;
}

/* Initiales dans une ligne de tableau */
.avatar--sm {
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
}

/* Pastille de résultat dans une série */
.streak-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
}

.streak-dot--win { background: var(--pico-accent, #4caf50); }
.streak-dot--loss { background: #f44336; }

.form-streak--centered {
  justify-content: center;
}

.stat-grid--spaced {
  margin-top: 2rem;
}

.is-champion {
  background: var(--pico-primary-focus);
}

.champion-flag {
  color: var(--pico-accent);
}
