/* ============================================
   DASHBOARD SEGRETERIA
   Colori: theme del gestionale (primary-color, primary-dark, ecc.)
   ============================================ */

.dashboard-segreteria-container {
    padding: 24px;
    background-color: var(--bg-lighter, #f5f5f5);
    min-height: calc(100vh - var(--header-height, 56px));
}

/* ============================================
   HEADER DASHBOARD
   ============================================ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--primary-color, #2F6FED);
}

.dashboard-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-dark, #0E1F38);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-title i {
    color: var(--primary-color, #2F6FED);
}

.dashboard-actions {
    display: flex;
    gap: 8px;
}

.btn-refresh {
    background: var(--navy-accent, #213858);
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-refresh:hover {
    background: var(--primary-dark, #0E1F38);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(46, 120, 168, 0.3);
}

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 500;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.kpi-subvalue {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
    font-weight: 500;
}

.badge-critico {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: #dc3545;
    color: white;
    animation: pulse 1.5s infinite;
}

/* KPI Primary (Appuntamenti) */
.kpi-primary {
    border-left-color: var(--primary-color, #2F6FED);
}

.kpi-primary .kpi-icon {
    background: rgba(46, 120, 168, 0.1);
    color: var(--primary-color, #2F6FED);
}

.kpi-primary .kpi-value {
    color: var(--primary-dark, #0E1F38);
}

/* KPI Success (Fatture) */
.kpi-success {
    border-left-color: #4CAF50;
}

.kpi-success .kpi-icon {
    background: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
}

.kpi-success .kpi-value {
    color: #388E3C;
}

/* KPI Warning (Pratiche) */
.kpi-warning {
    border-left-color: #FFC107;
}

.kpi-warning .kpi-icon {
    background: rgba(255, 193, 7, 0.1);
    color: #FFC107;
}

.kpi-warning .kpi-value {
    color: #F57C00;
}

/* KPI Info (Pazienti) */
.kpi-info {
    border-left-color: #2196F3;
}

.kpi-info .kpi-icon {
    background: rgba(33, 150, 243, 0.1);
    color: #2196F3;
}

.kpi-info .kpi-value {
    color: #1976D2;
}

/* ============================================
   ALERT FATTURAZIONE
   ============================================ */
.alert-fatturazione {
    background: #fff3e0;
    border-left: 4px solid #FFC107;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(255, 193, 7, 0.2);
}

.alert-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.alert-header i {
    font-size: 24px;
    color: #F57C00;
}

.alert-title {
    font-size: 18px;
    font-weight: 600;
    color: #E65100;
}

.alert-description {
    color: #666;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-item {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.alert-item:last-child {
    margin-bottom: 0;
}

.alert-item-content {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.paziente-nome {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.pratica-info {
    color: #666;
    font-size: 13px;
}

.giorni-badge {
    background: #FFC107;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.alert-item-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    cursor: pointer;
}

.btn-primary-outline {
    color: var(--primary-color, #2F6FED);
    border-color: var(--primary-color, #2F6FED);
    background: white;
}

.btn-primary-outline:hover {
    background: var(--navy-accent, #213858);
    color: white;
}

.btn-success-outline {
    color: #4CAF50;
    border-color: #4CAF50;
    background: white;
}

.btn-success-outline:hover {
    background: #4CAF50;
    color: white;
}

/* ============================================
   CHARTS SECTION
   ============================================ */
.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-large {
    grid-column: span 2;
}

@media (max-width: 1200px) {
    .chart-large {
        grid-column: span 1;
    }
}

.chart-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary-dark, #0E1F38);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-title i {
    color: var(--primary-color, #2F6FED);
}

.chart-body {
    position: relative;
    height: 300px;
}

.chart-body canvas {
    max-height: 300px;
}

/* ============================================
   PAZIENTI SECTION
   ============================================ */
.pazienti-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.section-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-dark, #0E1F38);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: var(--primary-color, #2F6FED);
}

/* ============================================
   TABLE PAZIENTI
   ============================================ */
.table-responsive {
    overflow-x: auto;
}

.table-pazienti {
    width: 100%;
    border-collapse: collapse;
}

.table-pazienti thead {
    background: linear-gradient(135deg, var(--navy-accent, #213858) 0%, var(--primary-dark, #0E1F38) 100%);
    color: white;
}

.table-pazienti th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    border: none;
}

.table-pazienti td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #333;
}

.table-pazienti tbody tr:hover {
    background-color: #f8f9fa;
}

.table-pazienti tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .dashboard-segreteria-container {
        padding: 16px;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .dashboard-title {
        font-size: 22px;
    }

    .kpi-section {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-large {
        grid-column: span 1;
    }

    .alert-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .table-pazienti {
        font-size: 12px;
    }

    .table-pazienti th,
    .table-pazienti td {
        padding: 8px 12px;
    }
}

@media (max-width: 480px) {
    .kpi-card {
        flex-direction: column;
        text-align: center;
    }

    .kpi-icon {
        margin: 0 auto;
    }

    .btn-refresh {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================
   KPI COLORS EXTENDED
   ============================================ */
.kpi-danger {
    border-left-color: #e74c3c;
}
.kpi-danger .kpi-icon {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}
.kpi-danger .kpi-value {
    color: #c0392b;
}

.kpi-teal {
    border-left-color: #20c997;
}
.kpi-teal .kpi-icon {
    background: rgba(32, 201, 151, 0.1);
    color: #20c997;
}
.kpi-teal .kpi-value {
    color: #17a085;
}

.kpi-purple {
    border-left-color: #6f42c1;
}
.kpi-purple .kpi-icon {
    background: rgba(111, 66, 193, 0.1);
    color: #6f42c1;
}
.kpi-purple .kpi-value {
    color: #5a32a3;
}

.kpi-orange {
    border-left-color: #fd7e14;
}
.kpi-orange .kpi-icon {
    background: rgba(253, 126, 20, 0.1);
    color: #fd7e14;
}
.kpi-orange .kpi-value {
    color: #e86a0c;
}

.kpi-subtitle {
    color: #adb5bd;
    font-size: 0.75rem;
    margin-top: 4px;
}

.kpi-period-note {
    color: #6c757d;
    font-size: 0.7rem;
    font-style: italic;
    margin-top: 2px;
    opacity: 0.8;
}

/* ============================================
   PERIOD INFO
   ============================================ */
.period-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* ============================================
   RANKINGS SECTION
   ============================================ */
.rankings-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

@media (max-width: 1200px) {
    .rankings-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .rankings-section {
        grid-template-columns: 1fr;
    }
}

.ranking-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.ranking-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
}

.ranking-primary .ranking-header {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(41, 128, 185, 0.1) 100%);
}

.ranking-success .ranking-header {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(46, 204, 113, 0.1) 100%);
}

.ranking-warning .ranking-header {
    background: linear-gradient(135deg, rgba(243, 156, 18, 0.1) 0%, rgba(230, 126, 34, 0.1) 100%);
}

.ranking-title {
    margin: 0 0 4px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ranking-primary .ranking-title i {
    color: #3498db;
}

.ranking-success .ranking-title i {
    color: #27ae60;
}

.ranking-warning .ranking-title i {
    color: #f39c12;
}

.ranking-subtitle {
    color: #6c757d;
    font-size: 0.8rem;
}

.ranking-body {
    padding: 16px 20px;
    max-height: 320px;
    overflow-y: auto;
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f3f5;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-position {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
    background: #e9ecef;
    color: #6c757d;
}

.ranking-position.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    color: #7a6200;
}

.ranking-position.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #a8a8a8 100%);
    color: #555;
}

.ranking-position.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
    color: white;
}

.ranking-position.warning {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
}

.ranking-info {
    flex: 1;
    min-width: 0;
}

.ranking-name {
    display: block;
    font-weight: 500;
    color: #2c3e50;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-info .ranking-subtitle {
    display: block;
    font-size: 0.75rem;
    color: #adb5bd;
    margin-top: 2px;
}

.ranking-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #3498db;
}

.ranking-value.warning {
    color: #e74c3c;
}

.ranking-value.success {
    color: #27ae60;
}

.ranking-value-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.ranking-days {
    font-size: 0.75rem;
    color: #6c757d;
}

.ranking-bar-container {
    width: 60px;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.ranking-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.ranking-bar.primary {
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
}

.ranking-bar.success {
    background: linear-gradient(90deg, #27ae60 0%, #2ecc71 100%);
}

.ranking-bar.warning {
    background: linear-gradient(90deg, #f39c12 0%, #e74c3c 100%);
}

/* No Data */
.no-data {
    text-align: center;
    padding: 30px 20px;
    color: #6c757d;
}

.no-data i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
    opacity: 0.5;
}

.no-data.success {
    color: #27ae60;
}

.no-data.success i {
    color: #27ae60;
}

/* ============================================
   ANOMALIE AMMINISTRATIVE
   ============================================ */
.kpi-section.kpi-anomalies {
    margin-bottom: 24px;
}

.kpi-anomalies .kpi-card {
    grid-column: 1 / -1;
    max-width: 100%;
}

/* Anomalie - Card Styles */
.kpi-anomaly-critical {
    border-left-color: #dc3545;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.05) 0%, rgba(220, 53, 69, 0.02) 100%);
}

.kpi-anomaly-critical .kpi-icon {
    background: rgba(220, 53, 69, 0.15);
    color: #dc3545;
}

.kpi-anomaly-critical .kpi-value {
    color: #c82333;
}

.kpi-anomaly-critical.has-critical {
    border-left-width: 6px;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% {
        border-left-color: #dc3545;
    }
    50% {
        border-left-color: #ff6b7a;
    }
}

.kpi-anomaly-warning {
    border-left-color: #fd7e14;
    background: linear-gradient(135deg, rgba(253, 126, 20, 0.05) 0%, rgba(253, 126, 20, 0.02) 100%);
}

.kpi-anomaly-warning .kpi-icon {
    background: rgba(253, 126, 20, 0.15);
    color: #fd7e14;
}

.kpi-anomaly-warning .kpi-value {
    color: #e86a0c;
}

.kpi-anomaly-ok {
    border-left-color: #28a745;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.05) 0%, rgba(40, 167, 69, 0.02) 100%);
}

.kpi-anomaly-ok .kpi-icon {
    background: rgba(40, 167, 69, 0.15);
    color: #28a745;
}

.kpi-anomaly-ok .kpi-value {
    color: #218838;
}

/* Badge KPI */
.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 10px;
    vertical-align: middle;
}

.kpi-badge.badge-critical {
    background: #dc3545;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Breakdown Anomalie */
.kpi-breakdown {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.breakdown-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #6c757d;
    padding: 4px 10px;
    background: rgba(0,0,0,0.04);
    border-radius: 15px;
}

.breakdown-item i {
    font-size: 0.85rem;
    color: #495057;
}

/* Ranking Anomalie */
.ranking-danger .ranking-header {
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(192, 57, 43, 0.1) 100%);
}

.ranking-danger .ranking-title i {
    color: #dc3545;
}

/* Gravita Classes */
.ranking-item.gravita-critico {
    background: rgba(220, 53, 69, 0.05);
    border-left: 3px solid #dc3545;
    padding-left: 12px;
    margin-left: -12px;
}

.ranking-item.gravita-alto {
    background: rgba(253, 126, 20, 0.05);
    border-left: 3px solid #fd7e14;
    padding-left: 12px;
    margin-left: -12px;
}

.ranking-item.gravita-medio {
    background: rgba(255, 193, 7, 0.05);
    border-left: 3px solid #ffc107;
    padding-left: 12px;
    margin-left: -12px;
}

.ranking-item.gravita-basso {
    border-left: 3px solid #17a2b8;
    padding-left: 12px;
    margin-left: -12px;
}

/* Badge Gravita */
.ranking-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ranking-badge.badge-critical {
    background: #dc3545;
    color: white;
}

.ranking-badge.badge-high {
    background: #fd7e14;
    color: white;
}

.ranking-badge.badge-medium {
    background: #ffc107;
    color: #333;
}

.ranking-badge.badge-low {
    background: #17a2b8;
    color: white;
}

/* Value Danger */
.ranking-value.danger {
    color: #dc3545;
}

/* Position Icons */
.ranking-position.badge-critical {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
}

.ranking-position.badge-high {
    background: linear-gradient(135deg, #fd7e14 0%, #e86a0c 100%);
    color: white;
}

.ranking-position.badge-medium {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    color: #333;
}

.ranking-position.badge-low {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

/* ============================================
   PANNELLO DETTAGLIO ANOMALIE ESPANDIBILE
   ============================================ */
.kpi-clickable {
    cursor: pointer;
    position: relative;
}

.kpi-clickable:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.25);
}

.kpi-clickable .toggle-icon {
    font-size: 12px;
    margin-left: 8px;
    transition: transform 0.3s ease;
    color: #999;
}

.anomalie-detail-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.4s ease;
    border-left: 4px solid #dc3545;
}

.anomalie-detail-panel.expanded {
    max-height: 2000px;
    opacity: 1;
    padding: 0;
}

.anomalie-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.08) 0%, rgba(220, 53, 69, 0.03) 100%);
    border-bottom: 1px solid rgba(220, 53, 69, 0.1);
}

.anomalie-detail-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #c82333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.anomalie-detail-header h3 i {
    color: #dc3545;
}

.btn-close-panel {
    background: none;
    border: none;
    font-size: 18px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-close-panel:hover {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

.anomalie-detail-body {
    padding: 16px 20px;
    max-height: 500px;
    overflow-y: auto;
}

/* Card Paziente con Anomalie */
.anomalia-paziente-card {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

.anomalia-paziente-card:hover {
    border-color: #dc3545;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.1);
}

.anomalia-paziente-card:last-child {
    margin-bottom: 0;
}

.paziente-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #dee2e6;
}

.paziente-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.paziente-nome {
    font-weight: 600;
    font-size: 15px;
    color: #2c3e50;
}

.paziente-cf {
    font-size: 12px;
    color: #6c757d;
    font-family: monospace;
}

.paziente-totale {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.importo-totale {
    font-weight: 700;
    font-size: 18px;
    color: #dc3545;
}

.anomalie-count {
    font-size: 12px;
    color: #6c757d;
}

/* Lista Anomalie per Paziente */
.anomalie-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.anomalia-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: white;
    border-radius: 8px;
    border-left: 3px solid #6c757d;
}

.anomalia-item.anomalia-fattura {
    border-left-color: #fd7e14;
}

.anomalia-item.anomalia-pagamento {
    border-left-color: #dc3545;
}

.anomalia-item.anomalia-pratica {
    border-left-color: #6f42c1;
}

.anomalia-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.anomalia-info i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.anomalia-fattura .anomalia-info i {
    color: #fd7e14;
}

.anomalia-pagamento .anomalia-info i {
    color: #dc3545;
}

.anomalia-pratica .anomalia-info i {
    color: #6f42c1;
}

.anomalia-tipo {
    font-weight: 500;
    color: #495057;
    font-size: 13px;
}

.anomalia-count-badge {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.anomalia-importo {
    font-weight: 600;
    color: #dc3545;
    font-size: 13px;
}

/* Pulsanti Azione */
.btn-azione {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn-fattura {
    background: #fd7e14;
    color: white;
}

.btn-fattura:hover {
    background: #e86a0c;
    color: white;
    transform: translateY(-1px);
}

.btn-pagamento {
    background: #28a745;
    color: white;
}

.btn-pagamento:hover {
    background: #218838;
    color: white;
    transform: translateY(-1px);
}

.btn-pratica {
    background: #6f42c1;
    color: white;
}

.btn-pratica:hover {
    background: #5a32a3;
    color: white;
    transform: translateY(-1px);
}

/* No Anomalie */
.no-anomalie {
    text-align: center;
    padding: 40px 20px;
    color: #28a745;
}

.no-anomalie i {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.no-anomalie span {
    font-size: 16px;
    font-weight: 500;
}

/* Responsive Pannello Anomalie */
@media (max-width: 768px) {
    .anomalia-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .anomalia-info {
        width: 100%;
    }

    .btn-azione {
        width: 100%;
        justify-content: center;
    }

    .paziente-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .paziente-totale {
        text-align: left;
    }
}

/* ============================================
   POPUP SELEZIONE FATTURA
   ============================================ */
.selezione-fattura-container {
    padding: 10px;
}

.selezione-fattura-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #3498db;
}

/* Style for DevExpress Grid in popup */
.selezione-fattura-container .dxgvControl_Office365 {
    border-radius: 8px;
    overflow: hidden;
}

.selezione-fattura-container .dxgvHeader_Office365 {
    background: #f1f3f5;
}

/* Badge Critico in KPI Card */
.badge-critico {
    display: inline-flex;
    align-items: center;
    background: #dc3545;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}
