/* ==========================================
   STILI COMPLETI CRM AZIENDALE
   ========================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #667eea;
    --primary-hover: #5a6fd8;
    --primary-light: #eef1ff;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: var(--gray-900);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.login-box h1 { font-size: 24px; text-align: center; margin-bottom: 10px; color: #667eea; }
.login-box h2 { font-size: 18px; text-align: center; color: #666; margin-bottom: 30px; }
.login-box .form-group { margin-bottom: 20px; }
.login-box input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
.login-box input:focus { outline: none; border-color: #667eea; }
.login-box button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}
.login-box button:hover { background: #5a6fd8; }
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

/* Header */
.main-header {
    background: white;
    padding: 0 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 20px; }
.header-left h1 { font-size: 18px; color: var(--gray-900); white-space: nowrap; }
.header-left h1 span { color: var(--primary); }
.back-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.back-link:hover { color: var(--primary-hover); background: var(--primary-light); }
.header-nav { display: flex; gap: 8px; align-items: center; }
.header-nav a {
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    transition: all var(--transition);
    padding: 6px 12px;
    border-radius: var(--radius);
    white-space: nowrap;
}
.header-nav a:hover { color: var(--primary); background: var(--primary-light); }
.header-nav a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.header-nav a .nav-icon { margin-right: 4px; }
.nav-dropdown { position: relative; }
.nav-dropdown > .nav-dd-toggle {
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    transition: all var(--transition);
    padding: 6px 12px;
    border-radius: var(--radius);
    white-space: nowrap;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-dropdown > .nav-dd-toggle:hover { color: var(--primary); background: var(--primary-light); }
.nav-dropdown > .nav-dd-toggle.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.nav-dropdown > .nav-dd-toggle .nav-dd-arrow { font-size: 9px; opacity: .6; }
.nav-dd-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    min-width: 200px;
    padding: 6px;
    z-index: 200;
}
.nav-dropdown:hover .nav-dd-menu { display: block; }
.nav-dd-menu a {
    display: block;
    padding: 8px 10px;
    color: var(--gray-700);
    text-decoration: none;
    font-size: 13px;
    border-radius: 6px;
    white-space: nowrap;
}
.nav-dd-menu a:hover { color: var(--primary); background: var(--primary-light); }
.nav-dd-menu a.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.notification-badge-container { position: relative; margin-left: 15px; flex-shrink: 0; }
.notifica-campanella {
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: inline-block;
}
.notification-badge {
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    position: absolute;
    top: -8px;
    right: -8px;
    animation: pulse 2s infinite;
    min-width: 20px;
    text-align: center;
    display: none;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Dashboard */
.dashboard { padding: 20px; max-width: 1600px; margin: 0 auto; }
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

/* Quick Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all var(--transition);
    border: 1px solid var(--gray-200);
}
.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: #e6f7ec; color: var(--success); }
.stat-icon.red { background: #fce8e6; color: var(--danger); }
.stat-icon.orange { background: #fff4e5; color: #e37400; }
.stat-icon.purple { background: #f3e8ff; color: #7c3aed; }
.stat-info .stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-info .stat-label { font-size: 12px; color: var(--gray-600); margin-top: 2px; }

/* Buttons */
.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}
.btn-primary:active { transform: translateY(0); }
.btn-motivazione {
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    padding: 6px 14px;
    border-radius: 16px;
    cursor: pointer;
    font-size: 13px;
    transition: all var(--transition);
}
.btn-motivazione:hover {
    background: var(--primary);
    color: white;
}
.btn-motivazione:focus {
    background: var(--primary);
    color: white;
    outline: none;
}
.btn-secondary-sm, .btn-primary-sm, .btn-warning-sm, .btn-danger-sm {
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin: 2px;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.btn-secondary-sm { background: var(--gray-600); color: white; }
.btn-secondary-sm:hover { background: #5a6268; }
.btn-primary-sm { background: var(--primary); color: white; }
.btn-primary-sm:hover { background: var(--primary-hover); }
.btn-warning-sm { background: var(--warning); color: var(--gray-900); }
.btn-warning-sm:hover { background: #e0a800; }
.btn-danger-sm { background: var(--danger); color: white; }
.btn-danger-sm:hover { background: #c82333; }
.btn-success-sm { background: var(--success); color: white; }
.btn-success-sm:hover { background: #218838; }
.btn-success { background: var(--success); color: white; border: none; padding: 10px 20px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 500; transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px; }
.btn-success:hover { background: #218838; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(40, 167, 69, 0.35); }
.btn-warning { background: var(--warning); color: var(--gray-900); border: none; padding: 10px 20px; border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 500; transition: all var(--transition); display: inline-flex; align-items: center; gap: 6px; }
.btn-warning:hover { background: #e0a800; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3); }
.btn-primary-xs { background: var(--primary); border: 1px solid var(--primary); color: white; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; text-decoration: none; display: inline-block; transition: all var(--transition); }
.btn-primary-xs:hover { background: var(--primary-hover); text-decoration: none; color: white; }
.btn-success-xs { background: var(--success); border: 1px solid var(--success); color: white; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; text-decoration: none; display: inline-block; transition: all var(--transition); }
.btn-success-xs:hover { background: #218838; text-decoration: none; color: white; }
.btn-warning-xs { background: var(--warning); border: 1px solid var(--warning); color: var(--gray-900); padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; text-decoration: none; display: inline-block; transition: all var(--transition); }
.btn-warning-xs:hover { background: #e0a800; text-decoration: none; color: var(--gray-900); }
.btn-secondary-xs { background: var(--gray-600); border: 1px solid var(--gray-600); color: white; padding: 2px 6px; border-radius: 3px; cursor: pointer; font-size: 11px; text-decoration: none; display: inline-block; transition: all var(--transition); }
.btn-secondary-xs:hover { background: #5a6268; text-decoration: none; color: white; }
.btn-danger-xs { background: var(--danger); color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 11px; padding: 3px 8px; transition: background var(--transition); }
.btn-danger-xs:hover { background: #c82333; }

/* Grid delle cartelle fasi */
.folders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

/* Cartelle delle fasi */
.phase-folder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--radius-lg);
    padding: 24px 20px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid transparent;
    position: relative;
    overflow: hidden;
}

.phase-folder:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.15);
}

.phase-folder:active {
    transform: translateY(-2px);
}

.phase-rossa { background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%); border-color: var(--danger); }
.phase-azzurra { background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%); border-color: var(--info); }
.phase-arancione { background: linear-gradient(135deg, #fff3e0 0%, #ffcc02 100%); border-color: #fd7e14; }
.phase-arancione_chiaro { background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%); border-color: var(--warning); }
.phase-gialla { background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%); border-color: var(--warning); }
.phase-verde { background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%); border-color: var(--success); }
.phase-oli { background: linear-gradient(135deg, #fff3e0 0%, #ffcc02 100%); border-color: #fd7e14; }
.phase-batterie { background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%); border-color: #7c3aed; }
.phase-batterie-raccolta { background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%); border-color: var(--success); }

.folder-header {
    text-align: center;
    margin-bottom: 15px;
}

.folder-preview {
    min-height: 40px;
}

.folder-icon {
    font-size: 44px;
    margin-bottom: 10px;
    opacity: 0.85;
    display: block;
}

.folder-header h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: var(--gray-900);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.client-count {
    background: rgba(0,0,0,0.1);
    color: var(--gray-800);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.folder-preview {
    border-top: 1px solid rgba(0,0,0,0.08);
    padding-top: 15px;
    margin-top: 5px;
}

.preview-client {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.client-name {
    font-size: 13px;
    color: var(--gray-700);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.alert-dot {
    font-size: 12px;
    color: var(--danger);
    flex-shrink: 0;
}

.preview-more {
    text-align: center;
    font-size: 11px;
    color: var(--gray-600);
    font-style: italic;
    padding: 8px 0 4px;
}

/* Toast per note */
.notes-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    max-width: 400px;
    animation: toastSlideIn 0.3s ease-out;
}

.toast-content {
    padding: 15px;
}

.toast-content h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 16px;
}

#toastNotesContent {
    font-size: 14px;
    line-height: 1.4;
    color: #555;
    max-height: 200px;
    overflow-y: auto;
}

@keyframes toastSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Vista compatta clienti nella modal */
.clients-compact-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    padding: 20px 0;
}

.compact-client-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 14px 16px;
    cursor: default;
    transition: all var(--transition);
    position: relative;
}

.compact-client-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.compact-client-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}

.compact-client-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

.compact-client-badges {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.compact-client-badges--stacked {
    justify-content: flex-start;
    margin-bottom: 8px;
}

.compact-client-info {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.compact-client-info .info-label { color: var(--gray-500); font-size: 11px; }

.compact-client-files {
    display: flex;
    gap: 4px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.file-chip {
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    transition: all var(--transition);
}
.file-chip:hover {
    background: var(--primary-light);
    border-color: var(--primary);
}

.compact-client-actions {
    margin-top: 10px;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
    padding-top: 10px;
    border-top: 1px solid var(--gray-100);
}

.hover-tooltip-anchor {
    position: relative;
    outline: none;
}

.hover-tooltip-anchor:hover,
.hover-tooltip-anchor:focus-within {
    z-index: 260;
}

.hover-tooltip-anchor:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.hover-tooltip {
    position: absolute;
    top: var(--tt-top, auto);
    right: var(--tt-right, auto);
    bottom: var(--tt-bottom, calc(100% + 12px));
    left: var(--tt-left, 50%);
    transform: var(--tt-transform-hidden, translateX(-50%) translateY(6px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    min-width: 220px;
    max-width: 380px;
    max-height: 70vh;
    overflow-y: auto;
    width: max-content;
    padding: 14px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(26, 32, 44, 0.96) 0%, rgba(45, 55, 72, 0.98) 100%);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.28);
    backdrop-filter: blur(10px);
    z-index: 250;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.hover-tooltip::after {
    content: '';
    position: absolute;
    top: var(--tt-arrow-top, 100%);
    right: var(--tt-arrow-right, auto);
    bottom: var(--tt-arrow-bottom, auto);
    left: var(--tt-arrow-left, 50%);
    transform: var(--tt-arrow-transform, translateX(-50%));
    border: 7px solid transparent;
    border-top-color: var(--tt-arrow-top-color, rgba(45, 55, 72, 0.98));
    border-bottom-color: var(--tt-arrow-bottom-color, transparent);
}

.hover-tooltip-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    font-size: 12px;
    line-height: 1.45;
}

.hover-tooltip-row + .hover-tooltip-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hover-tooltip-label {
    color: #cbd5e1;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.hover-tooltip-value {
    color: #ffffff;
    font-weight: 500;
    word-break: break-word;
}

.hover-tooltip-anchor:hover .hover-tooltip,
.hover-tooltip-anchor:focus-within .hover-tooltip {
    opacity: 1;
    visibility: visible;
    transform: var(--tt-transform-visible, translateX(-50%) translateY(0));
}

.feedback-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 11000;
    pointer-events: none;
    max-width: min(420px, calc(100vw - 24px));
}

.feedback-toast {
    background: white;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16);
    min-width: 260px;
    max-width: 100%;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.feedback-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.feedback-toast__body {
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.4;
    color: #24303f;
}

.feedback-toast--success {
    border-left: 4px solid #28a745;
}

.feedback-toast--error {
    border-left: 4px solid #dc3545;
}

.feedback-toast--warning {
    border-left: 4px solid #ffc107;
}

.feedback-toast--info {
    border-left: 4px solid #667eea;
}

.compact-client-actions {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.column-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.column-header {
    transition: all 0.3s;
}

.column-header:hover {
    background: #e9ecef;
}

.column-header h2 {
    font-size: 14px;
    color: #495057;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.count {
    background: #6c757d;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
}

.toggle-icon {
    font-size: 12px;
    color: #6c757d;
    transition: transform 0.3s;
}

.kanban-column.expanded .toggle-icon {
    transform: rotate(90deg);
}
.cards-container { padding: 10px; min-height: 200px; }

/* Card Cliente */
.client-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.client-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

.client-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.client-card .card-header h3 {
    font-size: 14px;
    margin: 0;
    color: #333;
    word-break: break-word;
    line-height: 1.3;
    flex: 1;
}

.card-badges {
    display: flex;
    gap: 4px;
    align-items: center;
}

.badge-alert, .badge-mismatch {
    font-size: 14px;
    line-height: 1;
}

.client-card .card-content {
    margin-bottom: 10px;
}

.client-card .card-info {
    margin-bottom: 5px;
}

.card-files {
    margin-top: 5px;
}
.file-icons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.file-icons span {
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s;
}
.file-icons span:hover { background: #f0f2f5; transform: scale(1.1); }

/* ===== BADGE COLORATI PER LE 6 FASI ===== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: bold;
    margin-bottom: 8px;
}

.badge-rossa { background: #dc3545; color: white; }
.badge-azzurra { background: #17a2b8; color: white; }
.badge-arancione { background: #fd7e14; color: white; }
.badge-arancione_chiaro { background: #ffc107; color: #212529; }
.badge-gialla { background: #ffc107; color: #212529; }
.badge-verde { background: #28a745; color: white; }

/* Colonne colorate */
.kanban-column[data-phase="rossa"] .cards-container { background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 50%); }
.kanban-column[data-phase="azzurra"] .cards-container { background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 50%); }
.kanban-column[data-phase="arancione"] .cards-container { background: linear-gradient(135deg, #fff3e0 0%, #ffcc02 50%); }
.kanban-column[data-phase="arancione_chiaro"] .cards-container { background: linear-gradient(135deg, #fffde7 0%, #fff9c4 50%); }
.kanban-column[data-phase="gialla"] .cards-container { background: linear-gradient(135deg, #fffde7 0%, #fff9c4 50%); }
.kanban-column[data-phase="verde"] .cards-container { background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 50%); }

/* Card con colore della colonna */
.kanban-column[data-phase="rossa"] .client-card { border-color: #dc3545; background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%); }
.kanban-column[data-phase="azzurra"] .client-card { border-color: #17a2b8; background: linear-gradient(135deg, #e0f2fe 0%, #b3e5fc 100%); }
.kanban-column[data-phase="arancione"] .client-card { border-color: #fd7e14; background: linear-gradient(135deg, #fff3e0 0%, #ffcc02 100%); }
.kanban-column[data-phase="arancione_chiaro"] .client-card { border-color: #ffc107; background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%); }
.kanban-column[data-phase="gialla"] .client-card { border-color: #ffc107; background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%); }
.kanban-column[data-phase="verde"] .client-card { border-color: #28a745; background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%); }

/* Badge alert e mismatch */
.badge-alert, .badge-mismatch {
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
}

.badge-mismatch {
    animation: pulse 2s infinite;
}

/* Card mismatch styling */
.card-mismatch {
    border-style: dashed !important;
    border-width: 3px !important;
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0% { border-color: #ffc107; }
    50% { border-color: #ff6b35; }
    100% { border-color: #ffc107; }
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* Badge per ruoli utenti */
.badge-commerciale { background: #667eea; color: white; }
.badge-tecnico { background: #28a745; color: white; }
.badge-logistica { background: #fd7e14; color: white; }
.badge-amministrazione { background: #6c757d; color: white; }

/* Tooltip Preferenze */
.preferenze-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    background: #2c3e50;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.8;
    white-space: nowrap;
    z-index: 100;
    min-width: 250px;
    max-width: 320px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.preferenze-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #2c3e50;
}
.client-card:hover .preferenze-tooltip { display: block; }
.preferenze-tooltip strong { color: #667eea; font-size: 13px; }
.preferenze-tooltip em { color: #999; font-style: italic; }

/* Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    min-width: 200px;
    padding: 4px 0;
    animation: contextMenuIn 0.15s ease-out;
    pointer-events: auto;
}
.context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
    pointer-events: auto;
}
.context-menu li {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    pointer-events: auto;
}
.context-menu li:hover {
    background: #f8f9fa;
    color: #dc3545;
}

/* Alert Badge */
.alert-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    z-index: 10;
    animation: pulse 1.5s infinite;
}
.alert-badge:hover { transform: scale(1.2); }

/* Alert e Notifiche */
.alert-notification {
    padding: 10px 15px;
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    color: #856404;
}
.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
}
.alert-errore {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
}

/* Modali */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
    backdrop-filter: blur(2px);
}
.modal.modal-front {
    z-index: 1001;
}
.modal.active { display: flex; }
.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease-out;
    position: relative;
    box-shadow: var(--shadow-lg);
}
.modal-content.modal-overflow-visible {
    overflow: visible;
}
@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 {
    margin: 0;
    color: var(--gray-900);
    font-size: 18px;
}
.modal-header .close {
    font-size: 24px;
    font-weight: bold;
    color: var(--gray-500);
    cursor: pointer;
    line-height: 1;
    transition: color var(--transition);
    background: none;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
}
.modal-header .close:hover {
    color: var(--gray-900);
    background: var(--gray-100);
}
.modal-body {
    margin-bottom: 20px;
}

/* Loading Overlay */
.loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.75);
    z-index: 99999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(1px);
}
.loading-overlay.active { display: flex; }
.loading-spinner {
    background: white;
    padding: 30px 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    text-align: center;
}
.loading-spinner .spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.loading-spinner p { font-size: 14px; color: var(--gray-600); }

/* Keyboard Shortcut Hint */
.kbd-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gray-900);
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius);
    font-size: 12px;
    z-index: 999;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.kbd-hint.show { opacity: 0.8; }
.kbd-hint kbd {
    background: rgba(255,255,255,0.15);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: inherit;
    margin: 0 2px;
}

/* Verde Modal Specific Styles */
.verde-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.verde-filtri {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
    flex-shrink: 0;
}

.verde-clienti-section {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: visible;
    padding-right: 4px;
    background: white;
    border-radius: 8px;
}

.filtro-label {
    font-weight: bold;
    font-size: 13px;
    color: #1e7e34;
    white-space: nowrap;
}

.btn-verde {
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-verde-primary {
    background: #28a745;
    color: white;
}

.btn-verde-primary:hover {
    background: #218838;
}

.btn-verde-info {
    background: #17a2b8;
    color: white;
}

.btn-verde-info:hover {
    background: #138496;
}

.input-verde {
    width: 130px;
    padding: 6px 8px;
    border: 1px solid #28a745;
    border-radius: 5px;
    font-size: 12px;
}

.filtro-arrow {
    font-size: 13px;
    color: #28a745;
    font-weight: bold;
}

.verde-info {
    font-size: 13px;
    font-weight: bold;
    color: #28a745;
    white-space: nowrap;
    margin-left: auto;
}

.verde-clienti-section {
    flex: 1;
    min-height: 0;
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: visible;
    padding-right: 4px;
    background: white;
    border-radius: 8px;
}

/* Override clients-compact-view for verde modal - compact grid cards */
.verde-clienti-section .clients-compact-view {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)) !important;
    gap: 8px !important;
    padding: 8px 0;
    align-items: start;
}

.verde-clienti-section .compact-client-card {
    margin-bottom: 0;
    padding: 8px;
    font-size: 12px;
}

.verde-clienti-section .compact-client-name {
    font-size: 13px;
    margin-bottom: 4px;
}

.verde-clienti-section .compact-client-info {
    font-size: 11px;
    margin-bottom: 3px;
}

.verde-clienti-section .compact-client-actions {
    margin-top: 6px;
    gap: 4px;
}

.verde-clienti-section .btn-primary-xs,
.verde-clienti-section .btn-success-xs,
.verde-clienti-section .btn-warning-xs,
.verde-clienti-section .btn-secondary-xs,
.verde-clienti-section .btn-danger-xs {
    font-size: 10px;
    padding: 1px 4px;
}

.large-modal { max-width: 90vw; max-height: 90vh; }
.large-modal .modal-body { max-height: calc(90vh - 120px); overflow-y: auto; }
/* Verde modal uses its own scrolling container */
.large-modal .verde-modal-body { max-height: none; overflow-y: visible; }
.large-modal.modal-few-items .modal-body { max-height: none; overflow-y: visible; }
.large-modal.modal-few-items { overflow: visible; }
.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* Notifications Dropdown */
.notifications-dropdown {
    position: absolute;
    top: 100%;
    right: 20px;
    width: 320px;
    max-height: 400px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10001;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.dropdown-header {
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.dropdown-header button {
    font-size: 11px;
    padding: 4px 8px;
}
.notifications-list {
    max-height: 300px;
    overflow-y: auto;
}
.notification-item {
    padding: 10px 16px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}
.notification-item:hover {
    background: #f8f9fa;
}
.notification-item.unread {
    background: #e3f2fd;
    font-weight: 500;
}
.notification-item .notif-time {
    font-size: 11px;
    color: #999;
    margin-bottom: 4px;
}
.notification-item .notif-text {
    font-size: 13px;
    color: #333;
    line-height: 1.4;
}
.notification-item .notif-type {
    font-size: 11px;
    text-transform: uppercase;
    color: #666;
    margin-top: 4px;
}
.notification-empty {
    padding: 20px;
    text-align: center;
    color: #777;
    font-size: 13px;
}

/* Form */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}
.form-group.full-width { grid-column: 1 / -1; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Chat */
.chat-page {
    display: flex;
    height: calc(100vh - 60px);
    background-color: #f0f2f5;
}
.chat-sidebar {
    width: 280px;
    background: white;
    border-right: 1px solid var(--gray-300);
    display: flex;
    flex-direction: column;
}
.chat-sidebar h3 {
    padding: 15px 20px;
    font-size: 14px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
    margin: 0;
}
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}
.chat-header-info {
    padding: 15px 20px;
    border-bottom: 1px solid var(--gray-300);
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.chat-header-info strong { font-size: 14px; color: var(--gray-900); }
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: block;
    position: relative;
}
.chat-message {
    margin-bottom: 15px;
    max-width: 75%;
    animation: msgIn 0.2s ease-out;
}
@keyframes msgIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.chat-message.mine { margin-left: auto; text-align: right; }
.chat-message.other { margin-right: auto; }
.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 12px;
    gap: 8px;
}
.chat-message.mine .message-header { justify-content: flex-end; }
.chat-message.mine .message-header strong { color: var(--primary); }
.chat-message.other .message-header strong { color: var(--success); }
.chat-message p {
    background: white;
    padding: 10px 16px;
    border-radius: 18px;
    margin: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    word-break: break-word;
    line-height: 1.5;
    font-size: 14px;
}
.chat-message.mine p { background: var(--primary); color: white; }

/* Role group header in chat sidebar */
.role-group-header {
    padding: 8px 15px;
    font-size: 11px;
    font-weight: 700;
    color: #667eea;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
    border-top: 2px solid #e9ecef;
    position: sticky;
    top: 0;
    z-index: 1;
}
.role-group-header:first-child {
    border-top: none;
}

/* Users list */
.users-list {
    flex: 1;
    overflow-y: auto;
}
.user-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}
.user-item:hover {
    background: #f8f9fa;
}
.user-item.selected {
    background: #e3f2fd;
}
.online-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
    flex-shrink: 0;
}
.online-indicator.online { background: #28a745; }
.online-indicator.offline { background: #dc3545; }
.user-info {
    flex: 1;
    min-width: 0;
}
.user-info strong {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 11px;
    color: #666;
    text-transform: capitalize;
}
.unread-badge {
    background: #e74c3c;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    margin-left: 8px;
}
.btn-delete-conv {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    margin-left: 8px;
    opacity: 0.5;
    transition: opacity 0.2s, transform 0.2s;
    border-radius: 4px;
    flex-shrink: 0;
}
.user-item:hover .btn-delete-conv {
    opacity: 1;
}
.btn-delete-conv:hover {
    opacity: 1;
    transform: scale(1.1);
    background: rgba(220, 53, 69, 0.1);
}
.chat-input-form,
.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #ddd;
    background: white;
}
.chat-input-form input,
.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    margin-right: 10px;
    font-size: 14px;
}
.chat-input-form input:focus,
.chat-input input:focus {
    outline: none;
    border-color: #667eea;
}
.online-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 10px;
}
.online-indicator.online { background: #28a745; }
.online-indicator.offline { background: #dc3545; }
.user-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}
.user-item:hover { background: #f8f9fa; }
.user-item.selected { background: #e3f2fd; }
.static-value {
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    background: #f8f9fa;
    min-height: 40px;
}
/* Scroll orizzontale navbar per schermi piccoli */
@media (max-width: 1200px) {
    .header-nav {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-shrink: 1;
    }
    .header-nav::-webkit-scrollbar {
        display: none;
    }
    .header-left h1 {
        font-size: 16px;
        white-space: nowrap;
    }
    .header-left button {
        font-size: 12px;
        padding: 8px 12px;
        white-space: nowrap;
    }
}
@media (max-width: 768px) {
    .kanban-board { grid-template-columns: 1fr; }
    .hover-tooltip {
        width: min(max-content, calc(100vw - 24px));
        min-width: 0;
        max-width: calc(100vw - 24px);
    }
    .hover-tooltip-anchor:hover .hover-tooltip,
    .hover-tooltip-anchor:focus-within .hover-tooltip {
        transform: var(--tt-transform-visible, translateX(-50%) translateY(0));
    }
    .hover-tooltip-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    .preferenze-tooltip {
        left: 10px;
        right: 10px;
        transform: none;
        min-width: auto;
    }
    .feedback-toast-container {
        top: auto;
        right: 12px;
        bottom: 12px;
        left: 12px;
        max-width: none;
    }
    .feedback-toast {
        min-width: 0;
    }
}

/* ==========================================
   CALENDARIO DASHBOARD
   ========================================== */
.calendar-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f2f5;
}
.calendar-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
    white-space: nowrap;
}
.calendar-filters {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.filter-checkbox {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.2s;
}
.filter-checkbox:hover {
    background: #e9ecef;
}
.filter-checkbox input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    accent-color: #667eea;
}
#dashboardCalendar {
    min-height: 400px;
}
#dashboardCalendar .fc-toolbar-title {
    font-size: 18px;
    color: #333;
}
#dashboardCalendar .fc-button-primary {
    background: #667eea;
    border-color: #667eea;
    font-size: 13px;
    padding: 4px 12px;
}
#dashboardCalendar .fc-button-primary:hover {
    background: #5a6fd8;
    border-color: #5a6fd8;
}
#dashboardCalendar .fc-button-primary:not(:disabled).fc-button-active {
    background: #5a6fd8;
    border-color: #5a6fd8;
}
#dashboardCalendar .fc-daygrid-day-number {
    font-size: 13px;
    color: #555;
    padding: 4px 6px;
}
#dashboardCalendar .fc-daygrid-day-frame {
    min-height: 80px;
}
#dashboardCalendar .fc-day-today {
    background: #f0f4ff !important;
}
#dashboardCalendar .fc-event {
    padding: 2px 4px;
    font-size: 11px;
    border-radius: 4px;
    margin-bottom: 1px;
    cursor: pointer;
    transition: transform 0.1s;
}
#dashboardCalendar .fc-event:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
}
#dashboardCalendar .fc-more-link {
    font-size: 11px;
    color: #667eea;
    font-weight: 500;
}

/* Legenda calendario */
.calendar-legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f2f5;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
}
.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* ===== GIALLA TABS (Urgenze / Programmazioni) ===== */
.gialla-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}
.gialla-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gialla-tab:hover { color: #333; background: #f8f9fa; }
.gialla-tab.active { color: #333; border-bottom-color: #667eea; font-weight: 600; }
.gialla-tab .badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #dee2e6;
    color: #333;
}

.batteria-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}
.batteria-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.batteria-tab:hover { color: #333; background: #f8f9fa; }
.batteria-tab.active { color: #333; border-bottom-color: #e83e8c; font-weight: 600; }
.batteria-tab .badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #dee2e6;
    color: #333;
}

.oli-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}
.oli-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.oli-tab:hover { color: #333; background: #f8f9fa; }
.oli-tab.active { color: #333; border-bottom-color: #fd7e14; font-weight: 600; }
.oli-tab .badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #dee2e6;
    color: #333;
}

.oli-commerciale-subtab {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: #666;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.oli-commerciale-subtab:hover { color: #333; background: #f8f9fa; }
.oli-commerciale-subtab.active { color: #856404; border-bottom-color: #ffc107; font-weight: 600; }

.cobat-fields {
    border: 2px solid #e83e8c;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #fff5f7;
}

/* Sub-folder indicator nella folder grid */
.sub-folder-indicator {
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

/* Filtri ritiri eseguiti */
.ritiri-filtri {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}
.ritiri-filtri .form-group {
    margin-bottom: 0;
}

/* Action buttons CER */
.cer-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #f0f2f5;
}

/* HP grouping in CER catalog */
.cer-hp-group {
    margin-bottom: 4px;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
}
.cer-hp-group .hp-list {
    margin-top: 2px;
    font-size: 11px;
    color: #666;
}

/* New messages banner in chat */
.new-msg-banner {
    position: sticky;
    bottom: 0;
    text-align: center;
    padding: 8px 16px;
    background: #667eea;
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    margin: 8px 16px;
    z-index: 5;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(102,126,234,0.4);
}
.new-msg-banner:hover {
    background: #5a6fd8;
}

/* Modal header migliorato */
.modal-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

/* Responsive calendario */
@media (max-width: 768px) {
    .calendar-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .calendar-filters {
        width: 100%;
    }
    #dashboardCalendar .fc-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    #dashboardCalendar .fc-toolbar-title {
        font-size: 15px;
    }
}

/* Correzione definitiva larghezza gruppi clienti dashboard */
#faseCardsContainer {
    min-width: 0;
}

#faseCardsContainer > .client-group-card {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

#faseCardsContainer .hover-tooltip-anchor {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

#faseCardsContainer .hover-tooltip-anchor * {
    min-width: 0;
}

#faseCardsContainer .hover-tooltip-anchor span {
    overflow-wrap: anywhere;
    word-break: break-word;
}
