/* Fase 23L.2 - grafica evento calendario più leggibile e azioni uniformi.
   Solo UI: non modifica logiche, drag/drop o salvataggi. */

.calendar-site-event.phase23l2-event-card {
    position: relative;
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    grid-template-areas:
        "drag body"
        "actions actions" !important;
    align-items: start !important;
    gap: 8px 10px !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    padding: 10px 10px 9px 12px !important;
    border: 1px solid #cfe0f2 !important;
    border-left: 7px solid var(--event-color, #2563eb) !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .08) !important;
    cursor: default !important;
    overflow: hidden !important;
}

.calendar-site-event.phase23l2-event-card.compact {
    padding: 8px 9px 8px 10px !important;
    gap: 7px 8px !important;
    border-radius: 14px !important;
}

.calendar-site-event.phase23l2-event-card:hover {
    box-shadow: 0 8px 24px rgba(15, 23, 42, .13) !important;
    transform: none !important;
}

.phase23l2-drag-slot {
    grid-area: drag !important;
    width: 34px !important;
    min-width: 34px !important;
    display: flex !important;
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: 2px !important;
}

.phase23l2-drag-handle,
.calendar-site-event .phase23l2-drag-handle.event-drag-handle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    border-radius: 11px !important;
    border: 1px solid #b7ccff !important;
    background: #eff6ff !important;
    color: #2563eb !important;
    font-size: 16px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    cursor: grab !important;
    user-select: none !important;
}

.phase23l2-drag-handle:active,
.calendar-site-event .phase23l2-drag-handle.event-drag-handle:active {
    cursor: grabbing !important;
}

.phase23l2-event-content {
    grid-area: body !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 3px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

.phase23l2-title-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: baseline !important;
    gap: 8px !important;
    min-width: 0 !important;
}

.phase23l2-customer,
.calendar-site-event .phase23l2-customer.event-customer {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: #0f172a !important;
    font-size: .92rem !important;
    font-weight: 900 !important;
    letter-spacing: .01em !important;
    line-height: 1.18 !important;
}

.phase23l2-time,
.calendar-site-event .phase23l2-time.event-time {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    white-space: nowrap !important;
    color: #1d4ed8 !important;
    font-size: .86rem !important;
    font-weight: 900 !important;
    line-height: 1.18 !important;
}

.phase23l2-activities,
.phase23l2-techs,
.phase23l2-place,
.phase23l2-notes {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    line-height: 1.22 !important;
}

.phase23l2-activities,
.calendar-site-event .phase23l2-activities.event-activities {
    color: #24364f !important;
    font-size: .82rem !important;
    font-weight: 800 !important;
}

.phase23l2-techs,
.calendar-site-event .phase23l2-techs.event-techs {
    color: #64748b !important;
    font-size: .80rem !important;
    font-weight: 800 !important;
}

.phase23l2-place,
.calendar-site-event .phase23l2-place.event-place {
    color: #64748b !important;
    font-size: .74rem !important;
    font-weight: 700 !important;
}

.phase23l2-notes,
.calendar-site-event .phase23l2-notes.event-notes {
    color: #64748b !important;
    font-size: .72rem !important;
    font-weight: 600 !important;
}

.phase23l2-actions,
.calendar-site-event .phase23l2-actions.event-inline-actions {
    grid-area: actions !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin: 3px 0 0 0 !important;
    padding: 0 !important;
    min-width: 0 !important;
}

.phase23l2-actions .phase23l2-action,
.phase23l2-actions a,
.phase23l2-actions button,
.calendar-site-event .event-inline-actions .phase23l2-action,
.calendar-site-event .event-inline-actions a.phase23l2-action,
.calendar-site-event .event-inline-actions button.phase23l2-action {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 24px !important;
    height: 24px !important;
    max-height: 24px !important;
    padding: 0 8px !important;
    border-radius: 999px !important;
    border: 1px solid transparent !important;
    background: #eef5ff !important;
    color: #1d4ed8 !important;
    font-family: inherit !important;
    font-size: .72rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
}

.phase23l2-actions .phase23l2-action.quick,
.calendar-site-event .event-inline-actions .phase23l2-action.quick {
    background: #f5f3ff !important;
    color: #6d28d9 !important;
    border-color: #ddd6fe !important;
}

.phase23l2-actions .phase23l2-action.danger,
.calendar-site-event .event-inline-actions .phase23l2-action.danger {
    background: #fff1f2 !important;
    color: #dc2626 !important;
    border-color: #fecdd3 !important;
}

.phase23l2-actions .phase23l2-action:hover,
.calendar-site-event .event-inline-actions .phase23l2-action:hover {
    filter: brightness(.97) !important;
}

.phase23l2-event-card.has-conflict,
.phase23l2-event-card.conflict {
    border-color: #fecaca !important;
    border-left-color: #dc2626 !important;
    background: #fff7f7 !important;
}

/* Celle molto strette: mostra meno testo, non rompe la griglia. */
@media (max-width: 980px) {
    .calendar-site-event.phase23l2-event-card {
        grid-template-columns: 28px minmax(0, 1fr) !important;
        padding: 8px !important;
        gap: 6px !important;
    }
    .phase23l2-drag-slot {
        width: 28px !important;
        min-width: 28px !important;
    }
    .phase23l2-drag-handle,
    .calendar-site-event .phase23l2-drag-handle.event-drag-handle {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }
    .phase23l2-title-row {
        grid-template-columns: 1fr !important;
        gap: 2px !important;
    }
    .phase23l2-time,
    .calendar-site-event .phase23l2-time.event-time {
        justify-content: flex-start !important;
    }
}

@media (min-width: 1400px) {
    .phase23l2-customer,
    .calendar-site-event .phase23l2-customer.event-customer {
        font-size: .98rem !important;
    }
    .phase23l2-time,
    .calendar-site-event .phase23l2-time.event-time {
        font-size: .9rem !important;
    }
    .phase23l2-activities,
    .calendar-site-event .phase23l2-activities.event-activities {
        font-size: .86rem !important;
    }
    .phase23l2-techs,
    .calendar-site-event .phase23l2-techs.event-techs {
        font-size: .83rem !important;
    }
}

/* Fase 23M.2 FIX - override finale vista mese cliente
   Questa correzione e dentro il CSS gia caricato dalla 23L.2. Non dipende da un nuovo file CSS.
   Obiettivo: nelle colonne strette della vista mese il cliente deve essere la prima informazione leggibile. */

.calendar-site-event.phase23l2-event-card,
.calendar-site-event.phase23m2-month-readable {
    grid-template-columns: 20px minmax(0, 1fr) !important;
    gap: 3px 5px !important;
    padding: 5px 5px 4px 6px !important;
    border-left-width: 4px !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .07) !important;
    max-width: 100% !important;
    min-width: 0 !important;
}

.calendar-site-event.phase23l2-event-card.compact,
.calendar-site-event.phase23m2-month-readable.compact {
    grid-template-columns: 18px minmax(0, 1fr) !important;
    padding: 4px 5px 4px 5px !important;
    gap: 2px 4px !important;
    border-left-width: 3px !important;
    border-radius: 8px !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-drag-slot,
.calendar-site-event.phase23m2-month-readable .phase23l2-drag-slot {
    width: 20px !important;
    min-width: 20px !important;
    padding-top: 0 !important;
}

.calendar-site-event.phase23l2-event-card.compact .phase23l2-drag-slot,
.calendar-site-event.phase23m2-month-readable.compact .phase23l2-drag-slot {
    width: 18px !important;
    min-width: 18px !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-drag-handle,
.calendar-site-event.phase23l2-event-card .event-drag-handle.phase23l2-drag-handle,
.calendar-site-event.phase23m2-month-readable .phase23l2-drag-handle,
.calendar-site-event.phase23m2-month-readable .event-drag-handle.phase23l2-drag-handle {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    border-radius: 7px !important;
    font-size: 10px !important;
    line-height: 1 !important;
}

.calendar-site-event.phase23l2-event-card.compact .phase23l2-drag-handle,
.calendar-site-event.phase23l2-event-card.compact .event-drag-handle.phase23l2-drag-handle,
.calendar-site-event.phase23m2-month-readable.compact .phase23l2-drag-handle,
.calendar-site-event.phase23m2-month-readable.compact .event-drag-handle.phase23l2-drag-handle {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    font-size: 9px !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-event-content,
.calendar-site-event.phase23m2-month-readable .phase23l2-event-content {
    gap: 1px !important;
    min-width: 0 !important;
    overflow: hidden !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-title-row,
.calendar-site-event.phase23m2-month-readable .phase23l2-title-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 0 !important;
    align-items: start !important;
    min-width: 0 !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-customer,
.calendar-site-event.phase23l2-event-card .event-customer.phase23l2-customer,
.calendar-site-event.phase23m2-month-readable .phase23l2-customer,
.calendar-site-event.phase23m2-month-readable .event-customer.phase23l2-customer {
    display: -webkit-box !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    white-space: normal !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    max-height: 2.22em !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    color: #0f172a !important;
    font-size: .70rem !important;
    font-weight: 900 !important;
    letter-spacing: 0 !important;
    line-height: 1.08 !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-time,
.calendar-site-event.phase23l2-event-card .event-time.phase23l2-time,
.calendar-site-event.phase23m2-month-readable .phase23l2-time,
.calendar-site-event.phase23m2-month-readable .event-time.phase23l2-time {
    display: block !important;
    justify-content: flex-start !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: #1d4ed8 !important;
    font-size: .56rem !important;
    font-weight: 900 !important;
    line-height: 1.04 !important;
    margin-top: 1px !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-activities,
.calendar-site-event.phase23l2-event-card .event-activities.phase23l2-activities,
.calendar-site-event.phase23m2-month-readable .phase23l2-activities,
.calendar-site-event.phase23m2-month-readable .event-activities.phase23l2-activities {
    font-size: .56rem !important;
    line-height: 1.05 !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-techs,
.calendar-site-event.phase23l2-event-card .event-techs.phase23l2-techs,
.calendar-site-event.phase23m2-month-readable .phase23l2-techs,
.calendar-site-event.phase23m2-month-readable .event-techs.phase23l2-techs {
    font-size: .53rem !important;
    line-height: 1.05 !important;
    font-weight: 800 !important;
    white-space: nowrap !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-place,
.calendar-site-event.phase23l2-event-card .phase23l2-notes,
.calendar-site-event.phase23m2-month-readable .phase23l2-place,
.calendar-site-event.phase23m2-month-readable .phase23l2-notes {
    display: none !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-actions,
.calendar-site-event.phase23l2-event-card .event-inline-actions.phase23l2-actions,
.calendar-site-event.phase23m2-month-readable .phase23l2-actions,
.calendar-site-event.phase23m2-month-readable .event-inline-actions.phase23l2-actions {
    gap: 2px !important;
    margin-top: 2px !important;
    overflow: hidden !important;
    flex-wrap: wrap !important;
}

.calendar-site-event.phase23l2-event-card .phase23l2-actions .phase23l2-action,
.calendar-site-event.phase23l2-event-card .phase23l2-actions a,
.calendar-site-event.phase23l2-event-card .phase23l2-actions button,
.calendar-site-event.phase23l2-event-card .event-inline-actions a.phase23l2-action,
.calendar-site-event.phase23l2-event-card .event-inline-actions button.phase23l2-action,
.calendar-site-event.phase23m2-month-readable .phase23l2-actions .phase23l2-action,
.calendar-site-event.phase23m2-month-readable .phase23l2-actions a,
.calendar-site-event.phase23m2-month-readable .phase23l2-actions button {
    min-height: 16px !important;
    height: 16px !important;
    max-height: 16px !important;
    padding: 0 4px !important;
    border-radius: 7px !important;
    font-size: .50rem !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    max-width: 100% !important;
}

@media (max-width: 1500px) {
    .calendar-site-event.phase23l2-event-card,
    .calendar-site-event.phase23m2-month-readable {
        grid-template-columns: 17px minmax(0, 1fr) !important;
        padding: 4px 4px 3px 5px !important;
        gap: 2px 3px !important;
        border-left-width: 3px !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-drag-slot,
    .calendar-site-event.phase23m2-month-readable .phase23l2-drag-slot {
        width: 17px !important;
        min-width: 17px !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-drag-handle,
    .calendar-site-event.phase23l2-event-card .event-drag-handle.phase23l2-drag-handle,
    .calendar-site-event.phase23m2-month-readable .phase23l2-drag-handle,
    .calendar-site-event.phase23m2-month-readable .event-drag-handle.phase23l2-drag-handle {
        width: 15px !important;
        height: 15px !important;
        min-width: 15px !important;
        font-size: 9px !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-customer,
    .calendar-site-event.phase23l2-event-card .event-customer.phase23l2-customer,
    .calendar-site-event.phase23m2-month-readable .phase23l2-customer,
    .calendar-site-event.phase23m2-month-readable .event-customer.phase23l2-customer {
        font-size: .66rem !important;
        line-height: 1.06 !important;
        max-height: 2.16em !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-time,
    .calendar-site-event.phase23l2-event-card .event-time.phase23l2-time,
    .calendar-site-event.phase23m2-month-readable .phase23l2-time,
    .calendar-site-event.phase23m2-month-readable .event-time.phase23l2-time {
        font-size: .52rem !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-activities,
    .calendar-site-event.phase23l2-event-card .event-activities.phase23l2-activities,
    .calendar-site-event.phase23m2-month-readable .phase23l2-activities,
    .calendar-site-event.phase23m2-month-readable .event-activities.phase23l2-activities {
        font-size: .52rem !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-techs,
    .calendar-site-event.phase23l2-event-card .event-techs.phase23l2-techs,
    .calendar-site-event.phase23m2-month-readable .phase23l2-techs,
    .calendar-site-event.phase23m2-month-readable .event-techs.phase23l2-techs {
        font-size: .50rem !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-actions .phase23l2-action,
    .calendar-site-event.phase23l2-event-card .phase23l2-actions a,
    .calendar-site-event.phase23l2-event-card .phase23l2-actions button,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions .phase23l2-action,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions a,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions button {
        min-height: 15px !important;
        height: 15px !important;
        max-height: 15px !important;
        padding: 0 3px !important;
        font-size: .48rem !important;
    }
}

@media (max-width: 1250px) {
    .calendar-site-event.phase23l2-event-card .phase23l2-actions .phase23l2-action,
    .calendar-site-event.phase23l2-event-card .phase23l2-actions a,
    .calendar-site-event.phase23l2-event-card .phase23l2-actions button,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions .phase23l2-action,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions a,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions button {
        width: 20px !important;
        min-width: 20px !important;
        max-width: 20px !important;
        padding: 0 !important;
        overflow: hidden !important;
        font-size: 0 !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-actions .phase23l2-action.quick,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions .phase23l2-action.quick {
        width: 28px !important;
        min-width: 28px !important;
        max-width: 28px !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-actions .phase23l2-action::before,
    .calendar-site-event.phase23m2-month-readable .phase23l2-actions .phase23l2-action::before {
        content: attr(data-short-label) !important;
        display: inline !important;
        font-size: .50rem !important;
        line-height: 1 !important;
    }
}

@media (max-width: 980px) {
    .calendar-site-event.phase23l2-event-card .phase23l2-activities,
    .calendar-site-event.phase23l2-event-card .phase23l2-techs,
    .calendar-site-event.phase23m2-month-readable .phase23l2-activities,
    .calendar-site-event.phase23m2-month-readable .phase23l2-techs {
        display: none !important;
    }

    .calendar-site-event.phase23l2-event-card .phase23l2-customer,
    .calendar-site-event.phase23l2-event-card .event-customer.phase23l2-customer,
    .calendar-site-event.phase23m2-month-readable .phase23l2-customer,
    .calendar-site-event.phase23m2-month-readable .event-customer.phase23l2-customer {
        font-size: .62rem !important;
    }
}
