/* Reset e Stili Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    font-size: 14px; /* Ridotto per migliore leggibilità */
    /* iOS optimizations */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Safe area support for iPhone X+ */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}



/* Sidebar */
.sidebar {
    width: 280px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 20px rgba(0,0,0,0.15);
    position: fixed;
    height: 100vh;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(255,255,255,0.1);
}

/* Desktop Sidebar Modern Design */
@media (min-width: 769px) {
    .sidebar {
        background: linear-gradient(180deg, #2d3748 0%, #1a202c 100%);
        border-right: 1px solid rgba(255,255,255,0.08);
        box-shadow: 4px 0 25px rgba(0,0,0,0.12);
    }
    
    .sidebar-header {
        padding: 1.5rem 1.25rem;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        background: rgba(255,255,255,0.02);
    }
    
    .sidebar-nav {
        padding: 0.75rem 0;
        flex: 1;
    }
    
    .nav-link {
        padding: 0.875rem 1.25rem;
        margin: 0.25rem 0.75rem;
        border-radius: 8px;
        transition: all 0.2s ease;
        font-weight: 500;
        font-size: 14px;
    }
    
    .nav-link:hover {
        background: rgba(255,255,255,0.08);
        transform: translateX(2px);
    }
    
    .nav-link.active {
        background: rgba(99, 102, 241, 0.15);
        border-left: 3px solid #6366f1;
    }
    
    /* Dark Mode Toggle - Desktop */
    .sidebar-section {
        padding: 1.25rem;
        margin: 1rem 0.75rem;
        background: rgba(255,255,255,0.03);
        border-radius: 10px;
        border: 1px solid rgba(255,255,255,0.06);
    }
    
    .dark-mode-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 0;
    }
    
    .dark-mode-toggle .toggle-label {
        font-size: 13px;
        font-weight: 500;
        color: rgba(255,255,255,0.9);
    }
    
    .toggle-switch {
        position: relative;
        width: 48px;
        height: 24px;
    }
    
    .toggle-slider {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
        border-radius: 12px;
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transition: 0.3s;
    }
    
    .toggle-slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background: white;
        border-radius: 50%;
        transition: 0.3s;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    input:checked + .toggle-slider {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(24px);
    }
    
    /* Logout Button - Desktop */
    .sidebar-footer {
        padding: 1.25rem;
        margin: 0.75rem;
        border-radius: 10px;
        background: rgba(239, 68, 68, 0.1);
        border: 1px solid rgba(239, 68, 68, 0.2);
    }
    
    .logout-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
        border-radius: 6px;
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        color: white;
        text-decoration: none;
        font-weight: 500;
        font-size: 14px;
        transition: all 0.2s ease;
        box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
    }
    
    .logout-btn:hover {
        background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    }
    
    .logout-icon {
        margin-right: 8px;
        font-size: 16px;
    }
}

/* Mobile Sidebar - stile meetinghelper.org */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 240px !important;
        max-width: 80vw !important;
        padding: 12px !important;
        border-radius: 0 !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
        height: 100vh;
        transform: translateX(-100%);
        background: #1f2937 !important;
        border: none !important;
        z-index: 1001;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    /* Mobile Overlay - stile meetinghelper.org */
    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,.35) !important;
        backdrop-filter: blur(8px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    /* Dark Mode Toggle Styles */
    .sidebar-section {
        padding: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: auto;
    }
    
    .dark-mode-toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        border-radius: 6px;
        background: rgba(255,255,255,0.05);
        transition: background-color 0.2s ease;
        margin: 8px 4px;
    }
    
    .dark-mode-toggle:hover {
        background: rgba(255,255,255,0.1);
    }
    
    /* Desktop: sposta dark mode più in alto */
    @media (min-width: 769px) {
        .sidebar-section {
            margin-top: 2rem;
            padding-top: 0;
            border-top: none;
        }
        
        .dark-mode-toggle {
            margin-bottom: 2rem;
            margin-top: 1rem;
        }
    }
    
    .toggle-switch {
        position: relative;
        display: inline-block;
        width: 50px;
        height: 26px;
    }
    
    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }
    
    .toggle-slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        transition: 0.3s;
        border-radius: 26px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 6px;
    }
    
    .toggle-slider:before {
        position: absolute;
        content: "";
        height: 20px;
        width: 20px;
        left: 3px;
        bottom: 3px;
        background: white;
        transition: 0.3s;
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    .toggle-icon {
        font-size: 12px;
        z-index: 1;
        transition: opacity 0.3s;
    }
    
    .toggle-slider .toggle-icon:first-child {
        opacity: 1;
    }
    
    .toggle-slider .toggle-icon:last-child {
        opacity: 0.3;
    }
    
    input:checked + .toggle-slider {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    }
    
    input:checked + .toggle-slider:before {
        transform: translateX(24px);
    }
    
    input:checked + .toggle-slider .toggle-icon:first-child {
        opacity: 0.3;
    }
    
    input:checked + .toggle-slider .toggle-icon:last-child {
        opacity: 1;
    }
    
    .toggle-label {
        font-size: 14px;
        font-weight: 500;
        color: rgba(255,255,255,0.9);
    }
    
    /* Footer con logout migliorato */
    .sidebar-footer {
        padding: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: auto;
    }
    
    .logout-btn {
        display: flex !important;
        width: 100% !important;
        background: #dc2626 !important;
        color: #ffffff !important;
        border-radius: 6px !important;
        padding: 10px 12px !important;
        justify-content: center !important;
        align-items: center !important;
        margin-top: auto !important;
        text-decoration: none !important;
        transition: background-color 0.2s ease !important;
        font-weight: 500 !important;
        font-size: 15px !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .logout-btn:hover {
        background: #b91c1c !important;
    }
    
    /* Desktop: logout più elegante */
    @media (min-width: 769px) {
        .sidebar-footer {
            padding: 1.5rem 1rem;
            border-top: 1px solid rgba(255,255,255,0.1);
        }
        
        .logout-btn {
            padding: 14px 20px;
            font-size: 15px;
            border-radius: 14px;
        }
    }
    
    /* Dark Mode Styles */
    body.dark-mode {
        background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
        color: #e2e8f0;
    }
    
    body.dark-mode .main-content {
        background: linear-gradient(135deg, #1a1a2e 0%, #0f0f1e 100%);
        color: #e2e8f0;
    }
    
    body.dark-mode .sidebar {
        background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
        border-color: rgba(255,255,255,0.1);
    }
    
    body.dark-mode .card {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        border-color: rgba(255,255,255,0.1);
        box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    }
    
    body.dark-mode .btn-primary {
        background: linear-gradient(135deg, #4c1d95 0%, #5b21b6 100%);
        border-color: #5b21b6;
    }
    
    body.dark-mode .btn-secondary {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        border-color: #4b5563;
        color: #e2e8f0;
    }
    
    body.dark-mode .form-control {
        background: rgba(255,255,255,0.05);
        border-color: rgba(255,255,255,0.1);
        color: #e2e8f0;
    }
    
    body.dark-mode .form-control:focus {
        background: rgba(255,255,255,0.08);
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
    }
    
    body.dark-mode .modal-content {
        background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
        color: #e2e8f0;
    }
    
    body.dark-mode .table {
        background: transparent;
    }
    
    body.dark-mode .table th {
        background: rgba(255,255,255,0.05);
        color: #e2e8f0;
        border-color: rgba(255,255,255,0.1);
    }
    
    body.dark-mode .table td {
        border-color: rgba(255,255,255,0.05);
        color: #e2e8f0;
    }
    
    body.dark-mode .table tr:hover {
        background: rgba(255,255,255,0.02);
    }
    
    body.dark-mode h1,
    body.dark-mode h2,
    body.dark-mode h3,
    body.dark-mode h4,
    body.dark-mode h5,
    body.dark-mode h6 {
        color: #f1f5f9;
    }
    
    body.dark-mode .text-muted {
        color: #94a3b8 !important;
    }
    
    /* Header compatto */
    .sidebar-header {
        padding: 1.2rem 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    .logo {
        font-size: 1.1rem;
        font-weight: 700;
    }
    
    .logo-text {
        font-size: 0.85rem;
        opacity: 0.9;
    }
    
    /* Navigation compatta */
    .sidebar-nav {
        padding: 0.5rem 0;
    }
    
    .nav-link {
        height: 40px !important;
        padding: 8px 12px !important;
        gap: 10px !important;
        font-size: 15px !important;
        margin: 2px 4px !important;
        border-radius: 6px !important;
        transition: background-color 0.2s ease !important;
        display: flex;
        align-items: center;
        color: #ffffff !important;
        text-decoration: none !important;
    }
    
    .nav-link:hover {
        background-color: rgba(255,255,255,0.1) !important;
    }
    
    .nav-icon {
        width: 18px !important;
        height: 18px !important;
        font-size: 18px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        color: #ffffff !important;
    }
    
    .nav-text {
        font-size: 16px;
        font-weight: 500;
        line-height: 1.3;
    }
    
    /* Logout fisso in basso */
    .sidebar-footer {
        padding: 1rem;
        border-top: 1px solid rgba(255,255,255,0.1);
        margin-top: auto;
        position: sticky;
        bottom: 0;
        background: linear-gradient(135deg, rgba(220, 53, 69, 0.9) 0%, rgba(142, 68, 173, 0.9) 100%);
        backdrop-filter: blur(10px);
    }
    
    .logout-btn {
        width: 100%;
        padding: 0.8rem 1rem;
        background: linear-gradient(135deg, #dc3545 0%, #8e44ad 100%);
        color: white;
        border: none;
        border-radius: 12px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.8rem;
        min-height: 44px;
        box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    }
    
    .logout-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
        background: linear-gradient(135deg, #c82333 0%, #7d3c98 100%);
    }
    
    .logout-btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
    }
    
    /* Pulsante chiudi più piccolo */
    .sidebar-close {
        position: absolute;
        top: 1rem;
        right: 1rem;
        width: 44px !important;
        height: 44px !important;
        font-size: 22px !important;
        background: rgba(255,255,255,0.15);
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 8px;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 10;
    }
    
    .sidebar-close:hover {
        background: rgba(255,255,255,0.25);
        transform: scale(1.05);
    }
    
    .sidebar-close:active {
        transform: scale(0.95);
    }
    
    /* Classi aggiuntive per compatibilità */
    .sidebar a,
    .sidebar .menu-item {
        height: 40px !important;
        padding: 8px 12px !important;
        gap: 10px !important;
        font-size: 15px !important;
        color: #ffffff !important;
        text-decoration: none !important;
        margin: 2px 4px !important;
        border-radius: 6px !important;
        transition: background-color 0.2s ease !important;
        display: flex;
        align-items: center;
    }
    
    .sidebar a:hover,
    .sidebar .menu-item:hover {
        background-color: rgba(255,255,255,0.1) !important;
    }
    
    .sidebar i,
    .sidebar svg,
    .sidebar .icon {
        width: 18px !important;
        height: 18px !important;
        font-size: 18px !important;
        color: #ffffff !important;
    }
    
    .mobile-overlay,
    .sidebar-overlay {
        background: rgba(0,0,0,0.3) !important;
    }
    
    .sidebar .logout,
    .logout-btn,
    a[href*="logout"] {
        display: flex !important;
        width: 100% !important;
        background: #dc2626 !important;
        color: #ffffff !important;
        border-radius: 6px !important;
        padding: 10px 12px !important;
        justify-content: center !important;
        align-items: center !important;
        margin-top: auto !important;
        text-decoration: none !important;
        transition: background-color 0.2s ease !important;
        font-weight: 500 !important;
        font-size: 15px !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    .sidebar .logout:hover,
    .logout-btn:hover,
    a[href*="logout"]:hover {
        background: #b91c1c !important;
    }
    
    .close-sidebar,
    .mobile-close,
    .hamburger-close {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
        background: rgba(255,255,255,0.1) !important;
        border-radius: 6px !important;
        color: #ffffff !important;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background-color 0.2s ease !important;
    }
    
    .close-sidebar:hover,
    .mobile-close:hover,
    .hamburger-close:hover {
        background: rgba(255,255,255,0.2) !important;
    }
}

/* Desktop - Collapsed State */
@media (min-width: 768px) {
    .sidebar.collapsed {
        width: 80px;
    }
    
    .sidebar.collapsed .logo-text {
        opacity: 0;
        visibility: hidden;
    }
    
    .sidebar.collapsed .nav-text {
        opacity: 0;
        visibility: hidden;
    }
    
    .sidebar.collapsed .nav-link {
        justify-content: center;
    }
    
    .sidebar.collapsed .nav-icon {
        margin-right: 0;
    }
}

/* Tooltip styles for collapsed sidebar */
.nav-link[data-tooltip] {
    position: relative;
}

.nav-link[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    margin-left: 0.5rem;
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.sidebar.collapsed .nav-link[data-tooltip]:hover::after {
    opacity: 1;
}

/* Hide tooltips when sidebar is not collapsed */
.sidebar:not(.collapsed) .nav-link[data-tooltip]:hover::after {
    display: none;
}

/* Mobile tooltip improvements */
@media (max-width: 768px) {
    .nav-link[data-tooltip]:hover::after {
        left: 100%;
        top: 50%;
        transform: translateY(-50%);
        margin-left: 0.3rem;
        background: #1f2937;
        color: white;
        padding: 0.4rem 0.6rem;
        border-radius: 4px;
        font-size: 0.75rem;
        font-weight: 500;
        white-space: nowrap;
        z-index: 1000;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.2s ease;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
        max-width: 120px;
        text-align: center;
        line-height: 1.2;
    }
    
    /* Always show tooltips on mobile when sidebar is in any state */
    .sidebar .nav-link[data-tooltip]:hover::after {
        opacity: 1;
        display: block;
    }
    
    /* Adjust tooltip position for better mobile visibility */
    .nav-link[data-tooltip]:hover::after {
        left: auto;
        right: -10px;
        top: -40px;
        transform: none;
        margin-left: 0;
        margin-top: 0;
    }
    
    /* Arrow pointing to the icon */
    .nav-link[data-tooltip]:hover::before {
        content: '';
        position: absolute;
        left: auto;
        right: 5px;
        top: -8px;
        transform: none;
        width: 0;
        height: 0;
        border-left: 5px solid transparent;
        border-right: 5px solid transparent;
        border-top: 5px solid #1f2937;
        z-index: 1000;
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    .sidebar .nav-link[data-tooltip]:hover::before {
        opacity: 1;
        display: block;
    }
}

@media (max-width: 480px) {
    .nav-link[data-tooltip]:hover::after {
        font-size: 0.7rem;
        padding: 0.35rem 0.5rem;
        max-width: 100px;
        right: -15px;
        top: -35px;
    }
    
    .nav-link[data-tooltip]:hover::before {
        right: 3px;
        top: -6px;
        border-left-width: 4px;
        border-right-width: 4px;
        border-top-width: 4px;
    }
}

@media (max-width: 360px) {
    .nav-link[data-tooltip]:hover::after {
        font-size: 0.65rem;
        padding: 0.3rem 0.4rem;
        max-width: 90px;
        right: -20px;
        top: -30px;
    }
    
    .nav-link[data-tooltip]:hover::before {
        right: 2px;
        top: -4px;
        border-left-width: 3px;
        border-right-width: 3px;
        border-top-width: 3px;
    }
}


.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.logo-text {
    transition: all 0.3s ease;
}

.logo-text h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.logo-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
    border-left-color: rgba(255,255,255,0.3);
}

.nav-link.active {
    background-color: rgba(255,255,255,0.15);
    color: white;
    border-left-color: white;
}

.nav-icon {
    font-size: 1.2rem;
    width: 1.5rem;
    text-align: center;
    flex-shrink: 0;
    margin-right: 1rem;
    transition: all 0.3s ease;
}

.nav-text {
    flex: 1;
    transition: all 0.3s ease;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: rgba(255,255,255,0.1);
    border-radius: 8px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-icon {
    font-size: 1.2rem;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.7rem;
}

.role-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin {
    background-color: #ff6b6b;
    color: white;
}

.badge-proclamatore {
    background-color: #51cf66;
    color: white;
}

.badge-servitore {
    background-color: #ffc107;
    color: #212529;
}

.badge-anziano {
    background-color: #17a2b8;
    color: white;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
    width: 100%;
    justify-content: center;
    min-height: 44px;
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.logout-icon {
    font-size: 1rem;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 280px;
    background-color: #f8f9fa;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Desktop - Collapsed State */
@media (min-width: 768px) {
    .sidebar.collapsed + .main-content {
        margin-left: 80px;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 8px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.mobile-menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background: white;
    margin: 3px auto;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile - Sidebar Hidden */
@media (max-width: 767px) {
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1001;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
}

.content-wrapper {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.page-header h1 {
    font-size: 2rem;
    color: #333;
    font-weight: 700;
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.card-title {
    font-size: 1.5rem;
    color: #333;
    font-weight: 600;
}

/* Buttons - Design iOS/SaaS Moderno */
.btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 44px; /* Touch-friendly */
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Mobile Button Optimizations - più armoniosi */
@media (max-width: 768px) {
    .btn {
        padding: 0.9rem 1.1rem;
        font-size: 0.9rem;
        font-weight: 600;
        border-radius: 12px;
        min-height: 44px;
        letter-spacing: 0.2px;
        box-shadow: 0 2px 10px rgba(0,0,0,0.08);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 15px rgba(0,0,0,0.12);
    }
    
    .btn:active {
        transform: translateY(0);
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    /* Cards più compatte */
    .card {
        margin: 0.8rem;
        padding: 1.2rem;
        border-radius: 16px;
        box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    }
    
    .card-header {
        padding: 0 0 1rem 0;
        margin-bottom: 1rem;
    }
    
    .card-title {
        font-size: 1.2rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    /* Spaziatura verticale ridotta */
    .container-fluid {
        padding: 0.5rem;
    }
    
    .row {
        margin: -0.4rem;
    }
    
    .col, [class*="col-"] {
        padding: 0.4rem;
    }
    
    /* Form più compatti */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
        border-radius: 10px;
        min-height: 44px;
    }
    
    .form-label {
        font-size: 0.85rem;
        font-weight: 600;
        margin-bottom: 0.4rem;
    }
    
    /* Modal più compatti */
    .modal-content {
        margin: 1rem;
        border-radius: 20px;
        box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    }
    
    .modal-header {
        padding: 1.5rem 1.5rem 1rem 1.5rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }
    
    .modal-body {
        padding: 1rem 1.5rem;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem 1.5rem 1.5rem;
        border-top: 1px solid rgba(0,0,0,0.05);
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-height: 44px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

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

.btn-success:hover {
    background-color: #218838;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #333;
}

/* Password input group with toggle button */
.password-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-input-group .form-control {
    flex: 1;
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.btn-toggle-password {
    background: #f3f4f6;
    border: 2px solid #ddd;
    border-left: none;
    border-radius: 0 8px 8px 0;
    padding: 0.875rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 42px;
}

.btn-toggle-password:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.btn-toggle-password:active {
    background: #d1d5db;
    transform: translateY(1px);
}

.form-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
    display: block;
}

.form-control {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    min-height: 44px;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    font-size: 0.9rem;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 2rem;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.8rem;
    color: #333;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 2rem;
    border-top: 2px solid #e9ecef;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Dashboard Cards */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.05);
    backdrop-filter: blur(10px);
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}

.dashboard-card-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.dashboard-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
    letter-spacing: 0.25px;
}

.dashboard-card-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #667eea;
    line-height: 1.2;
}

/* Mobile Dashboard Optimizations */
@media (max-width: 768px) {
    .dashboard-card {
        padding: 1rem;
        border-radius: 12px;
    }
    
    .dashboard-card-icon {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .dashboard-card-title {
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .dashboard-card-value {
        font-size: 1.4rem;
        font-weight: 700;
    }
}

/* Actions Bar */
.actions-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.actions-bar .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #666;
    font-size: 1.1rem;
}

/* Actions */
.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Filters */
.filters {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.filter-group .form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.8rem;
    color: #6c757d;
}

.form-text a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.form-text a:hover {
    color: #5a6fd8;
    text-decoration: underline;
}

.filter-group .form-control {
    margin-bottom: 0;
}

/* Footer */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content p {
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }
    
    .sidebar-header {
        padding: 1rem 0.5rem;
        text-align: center;
    }
    
    .logo {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .logo-text h3,
    .logo-text p {
        display: none;
    }
    
    .nav-text {
        display: inline;
        font-size: 14px;
    }
    
    .nav-link {
        justify-content: flex-start;
        padding: 1rem 1rem;
        display: flex;
        align-items: center;
        gap: 12px;
    }
    
    .nav-icon {
        font-size: 1.5rem;
        width: auto;
    }
    
    .sidebar-footer {
        padding: 0.8rem;
        position: sticky;
        bottom: 0;
        background: rgba(102, 126, 234, 0.95);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255,255,255,0.1);
    }
    
    .user-profile {
        margin-bottom: 0.6rem;
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .user-avatar {
        width: 30px;
        height: 30px;
    }
    
    .avatar-icon {
        font-size: 0.9rem;
    }
    
    .user-name {
        font-size: 0.7rem;
    }
    
    .user-role {
        font-size: 0.65rem;
    }
    
    .role-badge {
        font-size: 0.55rem;
        padding: 0.15rem 0.3rem;
    }
    
    .logout-btn {
        padding: 0.5rem 0.6rem;
        min-height: 48px;
        font-weight: 600;
        gap: 0.4rem;
    }
    
    .logout-icon {
        font-size: 0.8rem;
    }
    
    .logout-text {
        font-size: 0.75rem;
    }
    
    .logout-text {
        display: none;
    }
    
    .logout-btn {
        justify-content: center;
        padding: 0.5rem;
    }
    
    .main-content {
        margin-left: 70px;
    }
    
    .content-wrapper {
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 12px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1.5rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .actions {
        flex-direction: column;
    }
    
    .table {
        font-size: 1rem;
    }
    
    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 60px;
    }
    
    .logo-icon {
        font-size: 1.5rem;
    }
    
    .nav-icon {
        font-size: 1.2rem;
    }
    
    .main-content {
        margin-left: 60px;
    }
    
    .content-wrapper {
        padding: 0.75rem;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .btn {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .modal-content {
        width: 98%;
        max-height: 95vh;
        overflow-y: auto;
        border-radius: 12px;
    }
}

/* Extra small screens (< 400px) */
@media (max-width: 400px) {
    .sidebar {
        width: 45px;
    }
    
    .logo-icon {
        font-size: 1.1rem;
    }
    
    .nav-icon {
        font-size: 0.9rem;
    }
    
    .main-content {
        margin-left: 45px;
    }
    
    .content-wrapper {
        padding: 0.4rem;
    }
    
    .page-header h1 {
        font-size: 1.4rem;
        line-height: 1.3;
    }
    
    .btn {
        font-size: 0.95rem;
        padding: 0.8rem 1rem;
        min-height: 48px;
        border-radius: 6px;
        font-weight: 600;
    }
    
    .card {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
        border-radius: 8px;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.8rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .dashboard-card {
        padding: 0.8rem;
    }
    
    .dashboard-card-icon {
        font-size: 1.3rem;
    }
    
    .dashboard-card-title {
        font-size: 0.8rem;
        font-weight: 600;
    }
    
    .dashboard-card-value {
        font-size: 1.1rem;
        font-weight: 700;
    }
    
    .sidebar-footer {
        padding: 0.6rem;
    }
    
    .user-profile {
        gap: 0.4rem;
        padding: 0.4rem;
        margin-bottom: 0.5rem;
    }
    
    .user-avatar {
        width: 28px;
        height: 28px;
    }
    
    .avatar-icon {
        font-size: 0.8rem;
    }
    
    .user-name {
        font-size: 0.65rem;
        line-height: 1.2;
    }
    
    .user-role {
        font-size: 0.6rem;
    }
    
    .role-badge {
        font-size: 0.5rem;
        padding: 0.1rem 0.25rem;
    }
    
    .logout-btn {
        padding: 0.4rem 0.5rem;
        min-height: 44px;
        gap: 0.3rem;
    }
    
    .logout-icon {
        font-size: 0.75rem;
    }
    
    .logout-text {
        font-size: 0.7rem;
    }
}

/* Ultra small screens (< 360px) - iPhone SE, small Android phones */
@media (max-width: 360px) {
    .sidebar {
        width: 40px;
    }
    
    .logo-icon {
        font-size: 1rem;
    }
    
    .nav-icon {
        font-size: 0.8rem;
    }
    
    .main-content {
        margin-left: 40px;
    }
    
    .content-wrapper {
        padding: 0.3rem;
    }
    
    .page-header h1 {
        font-size: 1.2rem;
        line-height: 1.2;
        margin-bottom: 0.5rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.7rem 0.8rem;
        min-height: 44px;
        border-radius: 6px;
        font-weight: 600;
        width: 100%;
    }
    
    .card {
        padding: 0.6rem;
        margin-bottom: 0.6rem;
        border-radius: 6px;
    }
    
    .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 0.6rem;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .dashboard-card {
        padding: 0.6rem;
    }
    
    .dashboard-card-icon {
        font-size: 1.2rem;
    }
    
    .dashboard-card-title {
        font-size: 0.75rem;
        font-weight: 600;
    }
    
    .dashboard-card-value {
        font-size: 1rem;
        font-weight: 700;
    }
    
    .sidebar-footer {
        padding: 0.5rem;
    }
    
    .user-profile {
        gap: 0.3rem;
        padding: 0.3rem;
        margin-bottom: 0.4rem;
    }
    
    .user-avatar {
        width: 25px;
        height: 25px;
    }
    
    .avatar-icon {
        font-size: 0.7rem;
    }
    
    .user-name {
        font-size: 0.6rem;
        line-height: 1.1;
    }
    
    .user-role {
        font-size: 0.55rem;
    }
    
    .role-badge {
        font-size: 0.45rem;
        padding: 0.08rem 0.2rem;
    }
    
    .logout-btn {
        padding: 0.35rem 0.4rem;
        min-height: 40px;
        gap: 0.25rem;
    }
    
    .logout-icon {
        font-size: 0.7rem;
    }
    
    .logout-text {
        font-size: 0.65rem;
    }
}

/* Form optimizations for mobile */
@media (max-width: 480px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 14px;
        min-height: 48px;
        border-radius: 6px;
        border: 2px solid #e2e8f0;
        transition: all 0.3s ease;
        font-weight: 500;
    }
}

@media (max-width: 360px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="date"],
    input[type="time"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 8px 12px;
        min-height: 44px;
        border-radius: 6px;
        border: 2px solid #e2e8f0;
        transition: all 0.3s ease;
        font-weight: 500;
    }
}

/* Form focus states */
@media (max-width: 480px) {
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    input[type="date"]:focus,
    input[type="time"]:focus,
    input[type="number"]:focus,
    select:focus,
    textarea:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        outline: none;
    }
    
    .form-group {
        margin-bottom: 1.2rem;
    }
    
    .form-label {
        display: block;
        margin-bottom: 0.4rem;
        font-weight: 600;
        color: #374151;
        font-size: 0.85rem;
    }
    
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 0.8rem;
    }
    
    @media (min-width: 768px) {
        .form-row {
            flex-direction: row;
            gap: 1rem;
        }
        
        .form-row .form-group {
            flex: 1;
        }
    }
}

@media (max-width: 360px) {
    input[type="text"]:focus,
    input[type="email"]:focus,
    input[type="password"]:focus,
    input[type="date"]:focus,
    input[type="time"]:focus,
    input[type="number"]:focus,
    select:focus,
    textarea:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
        outline: none;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-label {
        display: block;
        margin-bottom: 0.3rem;
        font-weight: 600;
        color: #374151;
        font-size: 0.8rem;
    }
    
    .form-row {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
    }
}

/* Mobile card styles for users and families */
.utenti-list, .famiglie-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.utente-card, .famiglia-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.utente-card:hover, .famiglia-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.utente-header, .famiglia-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.utente-nome, .famiglia-nome {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.utente-details, .famiglia-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-icon {
    font-size: 0.9rem;
    width: 20px;
    text-align: center;
}

.detail-text {
    font-size: 0.85rem;
    color: #6b7280;
    line-height: 1.3;
}

.utente-actions, .famiglia-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.utente-actions .btn-sm, .famiglia-actions .btn-sm {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    min-width: 36px;
    min-height: 36px;
}

/* Responsive visibility */
.desktop-view {
    display: block;
}

.mobile-view {
    display: none;
}

@media (max-width: 768px) {
    .desktop-view {
        display: none;
    }
    
    .mobile-view {
        display: block;
    }
    
    .utente-card, .famiglia-card {
        padding: 0.8rem;
        border-radius: 6px;
    }
    
    .utente-header, .famiglia-header {
        margin-bottom: 0.6rem;
        padding-bottom: 0.4rem;
    }
    
    .utente-nome, .famiglia-nome {
        font-size: 0.9rem;
    }
    
    .utente-details, .famiglia-details {
        margin-bottom: 0.6rem;
        gap: 0.4rem;
    }
    
    .detail-text {
        font-size: 0.8rem;
    }
    
    .utente-actions .btn-sm, .famiglia-actions .btn-sm {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
        min-width: 32px;
        min-height: 32px;
    }
}

@media (max-width: 480px) {
    .utente-card, .famiglia-card {
        padding: 0.6rem;
        border-radius: 6px;
    }
    
    .utente-header, .famiglia-header {
        margin-bottom: 0.5rem;
        padding-bottom: 0.3rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .utente-nome, .famiglia-nome {
        font-size: 0.85rem;
    }
    
    .utente-details, .famiglia-details {
        margin-bottom: 0.5rem;
        gap: 0.3rem;
    }
    
    .detail-text {
        font-size: 0.75rem;
    }
    
    .utente-actions .btn-sm, .famiglia-actions .btn-sm {
        padding: 0.3rem 0.4rem;
        font-size: 0.7rem;
        min-width: 30px;
        min-height: 30px;
    }
}

@media (max-width: 360px) {
    .utente-card, .famiglia-card {
        padding: 0.5rem;
        border-radius: 4px;
    }
    
    .utente-header, .famiglia-header {
        margin-bottom: 0.4rem;
        padding-bottom: 0.25rem;
    }
    
    .utente-nome, .famiglia-nome {
        font-size: 0.8rem;
    }
    
    .utente-details, .famiglia-details {
        margin-bottom: 0.4rem;
        gap: 0.25rem;
    }
    
    .detail-text {
        font-size: 0.7rem;
    }
    
    .utente-actions .btn-sm, .famiglia-actions .btn-sm {
        padding: 0.25rem 0.35rem;
        font-size: 0.65rem;
        min-width: 28px;
        min-height: 28px;
    }
}

/* Table optimizations for mobile */
@media (max-width: 768px) {
    .table {
        font-size: 0.8rem;
        border-collapse: collapse;
        width: 100%;
    }
    
    .table th,
    .table td {
        padding: 0.6rem 0.4rem;
        text-align: left;
        border-bottom: 1px solid #e2e8f0;
        vertical-align: top;
    }
    
    .table th {
        background: #f8f9fa;
        font-weight: 600;
        color: #495057;
        white-space: nowrap;
        font-size: 0.75rem;
    }
    
    .user-info-mobile strong {
        font-size: 0.8rem;
        line-height: 1.2;
    }
    
    .user-details small {
        font-size: 0.65rem;
    }
    
    .actions-mobile .btn-sm {
        padding: 0.35rem 0.4rem;
        font-size: 0.65rem;
        min-width: 30px;
        min-height: 30px;
    }
    
    /* Additional mobile table optimizations */
    @media (max-width: 480px) {
        .table {
            font-size: 0.75rem;
        }
        
        .table th,
        .table td {
            padding: 0.5rem 0.3rem;
        }
        
        .table th {
            font-size: 0.7rem;
        }
        
        .user-info-mobile strong {
            font-size: 0.75rem;
        }
        
        .user-details small {
            font-size: 0.6rem;
        }
        
        .actions-mobile .btn-sm {
            padding: 0.3rem 0.35rem;
            font-size: 0.6rem;
            min-width: 28px;
            min-height: 28px;
        }
    }
    
    @media (max-width: 360px) {
        .table {
            font-size: 0.7rem;
        }
        
        .table th,
        .table td {
            padding: 0.4rem 0.25rem;
        }
        
        .table th {
            font-size: 0.65rem;
        }
        
        .user-info-mobile strong {
            font-size: 0.7rem;
        }
        
        .user-details small {
            font-size: 0.55rem;
        }
        
        .actions-mobile .btn-sm {
            padding: 0.25rem 0.3rem;
            font-size: 0.55rem;
            min-width: 26px;
            min-height: 26px;
        }
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
}

/* Card-based layout for tables on very small screens */
@media (max-width: 640px) {
    .table-responsive {
        border: none;
        box-shadow: none;
    }
    
    .table {
        display: none;
    }
    
    .table.mobile-cards {
        display: block;
    }
    
    .table.mobile-cards thead {
        display: none;
    }
    
    .table.mobile-cards tbody,
    .table.mobile-cards tr {
        display: block;
        width: 100%;
    }
    
    .table.mobile-cards tr {
        margin-bottom: 1rem;
        background: white;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        overflow: hidden;
    }
    
    .table.mobile-cards td {
        display: block;
        text-align: right;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding-left: 50%;
    }
    
    .table.mobile-cards td:before {
        content: attr(data-label);
        position: absolute;
        left: 1rem;
        width: 45%;
        text-align: left;
        font-weight: 600;
        color: #495057;
        white-space: nowrap;
    }
    
    .table.mobile-cards td:last-child {
        border-bottom: none;
    }
}

/* List optimizations for mobile */
@media (max-width: 768px) {
    .list-group {
        border-radius: 8px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    
    .list-group-item {
        padding: 1rem;
        border-bottom: 1px solid #e2e8f0;
        background: white;
        transition: background-color 0.3s ease;
    }
    
    .list-group-item:hover {
        background: #f8f9fa;
    }
    
    .list-group-item:last-child {
        border-bottom: none;
    }
}

@media (max-width: 640px) {
    .list-group-item {
        padding: 0.75rem;
    }
}

/* Action buttons in tables/lists */
.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    min-height: 36px;
}

@media (max-width: 640px) {
    .btn-sm {
        padding: 0.5rem;
        font-size: 0.8rem;
        min-height: 32px;
    }
    
    .btn-group .btn {
        margin-bottom: 0.25rem;
    }
}

/* Touch-friendly interactions */
.btn,
.nav-link,
.card,
.list-group-item,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea,
.modal-content {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Touch feedback */
.btn:active,
.nav-link:active,
.card:active,
.list-group-item:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Better touch targets - iOS compliant */
.btn-sm {
    min-width: 44px;
    min-height: 44px;
}

/* iOS Modal Optimizations */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    /* iOS optimizations */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.modal-content {
    background: white;
    border-radius: 16px; /* iOS style rounded corners */
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    /* iOS optimizations */
    -webkit-overflow-scrolling: touch;
    transform: translateZ(0); /* Hardware acceleration */
    will-change: transform;
}

/* Mobile Modal Optimizations */
@media (max-width: 768px) {
    .modal {
        padding: 20px;
        padding-top: calc(20px + env(safe-area-inset-top));
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }
    
    .modal-content {
        width: 100%;
        max-height: calc(100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
        border-radius: 20px; /* More rounded on mobile */
        margin: 0;
    }
    
    .modal-header {
        padding: 1.5rem;
        border-bottom: 1px solid #f0f0f0;
        display: flex;
        justify-content: space-between;
        align-items: center;
        /* iOS style */
        background: linear-gradient(to bottom, #ffffff, #fafafa);
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }
    
    .modal-header h3 {
        font-size: 1.1rem;
        font-weight: 600;
        color: #1d1d1f; /* iOS dark text */
    }
    
    .modal-body {
        padding: 1.5rem;
        max-height: 60vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem;
        border-top: 1px solid #f0f0f0;
        display: flex;
        gap: 0.75rem;
        /* iOS style */
        background: #fafafa;
        border-bottom-left-radius: 20px;
        border-bottom-right-radius: 20px;
        flex-wrap: wrap;
    }
    
    .modal-footer .btn {
        flex: 1;
        min-height: 50px; /* iOS touch target */
        font-size: 1rem;
        font-weight: 600;
        border-radius: 12px;
        /* iOS transitions */
        transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* iOS Form Optimizations */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #1d1d1f; /* iOS dark text */
    font-size: 0.95rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 1rem;
    border: 1px solid #d1d1d6; /* iOS light gray */
    border-radius: 12px; /* iOS rounded corners */
    font-size: 1rem;
    background: #ffffff;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    /* iOS optimizations */
    -webkit-appearance: none;
    appearance: none;
    -webkit-border-radius: 12px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007aff; /* iOS blue */
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1); /* iOS focus ring */
    transform: scale(1.02); /* Subtle iOS animation */
}

/* iOS Select Styling */
.form-group select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

/* iOS Toggle Switch */
.form-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 32px;
}

.form-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.form-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d1d6;
    transition: 0.3s;
    border-radius: 32px;
}

.form-slider:before {
    position: absolute;
    content: "";
    height: 24px;
    width: 24px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-switch input:checked + .form-slider {
    background-color: #007aff; /* iOS green */
}

.form-switch input:checked + .form-slider:before {
    transform: translateX(28px);
}

/* iOS Animations */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalSlideOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
}

@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* iOS Button Press Animation */
.btn:active {
    animation: buttonPress 0.1s ease-out;
}

/* iOS Card Hover Effects */
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* iOS Navigation Link Effects */
.nav-link:hover {
    background: rgba(255,255,255,0.1);
    transform: translateX(4px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* iOS Form Focus Effects */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    transform: scale(1.02);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* iOS Scroll Optimizations */
* {
    -webkit-overflow-scrolling: touch;
}

/* iOS Pull-to-refresh indicator */
.pull-to-refresh {
    position: fixed;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    z-index: 9998;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pull-to-refresh.active {
    transform: translateY(60px);
}

/* iOS Status Bar Safe Area */
.status-bar-safe-area {
    height: env(safe-area-inset-top);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* iOS Home Indicator Safe Area */
.home-indicator-safe-area {
    height: env(safe-area-inset-bottom);
    background: white;
}

/* iOS Loading Spinner */
.ios-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007aff;
    border-radius: 50%;
    animation: iosSpin 1s linear infinite;
}

@keyframes iosSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* iOS Alert Styling */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    font-weight: 500;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    animation: fadeInUp 0.3s ease-out;
}

.alert-success {
    background: linear-gradient(135deg, #34c759, #28a745);
    color: white;
}

.alert-error {
    background: linear-gradient(135deg, #ff3b30, #dc3545);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #007aff, #17a2b8);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #ff9500, #ffc107);
    color: #212529;
}

/* iOS Table Optimizations */
.table {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table th {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    font-weight: 600;
    color: #1d1d1f;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.table tr:hover {
    background: #f8f9fa;
    transition: background 0.2s ease;
}

/* iOS Card Optimizations */
.card {
    border-radius: 16px;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #ffffff, #fafafa);
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
    color: #1d1d1f;
}

/* iOS Badge Optimizations */
.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* iOS Progress Bar */
.progress {
    height: 8px;
    border-radius: 4px;
    background: #f0f0f0;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, #007aff, #5ac8fa);
    border-radius: 4px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link {
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
}

/* Swipe gestures for modals */
.modal-content {
    touch-action: pan-y;
}

/* Prevent horizontal scrolling on mobile */
body {
    overflow-x: hidden;
}

/* Better scrolling for touch devices */
.table-responsive,
.modal-body {
    -webkit-overflow-scrolling: touch;
}

/* Touch-friendly dropdowns */
select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

/* Touch-friendly checkboxes and radio buttons */
input[type="checkbox"],
input[type="radio"] {
    min-width: 24px;
    min-height: 24px;
    transform: scale(1.2);
}

/* Better spacing for touch */
@media (max-width: 768px) {
    .btn {
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        margin-bottom: 0;
    }
}

/* Ripple effect for touch feedback */
.btn,
.nav-link,
.card,
.list-group-item {
    position: relative;
    overflow: hidden;
}

.btn::after,
.nav-link::after,
.card::after,
.list-group-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    pointer-events: none;
}

.btn:active::after,
.nav-link:active::after,
.card:active::after,
.list-group-item:active::after {
    width: 300px;
    height: 300px;
}

/* Loading */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Text utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: #667eea; }
.text-success { color: #28a745; }
.text-danger { color: #dc3545; }
.text-warning { color: #ffc107; }
.text-muted { color: #6c757d; }

/* Spacing utilities */
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Professional unified main UI refresh */
:root {
    --ui-bg: #f8fafc;
    --ui-surface: #ffffff;
    --ui-border: #e5e7eb;
    --ui-text: #111827;
    --ui-muted: #6b7280;
    --ui-primary: #2563eb;
    --ui-primary-2: #4f46e5;
    --ui-success: #047857;
    --ui-warning: #c2410c;
    --ui-danger: #b91c1c;
    --ui-info: #1d4ed8;
    --ui-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    --ui-shadow-hover: 0 22px 48px rgba(15, 23, 42, 0.12);
}

body.logged-in {
    background: var(--ui-bg);
    color: var(--ui-text);
}

.main-content {
    background: var(--ui-bg);
}

.content-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 22px 44px;
}

.page-header {
    background: radial-gradient(circle at top left, rgba(59, 130, 246, 0.28), transparent 35%), linear-gradient(135deg, #111827 0%, #1e3a8a 55%, #312e81 100%);
    color: #ffffff;
    padding: 30px 34px;
    border-radius: 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.18);
}

.page-header h1 {
    margin: 0;
    color: #ffffff;
    font-size: clamp(1.8rem, 3vw, 2.7rem);
    font-weight: 800;
    letter-spacing: -0.04em;
}

.card {
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: 22px;
    box-shadow: var(--ui-shadow);
    overflow: hidden;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: #c7d2fe;
    box-shadow: var(--ui-shadow-hover);
}

.card-header {
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    border-bottom: 1px solid var(--ui-border);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.card-title {
    margin: 0;
    color: var(--ui-text);
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.card-body {
    padding: 20px;
}

.btn {
    border: 1px solid transparent;
    border-radius: 12px;
    font-weight: 700;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(135deg, var(--ui-primary), var(--ui-primary-2));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
}

.btn-primary:hover {
    box-shadow: 0 16px 32px rgba(37, 99, 235, 0.28);
}

.btn-success {
    background: #ecfdf5;
    color: var(--ui-success);
    border-color: #a7f3d0;
}

.btn-success:hover {
    background: #d1fae5;
}

.btn-warning {
    background: #fff7ed;
    color: var(--ui-warning);
    border-color: #fed7aa;
}

.btn-warning:hover {
    background: #ffedd5;
}

.btn-danger {
    background: #fef2f2;
    color: var(--ui-danger);
    border-color: #fecaca;
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-info,
.btn-secondary {
    background: #eff6ff;
    color: var(--ui-info);
    border-color: #bfdbfe;
}

.btn-info:hover,
.btn-secondary:hover {
    background: #dbeafe;
}

.btn-sm {
    padding: 8px 11px;
    font-size: 0.82rem;
    border-radius: 10px;
}

.btn-full {
    width: 100%;
}

.table-responsive {
    border: 1px solid var(--ui-border);
    border-radius: 16px;
    overflow: auto;
    background: #ffffff;
}

.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
}

.table thead th {
    background: #f8fafc;
    color: #374151;
    font-weight: 800;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--ui-border);
    padding: 13px 14px;
}

.table tbody td {
    color: #374151;
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table tbody tr:hover td {
    background: #f8fafc;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.filters {
    background: #ffffff;
    border: 1px solid var(--ui-border);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.form-group label {
    color: #374151;
    font-weight: 800;
    margin-bottom: 7px;
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
    border: 1px solid #d1d5db;
    border-radius: 12px;
    padding: 11px 12px;
    background: #ffffff;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--ui-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: #ffffff;
    border: 1px solid var(--ui-border);
    border-radius: 22px;
    box-shadow: var(--ui-shadow);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.dashboard-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(135deg, var(--ui-primary), var(--ui-primary-2));
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ui-shadow-hover);
    border-color: #c7d2fe;
}

.dashboard-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #eef2ff;
    color: #3730a3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.dashboard-card-title {
    color: var(--ui-muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dashboard-card-value {
    color: var(--ui-text);
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
    margin-top: 7px;
}

.dashboard-card-subtitle {
    color: var(--ui-muted);
    font-size: 0.84rem;
    margin-top: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.76rem;
    font-weight: 800;
}

.badge-info {
    background: #e0e7ff;
    color: #3730a3;
}

.modal-content {
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
}

.modal-header {
    background: linear-gradient(135deg, #111827 0%, #1e3a8a 100%);
    color: #ffffff;
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 14px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 24px;
        border-radius: 20px;
    }

    .card-header {
        align-items: stretch;
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-ops-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.dashboard-ops-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 16px;
}

.dashboard-ops-card h4 {
    color: #111827;
    font-size: 0.98rem;
    font-weight: 900;
    margin: 0 0 12px;
}

.dashboard-ops-item {
    border-bottom: 1px solid #e5e7eb;
    display: grid;
    gap: 3px;
    padding: 10px 0;
}

.dashboard-ops-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dashboard-ops-item strong {
    color: #111827;
    font-weight: 800;
}

.dashboard-ops-item span {
    color: #6b7280;
    font-size: 0.86rem;
}
