/* =====================================================================
 * CRM TOTOWIN — fogli di stile custom condivisi
 * Caricato via render hook in tutte le pagine del pannello.
 * Tutti i selettori prefissati con .tw- per non confliggere con Filament.
 * ===================================================================== */

/* ---------- Atomi: pin colorato, bottoni icona, pillole ---------- */
.tw-pin { width: 10px; height: 10px; border-radius: 9999px; display: inline-block; flex-shrink: 0; }
.tw-pin-sm { width: 8px; height: 8px; border-radius: 9999px; display: inline-block; flex-shrink: 0; }

.tw-iconbtn {
    width: 32px; height: 32px;
    border-radius: 9999px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 15px; line-height: 1;
    flex-shrink: 0;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}
.tw-iconbtn:hover { transform: scale(1.1); box-shadow: 0 2px 6px rgba(0,0,0,0.15); }
.tw-iconbtn-sm { width: 28px; height: 28px; font-size: 13px; }

.tw-iconbtn-call { background: #DBEAFE; color: #2563EB; }
.dark .tw-iconbtn-call { background: rgb(30 58 138 / 0.4); color: #93C5FD; }

.tw-iconbtn-map { background: #D1FAE5; color: #059669; }
.dark .tw-iconbtn-map { background: rgb(6 78 59 / 0.4); color: #6EE7B7; }

.tw-iconbtn-add { background: #FEF3C7; color: #D97706; }
.dark .tw-iconbtn-add { background: rgb(120 53 15 / 0.4); color: #FBBF24; }

.tw-iconbtn-msg { background: #DCFCE7; color: #16A34A; }
.dark .tw-iconbtn-msg { background: rgb(22 101 52 / 0.4); color: #86EFAC; }

.tw-time-pill {
    display: inline-flex; align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 12px; font-weight: 600;
    background: #FEF3C7; color: #B45309;
    white-space: nowrap;
}
.dark .tw-time-pill { background: rgb(120 53 15 / 0.4); color: #FCD34D; }

.tw-time-pill-flex { background: #E5E7EB; color: #6B7280; }
.dark .tw-time-pill-flex { background: rgb(55 65 81); color: #D1D5DB; }


/* ---------- KANBAN ---------- */
.tw-kb-row { display: flex; gap: 14px; align-items: stretch; min-width: max-content; }

.tw-kb-col {
    display: flex; flex-direction: column;
    background: rgb(243 244 246);
    border-radius: 16px;
    border: 1px solid rgb(229 231 235);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    flex-shrink: 0;
    width: 280px;
}
.dark .tw-kb-col { background: rgb(31 41 55 / 0.6); border-color: rgb(55 65 81); }
@media (min-width: 1280px) { .tw-kb-col { width: 300px; } }

.tw-kb-head {
    padding: 12px 14px;
    border-radius: 16px 16px 0 0;
    position: sticky; top: 0; z-index: 1;
}

.tw-kb-body { padding: 10px; flex: 1; overflow-y: auto; min-height: 200px; max-height: 70vh; }

.tw-kb-card {
    background: white;
    border-radius: 12px;
    border: 1px solid rgb(229 231 235);
    padding: 10px;
    cursor: grab;
    transition: all .15s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    margin-bottom: 8px;
}
.dark .tw-kb-card { background: rgb(31 41 55); border-color: rgb(55 65 81); }
.tw-kb-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.10); border-color: rgb(245 158 11); transform: translateY(-1px); }
.tw-kb-card:active { cursor: grabbing; }
.tw-kb-card:last-child { margin-bottom: 0; }

.tw-kb-name {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}


/* ---------- AGENDA / CALENDARIO ---------- */
.tw-cal-cell {
    min-height: 70px;
    padding: 6px;
    cursor: pointer;
    transition: all .15s;
    border-right: 1px solid rgb(229 231 235);
    border-bottom: 1px solid rgb(229 231 235);
    background: white;
    overflow: hidden;
}
.dark .tw-cal-cell { background: rgb(31 41 55); border-color: rgb(55 65 81); }
@media (min-width: 768px) { .tw-cal-cell { min-height: 95px; } }
@media (min-width: 1280px) { .tw-cal-cell { min-height: 110px; padding: 8px; } }

.tw-cal-cell:hover { background: rgb(254 243 199 / 0.4); }
.dark .tw-cal-cell:hover { background: rgb(120 53 15 / 0.2); }

.tw-cal-cell.is-oggi { background: rgb(254 243 199 / 0.6); }
.dark .tw-cal-cell.is-oggi { background: rgb(120 53 15 / 0.3); }
.tw-cal-cell.is-oggi .tw-cal-day-num { color: white; background: #F59E0B; }

.tw-cal-cell.is-selezionato { box-shadow: inset 0 0 0 2px #F59E0B; background: rgb(254 243 199 / 0.5); }

.tw-cal-cell.fuori-mese { opacity: 0.4; background: rgb(249 250 251); }
.dark .tw-cal-cell.fuori-mese { background: rgb(17 24 39 / 0.5); }

.tw-cal-day-num {
    font-size: 13px; font-weight: 700;
    width: 24px; height: 24px;
    border-radius: 9999px;
    display: inline-flex; align-items: center; justify-content: center;
    color: rgb(31 41 55);
}
.dark .tw-cal-day-num { color: rgb(229 231 235); }

.tw-cal-evento {
    font-size: 11px; line-height: 1.2;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    font-weight: 500;
}


/* ---------- IL MIO GIRO ---------- */
.tw-giro-row {
    display: flex; align-items: stretch;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgb(229 231 235);
    background: white;
    transition: box-shadow .15s;
}
.dark .tw-giro-row { background: rgb(31 41 55); border-color: rgb(55 65 81); }
.tw-giro-row.is-oggi { border-color: #F59E0B; border-width: 2px; }
.tw-giro-row.is-empty { background: rgb(249 250 251); opacity: 0.7; }
.dark .tw-giro-row.is-empty { background: rgb(17 24 39 / 0.5); }

.tw-giro-data {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 90px; padding: 12px;
    background: rgb(249 250 251);
    color: rgb(75 85 99);
}
.dark .tw-giro-data { background: rgb(55 65 81 / 0.5); color: rgb(229 231 235); }

.tw-giro-data.is-oggi { background: #F59E0B; color: white; }
.tw-giro-data.is-weekend { background: rgb(243 244 246); }
.dark .tw-giro-data.is-weekend { background: rgb(31 41 55); }

.tw-giro-day-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; opacity: 0.85; }
.tw-giro-day-num { font-size: 28px; font-weight: 800; line-height: 1; margin-top: 2px; }

.tw-giro-content { flex: 1; padding: 12px; min-width: 0; }

.tw-giro-card {
    display: flex; flex-direction: column;
    gap: 8px;
    padding: 12px;
    border-radius: 12px;
    background: rgb(255 247 237);
    border: 1px solid rgb(254 215 170);
    transition: transform .15s;
    margin-bottom: 8px;
}
.dark .tw-giro-card { background: rgb(120 53 15 / 0.15); border-color: rgb(180 83 9 / 0.4); }
.tw-giro-card:hover { transform: translateX(2px); }
.tw-giro-card:last-child { margin-bottom: 0; }

@media (min-width: 640px) {
    .tw-giro-card { flex-direction: row; align-items: flex-start; }
}

.tw-giro-empty {
    display: flex; align-items: center; justify-content: center;
    height: 100%;
    color: rgb(156 163 175);
    font-style: italic;
    font-size: 14px;
}


/* ---------- BANNER PRESENCE ---------- */
.tw-presence-banner {
    border-radius: 16px;
    border: 2px solid #FB923C;
    background: rgb(255 247 237);
    padding: 16px;
    margin-bottom: 8px;
}
.dark .tw-presence-banner { background: rgb(120 53 15 / 0.2); border-color: rgb(234 88 12); }

.tw-presence-avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    border-radius: 9999px;
    background: #F97316; color: white;
    font-size: 12px; font-weight: 700;
}

.tw-presence-chip {
    display: inline-flex; align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 9999px;
    background: white;
    border: 1px solid rgb(253 186 116);
    font-size: 13px;
}
.dark .tw-presence-chip { background: rgb(31 41 55); border-color: rgb(194 65 12); }


/* ---------- HEADER NAVIGAZIONE COMUNE ---------- */
.tw-nav-btn {
    padding: 8px 14px;
    border-radius: 8px;
    background: rgb(243 244 246);
    color: rgb(31 41 55);
    font-size: 14px; font-weight: 500;
    transition: background .15s;
    border: none; cursor: pointer;
    text-decoration: none;
    display: inline-flex; align-items: center;
}
.dark .tw-nav-btn { background: rgb(55 65 81); color: rgb(229 231 235); }
.tw-nav-btn:hover { background: rgb(229 231 235); }
.dark .tw-nav-btn:hover { background: rgb(75 85 99); }

.tw-nav-btn-primary { background: #F59E0B; color: white; }
.tw-nav-btn-primary:hover { background: #D97706; }

.tw-nav-info {
    padding: 8px 16px;
    background: white;
    border: 1px solid rgb(229 231 235);
    border-radius: 8px;
    font-size: 14px; font-weight: 700;
    color: rgb(31 41 55);
}
.dark .tw-nav-info { background: rgb(31 41 55); border-color: rgb(55 65 81); color: white; }


/* ---------- SCANNER PDF (overlay) ---------- */
#tw-scanner-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 99999;
    display: none;
    align-items: center; justify-content: center;
    padding: 16px;
    backdrop-filter: blur(6px);
}

.tw-scanner-modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.dark .tw-scanner-modal { background: rgb(17 24 39); color: rgb(229 231 235); }

.tw-scanner-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px;
    background: #F59E0B;
    color: white;
    font-size: 15px;
}

.tw-scanner-close {
    width: 32px; height: 32px;
    border-radius: 9999px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 22px; line-height: 1;
    border: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.tw-scanner-close:hover { background: rgba(255,255,255,0.35); }

.tw-scanner-body { padding: 18px; overflow-y: auto; flex: 1; }

.tw-scanner-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }

.tw-scanner-btn {
    padding: 12px 18px;
    border-radius: 10px;
    border: 2px solid rgb(229 231 235);
    background: white;
    color: rgb(31 41 55);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    flex: 1; min-width: 120px;
    transition: all .15s;
}
.dark .tw-scanner-btn { background: rgb(31 41 55); border-color: rgb(55 65 81); color: rgb(229 231 235); }
.tw-scanner-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.tw-scanner-btn.primary { background: #F59E0B; border-color: #F59E0B; color: white; }
.tw-scanner-btn.primary:hover { background: #D97706; border-color: #D97706; }
.tw-scanner-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.tw-scanner-confirm { margin-top: 16px; }

.tw-scanner-hint {
    background: rgb(254 243 199);
    border: 1px solid rgb(252 211 77);
    color: rgb(146 64 14);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
}
.dark .tw-scanner-hint { background: rgb(120 53 15 / 0.3); border-color: rgb(180 83 9); color: rgb(252 211 77); }

.tw-scanner-gallery {
    display: flex; gap: 8px; flex-wrap: wrap;
    min-height: 100px;
    padding: 10px;
    border: 2px dashed rgb(229 231 235);
    border-radius: 10px;
    background: rgb(249 250 251);
}
.dark .tw-scanner-gallery { background: rgb(31 41 55 / 0.5); border-color: rgb(55 65 81); }

.tw-scanner-thumb {
    position: relative;
    width: 80px; height: 110px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #F59E0B;
    background: black;
    flex-shrink: 0;
}
.tw-scanner-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tw-scanner-thumb-close {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    border-radius: 9999px;
    background: rgba(220,38,38,0.95);
    color: white; border: none;
    font-size: 16px; font-weight: bold; line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    z-index: 2;
}

.tw-scanner-thumb-label {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 3px 0;
    background: rgba(0,0,0,0.75);
    color: white;
    font-size: 10px; font-weight: 600; text-align: center;
}

.tw-scanner-cropbox { max-height: 60vh; overflow: hidden; margin-bottom: 12px; background: black; border-radius: 10px; }


/* ---------- ANTEPRIMA SICURA (overlay con iframe) ---------- */
#tw-anteprima-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
    z-index: 99999;
    display: none;
    flex-direction: column;
    backdrop-filter: blur(8px);
}

.tw-anteprima-head {
    padding: 12px 20px;
    display: flex; justify-content: space-between; align-items: center;
    background: #111;
    border-bottom: 1px solid #333;
    color: #F59E0B;
    font-weight: 700;
    font-size: 14px;
}

.tw-anteprima-content { flex: 1; overflow: auto; background: white; position: relative; }
.tw-anteprima-iframe { width: 100%; height: 100%; border: none; }

.tw-anteprima-spinner {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 40px; height: 40px;
    border: 4px solid rgba(245, 158, 11, 0.3);
    border-top-color: #F59E0B;
    border-radius: 9999px;
    animation: tw-spin 1s linear infinite;
}
@keyframes tw-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }


/* ---------- FOTO LOCALE PREVIEW ---------- */
.tw-foto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.tw-foto-thumb {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: 10px;
    overflow: hidden;
    background: rgb(243 244 246);
    border: 1px solid rgb(229 231 235);
    cursor: pointer;
}
.tw-foto-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.tw-foto-thumb:hover img { transform: scale(1.05); }
.tw-foto-thumb-del {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px;
    border-radius: 9999px;
    background: rgba(220,38,38,0.9);
    color: white; font-size: 14px; line-height: 1;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}


/* ---------- KANBAN: VERSIONE RESPONSIVE MOBILE ---------- */
/* Mobile-only: tabs in alto + 1 colonna a piena larghezza per volta */

.tw-kb-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 4px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
}
.tw-kb-tabs::-webkit-scrollbar { display: none; }

.tw-kb-tab {
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px 14px;
    border-radius: 9999px;
    background: rgb(243 244 246);
    color: rgb(31 41 55);
    font-size: 13px;
    font-weight: 600;
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all .15s;
    white-space: nowrap;
}
.dark .tw-kb-tab { background: rgb(55 65 81); color: rgb(229 231 235); }
.tw-kb-tab.is-active {
    background: white;
    border-color: var(--tab-color, #F59E0B);
    color: rgb(31 41 55);
}
.dark .tw-kb-tab.is-active { background: rgb(31 41 55); color: white; }

.tw-kb-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 9999px;
    background: var(--tab-color, #F59E0B);
    color: white;
    font-size: 11px;
    font-weight: 700;
}

/* Layout switch */
@media (max-width: 767px) {
    /* Mobile: una colonna alla volta, larghezza piena */
    .tw-kb-row {
        display: block;
        min-width: 0;
    }
    .tw-kb-col {
        width: 100%;
        margin-bottom: 0;
        display: none;
    }
    .tw-kb-col.is-active {
        display: flex;
    }
    .tw-kb-body {
        max-height: calc(100vh - 280px);
    }
}

@media (min-width: 768px) {
    /* Desktop+tablet: kanban classico orizzontale, nascondi le tabs */
    .tw-kb-tabs {
        display: none;
    }
}


/* ---------- SCANNER GALLERY (sezione integrata nei form) ---------- */
.tw-scanner-section {
    width: 100%;
}

.tw-scanner-section-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tw-scanner-section-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px;
    background: #F59E0B;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.tw-scanner-section-btn:hover { background: #D97706; transform: translateY(-1px); }

.tw-scanner-section-counter {
    font-size: 12px;
    color: rgb(107 114 128);
    background: rgb(243 244 246);
    padding: 4px 10px;
    border-radius: 9999px;
}
.dark .tw-scanner-section-counter { background: rgb(55 65 81); color: rgb(209 213 219); }

.tw-scanner-section-hint {
    font-size: 13px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgb(254 243 199);
    color: rgb(146 64 14);
    border: 1px solid rgb(252 211 77);
}
.dark .tw-scanner-section-hint { background: rgb(120 53 15 / 0.3); border-color: rgb(180 83 9); color: rgb(252 211 77); }

.tw-scanner-empty {
    padding: 24px;
    text-align: center;
    color: rgb(156 163 175);
    font-style: italic;
    font-size: 14px;
    border: 2px dashed rgb(229 231 235);
    border-radius: 10px;
    background: rgb(249 250 251);
}
.dark .tw-scanner-empty { background: rgb(31 41 55 / 0.5); border-color: rgb(55 65 81); }


/* ---------- SECURED GRID (thumbnail senza link diretti) ---------- */
.tw-secured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.tw-secured-thumb {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: rgb(243 244 246);
    border: 1px solid rgb(229 231 235);
    cursor: pointer;
    transition: all .15s;
    display: flex; flex-direction: column;
}
.dark .tw-secured-thumb { background: rgb(31 41 55); border-color: rgb(55 65 81); }
.tw-secured-thumb:hover { border-color: #F59E0B; box-shadow: 0 4px 12px rgba(0,0,0,0.10); transform: translateY(-1px); }

/* Quando contiene immagini → aspect ratio e img full */
.tw-secured-grid.is-image .tw-secured-thumb { aspect-ratio: 4/3; }
.tw-secured-grid.is-image .tw-secured-thumb img { width: 100%; height: 100%; object-fit: cover; }

.tw-secured-thumb img,
.tw-secured-img-placeholder {
    width: 100%;
    aspect-ratio: 4/3;
    display: block;
    object-fit: cover;
    background: rgb(243 244 246);
    position: relative;
}
.dark .tw-secured-img-placeholder { background: rgb(31 41 55 / 0.6); }

.tw-secured-spinner {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 24px; height: 24px;
    border: 3px solid rgba(245, 158, 11, 0.3);
    border-top-color: #F59E0B;
    border-radius: 9999px;
    animation: tw-spin 1s linear infinite;
}

.tw-secured-doc-icon {
    aspect-ratio: 4/3;
    display: flex; align-items: center; justify-content: center;
    font-size: 48px;
    background: rgb(243 244 246);
}
.dark .tw-secured-doc-icon { background: rgb(31 41 55 / 0.6); }

.tw-secured-thumb-info {
    padding: 8px 10px;
    flex: 1;
    display: flex; flex-direction: column;
    gap: 2px;
}

.tw-secured-thumb-name {
    font-size: 12px; font-weight: 600;
    color: rgb(31 41 55);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dark .tw-secured-thumb-name { color: rgb(229 231 235); }

.tw-secured-thumb-meta {
    font-size: 10px;
    color: rgb(107 114 128);
}

.tw-secured-thumb-del {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px;
    border-radius: 9999px;
    background: rgba(220,38,38,0.92);
    color: white;
    font-size: 14px; font-weight: bold; line-height: 1;
    border: none;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.tw-secured-thumb-del:hover { background: rgba(185,28,28,1); }


/* ---------- FIX CROPPER: handle e margini visibili ---------- */
.tw-scanner-cropbox {
    max-height: 65vh;
    overflow: visible;        /* era hidden — nascondeva le handle Cropper */
    margin-bottom: 12px;
    background: #1F2937;
    border-radius: 10px;
    padding: 8px;
}

/* Handle Cropper più visibili (linee + punti dei margini) */
.cropper-line { background-color: #F59E0B !important; opacity: 0.9 !important; }
.cropper-point { background-color: #F59E0B !important; opacity: 1 !important; width: 12px !important; height: 12px !important; }
.cropper-view-box { outline: 2px solid #F59E0B !important; outline-color: #F59E0B !important; }
.cropper-dashed { border-color: rgba(245, 158, 11, 0.5) !important; }


/* ---------- KANBAN OVERRIDE: card piu' compatte + bottoni disabled ---------- */
.tw-kb-col { width: 240px; }
@media (min-width: 1024px) { .tw-kb-col { width: 250px; } }
@media (min-width: 1280px) { .tw-kb-col { width: 270px; } }

.tw-kb-card {
    padding: 8px 10px;
}
.tw-kb-card:last-child { margin-bottom: 0; }

.tw-iconbtn-disabled {
    background: rgb(243 244 246) !important;
    color: rgb(156 163 175) !important;
    opacity: 0.55;
    cursor: not-allowed !important;
}
.dark .tw-iconbtn-disabled {
    background: rgb(55 65 81) !important;
    color: rgb(107 114 128) !important;
}
.tw-iconbtn-disabled:hover { transform: none !important; box-shadow: none !important; }

/* Tabs mobile leggermente piu' grandi/leggibili */
.tw-kb-tab { padding: 9px 16px; font-size: 14px; }
.tw-kb-tab-count { min-width: 26px; height: 24px; font-size: 12px; }


/* ===================================================================
 * KANBAN v7 — FIX FINALE: tabs sempre visibili mobile + colonne strette desktop
 * =================================================================== */

/* ---------- MOBILE TABS: griglia 3 colonne, tutte visibili ---------- */
@media (max-width: 767px) {
    #tw-kb-tabs.tw-kb-tabs {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        overflow: visible !important;
        padding: 4px 0 8px !important;
        margin-bottom: 10px !important;
    }
    #tw-kb-tabs .tw-kb-tab {
        flex: none !important;
        padding: 8px 6px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        justify-content: center !important;
        border-width: 2px !important;
    }
    #tw-kb-tabs .tw-kb-tab .tw-pin-sm {
        width: 6px !important;
        height: 6px !important;
    }
    #tw-kb-tabs .tw-kb-tab span:nth-child(2) {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 65px;
    }
    #tw-kb-tabs .tw-kb-tab .tw-kb-tab-count {
        min-width: 20px !important;
        height: 18px !important;
        padding: 0 5px !important;
        font-size: 10px !important;
    }
}


/* ===================================================================
 * KANBAN v8 — Layout responsive che si adatta al monitor
 *
 * Mobile (<768px):  tabs in griglia 3x2 + 1 colonna per volta full-width
 * Desktop:           colonne flex che riempiono lo spazio disponibile
 *                    se non ci stanno tutte → scroll orizzontale automatico
 * =================================================================== */

/* MOBILE: tabs in griglia 3 colonne 2 righe (tutte visibili, no scroll) */
@media (max-width: 767px) {
    #tw-kb-tabs.tw-kb-tabs {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
        overflow: visible !important;
        padding: 4px 0 8px !important;
        margin-bottom: 10px !important;
    }
    #tw-kb-tabs .tw-kb-tab {
        flex: none !important;
        padding: 8px 6px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        justify-content: center !important;
        border-width: 2px !important;
    }
    #tw-kb-tabs .tw-kb-tab .tw-pin-sm { width: 6px !important; height: 6px !important; }
    #tw-kb-tabs .tw-kb-tab span:nth-child(2) {
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 70px;
    }
    #tw-kb-tabs .tw-kb-tab .tw-kb-tab-count {
        min-width: 20px !important;
        height: 18px !important;
        padding: 0 5px !important;
        font-size: 10px !important;
    }
}

/* DESKTOP: colonne flex auto che riempiono lo spazio.
 * min-width: 240px → sotto questa larghezza scattera' scroll orizzontale.
 * flex: 1 1 240px → si espandono per riempire spazio extra disponibile. */
@media (min-width: 768px) {
    .tw-kb-row {
        display: flex !important;
        gap: 12px !important;
        width: 100% !important;
        min-width: max-content;
    }
    .tw-kb-col {
        flex: 1 1 240px !important;
        width: auto !important;
        min-width: 240px !important;
        max-width: 320px !important;
    }
}

/* DESKTOP card: dimensioni standard leggibili */
@media (min-width: 768px) {
    .tw-kb-card { padding: 10px 12px !important; }
    .tw-kb-card a { font-size: 14px !important; }
    .tw-iconbtn-sm {
        width: 30px !important;
        height: 30px !important;
        font-size: 13px !important;
    }
}
