/* ============================================================================
   NEXTCARE PLATFORM - DESIGN SYSTEM (VANILLA CSS)
   ============================================================================ */

/* CSS Variables & Themes */
:root {
    /* Fonts */
    --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;

    /* Light Theme Palette (Default) */
    --bg-base: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-surface-trans: rgba(255, 255, 255, 0.85);
    --border-color: rgba(226, 232, 240, 0.8);
    --border-hover: rgba(203, 213, 225, 1);
    
    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Accent Colors */
    --primary: #e11d48;
    --primary-light: #fff1f2;
    --primary-gradient: linear-gradient(135deg, #be123c 0%, #e11d48 50%, #9f1239 100%);
    
    --success: #10b981;
    --success-light: #ecfdf5;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    
    --danger: #ef4444;
    --danger-light: #fef2f2;
    
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    
    --orange: #f97316;
    --orange-light: #fff7ed;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
    --shadow-premium: 0 20px 40px -15px rgba(225, 29, 72, 0.18);
    
    /* UI Dimensions */
    --sidebar-width: 280px;
    --header-height: 80px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Palette Override */
body.dark-theme {
    --bg-base: #0b0f19;
    --bg-surface: #131a2c;
    --bg-surface-trans: rgba(19, 26, 44, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    
    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Accent modifications for dark theme */
    --primary: #e11d48;
    --primary-light: rgba(225, 29, 72, 0.12);
    --primary-gradient: linear-gradient(135deg, #be123c 0%, #e11d48 50%, #9f1239 100%);
    
    --success-light: rgba(16, 185, 129, 0.1);
    --warning-light: rgba(245, 158, 11, 0.1);
    --danger-light: rgba(239, 68, 68, 0.1);
    --purple-light: rgba(139, 92, 246, 0.1);
    --orange-light: rgba(249, 115, 22, 0.1);
    
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --shadow-premium: 0 20px 40px -15px rgba(59, 130, 246, 0.2);
}

/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: inherit;
}

/* App Container Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    overflow: hidden;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: var(--radius-md);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logo-title {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.logo-subtitle {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.88rem;
    transition: all var(--transition-fast);
}

.nav-item i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}

.nav-item:hover {
    color: var(--primary);
    background-color: var(--primary-light);
}

.nav-item:hover i {
    transform: translateX(3px);
}

.nav-item.active {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: 0 4px 12px rgba(3b, 130, 246, 0.2);
}

.nav-item.active:hover {
    color: #ffffff;
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-surface);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: var(--purple-light);
    color: var(--purple);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid var(--border-color);
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Previene l'espansione del contenitore flex oltre il viewport */
}

/* Header Top */
.top-header {
    display: none !important; /* Nasconde la header e recupera l'altezza su Desktop */
    height: var(--header-height);
    background-color: var(--bg-surface-trans);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 40px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-search {
    position: relative;
    width: 380px;
}

.header-search i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.header-search input {
    width: 100%;
    padding: 10px 16px 10px 42px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: all var(--transition-fast);
}

.header-search input:focus {
    border-color: var(--primary);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background-color: var(--primary-light);
}

.sun-icon {
    display: none;
}
.moon-icon {
    display: block;
}

body.dark-theme .sun-icon {
    display: block;
}
body.dark-theme .moon-icon {
    display: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background-color: var(--primary-light);
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.badge-live-pulse {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ffe4e6;
    color: #be123c;
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    border: 1px solid #fecdd3;
    letter-spacing: 0.4px;
    line-height: 1;
}

.badge-live-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #e11d48;
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7);
    animation: livePulseDot 1.4s infinite ease-in-out;
    display: inline-block;
}

@keyframes livePulseDot {
    0% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 0 4px rgba(225, 29, 72, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0.85);
        box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
        opacity: 0.8;
    }
}

/* Content Body */
.content-body {
    padding: 14px 18px 60px 18px;
    flex: 1;
    overflow-y: auto;
    overflow-x: auto; /* Evita il taglio degli elementi a destra e consente lo scorrimento naturale */
    min-width: 0;     /* Consente il restringimento degli elementi figli */
}

/* Tab Management */
.tab-content {
    display: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.tab-content.active {
    display: block;
    animation: fadeIn var(--transition-normal);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 50%, #881337 100%);
    border-radius: var(--radius-lg);
    padding: 32px 40px;
    color: #ffffff;
    margin-bottom: 32px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.welcome-banner h1 {
    color: #ffffff;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-banner p {
    color: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    max-width: 600px;
    line-height: 1.5;
}

/* KPI Cards Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.kpi-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.kpi-icon {
    width: 54px;
    height: 54px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.kpi-icon i {
    width: 24px;
    height: 24px;
}

.kpi-icon.color-blue { background-color: var(--primary-light); color: var(--primary); }
.kpi-icon.color-green { background-color: var(--success-light); color: var(--success); }
.kpi-icon.color-purple { background-color: var(--purple-light); color: var(--purple); }
.kpi-icon.color-orange { background-color: var(--orange-light); color: var(--orange); }
.kpi-icon.color-red { background-color: rgba(239, 68, 68, 0.15); color: #ef4444; }
.kpi-icon.color-teal { background-color: rgba(20, 184, 166, 0.15); color: #14b8a6; }

.kpi-info {
    display: flex;
    flex-direction: column;
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 4px;
}

/* Standard Section Headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* Cards & Layout Grid */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    overflow: hidden;
    transition: border-color var(--transition-normal);
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.card-header i {
    color: var(--text-muted);
    width: 20px;
    height: 20px;
}

.card-body {
    padding: 24px;
}

.card-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Dashboard Columns Layout */
.dashboard-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    gap: 24px;
    align-items: start;
}

.dashboard-layout > * {
    min-width: 0;
}

@media (max-width: 1366px) {
    .dashboard-layout th, 
    .dashboard-layout td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 1200px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* Custom Charts */
.chart-container {
    height: 320px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 20px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.bar-chart {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: flex-end;
    justify-content: space-around;
}

.chart-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    width: 60px;
}

.chart-bar-fill {
    width: 32px;
    background: var(--primary-gradient);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    cursor: pointer;
}

.chart-bar-fill::after {
    content: attr(data-value) "%";
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-bar-fill:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.chart-bar-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 10px;
    font-weight: 500;
    white-space: nowrap;
}

/* AI Assistant Card styling */
.badge-ai {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

.ai-chat-box {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    height: 180px;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-message {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    line-height: 1.4;
    max-width: 85%;
}

.ai-message.assistant {
    background-color: var(--bg-surface);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border-color);
}

.ai-message.user {
    background: var(--primary-gradient);
    color: #ffffff;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.ai-input-group {
    display: flex;
    gap: 10px;
}

.ai-input-group input {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.ai-input-group input:focus {
    border-color: var(--purple);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

#ai-submit-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
    transition: all var(--transition-fast);
}

#ai-submit-btn:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 14px rgba(124, 58, 237, 0.4);
}

#ai-submit-btn i {
    width: 18px;
    height: 18px;
}

/* Data Tables — Professional Enterprise Healthcare Grid */
.table-container {
    overflow-x: auto;
    width: 100%;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    background-color: var(--bg-base);
    border-bottom: 1.5px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    vertical-align: middle;
    white-space: nowrap;
}

td {
    padding: 11px 16px;
    font-size: 0.86rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════════════════════════
   GLOBAL ZEBRA STRIPING & MODERN ROW CONTRAST FOR ALL DATA TABLES
   ══════════════════════════════════════════════════════════════════════════════ */
tbody tr,
table tbody tr {
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
}

tbody tr:nth-child(odd),
table tbody tr:nth-child(odd),
.table tbody tr:nth-child(odd),
.pacs-table tbody tr:nth-child(odd) {
    background-color: #ffffff !important;
}

tbody tr:nth-child(even),
table tbody tr:nth-child(even),
.table tbody tr:nth-child(even),
.pacs-table tbody tr:nth-child(even) {
    background-color: #f8fafc !important; /* Grigio chiaro pulito e distinto */
}

/* Effetto Hover ad alta visibilità */
tbody tr:hover,
table tbody tr:hover,
.table tbody tr:hover,
.pacs-table tbody tr:hover {
    background-color: #f0f7ff !important; /* Highlight azzurro chiarissimo */
    box-shadow: inset 3px 0 0 0 var(--primary, #e11d48), 0 2px 8px rgba(0, 0, 0, 0.04);
}

tr:last-child td {
    border-bottom: none;
}

/* Dark Theme Zebra Striping */
body.dark-theme tbody tr:nth-child(odd),
body.dark-theme table tbody tr:nth-child(odd),
body.dark-theme .pacs-table tbody tr:nth-child(odd) {
    background-color: #0f172a !important;
}

body.dark-theme tbody tr:nth-child(even),
body.dark-theme table tbody tr:nth-child(even),
body.dark-theme .pacs-table tbody tr:nth-child(even) {
    background-color: #1e293b !important;
}

body.dark-theme tbody tr:hover,
body.dark-theme table tbody tr:hover,
body.dark-theme .pacs-table tbody tr:hover {
    background-color: #334155 !important;
    box-shadow: inset 3px 0 0 0 var(--primary, #e11d48);
}

/* Badge System — Clean Healthcare Micro-pills */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.2px;
}

.badge-success { background-color: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge-warning { background-color: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-danger  { background-color: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-info    { background-color: #fff1f2; color: #be123c; border: 1px solid #fecdd3; }
.badge-purple  { background-color: #faf5ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.badge-primary { background-color: #fff1f2; color: #e11d48; border: 1px solid #fecdd3; }

.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

/* ── CUP & CLINICAL DATA TABLE RESPONSIVE ACTION BUTTONS ── */
.cup-actions-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.cup-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-weight: 700;
    font-size: 0.78rem;
    padding: 5px 10px;
    border-radius: 7px;
    white-space: nowrap;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.cup-action-btn i, .cup-action-btn svg {
    width: 13px;
    height: 13px;
}

.cup-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.cup-dropdown-trigger {
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.cup-dropdown-trigger:hover {
    background: #e2e8f0;
    color: #0f172a;
    border-color: #94a3b8;
}

.cup-dropdown-menu {
    animation: fadeInCupMenu 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

@keyframes fadeInCupMenu {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.table-container {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(225, 29, 72, 0.3) transparent;
    border-radius: var(--radius-md);
}

.table-container::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(225, 29, 72, 0.25);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(225, 29, 72, 0.55);
}

/* ── CUP APPOINTMENTS TABLE SPECIFIC RESPONSIVE OPTIMIZATION ── */
#appointments-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#appointments-table th:nth-child(1), #appointments-table td:nth-child(1) { width: 110px; }
#appointments-table th:nth-child(2), #appointments-table td:nth-child(2) { width: 230px; }
#appointments-table th:nth-child(3), #appointments-table td:nth-child(3) { width: 140px; }
#appointments-table th:nth-child(4), #appointments-table td:nth-child(4) { width: 170px; }
#appointments-table th:nth-child(5), #appointments-table td:nth-child(5) { width: 140px; }
#appointments-table th:nth-child(6), #appointments-table td:nth-child(6) { width: 90px; }
#appointments-table th:nth-child(7), #appointments-table td:nth-child(7) { width: 160px; text-align: right; }

#appointments-table th {
    font-size: 0.73rem;
    padding: 8px 6px;
    letter-spacing: 0.2px;
    vertical-align: middle;
}

#appointments-table td {
    padding: 6px 6px;
    font-size: 0.80rem;
    vertical-align: middle;
}

#appointments-table th:last-child,
#appointments-table td:last-child {
    text-align: right;
    white-space: nowrap;
    padding-right: 8px;
}

@media (max-width: 1440px) {
    #appointments-table th {
        font-size: 0.70rem;
        padding: 7px 5px;
    }
    #appointments-table td {
        font-size: 0.76rem;
        padding: 5px 5px;
    }
    .patient-identity-cell {
        min-width: 155px !important;
        max-width: 240px !important;
    }
    .patient-round-avatar {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.68rem !important;
    }
}

/* ── RIS RADIOLOGY TABLE SPECIFIC RESPONSIVE OPTIMIZATION ── */
#ris-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#ris-table th:nth-child(1), #ris-table td:nth-child(1) { width: 195px; }
#ris-table th:nth-child(2), #ris-table td:nth-child(2) { width: 175px; }
#ris-table th:nth-child(3), #ris-table td:nth-child(3) { width: 120px; }
#ris-table th:nth-child(4), #ris-table td:nth-child(4) { width: 135px; }
#ris-table th:nth-child(5), #ris-table td:nth-child(5) { width: 90px; text-align: center; }
#ris-table th:nth-child(6), #ris-table td:nth-child(6) { width: 105px; text-align: center; }
#ris-table th:nth-child(7), #ris-table td:nth-child(7) { width: 160px; text-align: right; }

#ris-table th {
    font-size: 0.73rem;
    padding: 8px 6px;
    letter-spacing: 0.2px;
    vertical-align: middle;
}

#ris-table td {
    padding: 6px 6px;
    font-size: 0.80rem;
    vertical-align: middle;
}

#ris-table th:last-child,
#ris-table td:last-child {
    text-align: right;
    white-space: nowrap;
    padding-right: 8px;
}

.ris-action-btn {
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

.ris-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.ris-dropdown-trigger {
    background: #ffffff;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.ris-dropdown-trigger:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.ris-dropdown-menu {
    animation: fadeInRisMenu 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

@keyframes fadeInRisMenu {
    from { opacity: 0; transform: scale(0.95) translateY(-4px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@media (max-width: 1440px) {
    #ris-table th {
        font-size: 0.70rem;
        padding: 7px 5px;
    }
    #ris-table td {
        font-size: 0.76rem;
        padding: 5px 5px;
    }
}

/* ── MODERN SUB-TABS RESPONSIVE BAR (UNIFIED STANDARD) ── */
.sub-tabs-container,
.sub-tabs-scroll,
.modern-sub-tabs-bar {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 2px 2px 6px 2px !important;
    margin-bottom: 14px !important;
    border-bottom: 1.5px solid #e2e8f0 !important;
    width: 100% !important;
}

.sub-tabs-container::-webkit-scrollbar,
.sub-tabs-scroll::-webkit-scrollbar,
.modern-sub-tabs-bar::-webkit-scrollbar {
    height: 4px;
}

.sub-tabs-container::-webkit-scrollbar-thumb,
.sub-tabs-scroll::-webkit-scrollbar-thumb,
.modern-sub-tabs-bar::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sub-tab-btn {
    background: transparent;
    border: none;
    font-size: 0.82rem;
    font-weight: 600;
    color: #64748b;
    padding: 6px 12px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    user-select: none;
}

.sub-tab-btn:hover {
    color: #0f172a;
    background: #f1f5f9;
}

.sub-tab-btn.active {
    color: #be123c !important;
    font-weight: 800 !important;
    border-bottom: 2.5px solid #be123c !important;
    background: rgba(225, 29, 72, 0.04) !important;
}

@media (max-width: 1440px) {
    .sub-tabs-container,
    .sub-tabs-scroll,
    .modern-sub-tabs-bar {
        gap: 4px !important;
        padding-bottom: 4px !important;
        margin-bottom: 12px !important;
    }
    .sub-tab-btn {
        font-size: 0.78rem;
        padding: 5px 9px;
        gap: 4px;
    }
    .sub-tab-btn i,
    .sub-tab-btn svg {
        width: 13px !important;
        height: 13px !important;
    }
}

/* ── LIS PREANALYTICS ACTION CARDS GRID ── */
.lis-action-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
    width: 100%;
}

@media (max-width: 1200px) {
    .lis-action-cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .lis-action-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ── ACCETTAZIONE DESK TABLES OPTIMIZATION ── */
#acc-table-ris,
#acc-table-visite,
#acc-table-lis,
#acc-table-physio,
#acc-table-surgery {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
}

#acc-table-ris th:nth-child(1), #acc-table-ris td:nth-child(1),
#acc-table-visite th:nth-child(1), #acc-table-visite td:nth-child(1),
#acc-table-lis th:nth-child(1), #acc-table-lis td:nth-child(1),
#acc-table-physio th:nth-child(1), #acc-table-physio td:nth-child(1),
#acc-table-surgery th:nth-child(1), #acc-table-surgery td:nth-child(1) { width: 210px; }

#acc-table-ris th:nth-child(2), #acc-table-ris td:nth-child(2),
#acc-table-visite th:nth-child(2), #acc-table-visite td:nth-child(2),
#acc-table-lis th:nth-child(2), #acc-table-lis td:nth-child(2),
#acc-table-physio th:nth-child(2), #acc-table-physio td:nth-child(2),
#acc-table-surgery th:nth-child(2), #acc-table-surgery td:nth-child(2) { width: 190px; }

#acc-table-ris th:nth-child(3), #acc-table-ris td:nth-child(3),
#acc-table-visite th:nth-child(3), #acc-table-visite td:nth-child(3),
#acc-table-lis th:nth-child(3), #acc-table-lis td:nth-child(3),
#acc-table-physio th:nth-child(3), #acc-table-physio td:nth-child(3),
#acc-table-surgery th:nth-child(3), #acc-table-surgery td:nth-child(3) { width: 110px; text-align: center; }

#acc-table-ris th:nth-child(4), #acc-table-ris td:nth-child(4),
#acc-table-visite th:nth-child(4), #acc-table-visite td:nth-child(4),
#acc-table-lis th:nth-child(4), #acc-table-lis td:nth-child(4),
#acc-table-physio th:nth-child(4), #acc-table-physio td:nth-child(4),
#acc-table-surgery th:nth-child(4), #acc-table-surgery td:nth-child(4) { width: 130px; }

#acc-table-ris th:nth-child(5), #acc-table-ris td:nth-child(5),
#acc-table-visite th:nth-child(5), #acc-table-visite td:nth-child(5),
#acc-table-lis th:nth-child(5), #acc-table-lis td:nth-child(5),
#acc-table-physio th:nth-child(5), #acc-table-physio td:nth-child(5),
#acc-table-surgery th:nth-child(5), #acc-table-surgery td:nth-child(5) { width: 95px; text-align: center; }

#acc-table-ris th:nth-child(6), #acc-table-ris td:nth-child(6),
#acc-table-visite th:nth-child(6), #acc-table-visite td:nth-child(6),
#acc-table-lis th:nth-child(6), #acc-table-lis td:nth-child(6),
#acc-table-physio th:nth-child(6), #acc-table-physio td:nth-child(6),
#acc-table-surgery th:nth-child(6), #acc-table-surgery td:nth-child(6) { width: 170px; text-align: right; }

/* ── PATIENT DETAIL 360 MODAL RESPONSIVE OPTIMIZATION ── */
#modal-patient-detail .tabs-sub {
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
    -webkit-overflow-scrolling: touch !important;
}

#modal-patient-detail .tab-sub-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 0.78rem !important;
    font-weight: 600;
    padding: 5px 8px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    transition: all 0.18s ease;
    border-radius: 6px 6px 0 0;
}

#modal-patient-detail .tab-sub-btn:hover {
    color: #0f172a !important;
    background: #f1f5f9;
}

#modal-patient-detail .tab-sub-btn.active {
    font-weight: 800 !important;
    background: rgba(2, 132, 199, 0.05);
}

@media (max-width: 1200px) {
    #modal-patient-detail .modal-box > div:nth-child(2) {
        grid-template-columns: 210px 1fr !important;
    }
}

/* Free slot badges style */
.free-slot-badge {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.free-slot-badge:hover {
    background-color: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.free-slot-badge.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

/* Buttons Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    outline: none;
}

.btn i {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background-color: var(--bg-base);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
    border-color: var(--border-hover);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-sm i {
    width: 14px;
    height: 14px;
}

.w-100 {
    width: 100%;
}

.text-muted {
    color: var(--text-muted);
}

/* Modals Overlay & Box */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 15, 25, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10050;
    padding: 20px;
    overflow-y: auto;
}

.modal-overlay.active {
    display: flex;
    animation: modalFadeIn var(--transition-fast);
}

.modal-box {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    animation: modalSlideUp var(--transition-normal);
}

.modal-box.modal-lg {
    max-width: 900px;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalSlideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--danger);
}

form {
    padding: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
}

.form-group {
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.span-2 {
    grid-column: span 2;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
select,
textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-base);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    background-color: var(--bg-surface);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 20px 0 12px 0;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

/* Checkbox Style */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 8px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.85rem;
    user-select: none;
    color: var(--text-primary);
    font-weight: 500;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modal-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Sample details inside LIS result entry */
.sample-detail-header {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 20px;
}

/* SQL Code Block view */
.sql-code-block {
    background-color: #0b0f19;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    padding: 20px;
    overflow-x: auto;
    max-height: 500px;
    color: #e2e8f0;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* DICOM Viewer specific styling */
.dicom-layout {
    display: grid;
    grid-template-columns: 1.6fr 0.6fr;
    gap: 24px;
    padding: 0 24px 24px 24px;
    height: calc(95vh - 160px);
    min-height: 450px;
    box-sizing: border-box;
}

.dicom-viewer-panel,
.dicom-report-panel,
.dicom-history-panel {
    height: 100% !important;
    max-height: 100% !important;
    box-sizing: border-box;
}

.dicom-viewer-panel {
    background-color: #000000;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    border-right: 1px solid var(--border-color);
    position: relative;
}

.dicom-canvas-container {
    position: relative;
    border: 2px solid #333;
    background-color: #111;
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#dicom-canvas {
    max-width: 100%;
    max-height: 100%;
}

.dicom-overlay-text {
    position: absolute;
    font-family: monospace;
    font-size: 0.75rem;
    color: #00ff00;
    text-shadow: 1px 1px 2px #000;
    pointer-events: none;
    line-height: 1.3;
}

.dicom-overlay-text.top-left {
    top: 10px;
    left: 10px;
}

.dicom-overlay-text.top-right {
    top: 10px;
    right: 10px;
    text-align: right;
}

.dicom-controls {
    display: flex;
    width: 100%;
    gap: 16px;
    padding-top: 10px;
    align-items: center;
}

.dicom-controls .control-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dicom-controls label {
    font-size: 0.75rem;
    color: #ccc;
    font-weight: 500;
}

.dicom-controls input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.dicom-report-panel {
    background-color: transparent;
    overflow-y: auto;
}

/* Patient profile detail layout */
.patient-detail-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    height: 520px;
}

@media (max-width: 768px) {
    .patient-detail-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
}

.patient-profile-card {
    background-color: var(--bg-base);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    overflow-y: auto;
}

.patient-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    margin-bottom: 16px;
}

.patient-avatar-large i {
    width: 36px;
    height: 36px;
}

.patient-meta-list {
    text-align: left;
    width: 100%;
    margin: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 0.85rem;
}

.consent-status-box {
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    text-align: left;
}

.consent-status-box h4 {
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.consent-status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.consent-status-item:last-child {
    margin-bottom: 0;
}

.consent-status-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
}

.consent-status-item .dot.active {
    background-color: var(--success);
}

.patient-history-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.tabs-sub {
    display: flex;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.tab-sub-btn {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-sub-btn.active {
    color: #ffffff;
    background-color: var(--primary);
}

.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
}

/* Timeline */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 5px;
    height: calc(100% - 10px);
    width: 2px;
    background-color: var(--border-color);
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
}

.timeline-dot {
    position: absolute;
    left: -24px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--bg-surface);
    border: 3px solid var(--primary);
    z-index: 10;
}

.timeline-item.lis .timeline-dot { border-color: var(--purple); }
.timeline-item.ris .timeline-dot { border-color: var(--success); }
.timeline-item.admission .timeline-dot { border-color: var(--orange); }

.timeline-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.timeline-content h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.timeline-content p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Audit Log List */
.audit-log-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audit-log-item {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.audit-log-text {
    font-weight: 500;
}

.audit-log-time {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Row Action Toggles/Dropdowns */
.row-actions {
    display: flex;
    gap: 8px;
}

/* ==========================================
   RICH TEXT EDITOR (WYSIWYG) STYLING
   ========================================== */
.editor-toolbar {
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.editor-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    cursor: pointer;
    min-width: 32px;
    height: 32px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
    transition: all var(--transition-fast);
    box-sizing: border-box;
    white-space: nowrap;
    user-select: none;
}

.editor-btn:hover {
    background-color: #f1f5f9;
    color: var(--primary);
    border-color: #94a3b8;
}

.editor-btn.active {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

.editor-btn.editor-btn-action {
    padding: 0 10px;
    gap: 6px;
    font-weight: 700;
}

.editor-btn i {
    width: 15px;
    height: 15px;
    pointer-events: none;
    flex-shrink: 0;
}

.editor-separator {
    width: 1px;
    height: 20px;
    background-color: var(--border-color);
    margin: 0 4px;
}

.editor-select {
    width: auto;
    padding: 4px 8px;
    font-size: 0.8rem;
    height: 30px;
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.rich-editor {
    min-height: 200px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    padding: 16px;
    outline: none;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    overflow-y: auto;
    max-height: 350px;
    transition: all var(--transition-fast);
}

.rich-editor[contenteditable="true"]:empty:before {
    content: attr(placeholder);
    color: var(--text-muted);
    pointer-events: none;
    display: block; /* For Firefox */
}

.rich-editor:focus {
    border-color: var(--primary);
    background-color: var(--bg-surface);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05);
}

/* Styling inside contenteditable for previewing html reports */
.rich-editor b, .rich-editor strong {
    font-weight: 700;
}

.rich-editor i, .rich-editor em {
    font-style: italic;
}

.rich-editor u {
    text-decoration: underline;
}

/* Forms layout adjustments */
.hidden {
    display: none !important;
}

/* Service Configurator Form fields toggling animation */
#srv-clinic-group, #srv-equip-group, #srv-sample-group, #srv-lis-details-group {
    transition: all var(--transition-normal);
}

/* ==========================================
   SEARCH SELECT DROPDOWN & TAG SYSTEM
   ========================================== */
.search-select-container {
    position: relative;
    width: 100%;
}

.search-results-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 220px;
    overflow-y: auto;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.search-result-item {
    padding: 10px 16px;
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: background-color var(--transition-fast);
}

.search-result-item:hover {
    background-color: var(--primary-light);
    color: var(--primary);
}

.selected-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    min-height: 38px;
    max-height: 150px;
    overflow-y: auto;
    padding: 8px;
    background-color: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.test-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--purple-light);
    color: var(--purple);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 4px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.test-tag-remove {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.test-tag-remove:hover {
    color: var(--danger);
}

/* Database settings alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.4;
    margin-top: 15px;
    white-space: pre-line;
}
.alert-info {
    background-color: var(--primary-light);
    color: var(--primary);
    border-left: 4px solid var(--primary);
}
.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border-left: 4px solid var(--success);
}
.alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border-left: 4px solid var(--danger);
}
.hidden {
    display: none !important;
}

/* ==========================================
   PRINTING STYLES (CLINICAL REPORTS)
   ========================================== */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .app-container, .sidebar, .main-content, .top-header, .content-body, .modal-overlay, .modal-box, .modal-header, .modal-footer, .modal-close {
        visibility: hidden !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
    
    /* Make the active report overlay visible and set it to print full screen */
    .modal-overlay.active {
        display: block !important;
        visibility: hidden !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .modal-overlay.active .modal-box,
    .modal-overlay.active .modal-body,
    .modal-overlay.active .report-print-container,
    .modal-overlay.active .report-print-container * {
        visibility: visible !important;
    }
    
    .modal-overlay.active .modal-box {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .modal-overlay.active .modal-body {
        padding: 0 !important;
        margin: 0 !important;
    }

    .modal-overlay.active .report-print-container {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
}

/* Visite Reporting Layout Override */
.dicom-layout.no-viewer {
    grid-template-columns: 1.6fr 0.6fr !important;
}
.dicom-layout.no-viewer .dicom-viewer-panel {
    display: none !important;
}

/* Agenda Google-Calendar Grid Visualizer & Modern Slot Cards */
.calendar-grid {
    display: grid;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md, 10px);
    background-color: #ffffff;
    margin-top: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.04);
}
.calendar-header-cell {
    padding: 8px 6px;
    font-weight: 800;
    text-align: center;
    background-color: #090d16;
    border-bottom: 2px solid #e11d48;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 0.80rem;
    min-height: 54px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: #ffffff;
}
.calendar-time-cell {
    min-height: 52px;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 800;
    text-align: center;
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1.5px solid #cbd5e1;
    font-size: 0.78rem;
    color: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
}
.calendar-slot-cell {
    min-height: 52px;
    box-sizing: border-box;
    border-bottom: 1px solid #f1f5f9;
    border-right: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding: 3px 4px;
    background-color: #ffffff;
    transition: background-color 0.15s ease;
}
.calendar-slot-cell:hover {
    background-color: #fcfcfc;
}
.calendar-slot-available {
    background-color: #ffffff;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 44px;
    border: 1px dashed transparent;
}
.calendar-slot-available:hover {
    background-color: #f0fdf4;
    border-color: #86efac;
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.08);
}
.calendar-slot-available-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 0.72rem;
    font-weight: 700;
    color: #10b981;
    transition: all 0.15s ease;
}
.calendar-slot-available:hover .calendar-slot-available-indicator {
    color: #059669;
    transform: scale(1.03);
}
.calendar-slot-booked {
    background-color: #fff1f2;
    border-left: 4px solid #e11d48;
    border-radius: var(--radius-sm, 6px);
    padding: 6px 8px;
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
    color: #0f172a;
}
.calendar-slot-booked-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4px 6px;
    box-sizing: border-box;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
    cursor: pointer;
}
.calendar-slot-booked-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    filter: brightness(0.98);
}
.calendar-slot-spanning-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    box-sizing: border-box;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #475569;
    font-size: 0.70rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}
.calendar-slot-spanning-card:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.calendar-slot-booked strong {
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 2px;
}
.calendar-slot-free {
    color: var(--success);
    font-size: 0.68rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px;
    border: 1px dashed var(--success);
    border-radius: var(--radius-sm);
    text-align: center;
    background-color: rgba(16, 185, 129, 0.04);
    width: calc(100% - 8px);
    margin: 2px auto;
    box-sizing: border-box;
}
.calendar-slot-free:hover {
    background-color: var(--success-light);
}
.calendar-slot-inactive {
    background: repeating-linear-gradient(
        -45deg,
        #f8fafc,
        #f8fafc 8px,
        #f1f5f9 8px,
        #f1f5f9 16px
    );
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    user-select: none;
}
body.dark-theme .calendar-slot-inactive {
    background: repeating-linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.02) 10px,
        rgba(255, 255, 255, 0.05) 10px,
        rgba(255, 255, 255, 0.05) 20px
    );
}

/* --- OVERLAPPING MODALS (Z-INDEX FIX) --- */
#modal-add-patient, 
#modal-add-claim, 
#modal-lis-print-prompt {
    z-index: 1200 !important;
}

/* --- LIS PRINT LABELS AND RECEIPTS --- */
.lis-label-container {
    width: 60mm;
    height: 35mm;
    padding: 3mm;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    color: #000;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border: 1px solid #ccc;
    border-radius: 4px;
    margin: 10px auto;
}
.lis-label-title {
    font-size: 8pt;
    font-weight: 700;
    text-transform: uppercase;
    border-bottom: 1px solid #000;
    padding-bottom: 1mm;
    margin: 0;
}
.lis-label-patient {
    font-size: 9pt;
    font-weight: 700;
    margin: 1mm 0 0.5mm 0;
}
.lis-label-info {
    font-size: 7pt;
    color: #333;
}
.lis-label-barcode-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1mm;
}
.lis-barcode-visual {
    height: 8mm;
    display: flex;
    align-items: stretch;
    justify-content: center;
    width: 100%;
}
.lis-barcode-visual span {
    display: inline-block;
    background: #000;
    margin-right: 1px;
}
.lis-label-barcode-text {
    font-family: monospace;
    font-size: 9pt;
    font-weight: 700;
    margin-top: 1mm;
}

/* Sub-tabs styles */
.sub-tabs-container {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    padding-bottom: 0px;
}
.sub-tab-btn {
    padding: 10px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
}
.sub-tab-btn:hover {
    color: var(--primary);
    background: var(--primary-light);
}
.sub-tab-btn.active {
    color: var(--primary);
    border-bottom: 3px solid var(--primary);
}

/* Patient Autocomplete Styles */
.patient-autocomplete-container {
    position: relative;
    width: 100%;
}

.patient-search-input {
    width: 100% !important;
}

.patient-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    box-shadow: var(--shadow-lg, 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05));
    z-index: 9999;
}

.patient-suggestion-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary, #0f172a);
    transition: background-color var(--transition-fast, 0.2s), color var(--transition-fast, 0.2s);
    border-bottom: 1px solid var(--border-color, #f1f5f9);
    text-align: left;
}

.patient-suggestion-item:last-child {
    border-bottom: none;
}

.patient-suggestion-item:hover {
    background-color: var(--primary-light, #eff6ff);
    color: var(--primary, #3b82f6);
}

.patient-suggestion-item strong {
    font-weight: 600;
    display: block;
}

.patient-suggestion-item .tax-code {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    margin-top: 2px;
}

/* AI Search & Advanced Filters */
.ai-search-container {
    margin-bottom: 20px;
    background: var(--bg-card, #ffffff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    padding: 15px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.ai-search-container:focus-within {
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.15);
}
.ai-search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    width: 100%;
}
.ai-search-input-wrapper i.sparkles-icon {
    position: absolute;
    left: 12px;
    color: #a855f7;
    pointer-events: none;
    width: 16px;
    height: 16px;
}
.ai-search-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-base, #f8fafc);
    color: var(--text-primary, #0f172a);
    font-size: 0.88rem;
    outline: none;
    transition: border-color 0.2s;
}
.ai-search-input:focus {
    border-color: #a855f7;
}
.ai-search-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary, #64748b);
    align-items: center;
}
.ai-search-hint-chip {
    background: rgba(168, 85, 247, 0.08);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.15);
    border-radius: 12px;
    padding: 2px 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}
.ai-search-hint-chip:hover {
    background: rgba(168, 85, 247, 0.15);
    transform: translateY(-1px);
}
.advanced-filters-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color, #e2e8f0);
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}
.filter-group label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.filter-group select, .filter-group input {
    padding: 8px 10px;
    font-size: 0.82rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-sm, 4px);
    background: var(--bg-base, #f8fafc);
    color: var(--text-primary, #0f172a);
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
}
.filter-group select:focus, .filter-group input:focus {
    border-color: var(--primary, #3b82f6);
}
.filter-actions {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .sidebar, .app-header, .btn, .sub-tab-navigation, .ai-search-container, .card-header, .row-actions, .modal-overlay, #db-conn-status {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .card {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    table {
        width: 100% !important;
        border-collapse: collapse !important;
        color: #000000 !important;
    }
    th, td {
        border: 1px solid #000000 !important;
        padding: 6px 8px !important;
        font-size: 0.8rem !important;
        background: transparent !important;
        color: #000000 !important;
    }
}

/* Glassmorphism Chat Styling */
#nextcare-chat-widget {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#chat-bubble:hover, #floating-support-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}
#chat-users-list .chat-user-item {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s ease;
    color: var(--text-primary);
}
#chat-users-list .chat-user-item:hover {
    background: rgba(99, 102, 241, 0.1);
}
#chat-users-list .chat-user-item.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}
.chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.chat-status-dot.active { background-color: #10b981; }
.chat-status-dot.inattivo { background-color: #f59e0b; }
.chat-status-dot.offline { background-color: #9ca3af; }

.chat-message-bubble {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    font-size: 0.825rem;
    line-height: 1.4;
    word-break: break-word;
}
.chat-message-bubble.sent {
    background: linear-gradient(135deg, var(--primary), var(--purple));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}
.chat-message-bubble.received {
    background: var(--bg-base);
    color: var(--text-primary);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border: 1px solid var(--border-color);
}
.chat-message-time {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
    align-self: flex-end;
}
.chat-message-bubble.sent .chat-message-time {
    color: rgba(255, 255, 255, 0.8);
}
.chat-attachment-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    color: var(--primary);
    text-decoration: none;
}
.chat-message-bubble.sent .chat-attachment-link {
    color: white;
    text-decoration: underline;
}
.chat-case-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.chat-message-bubble.sent .chat-case-card {
    color: var(--text-primary);
}
.instrument-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
}
.instrument-status-dot.active { background-color: #10b981; }
.instrument-status-dot.error { background-color: #ef4444; }
.instrument-status-dot.starting { background-color: #f59e0b; }
.instrument-status-dot.disabled { background-color: #9ca3af; }

/* Custom Toggle Switch for permissions and module configuration */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

input:disabled + .slider {
  background-color: #e2e8f0;
  cursor: not-allowed;
  opacity: 0.6;
}

/* ============================================================================
   COOKIE CONSENT & GDPR COMPLIANCE STYLES
   ============================================================================ */
.cookie-consent-banner {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: calc(100% - 48px);
    max-width: 480px;
    background-color: var(--bg-surface-trans);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    padding: 24px;
    z-index: 990;
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    font-family: var(--font-body);
}

.cookie-consent-banner.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.cookie-consent-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.cookie-consent-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.cookie-consent-desc a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}

.cookie-consent-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.cookie-consent-actions button {
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
}

.cookie-custom-panel {
    border-top: 1px solid var(--border-color);
    margin-top: 15px;
    padding-top: 15px;
}

.cookie-option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cookie-option-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cookie-option-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.cookie-option-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Switch Toggle (iOS style) */
.cookie-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 20px;
}

.cookie-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cookie-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .3s;
    border-radius: 20px;
}

.cookie-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.cookie-switch input:checked + .cookie-slider {
    background-color: var(--success);
}

.cookie-switch input:disabled + .cookie-slider {
    background-color: var(--border-color);
    cursor: not-allowed;
}

.cookie-switch input:checked + .cookie-slider:before {
    transform: translateX(18px);
}

@media (max-width: 480px) {
    .cookie-consent-banner {
        bottom: 12px;
        right: 12px;
        left: 12px;
        width: auto;
        padding: 16px;
    }
}

/* ==========================================================================
   STILI PER LA RESPONSIVITÀ GLOBALE (MOBILE, TABLET, LAPTOP, DESKTOP)
   ========================================================================== */

/* Breakpoint Grandi Laptop e Desktop Scaling 125% (≤ 1600px) */
@media (max-width: 1600px) {
    :root {
        --sidebar-width: 245px;
    }
    .content-body {
        padding: 22px 26px 70px 26px;
    }
    th, td {
        padding: 9px 12px;
        font-size: 0.84rem;
    }
}

/* Breakpoint Desktop Compatti / Basse Risoluzioni / Laptop 1366x768 & 1440x900 */
@media (max-width: 1440px) or (max-height: 900px) {
    :root {
        --sidebar-width: 225px;
        --header-height: 55px;
    }
    
    html {
        font-size: 13.5px; /* Ridimensionamento proporzionale di tutti i rem */
    }
    
    .sidebar-header {
        padding: 14px 16px;
    }
    
    .logo-icon {
        width: 30px;
        height: 30px;
        font-size: 0.95rem;
    }
    
    .logo-title {
        font-size: 1.05rem;
    }
    
    .nav-item {
        padding: 6px 10px;
        font-size: 0.84rem;
        gap: 7px;
    }
    
    .sidebar-footer {
        padding: 10px 14px;
    }
    
    .top-header {
        padding: 0 20px;
    }
    
    .content-body {
        padding: 16px 20px 70px 20px !important;
    }
    
    .welcome-banner {
        padding: 18px 22px;
        margin-bottom: 16px;
    }
    
    .card {
        margin-bottom: 14px;
        max-width: 100%;
        overflow: hidden;
    }
    
    .card-header, .card-body {
        padding: 14px 16px;
    }
    
    .card-header h2 {
        font-size: 0.98rem;
    }
    
    /* Riduzione gap griglie generali */
    .grid, .kpi-grid, .dashboard-grid {
        gap: 12px !important;
    }

    .kpi-card {
        padding: 12px 14px !important;
    }
    
    .kpi-value {
        font-size: 1.45rem !important;
    }
    
    /* Tabelle compatte ad altissima leggibilità */
    th, td {
        padding: 7px 9px !important;
        font-size: 0.82rem !important;
    }

    .table-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .btn-sm {
        padding: 4px 8px !important;
        font-size: 0.75rem !important;
    }

    .advanced-filters-panel {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
        gap: 10px !important;
    }
}

/* Nascosto su Desktop */
.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background-color: var(--bg-hover);
}

.mobile-menu-toggle i {
    width: 24px;
    height: 24px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 95;
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* Regole per schermi < 1024px (Tablet & Mobile) */
@media (max-width: 1024px) {
    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-menu-close {
        display: block !important;
    }

    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 100;
        box-shadow: var(--shadow-lg);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        min-width: 0;
    }

    .top-header {
        display: flex !important;
        height: 50px !important;
        padding: 0 16px !important;
    }

    .header-actions {
        display: none !important;
    }

    /* Modali Responsive */
    .modal-box {
        width: 95% !important;
        max-width: 650px !important;
        margin: 15px auto !important;
        padding: 20px !important;
    }

    /* Griglie a colonne responsive */
    .grid, .kpi-grid, .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
        gap: 16px !important;
    }

    /* Adattamento form con colonne multiple */
    .form-grid, .form-row {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Sezione tabelle con scroll orizzontale */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
    }

    table {
        min-width: 800px; /* Impedisce il collasso della tabella */
    }
}

/* Regole per schermi < 768px (Mobile) */
@media (max-width: 768px) {
    .top-header {
        height: 60px;
    }

    .content-body {
        padding: 16px !important;
    }

    .welcome-banner {
        padding: 20px !important;
    }

    .welcome-banner h1 {
        font-size: 1.5rem !important;
    }

    /* Modali ancora piÔö£Ôòú compatte */
    .modal-box {
        padding: 16px !important;
    }

    /* Allineamenti form */
    .filter-group, .advanced-filters-panel {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    
    .ai-search-input-wrapper {
        flex-direction: column !important;
        height: auto !important;
        gap: 8px !important;
    }
    
    .ai-search-input {
        width: 100% !important;
    }
    
    .ai-search-input-wrapper button {
        width: 100% !important;
        height: 40px !important;
    }

    /* Tab orizzontali diventano scrollabili o incolonnate */
    .sub-tabs-container {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 6px !important;
    }
    
    .sub-tab-btn {
        padding: 8px 12px !important;
        font-size: 0.8rem !important;
    }
}

/* Universal Table Search & Sorting */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 28px !important;
    transition: background-color var(--transition-fast) !important;
}

.sortable-header:hover {
    background-color: var(--bg-hover) !important;
    color: var(--primary) !important;
}

.sort-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.sortable-header:hover .sort-icon-wrapper {
    color: var(--primary);
}

.sorted-column {
    background-color: rgba(59, 130, 246, 0.02);
}

.universal-search-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
    max-width: 320px;
    margin-bottom: 12px;
}

.universal-search-input {
    width: 100%;
    padding: 8px 36px 8px 12px;
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-primary);
    background-color: var(--bg-surface);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.universal-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.universal-search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    transition: all var(--transition-fast);
}

.universal-search-clear:hover {
    color: var(--text-primary);
    background-color: var(--bg-base);
}

/* Results modal compact table */
.results-table-compact th, 
.results-table-compact td {
    padding: 8px 12px !important;
    font-size: 0.82rem !important;
}

.results-table-compact tr:hover {
    background-color: var(--bg-hover) !important;
}

/* ========================================================================= */
/* RESPONSIVE ACCETTAZIONE MODALS (LIS, RIS, ADMISSION, EDIT) OVERRIDES      */
/* ========================================================================= */

/* Large screens layout polish for max-width modals to look wide, clean & comfortable */
.modal-overlay.active .modal-box {
    display: flex;
    flex-direction: column;
    max-height: 95vh !important;
}

.modal-box.modal-lg {
    max-width: 92% !important;
    width: 1100px !important;
}

/* Scrollable form/body keeping header and footer sticky */
.modal-box form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.modal-box .modal-body {
    flex: 1;
    overflow-y: auto !important;
    min-height: 0;
}

/* Breakpoint for Tablets and Medium-sized screens */
@media (max-width: 1024px) {
    .modal-box {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        max-height: 94vh !important;
    }
    
    /* Overriding inline grid-template-columns style on LIS, RIS and edit modals */
    #modal-add-sample form > div[style*="grid-template-columns"],
    #modal-add-ris form > div[style*="grid-template-columns"],
    #modal-edit-acceptance form div[style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
    
    /* Clean up borders and extra padding on edit column split */
    #modal-edit-acceptance form div[style*="border-left"] {
        border-left: none !important;
        padding-left: 0 !important;
        border-top: 1px solid var(--border-color) !important;
        padding-top: 15px !important;
    }
}

/* Breakpoint for Mobile and small tablets */
@media (max-width: 768px) {
    .modal-box {
        width: 98% !important;
        max-width: 98% !important;
        max-height: 98vh !important;
        margin: 4px auto !important;
    }

    .modal-header {
        padding: 16px !important;
    }

    .modal-footer {
        padding: 12px 16px !important;
    }

    /* Stack all sub-grids and small form rows inside modals */
    .modal-box .form-grid, 
    .modal-box [style*="display: grid; grid-template-columns"] {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    /* Keep the LIS selected tests container and other tag containers compact but scrollable */
    .selected-tags-container {
        max-height: 140px !important;
    }
}

/* Native full-screen feel on very small mobile screens */
@media (max-width: 480px) {
    .modal-overlay {
        padding: 0 !important;
    }
    
    .modal-box {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0 !important;
        border: none !important;
    }
}


/* ==========================================================================
   DYNAMIC BARCODE LABEL EDITOR STYLES
   ========================================================================== */

.label-canvas-viewport {
    background-color: #0b0c10 !important;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1.5px, transparent 1.5px) !important;
    background-size: 12px 12px !important;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    position: relative;
}

#label-interactive-canvas {
    background-color: #ffffff !important;
    color: #000000 !important;
    position: relative;
    border-radius: 4px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6);
    border: 1px solid #1e293b;
    outline: none;
    box-sizing: border-box;
}

.label-drag-element {
    position: absolute;
    cursor: move;
    border: 1px dashed transparent;
    user-select: none;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 1px 2px;
}

.label-drag-element:hover {
    border-color: rgba(59, 130, 246, 0.5);
    background-color: rgba(59, 130, 246, 0.03);
}

.label-drag-element.active {
    border: 1.5px solid #3b82f6 !important;
    background-color: rgba(59, 130, 246, 0.06);
    z-index: 100;
}

.label-drag-element .resize-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: #3b82f6;
    border: 1px solid #ffffff;
    border-radius: 50%;
    right: -4px;
    bottom: -4px;
    cursor: se-resize;
    display: none;
    z-index: 110;
}

.label-drag-element.active .resize-handle {
    display: block;
}

.label-text-preview {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: monospace;
    font-weight: 700;
    line-height: 1.1;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.label-barcode-preview-img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.label-drag-element .element-type-badge {
    position: absolute;
    top: -16px;
    left: -1px;
    background-color: #3b82f6;
    color: #ffffff;
    font-size: 7px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px 3px 0 0;
    text-transform: uppercase;
    display: none;
    white-space: nowrap;
}

.label-drag-element.active .element-type-badge {
    display: block;
}




/* ============================================================
   STAMPA DIRETTA REFERTO LIS ├ö├ç├Â Clone print isolation
   Usato da printSingleLisReport() per garantire output
   identico al modal anteprima
   ============================================================ */

#lis-print-clone {
    display: none;
}

@media print {
    /* Quando body.print-lis-direct: nasconde TUTTO tranne il clone */
    body.print-lis-direct > *:not(#lis-print-clone) {
        display: none !important;
        visibility: hidden !important;
    }

    body.print-lis-direct #lis-print-clone {
        display: block !important;
        visibility: visible !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: auto !important;
        background: #ffffff !important;
        z-index: 99999 !important;
        padding: 40px !important;
        box-sizing: border-box !important;
    }

    /* Reset tema ├ö├ç├Â forza colori chiari su tutti i figli del clone */
    body.print-lis-direct #lis-print-clone,
    body.print-lis-direct #lis-print-clone * {
        color: #1e293b !important;
        background-color: transparent !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Ripristina background colorati espliciti (box grigio paziente, celle tabella) */
    body.print-lis-direct #lis-print-clone [style*="background: #f8fafc"],
    body.print-lis-direct #lis-print-clone [style*="background-color: #f8fafc"],
    body.print-lis-direct #lis-print-clone [style*="background:#f8fafc"] {
        background-color: #f8fafc !important;
    }
    body.print-lis-direct #lis-print-clone [style*="background: #fef2f2"],
    body.print-lis-direct #lis-print-clone [style*="background-color: #fef2f2"] {
        background-color: #fef2f2 !important;
    }

    /* Pagina A4 */
    @page {
        size: A4 portrait;
        margin: 1.2cm 1.5cm;
    }
}




/* RIS Dark Theme */
.ris-dark-theme .modal-box {
    background: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
/* RIS Light Theme Standard */
.ris-light-clean {
    background: #ffffff !important;
    color: #0f172a !important;
}

/* RIS Clinical Reporting Dark Suite - Progettata per Radiologia e Massima Concentrazione Visiva */
#modal-dicom-viewer.modal-overlay {
    background: rgba(3, 7, 18, 0.92) !important;
    backdrop-filter: blur(12px) !important;
}
#modal-dicom-viewer .modal-box {
    width: 96vw !important;
    max-width: 1880px !important;
    height: 96vh !important;
    max-height: 96vh !important;
    background: #090d16 !important;
    color: #f1f5f9 !important;
    border: 1px solid #1e293b !important;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.85) !important;
    border-radius: 14px !important;
}
#modal-dicom-viewer .modal-header {
    background: #0f172a !important;
    border-bottom: 1px solid #1e293b !important;
    color: #f8fafc !important;
}
#modal-dicom-viewer #dicom-modal-title {
    color: #f8fafc !important;
}
#modal-dicom-viewer select,
#modal-dicom-viewer input {
    background: #090d16 !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}
#modal-dicom-viewer select:focus,
#modal-dicom-viewer input:focus {
    border-color: #00f0ff !important;
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2) !important;
}
#modal-dicom-viewer select option {
    background: #0f172a !important;
    color: #f8fafc !important;
}
#modal-dicom-viewer .editor-container {
    background: #0a0e1a !important;
    border: 1.5px solid #334155 !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;
}
#modal-dicom-viewer .editor-btn {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #cbd5e1 !important;
}
#modal-dicom-viewer .editor-btn:hover {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #00f0ff !important;
}
#modal-dicom-viewer .editor-separator {
    background: #334155 !important;
}
#modal-dicom-viewer .editor-select {
    background: #090d16 !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}
#dicom-report-editor {
    background: #060913 !important;
    color: #f8fafc !important;
    font-size: 1.05rem !important;
    line-height: 1.75 !important;
    caret-color: #00f0ff !important;
}
#dicom-report-editor:focus {
    background: #050811 !important;
}
#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;
}
#dicom-report-editor h3 {
    color: #00f0ff !important;
    font-size: 1rem !important;
    font-weight: 700 !important;
    margin-top: 12px !important;
    margin-bottom: 6px !important;
}
#dicom-report-editor p {
    color: #e2e8f0 !important;
    margin: 4px 0 !important;
}
#dicom-report-editor strong {
    color: #ffffff !important;
}
#dicom-report-editor table {
    border-collapse: collapse !important;
    width: 100% !important;
    margin: 12px 0 !important;
    border: 1px solid #334155 !important;
}
#dicom-report-editor th, #dicom-report-editor td {
    border: 1px solid #334155 !important;
    padding: 6px 10px !important;
    color: #e2e8f0 !important;
}
#dicom-report-editor th {
    background: #1e293b !important;
    font-weight: 700 !important;
    color: #38bdf8 !important;
}

/* ============================================================================
   UNIFIED ACCEPTANCE (LIS/RIS) - CSS MODULE
   ============================================================================ */
.unified-checkin-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* --- TOP HEADER --- */
.patient-header {
    background: var(--surface); color: var(--text); padding: 1.25rem 2rem;
    display: flex; justify-content: space-between; align-items: center;
    flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.patient-info-block { display: flex; align-items: center; gap: 1.5rem; }
.avatar-box {
    width: 60px; height: 60px; background: var(--bg-color);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 1.8rem; color: var(--primary); border: 2px solid var(--border);
}
.patient-details h2 { font-size: 1.6rem; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 0.5rem;}
.patient-details p { font-size: 0.95rem; color: var(--text-muted); margin:0; }

.economic-summary-header {
    text-align: right; background: rgba(0,0,0,0.2);
    padding: 0.75rem 1.5rem; border-radius: var(--radius-md); border: 1px solid rgba(255,255,255,0.1);
}
.economic-summary-header h3 { font-size: 1.8rem; font-weight: 700; color: #34d399; margin:0;}
.economic-summary-header span { font-size: 0.8rem; color: #cbd5e1; text-transform: uppercase; letter-spacing: 1px; }

/* --- MAIN BODY --- */
.unified-main-body { display: flex; flex: 1; overflow: hidden; background: var(--bg-base); }

/* LEFT SIDEBAR */
.unified-sidebar {
    width: 360px; background: var(--bg-surface); border-right: 1px solid var(--border-color);
    padding: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; overflow-y: auto;
}
.unified-section-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-secondary); font-family: var(--font-heading); font-weight: 700; margin-bottom: 0.75rem; }

/* Privacy Block */
.privacy-block { padding: 1rem; border-radius: var(--radius-sm); border: 1px solid; font-size: 0.9rem; }
.privacy-block.unsigned { background: var(--danger-light); border-color: #fca5a5; color: #991b1b; }
.privacy-block.signed { background: var(--success-light); border-color: #6ee7b7; color: #065f46; }

/* SSN Button Block */
.ssn-block { background: var(--primary-light); padding: 1rem; border-radius: var(--radius-md); border: 1px solid #bfdbfe; }
.btn-ssn {
    width: 100%; padding: 1rem; background: var(--primary-gradient); color: white;
    border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 0.75rem;
    box-shadow: var(--shadow-md); transition: 0.2s;
}
.btn-ssn:hover { filter: brightness(1.1); transform: translateY(-2px); }

/* Economic Logic Container */
.economic-breakdown {
    background: var(--bg-base); padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color);
}
.eco-row { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.eco-row.bold { font-weight: 600; color: var(--text-primary); }
.eco-row.total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border-color); padding-top: 0.5rem; margin-top: 0.5rem; color: var(--text-primary); }
.eco-row.ins-row { color: var(--purple); font-size: 0.85rem;}

/* RIGHT CONTENT */
.unified-content-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.unified-tabs { display: flex; background: var(--bg-surface); border-bottom: 1px solid var(--border-color); padding: 0 1rem; }
.unified-tab {
    padding: 1rem 2rem; font-weight: 600; color: var(--text-secondary); font-family: var(--font-heading);
    cursor: pointer; border-bottom: 3px solid transparent; transition: 0.2s; display: flex; align-items: center; gap: 0.5rem;
}
.unified-tab:hover { color: var(--primary); background: var(--bg-base); }
.unified-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.module-content { flex: 1; padding: 1.5rem; overflow-y: auto; background: var(--bg-base); }

.unified-search-box { position: relative; margin-bottom: 1.5rem; }
.unified-search-box i { position: absolute; left: 1.2rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 1.2rem; }
.unified-search-input {
    width: 100%; padding: 1.2rem 1.2rem 1.2rem 3.5rem; font-size: 1.2rem;
    border: 1px solid var(--border-color); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.unified-search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light); }

/* Exam Lists */
.exam-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 2rem; }
.exam-item {
    background: white; border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center;
}
.exam-item:hover { border-color: var(--border-hover); }
.exam-info h4 { font-weight: 600; font-size: 1.05rem; margin:0; }
.exam-info .loinc { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.2rem; display: inline-block; background: var(--bg-base); padding: 2px 6px; border-radius: 4px; }

/* Advanced Price Editor */
.price-editor { display: flex; align-items: center; gap: 0.5rem; background: var(--bg-base); padding: 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.price-editor input { border: 1px solid var(--border-color); border-radius: 4px; padding: 6px; font-weight: 600; text-align: right; }
.price-editor input:focus { border-color: var(--primary); outline: none; }
.input-perc { width: 55px; }
.input-tot { width: 80px; color: var(--success); }
.exam-delete { color: var(--danger); cursor: pointer; padding: 0.5rem; opacity: 0.7; font-size: 1.2rem; transition: 0.2s;}
.exam-delete:hover { opacity: 1; transform: scale(1.1); }

/* Specific Consents Block */
.module-consents { background: var(--warning-light); border: 1px solid #fde68a; padding: 1rem; border-radius: var(--radius-sm); margin-top: 1rem; }

.tubes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tube-card { background: white; border: 1px solid var(--border-color); padding: 1rem; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 1rem; }
.tube-cap { width: 16px; height: 30px; border-radius: 4px; border: 2px solid #cbd5e1; position: relative; }
.tube-cap::before { content: ''; position: absolute; top: -2px; left: -2px; right: -2px; height: 10px; border-radius: 4px 4px 0 0; }
.cap-purple::before { background: #8b5cf6; }

.ris-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; }
.ris-panel { background: white; border: 1px solid var(--border-color); padding: 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); }

.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

/* ACTION FOOTER */
.action-footer {
    background: var(--bg-surface); border-top: 1px solid var(--border-color); padding: 1rem 2rem;
    display: flex; justify-content: flex-end; align-items: center; gap: 1rem;
}

/* Toast Notification */
.print-toast {
    position: fixed; bottom: -100px; left: 50%; transform: translateX(-50%);
    background: #1e293b; color: white; padding: 1rem 2rem; border-radius: 30px;
    font-weight: 600; display: flex; align-items: center; gap: 1rem;
    box-shadow: var(--shadow-lg); transition: 0.4s; z-index: 10000;
}
.print-toast.show { bottom: 30px; }
/ *   = = =   M O D A L   P R O T O T Y P E   O V E R R I D E S   = = =   * / 
 
.btn-ssn { width: 100%; padding: 1rem; background: var(--primary-gradient); color: white; border: none; border-radius: var(--radius-sm); font-size: 1rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.75rem; box-shadow: var(--shadow-md); transition: 0.2s; }
.btn-ssn:hover { filter: brightness(1.1); transform: translateY(-2px); }
.economic-breakdown { background: var(--bg-base); padding: 1rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); }
.eco-row { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 0.5rem; color: var(--text-secondary); }
.eco-row.bold { font-weight: 600; color: var(--text-primary); }
.eco-row.total { font-weight: 700; font-size: 1.1rem; border-top: 1px solid var(--border-color); padding-top: 0.5rem; margin-top: 0.5rem; color: var(--text-primary); }
.eco-row.ins-row { color: var(--purple); font-size: 0.85rem;}
.price-editor { display: flex; align-items: center; gap: 0.5rem; background: var(--bg-base); padding: 0.5rem; border-radius: var(--radius-sm); border: 1px solid var(--border-color); }
.price-editor input { border: 1px solid var(--border-color); border-radius: 4px; padding: 6px; font-weight: 600; text-align: right; }
.price-editor input:focus { border-color: var(--primary); outline: none; }
.input-perc { width: 55px; }
.input-tot { width: 80px; color: var(--success); }
.exam-delete { color: var(--danger); cursor: pointer; padding: 0.5rem; opacity: 0.7; font-size: 1.2rem; transition: 0.2s;}
.exam-delete:hover { opacity: 1; transform: scale(1.1); }
.module-consents { background: var(--warning-light); border: 1px solid #fde68a; padding: 1rem; border-radius: var(--radius-sm); margin-top: 1rem; }
.tubes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tube-card { background: white; border: 1px solid var(--border-color); padding: 1rem; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 1rem; }
.tube-cap { width: 16px; height: 30px; border-radius: 4px; border: 2px solid #cbd5e1; position: relative; }
.tube-cap::before { content: ''; position: absolute; top: -2px; left: -2px; right: -2px; height: 10px; border-radius: 4px 4px 0 0; }
.cap-purple::before { background: #8b5cf6; }
.cap-red::before { background: #ef4444; }
.cap-blue::before { background: #3b82f6; }
.cap-green::before { background: #10b981; }
.cap-gray::before { background: #64748b; }
.cap-yellow::before { background: #eab308; }
.ris-config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1rem; }
.ris-panel { background: white; border: 1px solid var(--border-color); padding: 1.5rem; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 0; border-bottom: 1px solid var(--border-color); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #cbd5e1; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ''; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(20px); }

.unified-modal { font-family: var(--font-body); }
.unified-modal * { font-family: inherit; }
.unified-modal h1, .unified-modal h2, .unified-modal h3, .unified-modal h4, .unified-modal h5, .unified-modal h6 { font-family: var(--font-heading); }
\n



/* ========================================================
   MODALE AGENDA OPERATIVA - HORIZONTAL V3
   ======================================================== */
#modal-add-agenda .modal-box {
    width: 100% !important;
    max-width: 1100px !important;
    background: #ffffff;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(226, 232, 240, 1);
    overflow: hidden;
}

#modal-add-agenda .modern-header-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
}

#modal-add-agenda .modern-header-subtitle {
    font-size: 0.75rem;
    font-weight: 500;
    color: #64748b;
    margin-top: 0.25rem;
}

#modal-add-agenda .agenda-grid {
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    #modal-add-agenda .agenda-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

#modal-add-agenda .col-left {
    padding: 1.5rem;
    background: #ffffff;
    border-right: 1px solid #f1f5f9;
}

#modal-add-agenda .col-right {
    padding: 1.5rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

#modal-add-agenda .modern-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

#modal-add-agenda .modern-input {
    width: 100%;
    padding: 0.625rem 1rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    color: #1e293b;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}

#modal-add-agenda .modern-input:focus {
    background-color: #ffffff;
    border-color: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.15);
}

#modal-add-agenda .section-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.5rem;
    color: #0284c7;
}

#modal-add-agenda .dynamic-group {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 0.75rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#modal-add-agenda .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #f1f5f9;
    background: #ffffff;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

#modal-add-agenda .btn-modern-primary {
    background: #0ea5e9;
    color: white;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
#modal-add-agenda .btn-modern-primary:hover {
    background: #0284c7;
}

#modal-add-agenda .btn-modern-secondary {
    background: #f1f5f9;
    color: #475569;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
#modal-add-agenda .btn-modern-secondary:hover {
    background: #e2e8f0;
}

/* ============================================================================
   LINKEDIN AI CONTENT STUDIO — Stili Modulo
   ============================================================================ */

.li-studio-wrapper {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    font-family: var(--font-body);
}

.li-studio-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.li-studio-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.li-status-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.li-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.li-badge-ok      { background: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.li-badge-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.li-badge-warn    { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.li-badge-loading { background: #f1f5f9; color: #64748b; border: 1px solid #e2e8f0; }

.li-connect-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #0A66C2;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}
.li-connect-btn:hover { background: #004182; transform: translateY(-1px); }

.li-tab-nav {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.3rem;
}

.li-tab-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
}
.li-tab-btn:hover { background: var(--bg-base); color: var(--text-primary); }
.li-tab-btn.active {
    background: #0A66C2;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(10, 102, 194, 0.25);
}

.li-generator-layout {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.25rem;
}

.li-controls-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: fit-content;
}

.li-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.li-field-group { display: flex; flex-direction: column; gap: 0.4rem; }

.li-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.li-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.15s;
}
.li-select:focus { outline: none; border-color: #0A66C2; }

.li-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-base);
    color: var(--text-primary);
    font-size: 0.875rem;
    resize: vertical;
    font-family: inherit;
    box-sizing: border-box;
}
.li-textarea:focus { outline: none; border-color: #0A66C2; }

.li-tone-selector, .li-length-selector, .li-lang-selector {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.li-tone-btn, .li-len-btn, .li-lang-btn {
    flex: 1;
    padding: 0.4rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-base);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.li-tone-btn:hover, .li-len-btn:hover, .li-lang-btn:hover {
    border-color: #0A66C2;
    color: #0A66C2;
    background: #eff6ff;
}
.li-tone-btn.active, .li-len-btn.active, .li-lang-btn.active {
    background: #0A66C2;
    color: white;
    border-color: #0A66C2;
}

.li-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #0A66C2, #0099ff);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(10, 102, 194, 0.3);
}
.li-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #004182, #0A66C2);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(10, 102, 194, 0.4);
}
.li-generate-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.li-generate-btn.li-loading { animation: li-pulse 1.2s ease-in-out infinite; }

@keyframes li-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.li-tip-box {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.75rem;
    color: #92400e;
    line-height: 1.5;
}

.li-preview-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.li-variants-tabs {
    display: flex;
    gap: 0.35rem;
}

.li-variant-tab {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.li-variant-tab:hover { border-color: #0A66C2; color: #0A66C2; }
.li-variant-tab.active {
    background: #0A66C2;
    color: white;
    border-color: #0A66C2;
}

.li-preview-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    position: relative;
}
.li-preview-card::before {
    content: 'Anteprima LinkedIn';
    position: absolute;
    top: -10px;
    left: 12px;
    background: #0A66C2;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.05em;
}

.li-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.li-card-avatar {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, #0A66C2, #00a0dc);
    color: white;
    font-size: 0.8rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.li-card-name { font-weight: 700; font-size: 0.9rem; color: #191919; }
.li-card-meta { font-size: 0.75rem; color: #666; }

.li-card-body {
    font-size: 0.875rem;
    color: #191919;
    line-height: 1.6;
    white-space: pre-wrap;
    min-height: 60px;
}

.li-card-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.75rem;
}

.li-hashtag {
    background: #e8f3ff;
    color: #0A66C2;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.li-action-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.li-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
}
.li-btn-primary { background: #0A66C2; color: white; box-shadow: 0 2px 8px rgba(10,102,194,0.25); }
.li-btn-primary:hover { background: #004182; transform: translateY(-1px); }
.li-btn-secondary { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border-color); }
.li-btn-secondary:hover { border-color: #0A66C2; color: #0A66C2; }
.li-btn-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.li-btn-danger:hover { background: #dc2626; color: white; }
.li-btn-xs { padding: 0.3rem 0.6rem; font-size: 0.75rem; }

.li-note-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 0.75rem;
    font-size: 0.78rem;
    color: #1e40af;
    line-height: 1.5;
}
.li-note-box code {
    background: rgba(37,99,235,0.1);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.li-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: 12px;
    gap: 0.75rem;
}
.li-empty-icon { font-size: 2.5rem; }
.li-empty-title { font-weight: 700; color: var(--text-primary); font-size: 1rem; }
.li-empty-sub { color: var(--text-muted); font-size: 0.85rem; max-width: 320px; line-height: 1.5; }

.li-drafts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.li-posts-list { display: flex; flex-direction: column; gap: 0.75rem; }

.li-post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    transition: box-shadow 0.2s;
}
.li-post-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.06); }

.li-post-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.li-post-meta { display: flex; align-items: center; gap: 0.5rem; }

.li-post-topic {
    font-size: 0.75rem;
    font-weight: 600;
    color: #0A66C2;
    background: #eff6ff;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.li-post-date { font-size: 0.72rem; color: var(--text-muted); }

.li-post-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.li-post-hashtags { font-size: 0.75rem; color: #0A66C2; margin-bottom: 0.75rem; }
.li-post-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.li-status-badge {
    display: inline-flex;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
}
.li-status-badge.draft     { background: #fffbeb; color: #d97706; }
.li-status-badge.published { background: #ecfdf5; color: #059669; }
.li-status-badge.scheduled { background: #eff6ff; color: #2563eb; }
.li-status-badge.failed    { background: #fef2f2; color: #dc2626; }

.li-loading-posts {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

#tab-linkedin-studio {
    height: 100%;
    overflow-y: auto;
}

.li-dest-selector {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.li-dest-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: var(--bg-base);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}
.li-dest-btn:hover {
    border-color: #0A66C2;
    color: #0A66C2;
    background: #eff6ff;
}
.li-dest-btn.active {
    background: #0A66C2;
    color: white;
    border-color: #0A66C2;
}

.li-card-image-wrap {
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-base);
}
.li-card-image-wrap img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 1.91;
    object-fit: cover;
}

/* ========================================================
   COMPACTING & IMPROVING PRINTING OF CLINICAL REPORTS
   ======================================================== */
.report-print-container {
    padding: 20px !important; /* Riduciamo il padding a schermo */
}

/* Margini interni del referto (header, patient card, table) */
.report-print-container > div[style*="margin-bottom: 25px"] {
    margin-bottom: 8px !important;
}
.report-print-container > div[style*="padding-bottom: 15px"] {
    padding-bottom: 6px !important;
}
.report-print-container .patient-details, 
.report-print-container div[style*="background: #f8fafc"] {
    padding: 8px !important;
    margin-bottom: 8px !important;
    font-size: 0.76rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
}

/* Tabella dei risultati */
.report-print-container table {
    margin-bottom: 8px !important;
    font-size: 0.76rem !important;
}
.report-print-container th {
    padding: 2px 4px !important;
}
.report-print-container td {
    padding: 2px 4px !important; /* Riduciamo il padding delle righe */
}

/* Antibiogramma */
.report-print-container table table th {
    padding: 2px 3px !important;
}
.report-print-container table table td {
    padding: 1px 2px !important;
}

/* Spazio firme e marcatura */
.report-print-container div[style*="margin-top: 25px"] {
    margin-top: 8px !important;
}
.report-print-container .digital-signature-info {
    margin-top: 6px !important;
    padding: 3px 5px !important;
    font-size: 0.7rem !important;
}

@media print {
    @page {
        margin: 3mm 4mm !important; /* Saliamo sopra al foglio riducendo i margini nativi */
    }
    body {
        padding: 0 !important;
        margin: 0 !important;
    }
    .report-print-container {
        padding: 4px !important; /* Azzeriamo o quasi il padding per salire al massimo */
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: #ffffff !important;
        color: #000000 !important;
    }
    /* Compattiamo drasticamente l'header per salire in alto */
    .report-print-container img, 
    .report-print-container #rep-lis-logo,
    .report-print-container #rep-ris-logo {
        max-height: 38px !important; /* Riduzione logo */
    }
    .report-print-container h1,
    .report-print-container #rep-lis-header-title,
    .report-print-container #rep-ris-header-title {
        font-size: 1.05rem !important;
        margin: 0 !important;
        line-height: 1.1 !important;
        page-break-after: avoid !important;
        break-after: avoid !important;
    }
    .report-print-container p {
        font-size: 0.7rem !important;
        margin: 0 !important;
        line-height: 1.1 !important;
    }
    .report-print-container table {
        margin-bottom: 6px !important;
    }
    .report-print-container table td {
        padding: 1.5px 3px !important; /* Compattazione estrema righe */
        font-size: 0.72rem !important;
    }
    .report-print-container table table td {
        padding: 1px 2px !important;
    }
    .report-print-container tr {
        page-break-inside: avoid !important;
        break-inside: avoid !important;
    }
    /* Riduzione spazi della firma e marcatura digitale */
    .report-print-container div[style*="margin-top: 25px"] {
        margin-top: 6px !important;
    }
    .digital-signature-info,
    .report-print-container .digital-signature-info {
        margin-top: 4px !important;
        padding: 2px 4px !important;
        font-size: 0.68rem !important;
    }
}

/* ========================================================================= */
/* CUP WIZARD MODAL EXTENSIONS & PREMIUM SCROLLBARS                          */
/* ========================================================================= */
.modal-box.modal-expanded {
    max-width: 98vw !important;
    width: 98vw !important;
    max-height: 98vh !important;
    height: 98vh !important;
    border-radius: var(--radius-md) !important;
    margin: 1vh auto !important;
}

#wiz-slots-container::-webkit-scrollbar {
    height: 8px;
    display: block !important;
}
#wiz-slots-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
}
#wiz-slots-container::-webkit-scrollbar-thumb {
    background: var(--primary-light, #bfdbfe);
    border-radius: 4px;
}
#wiz-slots-container::-webkit-scrollbar-thumb:hover {
    background: var(--primary, #2563eb);
}

#wiz-days-index-container::-webkit-scrollbar {
    height: 6px;
    display: block !important;
}
#wiz-days-index-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.02);
    border-radius: 3px;
}
#wiz-days-index-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}
#wiz-days-index-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* ============================================================================
   REPORTING PREMIUM — Riepilogo Prestazioni & Accettazioni
   ============================================================================ */

/* Hero Banner delle sezioni Reporting */
.reporting-hero {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 24px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.reporting-hero.services-hero {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 50%, #881337 100%);
}
.reporting-hero.acceptances-hero {
    background: linear-gradient(135deg, #065f46 0%, #059669 50%, #0891b2 100%);
}
.reporting-hero::before {
    content: '';
    position: absolute;
    top: -30px; right: -30px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    pointer-events: none;
}
.reporting-hero::after {
    content: '';
    position: absolute;
    bottom: -50px; left: 30%;
    width: 160px; height: 160px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    pointer-events: none;
}
.reporting-hero-text { position: relative; z-index: 1; }
.reporting-hero-text h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}
.reporting-hero-text p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
    line-height: 1.5;
}
.reporting-hero-actions {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}
.reporting-hero-actions .btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}
.reporting-hero-actions .btn-hero i { width: 15px; height: 15px; }
.btn-hero-ghost {
    background: rgba(255,255,255,0.15);
    color: #fff;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255,255,255,0.25) !important;
}
.btn-hero-ghost:hover { background: rgba(255,255,255,0.25); }
.btn-hero-solid {
    background: rgba(255,255,255,0.95);
    color: #1e293b;
}
.btn-hero-solid:hover { background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }

/* KPI Cards Premium — rigide con minmax(0, 1fr) su Desktop per evitare overflow */
.reporting-kpi-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 22px;
}
/* cols-4: 4 colonne uguali */
.reporting-kpi-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
/* cols-3: 3 colonne uguali */
.reporting-kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.rep-kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    min-width: 0; /* previene trabocco in grid */
}
.rep-kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 4px 0 0 4px;
    opacity: 0.8;
}
.rep-kpi-card.accent-blue::before   { background: linear-gradient(180deg, #be123c, #e11d48); }
.rep-kpi-card.accent-green::before  { background: linear-gradient(180deg, #059669, #34d399); }
.rep-kpi-card.accent-purple::before { background: linear-gradient(180deg, #7c3aed, #a78bfa); }
.rep-kpi-card.accent-red::before    { background: linear-gradient(180deg, #dc2626, #f87171); }
.rep-kpi-card.accent-teal::before   { background: linear-gradient(180deg, #0891b2, #38bdf8); }
.rep-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}
.rep-kpi-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.rep-kpi-icon i { width: 22px; height: 22px; }
.rep-kpi-icon.icon-blue   { background: var(--primary-light); color: var(--primary); }
.rep-kpi-icon.icon-green  { background: var(--success-light); color: var(--success); }
.rep-kpi-icon.icon-purple { background: var(--purple-light); color: var(--purple); }
.rep-kpi-icon.icon-red    { background: rgba(239,68,68,0.1); color: #dc2626; }
.rep-kpi-icon.icon-teal   { background: rgba(8,145,178,0.1); color: #0891b2; }

.rep-kpi-body { flex: 1; min-width: 0; overflow: hidden; }
.rep-kpi-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 3px;
    line-height: 1.25;
    /* Rimosso white-space: nowrap per consentire al testo lungo di andare a capo ed evitare overflow */
}
.rep-kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rep-kpi-trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}
.rep-kpi-trend.up   { color: #10b981; }
.rep-kpi-trend.neutral { color: var(--text-muted); }

/* Filtri Panel Premium */
.reporting-filters-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.reporting-filters-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.reporting-filters-title i { width: 14px; height: 14px; opacity: 0.7; }
.reporting-filters-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.reporting-filters-row .form-group { margin: 0; min-width: 0; }
.reporting-filters-row label {
    display: block;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reporting-filters-row select,
.reporting-filters-row input[type="text"],
.reporting-filters-row input[type="date"] {
    width: 100%;
    padding: 7px 10px;
    font-size: 0.84rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-base);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    min-width: 0;
    /* Previene trabocco del testo nel select */
    overflow: hidden;
    text-overflow: ellipsis;
}
.reporting-filters-row select:focus,
.reporting-filters-row input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* AI Search bar dentro panel filtri */
.rep-ai-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(37,99,235,0.05), rgba(139,92,246,0.05));
    border: 1px dashed rgba(37,99,235,0.3);
    border-radius: 10px;
    margin-top: 10px;
}
.rep-ai-wrapper .sparkle-icon { color: var(--primary); flex-shrink: 0; width: 16px; height: 16px; }
.rep-ai-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 0.87rem;
    color: var(--text-primary);
    outline: none;
}
.rep-ai-wrapper input::placeholder { color: var(--text-muted); font-style: italic; }

/* Chips suggerimento */
.rep-hint-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.rep-hint-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.rep-hint-chip {
    font-size: 0.76rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid rgba(37,99,235,0.2);
    cursor: pointer;
    transition: all 0.2s;
}
.rep-hint-chip:hover { background: var(--primary); color: #fff; }
.rep-hint-chip.reset {
    background: rgba(239,68,68,0.08);
    color: #dc2626;
    border-color: rgba(239,68,68,0.2);
}
.rep-hint-chip.reset:hover { background: #dc2626; color: #fff; }

/* Tabella Premium per Reporting */
.reporting-table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    /* NON overflow:hidden qui, altrimenti blocca lo scroll orizzontale della tabella */
}
.reporting-table-card > .reporting-table-header {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.reporting-table-card > .table-container {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    overflow-x: auto; /* scroll orizzontale se la tabella è larga */
}
.reporting-table-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-base);
}
.reporting-table-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.reporting-table-header-left span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}
.reporting-table-header-right {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap; /* va a capo se non c'è spazio */
    min-width: 0;
}
.reporting-table-header-right input[type="text"],
.reporting-table-header-right input[type="date"] {
    padding: 7px 12px;
    font-size: 0.84rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}
.reporting-table-header-right input:focus { border-color: var(--primary); }

#reporting-services-table,
#reporting-acceptances-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
#reporting-services-table thead th,
#reporting-acceptances-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--bg-base);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}
#reporting-services-table tbody tr,
#reporting-acceptances-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.15s;
}
#reporting-services-table tbody tr:hover,
#reporting-acceptances-table tbody tr:hover {
    background: rgba(37,99,235,0.03);
}
#reporting-services-table tbody td,
#reporting-acceptances-table tbody td {
    padding: 13px 16px;
    color: var(--text-primary);
    vertical-align: middle;
}
#reporting-services-table tbody tr:last-child,
#reporting-acceptances-table tbody tr:last-child { border-bottom: none; }

/* Badge Stato */
.rep-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.rep-status-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}
.rep-status-badge.completed  { background: rgba(16,185,129,0.1); color: #059669; }
.rep-status-badge.completed::before { background: #059669; }
.rep-status-badge.scheduled  { background: rgba(37,99,235,0.1); color: #2563eb; }
.rep-status-badge.scheduled::before { background: #2563eb; }
.rep-status-badge.in_progress { background: rgba(245,158,11,0.1); color: #d97706; }
.rep-status-badge.in_progress::before { background: #d97706; }
.rep-status-badge.stornata   { background: rgba(239,68,68,0.1); color: #dc2626; }
.rep-status-badge.stornata::before { background: #dc2626; }
.rep-status-badge.paid       { background: rgba(16,185,129,0.1); color: #059669; }
.rep-status-badge.paid::before { background: #059669; }
.rep-status-badge.unpaid     { background: rgba(239,68,68,0.1); color: #dc2626; }
.rep-status-badge.unpaid::before { background: #dc2626; }

/* Tipo badge */
.rep-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.rep-type-badge.lis  { background: rgba(8,145,178,0.1); color: #0891b2; }
.rep-type-badge.ris  { background: rgba(139,92,246,0.1); color: #7c3aed; }
.rep-type-badge.visit { background: rgba(37,99,235,0.1); color: #2563eb; }
.rep-type-badge.rehab { background: rgba(16,185,129,0.1); color: #059669; }
.rep-type-badge.ricovero { background: rgba(245,158,11,0.1); color: #d97706; }

/* Responsive — Reporting Premium */

/* 1200px: schermi desktop medi (content area ~900px con sidebar) */
@media (max-width: 1200px) {
    .reporting-kpi-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reporting-kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .reporting-filters-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 950px: schermi tablet in orizzontale o laptop compatti (content area ~670px) */
@media (max-width: 950px) {
    .reporting-hero { padding: 20px 22px; gap: 14px; }
    .reporting-hero-text h1 { font-size: 1.25rem; }
    .reporting-hero-text p { font-size: 0.82rem; }

    .reporting-kpi-grid { gap: 10px; }
    .reporting-kpi-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    
    /* 3 card in 2 colonne: 2 sopra affiancate, 1 sotto a tutta larghezza */
    .reporting-kpi-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .reporting-kpi-grid.cols-3 .rep-kpi-card:last-child { grid-column: span 2; }

    .rep-kpi-card { padding: 12px 10px; gap: 10px; }
    .rep-kpi-icon { width: 38px; height: 38px; flex-shrink: 0; }
    .rep-kpi-icon i { width: 18px; height: 18px; }
    .rep-kpi-label { font-size: 0.7rem; letter-spacing: 0.03em; }
    .rep-kpi-value { font-size: 1.2rem; }
    .rep-kpi-trend { font-size: 0.68rem; }
    
    .reporting-filters-row { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}

/* 750px: schermi tablet in verticale (content area ~470px) */
@media (max-width: 750px) {
    .reporting-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px 16px;
    }
    .reporting-hero-actions { width: 100%; flex-wrap: wrap; }
    .btn-hero { font-size: 0.82rem; padding: 8px 14px; }

    .reporting-filters-panel { padding: 12px 14px; }
    .reporting-filters-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    
    .reporting-table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 12px 14px;
    }
    .reporting-table-header-right { width: 100%; }
    .reporting-table-header-right input[type="text"] { flex: 1; min-width: 0; }
}

/* 550px: smartphone in orizzontale o verticale */
@media (max-width: 550px) {
    .reporting-kpi-grid.cols-4 { grid-template-columns: 1fr; }
    .reporting-kpi-grid.cols-3 { grid-template-columns: 1fr; }
    .reporting-kpi-grid.cols-3 .rep-kpi-card:last-child { grid-column: span 1; }
    
    .reporting-filters-row { grid-template-columns: 1fr; }
    .rep-hint-chips { flex-wrap: wrap; }
}

/* 380px: piccolo mobile */
@media (max-width: 380px) {
    .reporting-hero-text h1 { font-size: 1.1rem; }
    .rep-kpi-card { padding: 10px; }
}

/* ============================================================================
   PACS / DICOM — RESTYLING PREMIUM
   ============================================================================ */

/* ---- Hero Header PACS ---- */
.pacs-hero {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 45%, #1e40af 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(30, 64, 175, 0.3);
}

.pacs-hero::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(59,130,246,0.25) 0%, transparent 70%);
    pointer-events: none;
}
.pacs-hero::after {
    content: '';
    position: absolute;
    bottom: -30px; left: 30%;
    width: 160px; height: 160px;
    background: radial-gradient(circle, rgba(99,102,241,0.18) 0%, transparent 70%);
    pointer-events: none;
}

.pacs-hero-left { position: relative; z-index: 1; }

.pacs-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(99,102,241,0.25);
    border: 1px solid rgba(99,102,241,0.5);
    color: #a5b4fc;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 10px;
}

.pacs-hero-title {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    color: #f8fafc;
    margin: 0 0 6px 0;
    line-height: 1.2;
}

.pacs-hero-subtitle {
    font-size: 0.875rem;
    color: rgba(148, 163, 184, 0.9);
    margin: 0;
    max-width: 520px;
    line-height: 1.5;
}

.pacs-hero-stats {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 16px;
    flex-shrink: 0;
}

.pacs-hero-stat {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    text-align: center;
    backdrop-filter: blur(4px);
    min-width: 80px;
}

.pacs-hero-stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #60a5fa;
    line-height: 1;
    display: block;
}

.pacs-hero-stat-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 4px;
    display: block;
}

/* ---- Tab Bar PACS ---- */
.pacs-sub-nav {
    display: flex;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    overflow-x: auto; /* Impedisce che vadano a capo e permette lo scorrimento */
    white-space: nowrap;
    scrollbar-width: none; /* Nasconde barra scorrimento Firefox */
    -ms-overflow-style: none; /* Nasconde barra scorrimento IE/Edge */
}

.pacs-sub-nav::-webkit-scrollbar {
    display: none; /* Nasconde barra scorrimento Chrome/Safari/Opera */
}

.pacs-tab-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 9px 18px !important;
    border-radius: calc(var(--radius-md) - 3px) !important;
    border: none !important;
    background: transparent !important;
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
    font-size: 0.84rem !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
    white-space: nowrap;
    position: relative;
    flex-shrink: 0; /* Impedisce il rimpicciolimento dei pulsanti */
}

.pacs-tab-btn svg {
    width: 15px !important;
    height: 15px !important;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.pacs-tab-btn:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    transform: none !important;
}

.pacs-tab-btn:hover svg {
    transform: scale(1.1);
}

.pacs-tab-btn.active {
    background: var(--primary-gradient) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35) !important;
}

body.dark-theme .pacs-tab-btn {
    color: var(--text-secondary) !important;
}

body.dark-theme .pacs-tab-btn:hover {
    background: rgba(59,130,246,0.12) !important;
    color: #60a5fa !important;
}

body.dark-theme .pacs-tab-btn.active {
    background: linear-gradient(135deg, #be123c, #e11d48) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(59,130,246,0.4) !important;
}

/* Evidenziazione della cornice per le card del PACS per massima visibilità */
#tab-pacs .card {
    border: 1px solid rgba(148, 163, 184, 0.4) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06) !important;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
body.dark-theme #tab-pacs .card {
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.35) !important;
}

/* Filtri PACS allineati ed eleganti */
.pacs-filters-row {
    padding: 18px 24px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* ---- Card Header PACS colorati per tipo ---- */
.pacs-card-header-browser {
    background: linear-gradient(90deg, #eff6ff, #e0f2fe) !important;
    border-bottom: 1px solid #bfdbfe !important;
}

.pacs-card-header-browser h2 { color: #1d4ed8 !important; }

.pacs-card-header-modality {
    background: linear-gradient(90deg, #f5f3ff, #ede9fe) !important;
    border-bottom: 1px solid #c4b5fd !important;
}

.pacs-card-header-modality h2 { color: #6d28d9 !important; }

.pacs-card-header-robot {
    background: linear-gradient(90deg, #fff7ed, #ffedd5) !important;
    border-bottom: 1px solid #fed7aa !important;
}

.pacs-card-header-robot h2 { color: #c2410c !important; }

.pacs-card-header-tools {
    background: linear-gradient(90deg, #ecfdf5, #d1fae5) !important;
    border-bottom: 1px solid #6ee7b7 !important;
}

.pacs-card-header-tools h2 { color: #065f46 !important; }

/* Dark mode per card header PACS */
body.dark-theme .pacs-card-header-browser {
    background: linear-gradient(90deg, rgba(29,78,216,0.12), rgba(14,116,144,0.1)) !important;
    border-bottom: 1px solid rgba(59,130,246,0.2) !important;
}
body.dark-theme .pacs-card-header-browser h2 { color: #60a5fa !important; }

body.dark-theme .pacs-card-header-modality {
    background: linear-gradient(90deg, rgba(109,40,217,0.12), rgba(79,70,229,0.1)) !important;
    border-bottom: 1px solid rgba(139,92,246,0.2) !important;
}
body.dark-theme .pacs-card-header-modality h2 { color: #a78bfa !important; }

body.dark-theme .pacs-card-header-robot {
    background: linear-gradient(90deg, rgba(194,65,12,0.12), rgba(249,115,22,0.1)) !important;
    border-bottom: 1px solid rgba(249,115,22,0.2) !important;
}
body.dark-theme .pacs-card-header-robot h2 { color: #fb923c !important; }

body.dark-theme .pacs-card-header-tools {
    background: linear-gradient(90deg, rgba(6,95,70,0.12), rgba(16,185,129,0.1)) !important;
    border-bottom: 1px solid rgba(16,185,129,0.2) !important;
}
body.dark-theme .pacs-card-header-tools h2 { color: #34d399 !important; }

/* ---- Filtri Browser PACS ---- */
.pacs-filters-bar {
    padding: 14px 20px;
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

/* ---- MWL Status Widget ---- */
.pacs-mwl-status-online {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--success-light);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-sm);
    color: var(--success);
    font-weight: 700;
    font-size: 0.8rem;
}

.pacs-mwl-dot {
    width: 9px; height: 9px;
    background: var(--success);
    border-radius: 50%;
    animation: pacs-pulse 1.8s infinite;
    flex-shrink: 0;
}

@keyframes pacs-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(1.4); }
}

/* ---- Sub-pane transition ---- */
.pacs-sub-pane {
    animation: pacs-fade-in 0.15s ease both;
}

@keyframes pacs-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ---- Responsive PACS ---- */
@media (max-width: 900px) {
    .pacs-hero { flex-direction: column; align-items: flex-start; }
    .pacs-hero-stats { width: 100%; }
}

@media (max-width: 600px) {
    .pacs-hero { padding: 20px; }
    .pacs-hero-title { font-size: 1.2rem; }
    .pacs-hero-stats { flex-wrap: wrap; }
    .pacs-tab-btn { font-size: 0.78rem !important; padding: 7px 10px !important; }
}

/* ══════════════════════════════════════════════════════════════════════════════
   PURELABS UNIFIED PATIENT BADGE & MODERN TABLE ACTIONS
   ══════════════════════════════════════════════════════════════════════════════ */
.patient-identity-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.patient-round-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.78rem;
    flex-shrink: 0;
    letter-spacing: -0.3px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.patient-round-avatar:hover {
    transform: scale(1.1);
}

.btn-action-pacs {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 11px;
    border-radius: 7px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    user-select: none;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.btn-action-pacs:hover {
    transform: translateY(-1.5px);
}
.btn-action-pacs:active {
    transform: translateY(0);
}

.btn-action-viewer {
    background: linear-gradient(135deg, #090d16 0%, #1e293b 100%);
    color: #ffffff !important;
    border: 1px solid #334155;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.25);
}
.btn-action-viewer:hover {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.4);
    color: #38bdf8 !important;
    border-color: #38bdf8;
}

.btn-action-report-todo {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
    color: #ffffff !important;
    border: 1px solid #f43f5e;
    box-shadow: 0 2px 7px rgba(225, 29, 72, 0.32);
}
.btn-action-report-todo:hover {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 100%);
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.45);
}

.btn-action-report-done {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: #ffffff !important;
    border: 1px solid #10b981;
    box-shadow: 0 2px 7px rgba(5, 150, 105, 0.3);
}
.btn-action-report-done:hover {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
}

.btn-action-zip {
    background: #f8fafc;
    color: #0284c7 !important;
    border: 1px solid #bae6fd;
    box-shadow: 0 1px 3px rgba(2, 132, 199, 0.08);
}
.btn-action-zip:hover {
    background: #e0f2fe;
    border-color: #0284c7;
    color: #0369a1 !important;
    box-shadow: 0 3px 8px rgba(2, 132, 199, 0.2);
}

.btn-action-cd {
    background: #f8fafc;
    color: #475569 !important;
    border: 1px solid #cbd5e1;
}
.btn-action-cd:hover {
    background: #f1f5f9;
    color: #0f172a !important;
    border-color: #94a3b8;
}

.btn-action-del {
    background: #fff5f5;
    color: #dc2626 !important;
    border: 1px solid #fecaca;
}
.btn-action-del:hover {
    background: #fee2e2;
    border-color: #f87171;
}

/* PACS Sub-tabs Bar */
.pacs-subtab-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f1f5f9;
    padding: 6px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color, #e2e8f0);
    margin-bottom: 20px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.pacs-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary, #64748b);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    user-select: none;
}
.pacs-subtab-btn:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-primary, #0f172a);
}
.pacs-subtab-btn.active {
    background: #ffffff;
    color: #e11d48;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #fecdd3;
}
.pacs-subtab-pane {
    animation: pacsFadeIn 0.15s ease;
}
@keyframes pacsFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========================================================================= */
/* PURELABS PACS STORAGE SOURCE & MODALITY PILLS (HIGH-END LUXURY UI)        */
/* ========================================================================= */
.storage-split-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
    background: #ffffff;
    padding: 10px 18px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.source-split-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #475569;
    font-size: 0.80rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    outline: none;
}

.source-split-pill:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.source-split-pill.active {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(15, 23, 42, 0.25);
}

.source-split-pill.active#src-pill-nas {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    border-color: #0284c7;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(2, 132, 199, 0.3);
}

.source-split-pill.active#src-pill-zm {
    background: linear-gradient(135deg, #15803d 0%, #16a34a 100%);
    border-color: #16a34a;
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(22, 163, 74, 0.3);
}

.source-split-pill .pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    min-width: 20px;
    border-radius: 9999px;
    font-size: 0.70rem;
    font-weight: 800;
    background: #f1f5f9;
    color: #475569;
    transition: all 0.2s ease;
}

.source-split-pill:hover .pill-count {
    background: #e2e8f0;
    color: #0f172a;
}

.source-split-pill.active .pill-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.source-split-pill .split-subtag {
    font-size: 0.70rem;
    color: #64748b;
    font-weight: 600;
    transition: color 0.2s ease;
}

.source-split-pill.active .split-subtag {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Modality Pills */
.browser-modality-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    padding: 4px 0;
}

.modality-pill-label {
    font-size: 0.74rem;
    font-weight: 800;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 4px;
}

.modality-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    outline: none;
}

.modality-pill:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.modality-pill .pill-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 6px;
    min-width: 18px;
    border-radius: 9999px;
    font-size: 0.68rem;
    font-weight: 800;
    background: #f1f5f9;
    color: #64748b;
    transition: all 0.18s ease;
}

.modality-pill:hover .pill-count {
    background: #e2e8f0;
    color: #1e293b;
}

/* Modality Active Styles */
.modality-pill.active {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: #0f172a;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.22);
}

.modality-pill.active .pill-count {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.modality-pill.active#pill-mod-mr {
    background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%);
    border-color: #7c3aed;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.3);
}

.modality-pill.active#pill-mod-ct {
    background: linear-gradient(135deg, #ea580c 0%, #f97316 100%);
    border-color: #ea580c;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(234, 88, 12, 0.3);
}

.modality-pill.active#pill-mod-cr {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 100%);
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

.modality-pill.active#pill-mod-dx {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border-color: #475569;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(71, 85, 105, 0.3);
}

.modality-pill.active#pill-mod-mg {
    background: linear-gradient(135deg, #db2777 0%, #e11d48 100%);
    border-color: #e11d48;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(225, 29, 72, 0.3);
}

.modality-pill.active#pill-mod-px {
    background: linear-gradient(135deg, #0d9488 0%, #059669 100%);
    border-color: #0d9488;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.3);
}

.modality-pill.active#pill-mod-us {
    background: linear-gradient(135deg, #be123c 0%, #e11d48 100%);
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
}

/* ========================================================================= */
/* PURELABS PACS ANALYTICS & BREAKDOWN CARDS (HIGH-END LUXURY UI)            */
/* ========================================================================= */
.stat-item-row {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.stat-item-row:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.stat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.stat-metric-badges {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.stat-badge-downloaded {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 700;
}

.stat-badge-pct {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #0f172a;
    color: #ffffff;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
}

.stat-progress-track {
    width: 100%;
    height: 9px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.stat-progress-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}







/* PURELABS THEME OVERRIDES FOR SIDEBAR AND BRANDING */
.sidebar-nav .nav-item.active {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.35) !important;
}
.sidebar-nav .nav-item.active i,
.sidebar-nav .nav-item.active span {
    color: #ffffff !important;
}
.sidebar-nav .nav-item:hover {
    background-color: #fff1f2 !important;
    color: #e11d48 !important;
}
.sidebar-nav .nav-item:hover i,
.sidebar-nav .nav-item:hover span {
    color: #e11d48 !important;
}


/* PURELABS CALENDAR & WIZARD STYLING OVERRIDES */
.calendar-slot-free {
    color: #e11d48 !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    padding: 3px 6px !important;
    border: 1px dashed rgba(225, 29, 72, 0.4) !important;
    border-radius: 6px !important;
    text-align: center !important;
    background-color: rgba(225, 29, 72, 0.03) !important;
    width: calc(100% - 6px) !important;
    margin: 2px auto !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    transition: all 0.15s ease !important;
}
.calendar-slot-free:hover {
    background-color: #fff1f2 !important;
    border-color: #e11d48 !important;
    color: #be123c !important;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.15) !important;
    transform: translateY(-1px) !important;
}
.calendar-header-cell {
    border-bottom: 2px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}


/* ==========================================================================
   PURELABS HEALTHCORE - ENTERPRISE CALENDAR & CUP PRO THEME
   ========================================================================== */

#modal-agendas-calendar .modal-box {
    max-width: 96vw !important;
    width: 96vw !important;
    height: 92vh !important;
    max-height: 92vh !important;
    border-radius: 14px !important;
    border: 1px solid rgba(225, 29, 72, 0.25) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

#modal-cup-wizard .modal-box {
    max-width: 95vw !important;
    width: 95vw !important;
    height: 94vh !important;
    max-height: 94vh !important;
    border-radius: 14px !important;
    border: 1px solid rgba(225, 29, 72, 0.25) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

#modal-direct-slot-booking .modal-box {
    max-width: 760px !important;
    width: 95vw !important;
    border-radius: 14px !important;
    border: 1px solid rgba(225, 29, 72, 0.25) !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5) !important;
}

.wizard-steps-container {
    background: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
    padding: 12px 24px !important;
}

.wizard-step-indicator.active .step-num {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.35) !important;
}

.wizard-step-indicator.active .step-lbl {
    color: #e11d48 !important;
    font-weight: 800 !important;
}

#btn-wiz-next {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3) !important;
}

#btn-wiz-submit {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.free-slot-badge-wiz:hover {
    border-color: #e11d48 !important;
    background: #fff1f2 !important;
    color: #be123c !important;
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.2) !important;
    transform: translateY(-2px) !important;
}

.free-slot-badge-wiz.active {
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
    color: #ffffff !important;
    border-color: transparent !important;
    box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4) !important;
}

.calendar-slot-free {
    color: #e11d48 !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    padding: 3px 6px !important;
    border: 1px dashed rgba(225, 29, 72, 0.4) !important;
    border-radius: 6px !important;
    text-align: center !important;
    background-color: rgba(225, 29, 72, 0.03) !important;
    width: calc(100% - 6px) !important;
    margin: 2px auto !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 4px !important;
    transition: all 0.15s ease !important;
}

.calendar-slot-free:hover {
    background-color: #fff1f2 !important;
    border-color: #e11d48 !important;
    color: #be123c !important;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.15) !important;
    transform: translateY(-1px) !important;
}


/* 3-COLUMN LAYOUT FOR MODAL ADD AGENDA */
#modal-add-agenda .modal-box {
    max-width: 96vw !important;
    width: 96vw !important;
    max-height: 94vh !important;
    height: 94vh !important;
    display: flex !important;
    flex-direction: column !important;
    border-radius: 14px !important;
    overflow: hidden !important;
}

#modal-add-agenda .agenda-grid-3col {
    display: grid !important;
    grid-template-columns: 27% 33% 40% !important;
    flex: 1 !important;
    min-height: 0 !important;
    height: 100% !important;
}





/* =========================================================================
   PURELABS WADO DICOM VIEWER MODAL - EXACT STANDALONE PIXEL-PERFECT REPLICA
   ========================================================================= */

#dicom-viewer-modal.modal-overlay {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 999999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    margin: 0 !important;
}

#dicom-viewer-modal.modal-overlay.open,
#dicom-viewer-modal.modal-overlay.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#dicom-viewer-modal .viewer-modal-box {
    width: 98vw !important;
    height: 96vh !important;
    max-width: 99vw !important;
    max-height: 98vh !important;
    background: #090d16 !important;
    color: #ffffff !important;
    border-radius: 12px !important;
    border: 1px solid #1e293b !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8) !important;
}

/* Header */
#dicom-viewer-modal .viewer-header {
    background: #001f44 !important;
    padding: 8px 16px !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    flex-shrink: 0 !important;
    height: 46px !important;
    box-sizing: border-box !important;
}

/* Toolbar: Single Sleek Horizontal Row */
#dicom-viewer-modal .viewer-toolbar {
    background: #0f172a !important;
    padding: 5px 12px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    border-bottom: 1px solid #1e293b !important;
    flex-wrap: nowrap !important;
    overflow: visible !important;
    flex-shrink: 0 !important;
    height: 48px !important;
    box-sizing: border-box !important;
    position: relative !important;
    z-index: 2000 !important;
}

#dicom-viewer-modal .viewer-tool-group {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 6px !important;
    padding: 2px !important;
    gap: 2px !important;
    flex-shrink: 0 !important;
}

#dicom-viewer-modal .viewer-tool-btn {
    background: transparent !important;
    color: #cbd5e1 !important;
    border: none !important;
    padding: 4px 8px !important;
    border-radius: 4px !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    white-space: nowrap !important;
    transition: all 0.15s ease !important;
    line-height: 1.2 !important;
    height: 28px !important;
    box-sizing: border-box !important;
    width: auto !important;
}

#dicom-viewer-modal .viewer-tool-btn:hover {
    background: #334155 !important;
    color: #ffffff !important;
}

#dicom-viewer-modal .viewer-tool-btn.active {
    background: #0284c7 !important;
    color: #ffffff !important;
    box-shadow: 0 0 8px rgba(2, 132, 199, 0.5) !important;
}

#dicom-viewer-modal .viewer-divider {
    width: 1px !important;
    height: 22px !important;
    background: #334155 !important;
    margin: 0 3px !important;
    flex-shrink: 0 !important;
}

/* Preset & Select dropdowns */
#dicom-viewer-modal select,
#dicom-viewer-modal .viewer-tool-select {
    width: auto !important;
    min-width: 140px !important;
    max-width: 200px !important;
    height: 30px !important;
    background: #1e293b !important;
    color: #ffffff !important;
    border: 1px solid #334155 !important;
    border-radius: 6px !important;
    padding: 3px 8px !important;
    font-size: 0.72rem !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    display: inline-block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
}

/* Layout Dropdown Menu (Hidden by default, absolute on open) */
#dicom-viewer-modal .layout-dropdown-wrapper {
    position: relative !important;
    display: inline-block !important;
    flex-shrink: 0 !important;
}

#dicom-viewer-modal .layout-dropdown-menu {
    display: none;
    position: absolute !important;
    top: 36px !important;
    left: 0 !important;
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6) !important;
    z-index: 99999 !important;
    width: 280px !important;
}

#dicom-viewer-modal .layout-dropdown-menu.show,
#dicom-viewer-modal .layout-dropdown-menu.open {
    display: block !important;
}

#dicom-viewer-modal .layout-grid-selector {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
}

#dicom-viewer-modal .layout-btn-opt {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    border-radius: 4px !important;
    padding: 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    color: #cbd5e1 !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    transition: all 0.15s ease !important;
}

#dicom-viewer-modal .layout-btn-opt:hover,
#dicom-viewer-modal .layout-btn-opt.active {
    border-color: #00f0ff !important;
    background: rgba(0, 240, 255, 0.15) !important;
    color: #00f0ff !important;
}

#dicom-viewer-modal .layout-mini-grid {
    width: 32px !important;
    height: 24px !important;
    display: grid !important;
    gap: 2px !important;
    margin-bottom: 4px !important;
}

#dicom-viewer-modal .layout-mini-cell {
    background: #475569 !important;
    border-radius: 1px !important;
}

#dicom-viewer-modal .layout-btn-opt.active .layout-mini-cell {
    background: #00f0ff !important;
}

/* Main Viewport & Sidebar: Horizontal Layout side by side */
#dicom-viewer-modal .viewer-viewport-area {
    display: flex !important;
    flex-direction: row !important;
    flex: 1 !important;
    height: calc(100% - 94px) !important;
    width: 100% !important;
    overflow: hidden !important;
    position: relative !important;
    background: #000000 !important;
}

#dicom-viewer-modal .viewer-canvas-container {
    flex: 1 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative !important;
    background: #000000 !important;
    overflow: hidden !important;
}

#dicom-viewer-modal .viewer-multi-grid {
    flex: 1 !important;
    width: 100% !important;
    height: calc(100% - 46px) !important;
    position: relative !important;
    display: grid !important;
    background: #000000 !important;
    overflow: hidden !important;
    gap: 4px !important;
    padding: 4px !important;
    box-sizing: border-box !important;
}

#dicom-viewer-modal .viewport-cell {
    position: relative !important;
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #050811 !important;
    border: 1.5px solid #1e293b !important;
    border-radius: 6px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: all 0.15s ease !important;
}

#dicom-viewer-modal .viewport-cell.active-viewport {
    border-color: #00f0ff !important;
    box-shadow: inset 0 0 12px rgba(0, 240, 255, 0.25) !important;
}

#dicom-viewer-modal .viewport-cell canvas {
    display: block !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
}

#dicom-viewer-modal .viewport-badge {
    position: absolute !important;
    top: 8px !important;
    left: 8px !important;
    background: rgba(15, 23, 42, 0.85) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    font-size: 0.68rem !important;
    font-weight: 700 !important;
    color: #cbd5e1 !important;
    z-index: 10 !important;
    font-family: monospace !important;
    pointer-events: none !important;
}

#dicom-viewer-modal .viewport-cell.active-viewport .viewport-badge {
    border-color: #00f0ff !important;
    color: #00f0ff !important;
    background: rgba(0, 163, 224, 0.2) !important;
}

/* Cine Timeline Bar at the bottom of the canvas */
#dicom-viewer-modal .viewer-cine-bar {
    height: 46px !important;
    background: #090d16 !important;
    border-top: 1px solid #1e293b !important;
    padding: 6px 14px !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 10px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

#dicom-viewer-modal .cine-btn {
    background: #1e293b !important;
    color: #f1f5f9 !important;
    border: 1px solid #334155 !important;
    border-radius: 4px !important;
    padding: 4px 8px !important;
    font-size: 0.8rem !important;
    cursor: pointer !important;
    height: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

#dicom-viewer-modal #btn-cine-play {
    background: #0284c7 !important;
    border-color: #0284c7 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
}

/* Sidebar on the Right */
#dicom-viewer-modal .viewer-sidebar {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 100% !important;
    background: #0f172a !important;
    border-left: 1px solid rgba(255, 255, 255, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    padding: 12px !important;
    overflow-y: auto !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
}

/* Thumbnail card styling in sidebar */
#dicom-viewer-modal .viewer-thumb-card {
    background: #1e293b !important;
    border: 1.5px solid #334155 !important;
    border-radius: 6px !important;
    padding: 4px !important;
    cursor: pointer !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    transition: all 0.15s ease !important;
}

#dicom-viewer-modal .viewer-thumb-card.active,
#dicom-viewer-modal .viewer-thumb-card:hover {
    border-color: #00f0ff !important;
    background: rgba(0, 163, 224, 0.25) !important;
}

/* Badge Nome Esame & Modalità Clinica Header Viewer */
#dicom-viewer-modal .viewer-exam-badge {
    background: rgba(56, 189, 248, 0.15) !important;
    border: 1px solid #38bdf8 !important;
    color: #38bdf8 !important;
    padding: 3px 10px !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    font-size: 0.80rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.2) !important;
}

#dicom-viewer-modal .viewer-mod-badge {
    background: #1e293b !important;
    border: 1px solid #475569 !important;
    color: #94a3b8 !important;
    padding: 3px 8px !important;
    border-radius: 4px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
}

#dicom-viewer-modal #viewer-global-loader {
    animation: fadeIn 0.15s ease-out;
}

/* ============================================================================
   RIS CLINICAL REPORTING DARK MEDICAL SUITE (FULLSCREEN & DEEP CONTRAST)
   ============================================================================ */
#modal-dicom-viewer.modal-overlay {
    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;
    color: #f1f5f9 !important;
    border: 1px solid #1e293b !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 #dicom-modal-title {
    color: #f8fafc !important;
}

#modal-dicom-viewer select,
#modal-dicom-viewer input {
    background: #090d16 !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

#modal-dicom-viewer select:focus,
#modal-dicom-viewer input:focus {
    border-color: #00f0ff !important;
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.2) !important;
}

#modal-dicom-viewer select option {
    background: #0f172a !important;
    color: #f8fafc !important;
}

#modal-dicom-viewer #dicom-layout-grid {
    background: #090d16 !important;
}

#modal-dicom-viewer .editor-container {
    background: #060913 !important;
    border: 1.5px solid #334155 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
    flex: 1 !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
}

#modal-dicom-viewer .editor-toolbar {
    background: #131b2e !important;
    border-bottom: 1px solid #1e293b !important;
}

#modal-dicom-viewer .editor-btn {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

#modal-dicom-viewer .editor-btn:hover {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #00f0ff !important;
}

#modal-dicom-viewer .editor-btn i,
#modal-dicom-viewer .editor-btn span {
    color: #f8fafc !important;
}

#modal-dicom-viewer .editor-separator {
    background: #334155 !important;
}

#modal-dicom-viewer .editor-select {
    background: #090d16 !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

#modal-dicom-viewer #dicom-report-editor,
#dicom-report-editor {
    background: #060913 !important;
    background-color: #060913 !important;
    color: #f8fafc !important;
    font-size: 1.05rem !important;
    line-height: 1.75 !important;
    caret-color: #00f0ff !important;
    flex: 1 !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    overflow-y: auto !important;
}

#modal-dicom-viewer #dicom-report-editor:focus,
#dicom-report-editor:focus {
    background: #050811 !important;
    background-color: #050811 !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;
}

/* Stampa referto in modalita chiara / PDF */
.report-print-container table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 12px 0 !important;
    background-color: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
}

.report-print-container thead tr {
    background-color: #f1f5f9 !important;
    border-bottom: 2px solid #cbd5e1 !important;
}

.report-print-container th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    font-size: 0.80rem !important;
    text-transform: uppercase !important;
    padding: 7px 10px !important;
    border: 1px solid #cbd5e1 !important;
    text-align: left !important;
}

.report-print-container tbody tr {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

.report-print-container td {
    background-color: #ffffff !important;
    color: #334155 !important;
    font-size: 0.84rem !important;
    padding: 6px 10px !important;
    border: 1px solid #e2e8f0 !important;
}

.report-print-container td:first-child {
    font-weight: 700 !important;
    color: #0f172a !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;
}

/* =========================================================================
   SUITE REFERTAZIONE VISITE SPECIALISTICHE & CARTELLA AMBULATORIALE (EHR)
   ========================================================================= */

.modal-box.modal-visit-suite {
    max-width: 1460px;
    width: 96vw;
    height: 93vh;
    max-height: 93vh;
    display: flex;
    flex-direction: column;
    background: #090d16;
    border: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.85), 0 0 35px rgba(99, 102, 241, 0.15);
    border-radius: 12px;
    overflow: hidden;
    color: #f1f5f9;
}

.visit-header-suite {
    padding: 12px 20px;
    background: linear-gradient(180deg, #111827 0%, #0b0f19 100%);
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
}

.visit-header-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.visit-badge-branch {
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #34d399;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.visit-patient-bento-bar {
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    padding: 10px 20px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.visit-patient-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.visit-patient-meta-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    font-size: 0.85rem;
}

.visit-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.visit-meta-label {
    color: #94a3b8;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}

.visit-meta-value {
    color: #f8fafc;
    font-weight: 700;
}

.visit-main-workspace {
    flex: 1;
    display: grid;
    grid-template-columns: 7.2fr 2.8fr;
    min-height: 0;
    overflow: hidden;
    background: #070a11;
}

.visit-col-left {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid #1e293b;
}

.visit-tabs-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #0c121e;
    border-bottom: 1px solid #1e293b;
    flex-shrink: 0;
    overflow-x: auto;
}

.visit-tab-btn {
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: #94a3b8;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.visit-tab-btn:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.05);
}

.visit-tab-btn.active {
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.12);
    border-color: rgba(56, 189, 248, 0.35);
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
}

.visit-tab-pane {
    display: none;
    flex: 1;
    min-height: 0;
    padding: 14px 18px;
    overflow-y: auto;
}

.visit-tab-pane.active {
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}

/* Snippets Bar */
.visit-snippets-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    margin-bottom: 10px;
    overflow-x: auto;
    flex-shrink: 0;
}

.visit-snippet-chip {
    padding: 3px 10px;
    border-radius: 20px;
    background: #1e293b;
    border: 1px solid #334155;
    color: #cbd5e1;
    font-size: 0.73rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.visit-snippet-chip:hover {
    background: rgba(0, 240, 255, 0.15);
    border-color: #00f0ff;
    color: #00f0ff;
    transform: translateY(-1px);
}

/* Editor Container */
.visit-rich-editor-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 240px;
    background: #090d16;
    border: 1px solid #1e293b;
    border-radius: 8px;
    overflow: hidden;
}

.visit-editor-content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    outline: none;
    color: #f1f5f9;
    font-size: 0.92rem;
    line-height: 1.65;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.visit-editor-content h3 {
    color: #38bdf8;
    font-size: 0.98rem;
    font-weight: 800;
    margin-top: 14px;
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(56, 189, 248, 0.2);
    padding-bottom: 3px;
}

.visit-editor-content p {
    margin-bottom: 8px;
}

/* Vitals Bento Grid */
.visit-vitals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.visit-vital-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    transition: all 0.2s ease;
}

.visit-vital-card:hover {
    border-color: #38bdf8;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.1);
}

.visit-vital-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.visit-vital-input-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.visit-vital-input {
    background: #070a11;
    border: 1.5px solid #334155;
    border-radius: 6px;
    color: #f8fafc;
    font-size: 1.25rem;
    font-weight: 800;
    padding: 4px 8px;
    width: 90px;
    text-align: center;
    font-family: monospace;
}

.visit-vital-input:focus {
    border-color: #38bdf8;
    outline: none;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.visit-vital-unit {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
}

.visit-bmi-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
}

/* Specialty Templates Cards */
.visit-templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    overflow-y: auto;
}

.visit-specialty-card {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.visit-specialty-card:hover {
    background: #1e293b;
    border-color: #00f0ff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.15);
}

.visit-specialty-card-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.visit-specialty-card-desc {
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* History Dossier Sidebar */
.visit-col-right {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: #0b0f19;
}

.visit-history-header {
    padding: 12px 16px;
    background: #0f172a;
    border-bottom: 1px solid #1e293b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.visit-history-scrollable {
    flex: 1;
    padding: 12px 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.visit-history-item {
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.15s ease;
}

.visit-history-item:hover {
    border-color: #334155;
}

/* Live Audio Waveform for Voice Dictation */
.voice-wave-active {
    animation: voiceWavePulse 1.2s infinite ease-in-out;
    background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
    border-color: #f43f5e !important;
    box-shadow: 0 0 15px rgba(225, 29, 72, 0.5) !important;
}

@keyframes voiceWavePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.7); }
    50% { transform: scale(1.04); box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}

/* ========================================================================= */
/* 🔬 PURELABS LIS MIDDLEWARE & COCKPIT ANALIZZATORI (PURELABS WHITE THEME) */
/* ========================================================================= */

#modal-lis-analyzer-cockpit {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 100050 !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    box-sizing: border-box !important;
}

#modal-lis-analyzer-cockpit > div {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 20px !important;
    width: 80vw !important;
    max-width: 1440px !important;
    height: 80vh !important;
    max-height: 85vh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.25), 0 0 35px rgba(13, 148, 136, 0.12) !important;
    color: #1e293b !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

@media (max-width: 1024px) {
    #modal-lis-analyzer-cockpit > div {
        width: 92vw !important;
        height: 88vh !important;
        max-height: 90vh !important;
    }
}

@media (max-width: 640px) {
    #modal-lis-analyzer-cockpit {
        padding: 8px !important;
    }
    #modal-lis-analyzer-cockpit > div {
        width: 98vw !important;
        height: 94vh !important;
        max-height: 96vh !important;
        border-radius: 14px !important;
    }
}

#modal-lis-rerun-drawer {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 100060 !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px) !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}

#modal-lis-rerun-drawer > div {
    background: #ffffff !important;
    border: 1.5px solid #fca5a5 !important;
    border-radius: 18px !important;
    width: 100% !important;
    max-width: 480px !important;
    padding: 22px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2) !important;
    color: #1e293b !important;
}

/* MiddleWare Cockpit (BOX / BUTTON CARD STYLE) */
.lis-cockpit-nav-btn {
    padding: 10px 18px !important;
    border-radius: 12px !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer !important;
    background: #f8fafc !important;
    color: #475569 !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03) !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    white-space: nowrap !important;
    text-decoration: none !important;
}

.lis-cockpit-nav-btn:hover {
    color: #0f172a !important;
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    transform: translateY(-1px) !important;
}

.lis-cockpit-nav-btn.active {
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%) !important;
    color: #ffffff !important;
    border: 1.5px solid #0d9488 !important;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35) !important;
    font-weight: 800 !important;
}

.lis-cockpit-nav-btn.active i,
.lis-cockpit-nav-btn.active svg {
    color: #ffffff !important;
}

/* MiddleWare Tailwind-compatible utility mappings for PureLabs White Theme */
#modal-lis-analyzer-cockpit .hidden,
#modal-lis-rerun-drawer .hidden {
    display: none !important;
}

#modal-lis-analyzer-cockpit .flex { display: flex !important; }
#modal-lis-analyzer-cockpit .flex-col { flex-direction: column !important; }
#modal-lis-analyzer-cockpit .flex-1 { flex: 1 1 0% !important; }
#modal-lis-analyzer-cockpit .flex-shrink-0 { flex-shrink: 0 !important; }
#modal-lis-analyzer-cockpit .items-center { align-items: center !important; }
#modal-lis-analyzer-cockpit .items-start { align-items: flex-start !important; }
#modal-lis-analyzer-cockpit .items-end { align-items: flex-end !important; }
#modal-lis-analyzer-cockpit .justify-between { justify-content: space-between !important; }
#modal-lis-analyzer-cockpit .justify-center { justify-content: center !important; }
#modal-lis-analyzer-cockpit .justify-end { justify-content: flex-end !important; }

#modal-lis-analyzer-cockpit .grid { display: grid !important; }
#modal-lis-analyzer-cockpit .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)) !important; }
#modal-lis-analyzer-cockpit .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
#modal-lis-analyzer-cockpit .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
#modal-lis-analyzer-cockpit .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
#modal-lis-analyzer-cockpit .grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
#modal-lis-analyzer-cockpit .grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }

@media (min-width: 768px) {
    #modal-lis-analyzer-cockpit .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    #modal-lis-analyzer-cockpit .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    #modal-lis-analyzer-cockpit .md\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
    #modal-lis-analyzer-cockpit .md\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
}

@media (min-width: 1024px) {
    #modal-lis-analyzer-cockpit .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
    #modal-lis-analyzer-cockpit .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
    #modal-lis-analyzer-cockpit .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}

#modal-lis-analyzer-cockpit .gap-2 { gap: 8px !important; }
#modal-lis-analyzer-cockpit .gap-2\.5 { gap: 10px !important; }
#modal-lis-analyzer-cockpit .gap-3 { gap: 12px !important; }
#modal-lis-analyzer-cockpit .gap-3\.5 { gap: 14px !important; }
#modal-lis-analyzer-cockpit .gap-4 { gap: 16px !important; }
#modal-lis-analyzer-cockpit .gap-5 { gap: 20px !important; }
#modal-lis-analyzer-cockpit .gap-6 { gap: 24px !important; }

#modal-lis-analyzer-cockpit .p-2 { padding: 8px !important; }
#modal-lis-analyzer-cockpit .p-3 { padding: 12px !important; }
#modal-lis-analyzer-cockpit .p-3\.5 { padding: 14px !important; }
#modal-lis-analyzer-cockpit .p-4 { padding: 16px !important; }
#modal-lis-analyzer-cockpit .p-5 { padding: 20px !important; }
#modal-lis-analyzer-cockpit .p-6 { padding: 24px !important; }
#modal-lis-analyzer-cockpit .px-3 { padding-left: 12px !important; padding-right: 12px !important; }
#modal-lis-analyzer-cockpit .px-3\.5 { padding-left: 14px !important; padding-right: 14px !important; }
#modal-lis-analyzer-cockpit .px-4 { padding-left: 16px !important; padding-right: 16px !important; }
#modal-lis-analyzer-cockpit .px-5 { padding-left: 20px !important; padding-right: 20px !important; }
#modal-lis-analyzer-cockpit .px-6 { padding-left: 24px !important; padding-right: 24px !important; }
#modal-lis-analyzer-cockpit .py-1\.5 { padding-top: 6px !important; padding-bottom: 6px !important; }
#modal-lis-analyzer-cockpit .py-2 { padding-top: 8px !important; padding-bottom: 8px !important; }
#modal-lis-analyzer-cockpit .py-2\.5 { padding-top: 10px !important; padding-bottom: 10px !important; }
#modal-lis-analyzer-cockpit .py-3 { padding-top: 12px !important; padding-bottom: 12px !important; }
#modal-lis-analyzer-cockpit .py-4 { padding-top: 16px !important; padding-bottom: 16px !important; }

/* PureLabs Light Colors Mapping */
#modal-lis-analyzer-cockpit .bg-slate-900,
#modal-lis-analyzer-cockpit .bg-slate-900\/80,
#modal-lis-analyzer-cockpit .bg-slate-900\/90,
#modal-lis-analyzer-cockpit .bg-slate-900\/60 { background-color: #ffffff !important; }

#modal-lis-analyzer-cockpit .bg-slate-950,
#modal-lis-analyzer-cockpit .bg-slate-950\/50,
#modal-lis-analyzer-cockpit .bg-slate-950\/60,
#modal-lis-analyzer-cockpit .bg-slate-950\/80,
#modal-lis-analyzer-cockpit .bg-slate-950\/90,
#modal-lis-analyzer-cockpit .bg-slate-950\/40,
#modal-lis-analyzer-cockpit .bg-slate-950\/30 { background-color: #f8fafc !important; }

#modal-lis-analyzer-cockpit .bg-slate-800 { background-color: #f1f5f9 !important; }

#modal-lis-analyzer-cockpit .border-slate-800,
#modal-lis-analyzer-cockpit .border-slate-700,
#modal-lis-analyzer-cockpit .border-slate-800\/80 { border-color: #e2e8f0 !important; }

#modal-lis-analyzer-cockpit .rounded-xl { border-radius: 12px !important; }
#modal-lis-analyzer-cockpit .rounded-2xl { border-radius: 16px !important; }
#modal-lis-analyzer-cockpit .rounded-3xl { border-radius: 20px !important; }
#modal-lis-analyzer-cockpit .rounded-full { border-radius: 9999px !important; }

#modal-lis-analyzer-cockpit .text-emerald-400 { color: #059669 !important; }
#modal-lis-analyzer-cockpit .text-amber-400 { color: #d97706 !important; }
#modal-lis-analyzer-cockpit .text-cyan-400 { color: #0891b2 !important; }
#modal-lis-analyzer-cockpit .text-purple-400 { color: #7c3aed !important; }
#modal-lis-analyzer-cockpit .text-rose-400 { color: #e11d48 !important; }
#modal-lis-analyzer-cockpit .text-teal-300,
#modal-lis-analyzer-cockpit .text-teal-400 { color: #0d9488 !important; }

#modal-lis-analyzer-cockpit .text-slate-100,
#modal-lis-analyzer-cockpit .text-slate-200,
#modal-lis-analyzer-cockpit .text-white { color: #0f172a !important; }

#modal-lis-analyzer-cockpit .text-slate-300,
#modal-lis-analyzer-cockpit .text-slate-400 { color: #64748b !important; }

#modal-lis-analyzer-cockpit .text-slate-500 { color: #94a3b8 !important; }

#modal-lis-analyzer-cockpit .text-xs { font-size: 0.75rem !important; line-height: 1rem !important; }
#modal-lis-analyzer-cockpit .text-sm { font-size: 0.875rem !important; line-height: 1.25rem !important; }
#modal-lis-analyzer-cockpit .text-base { font-size: 1rem !important; line-height: 1.5rem !important; }
#modal-lis-analyzer-cockpit .text-lg { font-size: 1.125rem !important; line-height: 1.75rem !important; }
#modal-lis-analyzer-cockpit .text-xl { font-size: 1.25rem !important; line-height: 1.75rem !important; }
#modal-lis-analyzer-cockpit .font-semibold { font-weight: 600 !important; }
#modal-lis-analyzer-cockpit .font-bold { font-weight: 700 !important; }
#modal-lis-analyzer-cockpit .font-black { font-weight: 900 !important; }
#modal-lis-analyzer-cockpit .font-mono { font-family: monospace, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important; }

#modal-lis-analyzer-cockpit .overflow-y-auto { overflow-y: auto !important; }
#modal-lis-analyzer-cockpit .overflow-x-auto { overflow-x: auto !important; }
#modal-lis-analyzer-cockpit .w-full { width: 100% !important; }
#modal-lis-analyzer-cockpit .border-collapse { border-collapse: collapse !important; }

/* Custom Terminal for ASTM/HL7 Socket Logs */
#modal-lis-analyzer-cockpit #lis-socket-raw-logs {
    background-color: #0f172a !important;
    color: #34d399 !important;
    border-color: #1e293b !important;
}

/* ── SIDEBAR DESKTOP COLLAPSABILE ADATTIVA (68PX) ── */
.sidebar,
.sidebar.collapsed,
.sidebar-nav,
.sidebar-footer {
    overflow-x: hidden !important;
}

.sidebar.collapsed {
    width: 68px !important;
    min-width: 68px !important;
    max-width: 68px !important;
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.sidebar.collapsed .sidebar-header {
    padding: 12px 6px !important;
    justify-content: center !important;
}
.sidebar.collapsed .sidebar-logo-full {
    display: none !important;
}
.sidebar.collapsed .sidebar-logo-mini {
    display: block !important;
    margin: 0 auto !important;
}
.sidebar.collapsed .sidebar-section-label,
.sidebar.collapsed .nav-item > span,
.sidebar.collapsed .nav-item span:not(:has(.nav-icon-badge)),
.sidebar.collapsed .nav-item .badge,
.sidebar.collapsed .nav-item .badge-live-pulse,
.sidebar.collapsed .nav-item .tab-badge-blink,
.sidebar.collapsed .sidebar-footer .user-profile > div:first-child > div:last-child,
.sidebar.collapsed #sidebar-active-clinic-widget,
.sidebar.collapsed #btn-superadmin-impersonate span,
.sidebar.collapsed .sidebar-footer > div:last-child {
    display: none !important;
}
.sidebar.collapsed .nav-item {
    justify-content: center !important;
    padding: 10px 0 !important;
    margin: 3px 6px !important;
    border-radius: 8px !important;
    width: auto !important;
}
.sidebar.collapsed .nav-item .nav-icon-badge {
    display: flex !important;
    margin: 0 auto !important;
    flex-shrink: 0 !important;
}
.sidebar.collapsed .nav-item i,
.sidebar.collapsed .nav-item svg {
    margin: 0 !important;
    width: 20px !important;
    height: 20px !important;
}
.sidebar.collapsed .sidebar-footer {
    padding: 8px 4px !important;
    overflow: hidden !important;
}
.sidebar.collapsed .sidebar-footer .user-avatar {
    margin: 0 auto !important;
}
.sidebar.collapsed .sidebar-menu-switch {
    justify-content: center !important;
    padding: 4px 0 !important;
}
.sidebar.collapsed .menu-type-label,
.sidebar.collapsed #btn-toggle-menu-text {
    display: none !important;
}
.sidebar.collapsed #btn-toggle-menu {
    padding: 6px !important;
    margin: 0 auto !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
}

/* Riallineamento immediato di Main Content con Sidebar Collassata */
.sidebar.collapsed + .main-content,
.sidebar.collapsed ~ .main-content,
body.sidebar-desktop-collapsed .main-content,
.app-container:has(.sidebar.collapsed) .main-content {
    margin-left: 68px !important;
    transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── REGOLE DI RESPONSIVENESS GLOBALE PER PC DESKTOP & LAPTOP ── */
@media (max-width: 1600px) {
    :root {
        --sidebar-width: 230px;
    }
    .pacs-col-uid {
        display: none !important;
    }
}

@media (max-width: 1440px) {
    :root {
        --sidebar-width: 215px;
    }
    .content-body {
        padding: 10px 14px 60px 14px !important;
    }
    .pacs-col-uid,
    .pacs-col-received {
        display: none !important;
    }
    .card {
        margin-bottom: 12px !important;
    }
}

@media (max-width: 1366px) {
    :root {
        --sidebar-width: 205px;
    }
    .content-body {
        padding: 8px 12px 50px 12px !important;
    }
    .table th, .table td {
        padding: 6px 8px !important;
    }
}

@media (max-height: 800px) {
    .sidebar-header {
        min-height: 60px !important;
        padding: 8px 12px !important;
    }
    .sidebar-header .sidebar-logo-full {
        height: 42px !important;
    }
    .sidebar-nav {
        padding: 4px 8px !important;
    }
    .sidebar-section-label {
        margin-top: 6px !important;
        margin-bottom: 2px !important;
        padding: 2px 8px !important;
        font-size: 0.65rem !important;
    }
    .nav-item {
        padding: 5px 8px !important;
        font-size: 0.78rem !important;
    }
    .content-body {
        padding-top: 8px !important;
        padding-bottom: 40px !important;
    }
}



