.ag-grid-wrapper [hidden] { display: none !important; }

.ag-grid-wrapper {
    --ag-primary: #2271b1;
    --ag-border: #e2e4e7;
    --ag-text-muted: #50575e;
    font-family: inherit;
}

/* Toolbar : ligne recherche, puis ligne onglets + calendrier */
.ag-toolbar { margin-bottom: 24px; }

.ag-toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ag-toolbar-row + .ag-toolbar-row { margin-top: 12px; }

.ag-row-controls { justify-content: space-between; }

.ag-search { flex: 1 1 100%; }

.ag-search-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--ag-border);
    border-radius: 6px;
    font-size: 15px;
    box-sizing: border-box;
}

.ag-row-type { display: block; }

.ag-type-tabs { display: flex; width: 100%; gap: 8px; }

.ag-type-tab {
    flex: 1 1 50%;
    border: none;
    background: #f0f0f1;
    color: var(--ag-text-muted);
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color .15s ease, color .15s ease;
}

.ag-type-tab.is-active { background: var(--ag-primary); color: #fff; }

.ag-tabs { display: flex; gap: 4px; border-radius: 6px; background: #f0f0f1; padding: 4px; flex-wrap: wrap; }

.ag-tab {
    border: none;
    background: transparent;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    color: var(--ag-text-muted);
    transition: background-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.ag-tab.is-active { background: var(--ag-primary); color: #fff; }

.ag-calendar-wrap { position: relative; }

.ag-calendar-toggle {
    border: 1px solid var(--ag-border);
    background: #fff;
    height: 38px;
    padding: 0 14px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ag-text-muted);
    white-space: nowrap;
}

.ag-calendar-toggle:hover { border-color: var(--ag-primary); }
.ag-calendar-toggle .dashicons { font-size: 18px; width: 18px; height: 18px; }
.ag-calendar-label { font-size: 14px; font-weight: 600; }

.ag-calendar-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    width: 280px;
    background: #fff;
    border: 1px solid var(--ag-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    padding: 14px;
}

.ag-calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ag-cal-month-label { font-weight: 700; text-transform: capitalize; }
.ag-cal-nav { border: none; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; color: var(--ag-text-muted); }
.ag-cal-nav:hover { color: var(--ag-primary); }

.ag-calendar-weekdays, .ag-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}

.ag-calendar-weekdays { font-size: 12px; color: var(--ag-text-muted); margin-bottom: 4px; }

.ag-calendar-grid .ag-cal-day {
    position: relative;
    padding: 7px 0;
    font-size: 13px;
    border-radius: 50%;
    cursor: default;
    color: #1d2327;
}

.ag-calendar-grid .ag-cal-day.is-outside { color: #c3c4c7; }

.ag-calendar-grid .ag-cal-day.is-marked {
    cursor: pointer;
    background: color-mix(in srgb, var(--ag-primary) 14%, transparent);
    font-weight: 700;
}

.ag-calendar-grid .ag-cal-day.is-marked:hover { background: var(--ag-primary); color: #fff; }

.ag-calendar-grid .ag-cal-day.is-today { box-shadow: inset 0 0 0 2px var(--ag-primary); border-radius: 6px; }

/* Intertitres mode "Tous" */
.ag-list-group + .ag-list-group { margin-top: 32px; }

.ag-group-heading {
    margin: 0 0 14px;
    font-size: 20px;
    font-weight: 700;
}

/* Liste & cartes */
.ag-list, .ag-group-items { display: flex; flex-direction: column; gap: 16px; }

.ag-item {
    border: 1px solid var(--ag-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.ag-item-link {
    display: flex;
    align-items: stretch;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    padding: 14px;
}

.ag-item-monthyear {
    flex: 0 0 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    border-radius: 6px;
    background: #f0f6fb;
    color: var(--ag-primary);
    padding: 10px 4px;
    align-self: flex-start;
}

.ag-item-month { display: block; font-weight: 700; text-transform: uppercase; font-size: 13px; line-height: 1.3; }
.ag-item-year { display: block; font-size: 12px; opacity: .85; }

.ag-item-body { flex: 1 1 auto; min-width: 0; }

.ag-item-kicker { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ag-primary); }

.ag-item-title { margin: 0 0 6px; font-size: 18px; line-height: 1.3; }

.ag-item-address { margin: 0 0 8px; font-size: 13px; color: var(--ag-text-muted); }

.ag-item-excerpt { font-size: 14px; color: var(--ag-text-muted); line-height: 1.5; }

.ag-item-thumb { flex: 0 0 160px; align-self: stretch; border-radius: 6px; overflow: hidden; }
.ag-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ag-item-thumb.ag-fit-contain img { object-fit: contain; }

.ag-empty {
    padding: 18px;
    background: #f0f0f1;
    border-radius: 6px;
    color: var(--ag-text-muted);
    text-align: center;
}

.ag-list-footer { text-align: center; margin-top: 20px; }

.ag-load-more, .ag-load-more-group {
    border: 1px solid var(--ag-primary);
    background: #fff;
    color: var(--ag-primary);
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.ag-load-more:hover, .ag-load-more-group:hover { background: var(--ag-primary); color: #fff; }

.ag-load-more-group { display: block; margin: 16px auto 0; }

.ag-loading { color: var(--ag-text-muted); font-size: 14px; }

@media (max-width: 640px) {
    .ag-row-controls { justify-content: flex-start; }

    .ag-item-link { flex-direction: column; padding: 0; }
    .ag-item-monthyear { display: none; }
    .ag-item-thumb { order: -1; flex: none; width: 100%; aspect-ratio: 16/9; border-radius: 0; align-self: stretch; }
    .ag-item-body { padding: 14px 16px; }
}
