/* Fase 23K.3 - evento calendario leggibile + drag solo da handle */
.phase23k-calendar-dropzone {
    position: relative;
    transition: outline-color .12s ease, background-color .12s ease, box-shadow .12s ease;
}

.phase23k-calendar-dropzone.is-drag-target {
    outline: 3px dashed #2563eb;
    outline-offset: -5px;
    background: #eff6ff !important;
    box-shadow: inset 0 0 0 2px rgba(37, 99, 235, .16);
}

.calendar-site-event.phase23k3-event-card {
    display: grid !important;
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas:
        "drag content"
        "actions actions";
    align-items: start;
    gap: 7px 8px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    padding: 8px 9px;
    border-radius: 14px;
    border: 1px solid #dbe4f0;
    border-left: 6px solid var(--event-color, #2563eb);
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 7px rgba(15, 23, 42, .08);
    cursor: default !important;
    user-select: none;
    text-decoration: none;
    overflow: hidden;
}

.calendar-site-event.phase23k3-event-card.compact {
    min-height: 112px;
    padding: 8px;
}

.calendar-site-event.phase23k3-event-card.has-conflict {
    outline: 2px solid #f97316;
    outline-offset: 1px;
}

.calendar-site-event.phase23k3-event-card.status-done {
    opacity: .82;
}

.calendar-site-event.phase23k3-event-card.status-cancelled {
    opacity: .55;
}

.phase23k3-event-card .event-drag-slot {
    grid-area: drag;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    min-width: 0;
}

.phase23k3-event-card .event-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    min-width: 26px;
    height: 26px;
    border-radius: 10px;
    border: 1px solid rgba(37, 99, 235, .35);
    background: rgba(37, 99, 235, .10);
    color: #1d4ed8;
    font-weight: 900;
    line-height: 1;
    cursor: grab;
    touch-action: none;
}

.phase23k3-event-card .event-drag-handle:hover {
    background: rgba(37, 99, 235, .18);
    border-color: rgba(37, 99, 235, .55);
}

.phase23k3-event-card .event-drag-handle:active,
.phase23k3-event-card.is-dragging .event-drag-handle {
    cursor: grabbing;
}

.phase23k3-event-card[data-drag-allowed="false"] .event-drag-handle,
.phase23k3-event-card.status-done .event-drag-handle,
.phase23k3-event-card.status-cancelled .event-drag-handle {
    display: none !important;
}

.phase23k3-event-card .event-card-content {
    grid-area: content;
    display: flex !important;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
    color: #0f172a !important;
}

.phase23k3-event-card .event-title-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.phase23k3-event-card .event-customer,
.phase23k3-event-card .event-time,
.phase23k3-event-card .event-activities,
.phase23k3-event-card .event-techs,
.phase23k3-event-card .event-place,
.phase23k3-event-card .event-notes {
    display: block !important;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.22;
}

.phase23k3-event-card .event-customer {
    flex: 1 1 auto;
    color: #0f172a !important;
    font-weight: 900;
    font-size: .88rem;
}

.phase23k3-event-card .event-time {
    flex: 0 0 auto;
    color: #1d4ed8 !important;
    font-weight: 900;
    font-size: .74rem;
}

.phase23k3-event-card .event-activities {
    color: #334155 !important;
    font-weight: 800;
    font-size: .76rem;
}

.phase23k3-event-card .event-techs {
    color: #64748b !important;
    font-weight: 700;
    font-size: .73rem;
}

.phase23k3-event-card .event-place,
.phase23k3-event-card .event-notes {
    color: #64748b !important;
    font-size: .72rem;
}

.phase23k3-event-card .event-inline-actions {
    grid-area: actions;
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
    font-size: .72rem;
    font-weight: 900;
}

.phase23k3-event-card .event-inline-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 22px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb !important;
    text-decoration: none;
    white-space: nowrap;
}

.phase23k3-event-card .event-inline-actions a:hover {
    background: #dbeafe;
}

.phase23k3-event-card .event-inline-actions a.danger {
    background: #fef2f2;
    color: #dc2626 !important;
}

.phase23k3-event-card .event-inline-actions a.danger:hover {
    background: #fee2e2;
}

.calendar-site-event.is-dragging {
    opacity: .55;
    transform: scale(.985);
}

/* Vista mese: l'evento deve mostrare dettagli, non solo i pulsanti. */
.phase23i-month-grid .calendar-events-stack {
    gap: 8px;
}

.phase23i-month-grid .phase23k3-event-card.compact .event-inline-actions {
    justify-content: flex-start;
}

.phase23i-month-grid .phase23k3-event-card.compact .event-inline-actions a {
    font-size: .68rem;
    padding-inline: 6px;
}

/* Vista elenco / settimana / giorno: card più ariosa. */
.phase23i-day-events .phase23k3-event-card,
.phase23i-side-list .phase23k3-event-card {
    min-height: auto;
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas: "drag content actions";
    align-items: center;
}

.phase23i-day-events .phase23k3-event-card .event-inline-actions,
.phase23i-side-list .phase23k3-event-card .event-inline-actions {
    justify-content: flex-end;
}

.phase23k-toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 9999;
    max-width: min(520px, calc(100vw - 32px));
    border-radius: 14px;
    padding: 12px 14px;
    background: #0f172a;
    color: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, .25);
    font-weight: 800;
    line-height: 1.35;
}

.phase23k-toast.warning { background: #92400e; }
.phase23k-toast.error { background: #991b1b; }

@media (max-width: 760px) {
    .phase23k3-event-card .event-title-row {
        flex-direction: column;
        gap: 1px;
    }
    .phase23i-day-events .phase23k3-event-card,
    .phase23i-side-list .phase23k3-event-card {
        grid-template-columns: 30px minmax(0, 1fr);
        grid-template-areas:
            "drag content"
            "actions actions";
    }
}
