/* Fase 23J - calendario subito visibile, filtri in fondo pagina. */
.phase23j-calendar-header,
.phase23j-calendar-toolbar,
.phase23j-calendar-card,
.phase23j-list-layout,
.phase23j-legend-card,
.phase23j-filter-card {
    width: 100%;
    max-width: none;
}

.phase23j-calendar-header {
    margin-bottom: 12px;
}

.phase23j-calendar-toolbar {
    position: sticky;
    top: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid #dbe4f0;
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(8px);
}

.phase23j-view-tabs {
    flex: 0 0 auto;
}

.phase23j-top-kpis {
    flex: 1 1 auto;
    justify-content: flex-end;
}

.phase23j-top-kpis span {
    min-height: 30px;
    padding: 4px 10px;
    font-size: .78rem;
}

.phase23j-calendar-card,
.phase23j-list-layout {
    margin-top: 0;
    margin-bottom: 14px;
}

.phase23j-calendar-scroll {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
}

.phase23j-month-grid {
    min-width: 1180px;
}

.phase23j-month-grid .calendar-cell {
    min-height: clamp(132px, 15vh, 210px);
}

.phase23j-list-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
    gap: 14px;
}

.phase23j-period-list-card,
.phase23j-side-list-card {
    max-width: none;
}

.phase23j-side-list-card {
    position: sticky;
    top: 82px;
    max-height: calc(100vh - 110px);
    overflow: hidden;
}

.phase23j-side-list {
    max-height: calc(100vh - 190px);
    overflow: auto;
}

.phase23j-legend-card {
    margin-top: 14px;
    margin-bottom: 14px;
    padding: 12px 14px;
    background: #f8fafc;
}

.phase23j-filter-card {
    margin-top: 18px;
    padding: 16px;
    border-top: 3px solid #dbeafe;
}

.phase23j-filter-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}

.phase23j-filter-title h2 {
    margin: 0;
    font-size: 1rem;
    color: #0f172a;
}

.phase23j-filter-title p {
    margin: 3px 0 0;
    color: #64748b;
    font-size: .86rem;
}

.phase23j-filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1.4fr) minmax(210px, .9fr) minmax(250px, 1.1fr) minmax(220px, .9fr) auto;
    gap: 14px;
    align-items: end;
}

.phase23j-filter-grid .field,
.phase23j-filter-grid input,
.phase23j-filter-grid select {
    min-width: 0;
}

.phase23j-filter-actions .actions-row {
    flex-wrap: nowrap;
    white-space: nowrap;
}

@media (max-width: 1320px) {
    .phase23j-list-layout {
        grid-template-columns: 1fr;
    }
    .phase23j-side-list-card {
        position: static;
        max-height: none;
    }
    .phase23j-side-list {
        max-height: none;
    }
}

@media (max-width: 1100px) {
    .phase23j-calendar-toolbar {
        position: static;
        align-items: stretch;
        flex-direction: column;
    }
    .phase23j-top-kpis {
        justify-content: flex-start;
    }
    .phase23j-filter-grid {
        grid-template-columns: 1fr 1fr;
    }
    .phase23j-filter-actions {
        grid-column: 1 / -1;
    }
}

@media (max-width: 720px) {
    .phase23j-view-tabs,
    .phase23j-top-kpis,
    .phase23j-filter-title {
        width: 100%;
    }
    .phase23j-filter-title {
        flex-direction: column;
    }
    .phase23j-filter-grid {
        grid-template-columns: 1fr;
    }
}
