/* --- NEW MODAL STYLES FROM PREMIUM COMPACT PROTOTYPE --- */

        .premium-modal {
            --bg-base: #f1f5f9;
            --bg-surface: #ffffff;
            --text-primary: #0f172a;
            --text-secondary: #334155;
            --text-muted: #64748b;
            --border-color: #e2e8f0;
            --primary: #e11d48;
            --primary-light: #fff1f2;
            --secondary: #0ea5e9;
            --success: #10b981;
            --danger: #f43f5e;
            --warning: #f59e0b;
            --radius-md: 10px;
            --radius-lg: 16px;
            --shadow-float: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
        }

        

        .premium-modal.modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(15, 23, 42, 0.5);
            backdrop-filter: blur(6px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .premium-modal.modal-overlay.active {
            display: flex;
        }

        /* Modale compatto ma ampio a sufficienza per zero scroll */
        .premium-modal .modal-box {
            background: rgba(255, 255, 255, 0.98);
            backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.8);
            border-radius: var(--radius-lg);
            width: 95vw;
            max-width: 1150px; /* Ridimensionato: leggermente più piccolo */
            display: flex;
            flex-direction: column;
            box-shadow: var(--shadow-float);
            animation: scaleUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
            overflow: hidden;
        }

        @keyframes scaleUp { from { transform: scale(0.96) translateY(10px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

        .premium-modal .modal-header {
            padding: 12px 24px;
            background: linear-gradient(to right, #ffffff, #f8fafc);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .premium-modal .header-title-group {
            display: flex;
            align-items: center;
            gap: 14px;
        }

        .premium-modal .header-icon {
            width: 44px;
            height: 44px;
            background: linear-gradient(135deg, var(--primary), var(--secondary));
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.4rem;
            color: white;
            box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
        }

        .premium-modal .header-text h2 { 
            margin: 0; 
            font-family: 'Plus Jakarta Sans', sans-serif; 
            font-size: 1.3rem; 
            font-weight: 700; 
            color: #0f172a; 
            letter-spacing: -0.3px;
        }
        .premium-modal .header-text p { 
            margin: 2px 0 0; 
            font-size: 0.8rem; 
            color: var(--text-muted); 
            font-weight: 500; 
        }

        .premium-modal .modal-close {
            background: transparent;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 8px;
            font-size: 1.2rem;
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .premium-modal .modal-close:hover { background: #f1f5f9; color: var(--danger); transform: rotate(90deg); }

        .premium-modal .modal-body {
            padding: 12px 24px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            overflow-y: auto;
            flex: 1;
            min-height: 0;
        }

        .premium-modal .glass-card {
            background: #ffffff;
            border: 1px solid #e2e8f0;
            border-radius: var(--radius-md);
            padding: 12px; /* Padding compatto */
            box-shadow: 0 2px 4px rgba(0,0,0,0.02);
            transition: all 0.2s ease;
        }
        .premium-modal .glass-card:hover { border-color: #cbd5e1; box-shadow: 0 4px 12px rgba(0,0,0,0.04); }

        .premium-modal .card-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 14px;
        }

        .premium-modal .card-header h3 { 
            margin: 0; 
            font-family: 'Plus Jakarta Sans', sans-serif; 
            font-size: 0.95rem; 
            font-weight: 700; 
            color: var(--text-secondary); 
            text-transform: uppercase; 
            letter-spacing: 0.6px; 
            display: flex;
            align-items: center;
            gap: 6px;
        }

        /* Griglia flessibile a 4 colonne base */
        .premium-modal .grid-4-cols {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 8px;
            align-items: start;
        }
        
        .premium-modal .col-span-2 { grid-column: span 2; }
        .premium-modal .col-span-3 { grid-column: span 3; }
        .premium-modal .col-span-4 { grid-column: span 4; }

        .premium-modal .form-group { margin-bottom: 0; }
        
        /* Etichette compatte con icone inline */
        .premium-modal label { 
            display: flex; 
            align-items: center; 
            gap: 4px; 
            font-size: 0.75rem; 
            font-weight: 600; 
            color: var(--text-secondary); 
            margin-bottom: 4px; 
            text-transform: uppercase;
            letter-spacing: 0.3px;
        }
        .premium-modal .required-asterisk { color: var(--danger); }

        .premium-modal input[type="text"], .premium-modal input[type="number"], .premium-modal select {
            width: 100%;
            padding: 5px 8px; /* Input più bassi */
            font-family: 'Inter', sans-serif;
            font-size: 0.85rem;
            font-weight: 600;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            background: #f8fafc;
            color: var(--text-primary);
            box-sizing: border-box;
            transition: all 0.2s;
        }
        .premium-modal input[type="text"]:focus, .premium-modal input[type="number"]:focus, .premium-modal select:focus {
            outline: none;
            border-color: var(--primary);
            background: #ffffff;
            box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.1);
        }

        .premium-modal #srv-name { font-size: 0.95rem; font-weight: 700; padding: 10px 12px; background: #ffffff; border-color: #cbd5e1; }

        .premium-modal .modern-checkbox {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 12px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.8rem;
            transition: all 0.2s;
            height: 100%;
            box-sizing: border-box;
            background: #f8fafc;
        }
        .premium-modal .modern-checkbox:hover { background: #ffffff; border-color: var(--primary); }
        .premium-modal .modern-checkbox input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; margin: 0; }

        .premium-modal .modal-footer {
            padding: 10px 24px;
            background: #f8fafc;
            border-top: 1px solid var(--border-color);
            display: flex;
            justify-content: flex-end;
            gap: 12px;
        }

        .premium-modal .btn {
            padding: 6px 16px;
            font-family: 'Plus Jakarta Sans', sans-serif;
            font-size: 0.85rem;
            font-weight: 700;
            border-radius: 6px;
            cursor: pointer;
            border: none;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            transition: all 0.2s;
        }
        .premium-modal .btn-secondary { background: #ffffff; color: var(--text-secondary); border: 1px solid var(--border-color); box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
        .premium-modal .btn-secondary:hover { background: #f1f5f9; color: var(--text-primary); }
        .premium-modal .btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #ffffff; box-shadow: 0 4px 10px rgba(225, 29, 72, 0.25); }
        .premium-modal .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(225, 29, 72, 0.35); filter: brightness(1.05); }

        .premium-modal .btn-lis-params {
            width: 100%;
            background: #fff1f2;
            border: 1px dashed #93c5fd;
            color: #be123c;
            padding: 12px;
            border-radius: 8px;
            font-weight: 700;
            font-family: 'Plus Jakarta Sans', sans-serif;
            font-size: 0.85rem;
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            transition: all 0.2s;
        }
        .premium-modal .btn-lis-params:hover { border-color: #e11d48; background: #ffe4e6; }
        .premium-modal .badge { background: #e11d48; color: white; padding: 2px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: 700; }

        .premium-modal .hidden { display: none !important; }

        /* Icon Utilities */
        .premium-modal .ico { font-style: normal; margin-right: 2px; font-size: 1.1em; opacity: 0.8; }
        .premium-modal .card-icon { font-size: 1.2rem; }

        .premium-modal .grid-2-cols {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 12px;
        }

/* ==========================================================================
   RESTYLING SCOPED LIS ACCEPTANCE MODAL (#modal-add-sample) - ZERO SCROLL
   ========================================================================== */

#modal-add-sample .modal-box {
    max-width: 1150px;
    max-height: 90vh;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#modal-add-sample .modal-header {
    padding: 12px 20px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

#modal-add-sample .modal-header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 10px;
}

#modal-add-sample .modal-header h2 .icon-badge {
    color: #e11d48;
    background: #fff1f2;
    padding: 6px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#modal-add-sample .modal-close {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.15s ease;
}

#modal-add-sample .modal-close:hover {
    background: #fef2f2;
    color: #ef4444;
    transform: rotate(90deg);
}

#modal-add-sample .modal-body {
    padding: 16px 20px;
    display: grid;
    grid-template-columns: 1fr 1.1fr 1fr;
    gap: 16px;
    overflow: hidden;
    background: #f8fafc;
}

#modal-add-sample .glass-panel {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    min-height: 0;
}

#modal-add-sample .glass-panel:hover {
    box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e1;
}

#modal-add-sample .panel-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 6px;
}

#modal-add-sample .panel-title i,
#modal-add-sample .panel-title svg {
    color: #e11d48;
    width: 14px;
    height: 14px;
}

#modal-add-sample .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

#modal-add-sample label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #334155;
    display: flex;
    justify-content: space-between;
}

#modal-add-sample label span {
    color: #ef4444;
}

#modal-add-sample .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

#modal-add-sample .input-wrapper i.icon-left,
#modal-add-sample .input-wrapper svg.icon-left {
    position: absolute;
    left: 10px;
    color: #64748b;
    pointer-events: none;
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
}

#modal-add-sample input[type="text"], 
#modal-add-sample input[type="number"], 
#modal-add-sample select {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    font-size: 0.85rem;
    color: #0f172a;
    box-sizing: border-box;
    height: 32px;
}

#modal-add-sample select, 
#modal-add-sample .no-icon {
    padding-left: 10px !important;
}

#modal-add-sample input:focus, 
#modal-add-sample select:focus {
    outline: none;
    border-color: #e11d48;
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.1);
}

#modal-add-sample .action-row {
    display: flex;
    gap: 6px;
    width: 100%;
}

/* Pulsanti Quick-Action Colorati */
#modal-add-sample .icon-btn-add {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #047857;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

#modal-add-sample .icon-btn-add:hover {
    background: #d1fae5;
    border-color: #34d399;
    color: #065f46;
    transform: scale(1.05);
}

#modal-add-sample .icon-btn-edit {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #be123c;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

#modal-add-sample .icon-btn-edit:hover {
    background: #ffe4e6;
    border-color: #60a5fa;
    color: #881337;
    transform: scale(1.05);
}

#modal-add-sample .icon-btn-add i,
#modal-add-sample .icon-btn-add svg,
#modal-add-sample .icon-btn-edit i,
#modal-add-sample .icon-btn-edit svg {
    width: 14px;
    height: 14px;
}

/* Blocco Privacy GDPR */
#modal-add-sample .privacy-block,
#modal-add-ris .privacy-block {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.76rem;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

#modal-add-sample .privacy-block.neutral,
#modal-add-ris .privacy-block.neutral {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
}

#modal-add-sample .privacy-block.signed,
#modal-add-ris .privacy-block.signed {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

#modal-add-sample .privacy-block.unsigned,
#modal-add-ris .privacy-block.unsigned {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

#modal-add-sample .privacy-block button.btn-outline,
#modal-add-ris .privacy-block button.btn-outline {
    background: #ffffff;
    border: 1px solid #fca5a5;
    color: #991b1b;
    padding: 4px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

#modal-add-sample .privacy-block button.btn-outline:hover,
#modal-add-ris .privacy-block button.btn-outline:hover {
    background: #fef2f2;
    border-color: #ef4444;
    color: #7f1d1d;
}

#modal-add-sample .privacy-block i,
#modal-add-sample .privacy-block svg,
#modal-add-ris .privacy-block i,
#modal-add-ris .privacy-block svg {
    width: 12px;
    height: 12px;
}

/* SSN Toggle arancione */
#modal-add-sample .ssn-container-box {
    background: #fff7ed;
    border: 1px dashed #fdba74;
    border-radius: 10px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#modal-add-sample .ssn-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    width: 100%;
}

#modal-add-sample .toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background-color: #cbd5e1;
    border-radius: 10px;
    flex-shrink: 0;
}

#modal-add-sample .toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: white;
    top: 2px;
    left: 2px;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

#modal-add-sample input.sam-toggle-input {
    display: none;
}

#modal-add-sample input.sam-toggle-input:checked + .toggle-switch {
    background-color: #ea580c;
}

#modal-add-sample input.sam-toggle-input:checked + .toggle-switch::after {
    left: 18px;
}

/* Assicurazione Toggle e Details Box */
#modal-add-sample .insurance-details-box {
    background: #f5f3ff;
    border: 1px dashed #ddd6fe;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

#modal-add-sample .insurance-box-title {
    font-weight: 700;
    font-size: 0.75rem;
    color: #e11d48;
    display: flex;
    align-items: center;
    gap: 4px;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    padding-bottom: 4px;
}

#modal-add-sample .ssn-recipe-card {
    background: #ffffff;
    border: 1px solid #ffedd5;
    border-left: 3px solid #ea580c;
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#modal-add-sample .ssn-recipe-card-title {
    font-weight: 700;
    font-size: 0.75rem;
    color: #c2410c;
    display: flex;
    align-items: center;
    gap: 4px;
}

#modal-add-sample .ssn-recipe-details {
    font-size: 0.72rem;
    color: #334155;
    line-height: 1.3;
}

#modal-add-sample .ssn-recipe-action {
    align-self: flex-start;
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #c2410c;
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
}

/* Selected tests tags (Dynamic scroll) */
#modal-add-sample .selected-tags-container {
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap !important;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

#modal-add-sample .selected-tags-container > div {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    margin-bottom: 0px !important;
}

#modal-add-sample .selected-tags-container strong {
    color: #e11d48;
    background: #fff1f2;
    padding: 1px 4px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 4px;
}

#modal-add-sample .test-tag-remove {
    color: #64748b !important;
    font-size: 1.1rem;
    margin-left: 4px;
    cursor: pointer;
    vertical-align: middle;
}

#modal-add-sample .test-tag-remove:hover {
    color: #ef4444 !important;
}

#modal-add-sample .sam-price-input {
    width: 65px !important;
    padding: 2px 4px !important;
    text-align: right !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    color: #0f172a !important;
    background: #f8fafc !important;
    height: 24px !important;
}

/* Calcoli Finanziari */
#modal-add-sample .finance-panel {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    margin: -14px;
    margin-top: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#modal-add-sample .finance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #64748b;
}

#modal-add-sample .finance-row strong {
    color: #334155;
    font-weight: 600;
    font-size: 0.8rem;
}

#modal-add-sample .finance-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px dashed #cbd5e1;
    font-size: 1rem;
    font-weight: 800;
    color: #e11d48;
}

/* Footer & Bottoni */
#modal-add-sample .modal-footer {
    padding: 10px 20px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Pulsante Annulla Soft Slate */
#modal-add-sample .btn-cancel {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    color: #334155;
    cursor: pointer;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    transition: all 0.2s ease;
}

#modal-add-sample .btn-cancel:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
}

#modal-add-sample .btn-submit {
    background: linear-gradient(135deg, #e11d48 0%, #e11d48 100%);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.2);
    height: 32px;
}

#modal-add-sample .btn-submit:hover {
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.25);
    transform: translateY(-0.5px);
}

#modal-add-sample .btn-cancel i,
#modal-add-sample .btn-cancel svg,
#modal-add-sample .btn-submit i,
#modal-add-sample .btn-submit svg {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* --- OTTIMIZZAZIONE RESPONSIVA COMPATTA MODALE ACCETTAZIONE RIS (ZERO SCROLL) --- */

/* Contenitore principale del modale RIS */
#modal-add-ris.premium-modal .ris-modal-box {
    max-width: 1100px;
    width: 95%;
    max-height: 96vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
}

/* Riduzione generale di padding e margini */
#modal-add-ris .ris-form-body {
    padding: 10px 16px !important;
    gap: 8px !important;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

#modal-add-ris .modal-header {
    padding: 10px 16px !important;
}

#modal-add-ris .modal-footer {
    padding: 10px 16px !important;
}

#modal-add-ris .section-card {
    background: rgba(99, 102, 241, 0.03); /* primary rgb fallback */
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-lg);
    padding: 10px 14px !important;
    margin-bottom: 0 !important;
}

#modal-add-ris .ris-card {
    background: white !important;
    border-radius: var(--radius-lg) !important;
    padding: 10px 14px !important;
    border: 1px solid var(--border-color) !important;
}

#modal-add-ris .form-group {
    margin-bottom: 6px !important;
}

#modal-add-ris label {
    font-size: 0.72rem !important;
    margin-bottom: 2px !important;
}

#modal-add-ris input, 
#modal-add-ris select {
    padding: 5px 8px !important;
    font-size: 0.82rem !important;
    height: 32px !important;
    box-sizing: border-box;
}

#modal-add-ris #ris-patient-search,
#modal-add-ris #ris-service-search {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    padding-left: 36px !important;
    line-height: 30px !important;
}

#modal-add-ris .btn,
#modal-add-ris button {
    padding: 6px 12px !important;
    font-size: 0.82rem !important;
    height: 32px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#modal-add-ris .privacy-block {
    padding: 5px 10px !important;
    margin-top: 4px !important;
    font-size: 0.76rem !important;
}

#modal-add-ris #ris-selected-services {
    margin-top: 6px !important;
    max-height: 160px !important;
}

/* Riepilogo finanziario allineato in fondo alla colonna 3 */
#modal-add-ris .ris-finance-summary {
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    margin: auto -14px 0 -14px;
    padding: 10px 14px;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* Gestione delle colonne responsive */
.ris-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ris-columns-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

/* Media query per Tablet e schermi medi */
@media (max-width: 1024px) {
    #modal-add-ris.premium-modal .ris-modal-box {
        width: 98vw;
        max-height: 98vh;
    }
    
    .ris-columns-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    /* Spostiamo la terza colonna sotto a larghezza intera */
    .ris-columns-grid > div:nth-child(3) {
        grid-column: span 2;
    }
    
    #modal-add-ris .ris-finance-summary {
        margin: 10px -14px 0 -14px;
    }
}

/* Media query per Mobile (smartphone) */
@media (max-width: 768px) {
    #modal-add-ris.premium-modal .ris-modal-box {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }
    
    #modal-add-ris .modal-header {
        border-radius: 0;
    }
    
    #modal-add-ris .modal-footer {
        border-radius: 0;
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    #modal-add-ris .modal-footer > div {
        flex-direction: column;
        display: flex;
        gap: 6px;
    }
    
    #modal-add-ris .modal-footer button {
        width: 100%;
    }
    
    .ris-top-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .ris-columns-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .ris-columns-grid > div:nth-child(3) {
        grid-column: span 1;
    }
    
    #modal-add-ris .ris-finance-summary {
        margin: 10px -14px 0 -14px;
    }
}

/* Media query basata sull'altezza dello schermo per PC a bassa risoluzione (evita scrollo verticale) */
@media (max-height: 800px) {
    #modal-add-ris .ris-form-body {
        padding: 6px 12px !important;
        gap: 6px !important;
    }
    
    #modal-add-ris .section-card {
        padding: 8px 12px !important;
    }
    
    #modal-add-ris .ris-card {
        padding: 8px 12px !important;
    }
    
    #modal-add-ris .form-group {
        margin-bottom: 4px !important;
    }
    
    #modal-add-ris input, 
    #modal-add-ris select {
        height: 28px !important;
        padding: 4px 6px !important;
        font-size: 0.78rem !important;
    }
    
    #modal-add-ris #ris-patient-search,
    #modal-add-ris #ris-service-search {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        padding-left: 36px !important;
        line-height: 26px !important;
    }
    
    #modal-add-ris .btn,
    #modal-add-ris button {
        height: 28px !important;
        font-size: 0.78rem !important;
    }
    
    #modal-add-ris label {
        font-size: 0.68rem !important;
    }
    
    #modal-add-ris #ris-selected-services {
        max-height: 110px !important;
    }
}

#modal-dicom-viewer .dicom-layout.no-viewer #dicom-report-editor.rich-editor {
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    overflow-y: auto !important;
}

/* Stili per il nuovo modale indipendente delle visite specialistiche */
#modal-specialist-visit-report #visit-report-editor.rich-editor {
    min-height: 350px !important;
    max-height: 650px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#modal-specialist-visit-report .dicom-layout {
    display: grid;
    grid-template-columns: 1.6fr 0.9fr;
    gap: 20px;
    height: 100%;
}

.modal-header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.modal-header-actions .btn {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    height: auto !important;
    line-height: 1.2 !important;
}

/* Toolbar ed elementi editor compatti per i modali premium per salvare spazio verticale */
.premium-modal .editor-toolbar {
    padding: 4px 8px !important;
    gap: 4px !important;
}

.premium-modal .editor-btn {
    min-width: 28px !important;
    width: auto !important;
    height: 28px !important;
    padding: 0 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
}

.premium-modal .editor-btn i {
    width: 14px !important;
    height: 14px !important;
}

.premium-modal .editor-separator {
    height: 18px !important;
    margin: 0 3px !important;
}

.premium-modal .editor-select {
    padding: 3px 6px !important;
    font-size: 0.76rem !important;
    height: 28px !important;
}


/* Responsive layout adjustments for lower vertical resolution screens */
@media (max-height: 800px) {
    #modal-dicom-viewer .dicom-layout.no-viewer #dicom-report-editor.rich-editor {
        flex: 1 !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
    }
    #modal-specialist-visit-report #visit-report-editor.rich-editor {
        min-height: 200px !important;
        max-height: 460px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }
}

/* --- STILI SCURI PREMIUM PER IL MODALE DELLE VISITE SPECIALISTICHE --- */
#modal-specialist-visit-report,
.premium-modal#modal-specialist-visit-report {
    --bg-base: #0f172a !important;
    --bg-surface: #1e293b !important;
    --text-primary: #f1f5f9 !important;
    --text-secondary: #94a3b8 !important;
    --text-muted: #64748b !important;
    --text-main: #f1f5f9 !important;
    --border-color: rgba(255, 255, 255, 0.08) !important;
    --primary: #fb7185 !important;
    --primary-light: rgba(99, 102, 241, 0.15) !important;
    --secondary: #0ea5e9 !important;
    --purple: #8b5cf6 !important;
    
    background: rgba(15, 23, 42, 0.75) !important;
    backdrop-filter: blur(12px) !important;
}

#modal-specialist-visit-report .modal-box {
    background: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5) !important;
}

#modal-specialist-visit-report .modal-header {
    background: linear-gradient(90deg, rgba(30, 41, 59, 0.5), rgba(15, 23, 42, 0.5)) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#modal-specialist-visit-report .modal-header h2 {
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report .modal-close {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
}

#modal-specialist-visit-report .modal-close:hover {
    background: rgba(244, 63, 94, 0.2) !important;
    color: #f43f5e !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
}

/* Info Bar Paziente in versione scura */
#modal-specialist-visit-report div[style*="background: rgba(99, 102, 241, 0.08)"],
#modal-specialist-visit-report div[style*="background:rgba(99,102,241,0.08)"],
#modal-specialist-visit-report .patient-bar {
    background: rgba(99, 102, 241, 0.06) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report div[style*="background: rgba(99, 102, 241, 0.08)"] strong,
#modal-specialist-visit-report div[style*="background:rgba(99,102,241,0.08)"] strong {
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report div[style*="background: rgba(99, 102, 241, 0.08)"] span,
#modal-specialist-visit-report div[style*="background:rgba(99,102,241,0.08)"] span {
    color: #94a3b8 !important;
}

/* Pannello di refertazione (colonna sinistra) trasparente */
#modal-specialist-visit-report .dicom-report-panel,
#modal-specialist-visit-report #visit-report-panel {
    background-color: transparent !important;
}

/* Labels e Form Controls */
#modal-specialist-visit-report label {
    color: #94a3b8 !important;
}

#modal-specialist-visit-report input[type="text"],
#modal-specialist-visit-report select {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report input[type="text"]:focus,
#modal-specialist-visit-report select:focus {
    border-color: #fb7185 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
    background: rgba(30, 41, 59, 0.9) !important;
}

#modal-specialist-visit-report select option {
    background: #0f172a !important;
    color: #f1f5f9 !important;
}

/* WYSIWYG Editor scuro */
#modal-specialist-visit-report .editor-container {
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    background: rgba(30, 41, 59, 0.4) !important;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2) !important;
}

#modal-specialist-visit-report .editor-toolbar {
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-bottom: none !important;
}

#modal-specialist-visit-report .editor-btn {
    color: #94a3b8 !important;
}

#modal-specialist-visit-report .editor-btn:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report .editor-btn.active {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #fb7185 !important;
}

#modal-specialist-visit-report .editor-separator {
    background: rgba(255, 255, 255, 0.08) !important;
}

#modal-specialist-visit-report .editor-select {
    background: rgba(15, 23, 42, 0.8) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
}

#modal-specialist-visit-report .editor-voice-btn,
#modal-specialist-visit-report #btn-visit-voice-dictation {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
}

#modal-specialist-visit-report .editor-voice-btn:hover,
#modal-specialist-visit-report #btn-visit-voice-dictation:hover {
    background: rgba(16, 185, 129, 0.1) !important;
    color: #10b981 !important;
    border-color: rgba(16, 185, 129, 0.2) !important;
}

#modal-specialist-visit-report .editor-voice-btn.recording,
#modal-specialist-visit-report #btn-visit-voice-dictation.recording {
    background: rgba(244, 63, 94, 0.2) !important;
    color: #f43f5e !important;
    border-color: rgba(244, 63, 94, 0.4) !important;
}

#modal-specialist-visit-report .rich-editor,
#modal-specialist-visit-report #visit-report-editor.rich-editor {
    color: #f1f5f9 !important;
    background-color: #0f172a !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#modal-specialist-visit-report .rich-editor:focus,
#modal-specialist-visit-report #visit-report-editor.rich-editor:focus {
    background-color: #1e293b !important;
    border-color: #fb7185 !important;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25) !important;
}

/* Colonna Destra: Storico Clinico */
#modal-specialist-visit-report #visit-layout-grid > div:last-child {
    background: rgba(15, 23, 42, 0.3) !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-left: 15px !important;
}

#modal-specialist-visit-report #visit-layout-grid h3 {
    color: #fb7185 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    padding-bottom: 8px !important;
}

#modal-specialist-visit-report #ris-history-list > div {
    background: rgba(30, 41, 59, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #94a3b8 !important;
}

#modal-specialist-visit-report #ris-history-list > div:hover {
    border-color: rgba(99, 102, 241, 0.3) !important;
    background: rgba(30, 41, 59, 0.9) !important;
}

#modal-specialist-visit-report #ris-history-list > div strong {
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report #ris-history-list > div span {
    color: #94a3b8 !important;
}

/* Footer / Submit area del form */
#modal-specialist-visit-report div[style*="border-top: 1px solid var(--border-color)"] {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

#modal-specialist-visit-report #visit-autosave-indicator {
    color: #64748b !important;
}

#modal-specialist-visit-report .btn-secondary,
#modal-specialist-visit-report #btn-visit-draft {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f1f5f9 !important;
}

#modal-specialist-visit-report .btn-secondary:hover,
#modal-specialist-visit-report #btn-visit-draft:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

#modal-specialist-visit-report .btn-primary,
#modal-specialist-visit-report #btn-visit-report-submit {
    background: linear-gradient(135deg, #fb7185, #e11d48) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3) !important;
}

#modal-specialist-visit-report .btn-primary:hover,
#modal-specialist-visit-report #btn-visit-report-submit:hover {
    background: linear-gradient(135deg, #818cf8, #e11d48) !important;
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5) !important;
    transform: translateY(-1px) !important;
}

/* Pulsante PACS in alto */
#modal-specialist-visit-report #btn-visit-pacs-retrieve {
    background: #8b5cf6 !important;
    border-color: #8b5cf6 !important;
    color: #ffffff !important;
}

#modal-specialist-visit-report #btn-visit-pacs-retrieve:hover {
    background: #a78bfa !important;
    border-color: #a78bfa !important;
}

/* --- OTTIMIZZAZIONE RESPONSIVA ZERO-SCROLL PER TUTTI I MODALI PREMIUM --- */
.premium-modal .modal-box {
    max-height: 92vh !important;
    height: 90vh !important;
    width: 95vw !important;
    max-width: 1400px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.premium-modal .modal-header,
.premium-modal .patient-bar {
    flex-shrink: 0 !important;
}

.premium-modal .layout-grid,
.premium-modal .dicom-layout {
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    overflow: hidden !important;
    height: 100% !important;
}

.premium-modal .editor-panel,
.premium-modal .dicom-report-panel {
    flex: 65 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: hidden !important;
    min-height: 0 !important;
    height: 100% !important;
}

.premium-modal .history-panel,
.premium-modal .dicom-history-panel {
    flex: 35 !important;
    overflow-y: auto !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: 100% !important;
}

.premium-modal form {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
}

.premium-modal .form-group {
    flex-shrink: 0 !important;
}

.premium-modal .form-group[style*="flex: 1"] {
    flex: 1 !important;
    min-height: 200px !important;
}

.premium-modal .editor-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 150px !important;
}

.premium-modal .rich-editor {
    flex: 1 !important;
    min-height: 100px !important;
    overflow-y: auto !important;
}

.premium-modal .footer-actions {
    flex-shrink: 0 !important;
    margin-top: auto !important;
}

/* Media query per portatili con risoluzione verticale ridotta */
@media (max-height: 800px) {
    .premium-modal .modal-box {
        height: 95vh !important;
        max-height: 97vh !important;
    }
    .premium-modal .form-group[style*="flex: 1"] {
        min-height: 150px !important;
    }
    .premium-modal .editor-container {
        min-height: 120px !important;
    }
    .premium-modal .rich-editor {
        min-height: 80px !important;
    }
}

/* --- STILI PREMIUM LIGHT PER IL MODALE RIS (REFERTAZIONE & VIEWER) --- */
#modal-dicom-viewer,
.premium-modal#modal-dicom-viewer {
    background: rgba(3, 7, 18, 0.94) !important;
    backdrop-filter: blur(12px) !important;
}

#modal-dicom-viewer .modal-box {
    width: 97vw !important;
    max-width: 1900px !important;
    height: 96vh !important;
    max-height: 96vh !important;
    min-height: 820px !important;
    background: #090d16 !important;
    border: 1px solid #1e293b !important;
    color: #f1f5f9 !important;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9) !important;
    border-radius: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#modal-dicom-viewer .modal-header {
    background: #0f172a !important;
    border-bottom: 1px solid #1e293b !important;
    color: #f8fafc !important;
}

#modal-dicom-viewer .modal-close {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-size: 1.4rem !important;
    cursor: pointer !important;
}

#modal-dicom-viewer .modal-close:hover {
    color: #f8fafc !important;
}

#modal-dicom-viewer label {
    color: #cbd5e1 !important;
}

#modal-dicom-viewer input[type="text"],
#modal-dicom-viewer input[type="number"],
#modal-dicom-viewer select {
    background: #090d16 !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    border-radius: 6px !important;
}

#modal-dicom-viewer input:focus,
#modal-dicom-viewer select:focus {
    border-color: #00f0ff !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.25) !important;
}

#modal-dicom-viewer #dicom-layout-grid {
    background: #090d16 !important;
    display: grid !important;
    grid-template-columns: 1fr 280px !important;
    gap: 14px !important;
    padding: 10px 20px 12px 20px !important;
    flex: 1 !important;
    min-height: 0 !important;
    height: calc(100% - 130px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

#modal-dicom-viewer .dicom-report-panel {
    flex: none !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow-y: hidden !important;
    padding-right: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
}

#modal-dicom-viewer .dicom-history-panel {
    flex: none !important;
    width: 320px !important;
    min-width: 300px !important;
    max-width: 340px !important;
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
    height: 100% !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

#modal-dicom-viewer form#form-dicom-report {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
    gap: 8px !important;
}

#modal-dicom-viewer .editor-container {
    border: 1.5px solid #334155 !important;
    border-radius: 8px !important;
    background: #060913 !important;
    overflow: hidden !important;
    flex: 1 !important;
    min-height: 0 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
}

#modal-dicom-viewer .editor-toolbar {
    background: #131b2e !important;
    border-bottom: 1px solid #1e293b !important;
    padding: 6px 10px !important;
    display: flex !important;
    gap: 5px !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    flex-shrink: 0 !important;
}

#modal-dicom-viewer .editor-btn {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    border-radius: 6px !important;
    min-width: 30px !important;
    width: auto !important;
    height: 30px !important;
    padding: 0 8px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    transition: all 0.15s ease !important;
}

#modal-dicom-viewer .editor-btn i,
#modal-dicom-viewer .editor-btn svg,
#modal-dicom-viewer .editor-btn span {
    color: #f8fafc !important;
}

#modal-dicom-viewer .editor-btn:hover {
    background: #334155 !important;
    border-color: #00f0ff !important;
    color: #ffffff !important;
}

#modal-dicom-viewer .editor-btn.active {
    background: rgba(0, 240, 255, 0.2) !important;
    border-color: #00f0ff !important;
    color: #00f0ff !important;
}

#modal-dicom-viewer .editor-separator {
    background: #334155 !important;
    width: 1px !important;
    height: 18px !important;
    margin: 0 3px !important;
}

#modal-dicom-viewer .editor-select {
    background: #090d16 !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    border-radius: 5px !important;
    height: 30px !important;
    padding: 3px 8px !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
}

#modal-dicom-viewer .rich-editor,
#modal-dicom-viewer #dicom-report-editor.rich-editor,
#dicom-report-editor {
    color: #f8fafc !important;
    background: #060913 !important;
    background-color: #060913 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    font-size: 1.05rem !important;
    line-height: 1.75 !important;
    padding: 18px 22px !important;
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    overflow-y: auto !important;
    caret-color: #00f0ff !important;
}

#modal-dicom-viewer .rich-editor:focus,
#modal-dicom-viewer #dicom-report-editor.rich-editor:focus,
#dicom-report-editor:focus {
    background: #050811 !important;
    background-color: #050811 !important;
    outline: none !important;
}

#modal-dicom-viewer #dicom-report-editor h2,
#dicom-report-editor h2 {
    color: #38bdf8 !important;
    font-size: 1.15rem !important;
    font-weight: 800 !important;
    margin-top: 14px !important;
    margin-bottom: 6px !important;
    border-bottom: 1px solid #1e293b !important;
    padding-bottom: 4px !important;
}

#modal-dicom-viewer #dicom-report-editor h3,
#dicom-report-editor h3 {
    color: #00f0ff !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin-top: 12px !important;
    margin-bottom: 6px !important;
}

#modal-dicom-viewer #dicom-report-editor p,
#dicom-report-editor p {
    color: #e2e8f0 !important;
    margin: 4px 0 !important;
}

#modal-dicom-viewer #dicom-report-editor strong,
#dicom-report-editor strong {
    color: #ffffff !important;
}

#modal-dicom-viewer #dicom-report-editor table,
#dicom-report-editor table,
.rich-editor table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 14px 0 !important;
    background-color: #0b1120 !important;
    border: 1px solid #1e293b !important;
    border-radius: 6px !important;
}

#modal-dicom-viewer #dicom-report-editor thead tr,
#dicom-report-editor thead tr,
.rich-editor thead tr {
    background-color: #1e293b !important;
    border-bottom: 2px solid #334155 !important;
}

#modal-dicom-viewer #dicom-report-editor th,
#dicom-report-editor th,
.rich-editor th {
    background-color: #1e293b !important;
    color: #38bdf8 !important;
    font-weight: 800 !important;
    font-size: 0.82rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.04em !important;
    padding: 9px 12px !important;
    border: 1px solid #334155 !important;
    text-align: left !important;
}

#modal-dicom-viewer #dicom-report-editor tbody tr,
#dicom-report-editor tbody tr,
.rich-editor tbody tr {
    background-color: #0b1120 !important;
    border-bottom: 1px solid #1e293b !important;
}

#modal-dicom-viewer #dicom-report-editor tbody tr:hover,
#dicom-report-editor tbody tr:hover,
.rich-editor tbody tr:hover {
    background-color: #131d33 !important;
}

#modal-dicom-viewer #dicom-report-editor td,
#dicom-report-editor td,
.rich-editor td {
    background-color: transparent !important;
    color: #f1f5f9 !important;
    font-size: 0.90rem !important;
    padding: 8px 12px !important;
    border: 1px solid #1e293b !important;
}

#modal-dicom-viewer #dicom-report-editor td:first-child,
#dicom-report-editor td:first-child,
.rich-editor td:first-child {
    font-weight: 700 !important;
    color: #ffffff !important;
}

#modal-dicom-viewer .dicom-history-panel {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
}

#modal-dicom-viewer .ris-history-item,
#modal-dicom-viewer .visit-history-item {
    background: #0f172a !important;
    border: 1px solid #1e293b !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    color: #cbd5e1 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.15s ease !important;
}

#modal-dicom-viewer .ris-history-item:hover,
#modal-dicom-viewer .visit-history-item:hover {
    border-color: #38bdf8 !important;
    background: #131b2e !important;
}

/* ═══════════════════════════════════════════════════════════════
   MODALE LIS — FULLSCREEN COMMAND CENTER — Bianco/Blu
   Solo CSS. Nessun id/attributo funzionale modificato.
   ═══════════════════════════════════════════════════════════════ */

/* --- Modale Fullscreen --- */
#modal-add-sample.modal-overlay {
    padding: 0 !important;
    background: rgba(15, 23, 42, 0.4) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
}

#modal-add-sample .modal-box {
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    background: #f1f5f9 !important;
    box-shadow: none !important;
}

/* --- Header compatto blu scuro --- */
#modal-add-sample .modal-header {
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 28px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: linear-gradient(135deg, #0a1628 0%, #1e3a5f 50%, #be123c 100%) !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15) !important;
    flex-shrink: 0 !important;
    border-bottom: none !important;
}

#modal-add-sample .modal-header h2 {
    font-size: 15px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
}

/* --- Body: 2 colonne con grid --- */
#modal-add-sample .modal-body-rows {
    display: grid !important;
    grid-template-columns: 360px 1fr !important;
    grid-template-rows: auto 1fr !important;
    grid-template-areas:
        "opzioni anagrafica"
        "opzioni analisi" !important;
    gap: 0 !important;
    padding: 0 !important;
    background: #f1f5f9 !important;
    flex: 1 !important;
    overflow: hidden !important;
}

/* --- Row Sections: reset base --- */
#modal-add-sample .row-section {
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    gap: 0 !important;
    transition: none !important;
}

#modal-add-sample .row-section:hover {
    box-shadow: none !important;
    transform: none !important;
}

/* Rimuovi striscia decorativa superiore */
#modal-add-sample .row-section::before {
    display: none !important;
}

/* --- RIGA 1: Anagrafica — Ribbon compatto --- */
#modal-add-sample .row-section.row-blue {
    grid-area: anagrafica !important;
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04) !important;
    flex-shrink: 0 !important;
}

#modal-add-sample .row-blue .row-header {
    padding: 7px 28px !important;
    margin-bottom: 0 !important;
    border-bottom: 1px solid #ffe4e6 !important;
    background: #fff1f2 !important;
}

#modal-add-sample .row-blue .row-header-title {
    font-size: 10.5px !important;
    font-weight: 800 !important;
    color: #e11d48 !important;
    letter-spacing: 1.2px !important;
}

#modal-add-sample .row-blue .row-header-title i {
    color: #e11d48 !important;
}

#modal-add-sample .fields-grid-3 {
    display: grid !important;
    grid-template-columns: 1.5fr 1fr 1fr !important;
    gap: 16px !important;
    padding: 12px 28px 14px !important;
}

/* --- RIGA 2: Analisi — Colonna sinistra --- */
#modal-add-sample .row-section.row-purple {
    grid-area: analisi !important;
    background: #ffffff !important;
    overflow-y: auto !important;
    padding: 20px 24px !important;
    display: flex !important;
    flex-direction: column !important;
}

#modal-add-sample .row-purple .row-header {
    padding: 0 0 12px 0 !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid #ffe4e6 !important;
}

#modal-add-sample .row-header-title,
#modal-add-sample .row-header-title.accent {
    font-size: 11px !important;
    font-weight: 800 !important;
    color: #be123c !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

#modal-add-sample .row-header-title i,
#modal-add-sample .row-header-title.accent i {
    color: #e11d48 !important;
}

#modal-add-sample .row-purple > .form-group {
    margin-bottom: 12px !important;
    padding: 0 !important;
}

#modal-add-sample .row-purple > .form-group:last-child {
    margin-bottom: 0 !important;
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* --- Tabella Esami — Grande, sticky header --- */
#modal-add-sample .tests-table-container {
    border: 1.5px solid #ffe4e6 !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    margin-top: 0 !important;
    max-height: none !important;
    flex: 1 !important;
    box-shadow: 0 1px 4px rgba(30,58,95,0.06) !important;
}

#modal-add-sample .tests-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 13px !important;
}

#modal-add-sample .tests-table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 5 !important;
}

#modal-add-sample .tests-table th {
    background: linear-gradient(135deg, #0a1628 0%, #1e3a5f 100%) !important;
    color: #fecdd3 !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    font-size: 10px !important;
    letter-spacing: 1px !important;
    padding: 11px 16px !important;
    border-bottom: none !important;
}

#modal-add-sample .tests-table td {
    padding: 9px 16px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    color: #334155 !important;
    vertical-align: middle !important;
    font-size: 13px !important;
}

#modal-add-sample .tests-table tbody tr:nth-child(even) {
    background: #f8fafc !important;
}

#modal-add-sample .tests-table tr:hover td {
    background: #fff1f2 !important;
}

#modal-add-sample .tests-table tr:last-child td {
    border-bottom: none !important;
}

/* Provetta badge compatto */
#modal-add-sample .tube-badge {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-weight: 600 !important;
    padding: 3px 8px 3px 5px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
}

#modal-add-sample .tube-badge .tube-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 3px !important;
    flex-shrink: 0 !important;
}

#modal-add-sample .tube-badge svg {
    width: 11px !important;
    height: 11px !important;
}

/* Rimuovi button nella tabella */
#modal-add-sample .tag-remove-btn {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    cursor: pointer !important;
    padding: 4px !important;
    border-radius: 6px !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#modal-add-sample .tag-remove-btn:hover {
    background: #fef2f2 !important;
    color: #ef4444 !important;
    transform: none !important;
}

/* --- RIGA 3: Opzioni — Colonna destra (sidebar) --- */
#modal-add-sample .row-section.row-green {
    grid-area: opzioni !important;
    background: #f8fafc !important;
    border-right: 1px solid #e2e8f0 !important;
    overflow-y: auto !important;
    padding: 20px 24px !important;
}

#modal-add-sample .row-green .row-header {
    padding: 0 0 12px 0 !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid #ffe4e6 !important;
}

#modal-add-sample .row-header-title.green {
    color: #be123c !important;
}

#modal-add-sample .row-header-title.green i {
    color: #e11d48 !important;
}

/* Opzioni: layout verticale nella sidebar */
#modal-add-sample .options-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
}

#modal-add-sample .options-left-pane {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    padding-bottom: 16px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    margin-bottom: 16px !important;
}

#modal-add-sample .options-right-pane {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
}

/* --- SSN Toggle --- */
#modal-add-sample .ssn-container-box {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 10px 12px !important;
    height: auto !important;
}

#modal-add-sample .ssn-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    cursor: pointer !important;
    user-select: none !important;
}

#modal-add-sample .ssn-toggle-text {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #334155 !important;
}

#modal-add-sample .toggle-switch {
    position: relative !important;
    width: 40px !important;
    height: 22px !important;
    background-color: #cbd5e1 !important;
    border-radius: 11px !important;
    transition: all 0.2s ease !important;
    flex-shrink: 0 !important;
}

#modal-add-sample .sam-toggle-input {
    display: none !important;
}

#modal-add-sample .sam-toggle-input:checked + .toggle-switch {
    background-color: #e11d48 !important;
}

#modal-add-sample .toggle-switch::after {
    content: '' !important;
    position: absolute !important;
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    background-color: white !important;
    top: 2px !important;
    left: 2px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12) !important;
}

#modal-add-sample .sam-toggle-input:checked + .toggle-switch::after {
    transform: translateX(18px) !important;
}

/* --- Data Ritiro Referto --- */
#modal-add-sample .options-right-pane > .form-group:first-child {
    padding: 14px !important;
    border: 1.5px solid #fecdd3 !important;
    border-radius: 10px !important;
    background: #fff1f2 !important;
}

#modal-add-sample .options-right-pane > .form-group:first-child label {
    color: #be123c !important;
    font-weight: 700 !important;
}

#modal-add-sample .info-subtext {
    font-size: 10.5px !important;
    color: #e11d48 !important;
    margin-top: 4px !important;
}

/* --- Pannello Finanziario --- */
#modal-add-sample .finance-panel {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    padding: 14px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
}

#modal-add-sample .finance-row {
    display: flex;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 12px !important;
    color: #64748b !important;
    padding: 2px 0 !important;
}

#modal-add-sample .finance-row strong {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-variant-numeric: tabular-nums !important;
}

#modal-add-sample .finance-total {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    border-top: 2px solid #ffe4e6 !important;
    padding-top: 10px !important;
    margin-top: 6px !important;
    color: #1e293b !important;
}

#modal-add-sample .finance-total span:last-child,
#modal-add-sample .finance-total #sam-calc-total {
    font-size: 22px !important;
    font-weight: 900 !important;
    color: #be123c !important;
    letter-spacing: -0.5px !important;
}

/* --- Insurance Details Box --- */
#modal-add-sample .insurance-details-box {
    background: #fff1f2 !important;
    border: 1.5px solid #fecdd3 !important;
    border-radius: 10px !important;
    padding: 14px !important;
}

#modal-add-sample .insurance-box-title {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    color: #e11d48 !important;
    margin-bottom: 10px !important;
}

/* --- Footer --- */
#modal-add-sample .modal-footer {
    padding: 12px 28px !important;
    border-top: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04) !important;
}

#modal-add-sample .btn-cancel {
    background: #ffffff !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    color: #64748b !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 9px 20px !important;
    transition: all 0.2s ease !important;
}

#modal-add-sample .btn-cancel:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
}

#modal-add-sample .btn-submit {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 100%) !important;
    border: none !important;
    border-radius: 8px !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    padding: 10px 26px !important;
    box-shadow: 0 2px 10px rgba(37,99,235,0.3) !important;
    transition: all 0.2s ease !important;
}

#modal-add-sample .btn-submit:hover {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 20px rgba(37,99,235,0.35) !important;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    #modal-add-sample .modal-body-rows {
        grid-template-columns: 1fr !important;
        grid-template-areas:
            "anagrafica"
            "analisi"
            "opzioni" !important;
    }
    #modal-add-sample .fields-grid-3 {
        grid-template-columns: 1fr !important;
    }
    #modal-add-sample .row-section.row-purple {
        border-right: none !important;
    }
}

/* ════════════════════════════════════════════════════════════════════
   RESTYLING CALENDARIO GIORNALIERO — #modal-agendas-calendar
   Solo CSS sopra la struttura esistente. Nessun id/attributo/onclick
   modificato. Fix modal-box fullscreen gestito via JS in checkin.js.
   ════════════════════════════════════════════════════════════════════ */

/* ── FULLSCREEN: overlay e box ─────────────────────────────────────
   Il .modal-overlay base ha padding:20px e centra il box.
   Il .modal-box base ha max-width:580px.
   Qui sovrascriviamo entrambi solo per questo specifico modale.    ── */
#modal-agendas-calendar {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    background: rgba(238,243,251,0.98) !important;
    backdrop-filter: none !important;
    overflow: hidden !important;
}
#modal-agendas-calendar .modal-box {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #eef3fb !important;
    border: none !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding: 0 !important;
    animation: none !important;
}

/* ── Topbar ── */
#modal-agendas-calendar .modal-header {
    background: linear-gradient(90deg, #4c0519 0%, #be123c 55%, #e11d48 100%) !important;
    border-bottom: none !important;
    padding: 0 20px !important;
    min-height: 44px !important;
    height: 44px !important;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
#modal-agendas-calendar .modal-header h2 {
    color: #ffffff !important;
    font-size: .88rem !important;
    font-weight: 800 !important;
    letter-spacing: -.015em;
}
#modal-agendas-calendar .modal-close {
    background: rgba(255,255,255,.15) !important;
    border: 1px solid rgba(255,255,255,.25) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    width: 28px; height: 28px;
}
#modal-agendas-calendar .modal-close:hover {
    background: rgba(255,255,255,.3) !important;
    transform: scale(1.1);
}

/* ── Toolbar (primo div figlio di .modal-body) ── */
#modal-agendas-calendar .modal-body > div:first-child {
    background: #ffffff !important;
    border: none !important;
    border-bottom: 1px solid #dce6f5 !important;
    border-radius: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 20px !important;
    min-height: 52px !important;
    height: 52px !important;
    flex-shrink: 0 !important;
    flex-wrap: nowrap !important;
    box-shadow: 0 2px 8px rgba(29,78,216,.06);
    gap: 12px !important;
}
#modal-agendas-calendar .modal-body label {
    font-size: .72rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #64748b !important;
    white-space: nowrap;
}
#cal-date-select {
    height: 32px !important;
    background: #f4f8ff !important;
    border: 1.5px solid #dce6f5 !important;
    border-radius: 6px !important;
    font-size: .83rem !important;
    font-weight: 700 !important;
    padding: 0 10px !important;
    color: #0f172a !important;
    width: auto !important;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
#cal-date-select:focus {
    border-color: #e11d48 !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,.18) !important;
}
#cal-doctor-select {
    height: 32px !important;
    background: #f4f8ff !important;
    border: 1.5px solid #dce6f5 !important;
    border-radius: 6px !important;
    font-size: .82rem !important;
    font-weight: 600 !important;
    padding: 0 28px 0 10px !important;
    color: #0f172a !important;
    min-width: 250px !important;
    width: auto !important;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    outline: none;
}
#cal-doctor-select:focus {
    border-color: #e11d48 !important;
}
#modal-agendas-calendar .btn-secondary.btn-sm {
    background: #be123c !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: 6px !important;
    height: 32px !important;
    padding: 0 14px !important;
    font-size: .78rem !important;
    font-weight: 700 !important;
    box-shadow: 0 3px 10px rgba(29,78,216,.28);
    transition: background .2s, transform .2s;
    white-space: nowrap;
}
#modal-agendas-calendar .btn-secondary.btn-sm:hover {
    background: #881337 !important;
    transform: translateY(-1px);
}
#modal-agendas-calendar .text-muted {
    font-size: .7rem !important;
    color: #94a3b8 !important;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
}

/* ── Scroll wrapper ── */
#calendar-visualizer-scroll-wrapper {
    border: none !important;
    border-radius: 0 !important;
    background: #eef3fb !important;
    padding: 12px 16px !important;
}
#calendar-visualizer-scroll-wrapper::-webkit-scrollbar { width: 6px; height: 6px; }
#calendar-visualizer-scroll-wrapper::-webkit-scrollbar-track { background: transparent; }
#calendar-visualizer-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #93c5fd; border-radius: 3px;
}

/* ── Footer ── */
#modal-agendas-calendar .modal-footer {
    background: #ffffff !important;
    border-top: 1px solid #dce6f5 !important;
    padding: 0 20px !important;
    min-height: 42px !important;
    height: 42px !important;
    flex-shrink: 0;
}
#modal-agendas-calendar .modal-footer .btn-secondary {
    background: #f4f8ff !important;
    border: 1.5px solid #dce6f5 !important;
    color: #1e293b !important;
    border-radius: 6px !important;
    height: 28px !important;
    padding: 0 16px !important;
    font-size: .78rem !important;
    font-weight: 600 !important;
    transition: all .2s;
}
#modal-agendas-calendar .modal-footer .btn-secondary:hover {
    background: #ffe4e6 !important;
    border-color: #93c5fd !important;
    color: #be123c !important;
}

/* ── Griglia ── */
.calendar-grid {
    background: #ffffff !important;
    border: none !important;
    border-radius: 10px !important;
    overflow: hidden !important;
    margin-top: 0 !important;
    box-shadow: 0 4px 28px rgba(29,78,216,.10), 0 1px 4px rgba(0,0,0,.05) !important;
}

/* ── Header colonne agende ── */
.calendar-header-cell {
    min-height: 82px !important;
    height: auto !important;
    background: linear-gradient(160deg, #4c0519, #e11d48) !important;
    color: #ffffff !important;
    border-bottom: none !important;
    border-right: 1px solid rgba(255,255,255,.12) !important;
    font-size: .74rem !important;
    font-weight: 700 !important;
    padding: 6px 4px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}
.calendar-header-cell:first-child {
    background: #f4f8ff !important;
    color: #64748b !important;
    font-size: .62rem !important;
    text-transform: uppercase;
    letter-spacing: .07em;
    border-right: 2px solid #dce6f5 !important;
    min-height: 82px !important;
    height: auto !important;
}
/* Colori alterni per distinguere visivamente le agende */
.calendar-header-cell:nth-child(3)  { background: linear-gradient(160deg,#5b21b6,#7c3aed) !important; }
.calendar-header-cell:nth-child(4)  { background: linear-gradient(160deg,#064e3b,#059669) !important; }
.calendar-header-cell:nth-child(5)  { background: linear-gradient(160deg,#78350f,#d97706) !important; }
.calendar-header-cell:nth-child(6)  { background: linear-gradient(160deg,#0c4a6e,#0891b2) !important; }
.calendar-header-cell:nth-child(7)  { background: linear-gradient(160deg,#831843,#be185d) !important; }
.calendar-header-cell:nth-child(8)  { background: linear-gradient(160deg,#1a2e05,#4d7c0f) !important; }
.calendar-header-cell:nth-child(9)  { background: linear-gradient(160deg,#4c0519,#e11d48) !important; }
.calendar-header-cell:nth-child(10) { background: linear-gradient(160deg,#5b21b6,#7c3aed) !important; }
/* Testi iniettati dal JS dentro i div header */
.calendar-header-cell > div { color: rgba(255,255,255,.95) !important; }
.calendar-header-cell > div:first-child { font-weight: 800 !important; font-size: .78rem !important; color: #ffffff !important; }
.calendar-header-cell > div:nth-child(2) { font-size: .62rem !important; color: rgba(255,255,255,.85) !important; }
.calendar-header-cell .calendar-header-sede-badge {
    color: #ffffff !important;
    background: rgba(0, 0, 0, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
}
.calendar-header-cell .calendar-header-sede-badge * {
    color: #ffffff !important;
}
.calendar-header-cell > button {
    background: rgba(0,0,0,.22) !important;
    border: 1px solid rgba(255,255,255,.2) !important;
    color: rgba(255,255,255,.9) !important;
    border-radius: 99px !important;
    font-size: .57rem !important;
    padding: 1px 8px !important;
}

/* ── Colonna orario ── */
.calendar-time-cell {
    background: #f4f8ff !important;
    border-right: 2px solid #dce6f5 !important;
    border-bottom: 1px solid #dce6f5 !important;
    color: #64748b !important;
    font-weight: 700 !important;
    font-size: .68rem !important;
    height: 36px !important;
}

/* ── Cella slot generica ── */
.calendar-slot-cell {
    min-height: 36px !important;
    border-bottom: 1px solid #dce6f5 !important;
    border-right: 1px solid rgba(0,0,0,.04) !important;
}

/* ── Non in servizio ── */
.calendar-slot-inactive {
    background-color: #f8fafc !important;
    background-image: repeating-linear-gradient(
        135deg, transparent, transparent 4px,
        rgba(0,0,0,.02) 4px, rgba(0,0,0,.02) 8px
    ) !important;
    color: #94a3b8 !important;
    font-size: .66rem !important;
    font-weight: 400 !important;
}

/* ── Libero (+ Prenota) ── */
.calendar-slot-free {
    color: #15803d !important;
    font-weight: 700 !important;
    font-size: .72rem !important;
    border: none !important;
    background: transparent !important;
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
    padding: 4px !important;
    text-align: center;
    transition: background .12s;
}
.calendar-slot-free:hover {
    background: #f0fdf4 !important;
}

/* ── Card prenotazione — miglioramento leggibilità ──
   Il JS imposta background/borderLeft/color come inline style.
   Il CSS migliora il layout testuale e i font senza sovrascrivere i colori. ── */
.calendar-slot-booked-card {
    padding: 4px 8px 4px 10px !important;
    font-size: .72rem !important;
    font-weight: 600 !important;
    border-radius: 2px !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    gap: 1px !important;
}
.calendar-slot-booked-card strong {
    font-size: .75rem !important;
    font-weight: 800 !important;
    display: block !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    line-height: 1.2 !important;
}
.calendar-slot-booked-card > div {
    font-size: .65rem !important;
    font-weight: 500 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    opacity: .88;
}
.calendar-slot-booked-card:hover {
    filter: brightness(.93) !important;
    transform: none !important;
    box-shadow: none !important;
}

/* ════════════════════════════════════════════════════════════════════
   FINE RESTYLING CALENDARIO
   ════════════════════════════════════════════════════════════════════ */

/* ════════════════════════════════════════════════════════════════════
   PURELABS HEALTHCORE - SELETTORE & MODALE PRESTAZIONI SPECIALISTICO
   ════════════════════════════════════════════════════════════════════ */

/* Selettore Iniziale Bento Type Cards */
.purelabs-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 10px 0;
}

@media (max-width: 900px) {
    .purelabs-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .purelabs-type-grid {
        grid-template-columns: 1fr;
    }
}

.purelabs-type-card {
    position: relative;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 20px 18px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.purelabs-type-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px -8px rgba(15, 23, 42, 0.12);
}

.purelabs-type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--card-accent, #0ea5e9);
    transition: height 0.2s ease;
}

.purelabs-type-card:hover::before {
    height: 6px;
}

/* Card Themes */
.purelabs-type-card.theme-lis {
    --card-accent: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --card-light: #eff6ff;
}
.purelabs-type-card.theme-lis:hover {
    border-color: #93c5fd;
    background: linear-gradient(180deg, #ffffff 0%, #f0f7ff 100%);
}

.purelabs-type-card.theme-ris {
    --card-accent: linear-gradient(135deg, #06b6d4, #0284c7);
    --card-light: #ecfeff;
}
.purelabs-type-card.theme-ris:hover {
    border-color: #a5f3fc;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdfa 100%);
}

.purelabs-type-card.theme-visita {
    --card-accent: linear-gradient(135deg, #10b981, #059669);
    --card-light: #ecfdf5;
}
.purelabs-type-card.theme-visita:hover {
    border-color: #a7f3d0;
    background: linear-gradient(180deg, #ffffff 0%, #f0fdf4 100%);
}

.purelabs-type-card.theme-chirurgia {
    --card-accent: linear-gradient(135deg, #f43f5e, #e11d48);
    --card-light: #fff1f2;
}
.purelabs-type-card.theme-chirurgia:hover {
    border-color: #fecdd3;
    background: linear-gradient(180deg, #ffffff 0%, #fff1f2 100%);
}

.purelabs-type-card.theme-fisioterapia {
    --card-accent: linear-gradient(135deg, #f59e0b, #d97706);
    --card-light: #fffbeb;
}
.purelabs-type-card.theme-fisioterapia:hover {
    border-color: #fde68a;
    background: linear-gradient(180deg, #ffffff 0%, #fffbeb 100%);
}

.purelabs-type-card.theme-pacchetto {
    --card-accent: linear-gradient(135deg, #8b5cf6, #6d28d9);
    --card-light: #faf5ff;
}
.purelabs-type-card.theme-pacchetto:hover {
    border-color: #ddd6fe;
    background: linear-gradient(180deg, #ffffff 0%, #faf5ff 100%);
}

.purelabs-type-card .card-icon-bubble {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--card-light, #f1f5f9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease;
}

.purelabs-type-card:hover .card-icon-bubble {
    transform: scale(1.1) rotate(4deg);
}

.purelabs-type-card .card-info-content h3 {
    margin: 0 0 6px 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.purelabs-type-card .card-info-content p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #64748b;
}

.purelabs-type-card .card-action-badge {
    margin-top: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    transition: color 0.2s ease;
}

.purelabs-type-card:hover .card-action-badge {
/* ========================================================== */
/* PURELABS MODAL SELECT SERVICE TYPE (Compatto & Raffinato)   */
/* ========================================================== */
#modal-select-service-type .modal-box {
    height: auto !important;
    max-height: 90vh !important;
    width: 90vw;
    max-width: 660px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#modal-select-service-type .modal-header {
    padding: 14px 20px;
    background: #ffffff;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#modal-select-service-type .modal-body {
    padding: 16px 20px;
    background: #f8fafc;
    overflow-y: auto;
}

.purelabs-type-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.purelabs-type-card-compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    position: relative;
}

.purelabs-type-card-compact:hover {
    border-color: #e11d48;
    background: #fffcfc;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(225, 29, 72, 0.12);
}

.purelabs-type-card-compact .card-bubble-mini {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.purelabs-type-card-compact:hover .card-bubble-mini {
    transform: scale(1.08);
}

.purelabs-type-card-compact .card-text-mini {
    flex: 1;
    min-width: 0;
}

.purelabs-type-card-compact .card-text-mini h4 {
    margin: 0 0 2px 0;
    font-size: 0.86rem;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.2px;
}

.purelabs-type-card-compact .card-text-mini p {
    margin: 0;
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.purelabs-type-card-compact .card-arrow-mini {
    font-size: 1.1rem;
    color: #cbd5e1;
    font-weight: 700;
    transition: all 0.2s ease;
}

.purelabs-type-card-compact:hover .card-arrow-mini {
    color: #be123c;
    transform: translateX(3px);
}

/* ========================================================== */
/* PURELABS BENTO SECTIONS (Box organizzati per ogni Tab)     */
/* ========================================================== */
.purelabs-bento-section {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    margin-bottom: 12px;
    transition: border-color 0.2s ease;
}

.purelabs-bento-section:last-child {
    margin-bottom: 0;
}

.purelabs-bento-section:hover {
    border-color: #cbd5e1;
}

.purelabs-bento-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.purelabs-bento-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.purelabs-bento-icon {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.purelabs-bento-title {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 800;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.purelabs-bento-subtitle {
    margin: 0;
    font-size: 0.72rem;
    color: #64748b;
}

/* Visual Tube Selector Grid */
.purelabs-tube-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.purelabs-tube-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: #334155;
    transition: all 0.15s ease;
}

.purelabs-tube-option:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.purelabs-tube-option.selected {
    border-color: #3b82f6;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.tube-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Package Savings Badge */
.purelabs-savings-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    margin-top: 12px;
}

.savings-chip {
    background: #7c3aed;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.3px;
}

/* PureLabs LIS In-Line Parameters Section & Rows */
.purelabs-params-section {
    transition: all 0.2s ease;
}

.purelabs-params-section:hover {
    border-color: #fca5a5;
}

.purelabs-btn-add-param:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.35) !important;
}

.purelabs-btn-add-param:active {
    transform: translateY(0);
}

.srv-param-row {
    transition: all 0.15s ease;
}

.srv-param-row:hover {
    border-color: #fecdd3 !important;
    background: #fffcfc !important;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.04) !important;
}

.srv-param-row input:focus,
.srv-param-row select:focus {
    border-color: #e11d48 !important;
    outline: none !important;
    box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.12) !important;
}

/* Modal Form Controls PureLabs Styling */
#modal-add-service .form-group label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

#modal-add-service input[type="text"],
#modal-add-service input[type="number"],
#modal-add-service select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.84rem;
    color: #0f172a;
    transition: all 0.2s ease;
}

#modal-add-service input[type="text"]:focus,
#modal-add-service input[type="number"]:focus,
#modal-add-service select:focus {
    border-color: #e11d48;
    box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.12);
    outline: none;
}


