/* ==================== Accueil capitaine ==================== */
.home { gap: 24px; }
.home > * { width: 100%; max-width: 1100px; }

.onboarding {
    background: var(--md-surface);
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-elevation-table);
    padding: 32px;
}
.onboarding h1 { margin-top: 0; }
.onboarding-steps { list-style: none; counter-reset: step; margin: 20px 0 0; padding: 0; display: grid; gap: 12px; }
.onboarding-steps li { counter-increment: step; }
.onboarding-steps a {
    display: grid;
    grid-template-columns: 40px 1fr;
    grid-template-rows: auto auto;
    column-gap: 14px;
    padding: 14px 16px;
    border-radius: var(--md-radius-md);
    border: 1px solid var(--md-outline-variant);
    color: var(--md-on-surface);
    text-decoration: none;
    transition: background-color var(--md-motion), border-color var(--md-motion);
}
.onboarding-steps a::before {
    content: counter(step);
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--md-primary);
    color: var(--md-on-primary);
    font-weight: 700;
}
.onboarding-steps a:hover { background: var(--md-primary-container); border-color: var(--md-primary); }
.onboarding-steps span { color: var(--md-on-surface-variant); font-size: 0.9rem; }

.hero-card {
    background: linear-gradient(135deg, var(--inv-surface-high), var(--inv-hero-end));
    color: var(--inv-on-surface);
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-elevation-3);
    padding: 28px 32px;
}
.hero-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.hero-card .eyebrow { color: var(--md-accent); }
.hero-title { margin: 0; font-size: 3rem; line-height: 1.05; color: var(--inv-strong); }
.hero-date { margin: 6px 0 0; font-size: 1.05rem; color: var(--inv-on-surface); }
.countdown {
    padding: 8px 16px;
    border-radius: var(--md-radius-full);
    background: var(--md-primary-container);
    color: var(--md-on-primary-container);
    font-weight: 700;
    white-space: nowrap;
}
.countdown.is-soon { background: var(--status-warning-bg); color: var(--status-warning-fg); }

.progress-block { margin: 24px 0 18px; }
.progress-label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.progress-label strong { font-size: 1.3rem; color: var(--inv-strong); }
.progress { height: 10px; border-radius: var(--md-radius-full); background: var(--inv-overlay-2); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--md-accent), var(--md-success)); transition: width 0.4s ease; }

/* Lignes centrées : une dernière ligne incomplète (5 équipes = 3 + 2) se centre au lieu de laisser
   un trou à droite, ce que CSS Grid ne sait pas faire. Chaque tuile garde la largeur d'une colonne ;
   le nombre de colonnes suit la largeur du bloc (requête de conteneur), pas celle de l'écran. */
.team-tiles {
    --tile-gap: 12px;
    --tile-columns: 3;
    container-type: inline-size;
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--tile-gap);
}
.team-tiles > .team-tile {
    flex: 0 0 calc((100% - (var(--tile-columns) - 1) * var(--tile-gap)) / var(--tile-columns));
    min-width: 0;
}
@container (max-width: 593px) {
    .team-tile { --tile-columns: 2; }
}
.team-tile {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 2px 8px;
    padding: 12px 14px;
    border-radius: var(--md-radius-md);
    background: var(--inv-overlay);
    border-left: 5px solid var(--team-ink);
}
.team-tile { padding: 0; transition: background 0.15s; }
.team-tile:hover, .team-tile:focus-within { background: var(--inv-overlay-2); }
.team-tile-link { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 12px 14px; color: inherit; text-decoration: none; }
.team-tile-number { font-weight: 700; color: var(--inv-strong); }
.team-tile-opponent { grid-column: 1; font-size: 0.82rem; color: var(--inv-placeholder); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.team-tile-count { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 1.2rem; font-weight: 700; color: var(--inv-strong); }
.team-tile.is-complete .team-tile-count { color: var(--inv-ok); }
.team-tile.is-empty .team-tile-count { color: var(--inv-bad); }
.team-tile.is-partial .team-tile-count { color: var(--inv-warn); }
.hero-actions { margin-top: 22px; display: flex; justify-content: flex-end; }
.hero-actions .btn-link { background: var(--md-accent); color: var(--inv-surface); }
.hero-actions .btn-link:hover { background: var(--md-primary-hover); }

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; align-items: start; }
.panel {
    background: var(--md-surface);
    border-radius: var(--md-radius-md);
    box-shadow: var(--md-elevation-table);
    padding: 20px 22px;
}
.panel h2 { margin: 0 0 12px; }
.panel-empty { color: var(--md-on-surface-variant); margin: 4px 0; }
.panel--past summary { cursor: pointer; list-style: none; }
.panel--past summary::-webkit-details-marker { display: none; }
.panel--past summary h2 { display: inline; margin: 0; }
.panel--past summary::after { content: ' ▾'; color: var(--md-on-surface-variant); }
.panel--past[open] summary { margin-bottom: 12px; }

.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert-item {
    display: grid;
    grid-template-columns: 10px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--md-radius-sm);
    background: var(--md-surface-container);
    font-size: 0.9rem;
}
.alert-item a { font-weight: 600; font-size: 0.85rem; white-space: nowrap; text-decoration: none; }
.alert-dot { width: 10px; height: 10px; border-radius: 50%; }
.alert-item--error { background: var(--md-error-container); }
.alert-item--error .alert-dot { background: var(--md-error); }
.alert-item--warning { background: var(--status-warning-bg); }
.alert-item--warning .alert-dot { background: var(--status-warning-border); }
.alert-item--info .alert-dot { background: var(--md-primary); }

.matchday-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.matchday-row {
    display: grid;
    grid-template-columns: 48px 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 9px 10px;
    border-radius: var(--md-radius-sm);
    color: var(--md-on-surface);
    text-decoration: none;
    transition: background-color var(--md-motion);
}
.matchday-row:hover { background: var(--md-surface-container); }
.matchday-round { font-weight: 800; color: var(--md-primary); }
.matchday-date { color: var(--md-on-surface-variant); font-size: 0.9rem; }
.matchday-status { font-size: 0.8rem; font-weight: 700; color: var(--md-warning); min-width: 64px; text-align: right; }
.matchday-status.is-done { color: var(--md-success-text); }
.team-dots { display: flex; gap: 4px; }
.team-dot {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 700;
    border: 2px solid var(--team-ink);
    color: var(--team-ink);
    background: var(--md-surface);
}
.team-dot.is-complete { background: var(--team); color: var(--team-on); }
.team-dot.is-partial { background: linear-gradient(90deg, var(--team) 50%, var(--md-surface) 50%); color: var(--team-on); text-shadow: 0 0 2px rgba(0, 0, 0, 0.6); }

/* ==================== Calendrier public : cartes sur mobile ==================== */
@media (max-width: 700px) {
    #calendar-table, #calendar-table tbody { display: block; width: 100%; background: none; box-shadow: none; }
    #calendar-table thead { display: none; }
    #calendar-table tr {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 4px 12px;
        margin-bottom: 12px;
        padding: 14px 16px;
        background: var(--md-surface);
        border-radius: var(--md-radius-md);
        box-shadow: var(--md-elevation-1);
    }
    #calendar-table tr[style*="display: none"] { display: none !important; }
    #calendar-table td { display: contents; border: none; padding: 0; }
    #calendar-table td::before {
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--md-on-surface-variant);
        align-self: start;
        padding-top: 2px;
    }
    #calendar-table td > * { grid-column: 2; justify-self: start; }
    #calendar-table td.cal-venue { display: block; grid-column: 1 / -1; padding-top: 6px; border-top: 1px solid var(--md-outline-variant); }
    #calendar-table td.cal-venue::before { display: block; margin-bottom: 4px; }
    #calendar-table td.cal-venue.venue-modified { border-left: none; padding-left: 0; }
    #calendar-table td:first-child { text-align: left; }
}

/* ==================== Refonte accueil + calendrier (v0.3.1) ==================== */
.home > * { max-width: 1240px; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.home-main, .home-side { display: grid; gap: 24px; min-width: 0; }
@media (max-width: 1000px) {
    .home-layout { grid-template-columns: minmax(0, 1fr); }
}

/* Tuiles d'équipe du hero : aplat à la couleur de l'équipe (même code que les pastilles des
   journées et les poules), état en pilule claire pour rester lisible sur toutes les couleurs. */
.team-tile {
    border-left: 0;
    border-radius: var(--md-radius-lg);
    background: var(--team);
    box-shadow: var(--md-elevation-1);
    transition: background var(--md-motion), box-shadow var(--md-motion);
}
.team-tile:hover, .team-tile:focus-within { background: color-mix(in srgb, var(--team) 86%, #000); box-shadow: var(--md-elevation-2); }
.team-tile-link { padding: 14px 14px 12px 16px; border-radius: inherit; }
.team-tile-link:focus-visible { outline: 3px solid var(--md-accent); outline-offset: 2px; }
.team-tile-number { color: var(--team-on); }
.team-tile-opponent { color: var(--team-on-soft); }
.team-tile-count {
    padding: 2px 10px;
    border-radius: var(--md-radius-full);
    font-size: 0.95rem;
    background: var(--md-surface);
}
.team-tile.is-complete .team-tile-count { color: var(--status-success-fg); }
.team-tile.is-empty .team-tile-count { color: var(--status-danger-fg); }
.team-tile.is-partial .team-tile-count { color: var(--status-warning-fg); }
.hero-actions .btn-link { box-shadow: 0 4px 14px color-mix(in srgb, var(--md-primary) 35%, transparent); font-weight: 700; }
.hero-actions .btn-link::after { content: ' ›'; font-size: 1.2em; line-height: 1; }

/* Panneaux : coins plus doux, "A surveiller" en état vide rassurant. */
.panel { border-radius: var(--md-radius-lg); }
.panel-empty--ok {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--md-radius-md);
    background: var(--status-success-bg);
    color: var(--md-on-surface);
}
.panel-empty--ok .icon { flex: none; width: 28px; height: 28px; color: var(--md-success-text); }
.panel-empty--ok strong { display: block; color: var(--md-success-text); }

/* Journées à venir : colonne étroite, pastille de journée et rangée entièrement cliquable. */
.panel--upcoming .matchday-row { grid-template-columns: 44px 1fr; grid-template-areas: "round date" "round dots"; row-gap: 4px; padding: 10px; }
.panel--upcoming .matchday-round {
    grid-area: round;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: var(--md-radius-sm);
    background: var(--md-primary-container);
}
.panel--upcoming .matchday-date { grid-area: date; font-weight: 600; color: var(--md-on-surface); display: flex; justify-content: space-between; gap: 8px; }
.panel--upcoming .team-dots { grid-area: dots; display: flex; }
.panel--upcoming .matchday-status { display: none; }
.panel--upcoming .matchday-row:first-child { background: var(--md-primary-container); }
.team-dot.is-empty { opacity: 0.55; }

@media (max-width: 600px) {
    .panel--upcoming .matchday-row .team-dots { display: flex; }
    .team-tiles { --tile-gap: 8px; }
}

/* Calendrier : barre de couleur à gauche de chaque rencontre, pastille d'équipe. */
.page-head--actions { justify-content: flex-end; }
#calendar-table tr.cal-row > td:first-child { box-shadow: inset 6px 0 0 var(--team-ink); padding-left: 18px; }
#calendar-table tbody tr.cal-row:hover { background: color-mix(in srgb, var(--team-ink) 8%, transparent); }
@media (max-width: 700px) {
    #calendar-table tr.cal-row { border-left: 6px solid var(--team-ink); }
    #calendar-table tr.cal-row > td:first-child { box-shadow: none; padding-left: 0; }
}

/* Filtre d'équipe du calendrier : pastilles aux couleurs des équipes. */
.chip-group--teams .chip--team { border-color: var(--team-ink); color: var(--team-ink); }
.chip-group--teams .chip--team:hover { background: color-mix(in srgb, var(--team-ink) 12%, var(--md-surface)); border-color: var(--team-ink); color: var(--team-ink); }
.chip-group--teams .chip--team.is-active,
.chip-group--teams .chip--team.is-active:hover { background: var(--team); border-color: var(--team); color: var(--team-on); }

/* ==================== Ajustements de thème ==================== */
.hero-actions .btn-link { color: var(--md-on-primary); background: var(--md-primary); }
.hero-actions .btn-link:hover { background: var(--md-primary-hover); }
.countdown { background: var(--md-primary-container); color: var(--md-on-primary-container); }
/* Calendrier : espacement sous le bouton d'agenda, journées passées masquées par défaut. */
.page-head--actions { margin-bottom: 20px; }
.page-head--actions + .filters { margin-top: 0; gap: 14px 20px; }
.filters .chip-group + .chip-group { margin-left: 4px; }
#round-filter:not(.show-past) .chip.is-past:not(.is-active) { display: none; }
