/* ============================================
   RegistroPA - Gestionale Commesse PA
   File CSS Completo con Layout Dashboard
   ============================================ */

/* ==========================
   0. VARIABILI CSS & TEMI
========================== */

:root {
    /* Font */
    --font-primary: 'Titillium Web', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    /* Colori Principali */
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    /* Layout */
    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
    --header-height: 70px;
    /* Light Theme */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --border-color: #e2e8f0;
    --sidebar-bg-start: #1e293b;
    --sidebar-bg-end: #0f172a;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Dark Theme */
[data-theme="dark"] {
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --bg-primary: #1e293b;
    --bg-secondary: #0f172a;
    --bg-tertiary: #334155;
    --border-color: #334155;
    --sidebar-bg-start: #0f172a;
    --sidebar-bg-end: #020617;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

/* ==========================
   1. RESET & BASE STYLES
========================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.2px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Applica font a tutti gli elementi */
body, input, button, select, textarea,
.form-control, .btn, table,
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-primary) !important;
}

/* Gerarchia titoli */
h1, h2 {
    font-weight: 700;
}

h3, h4, h5, h6 {
    font-weight: 600;
}

strong {
    font-weight: 600;
}

.small-text {
    font-weight: 300;
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ==========================
   2. LAYOUT DASHBOARD
========================== */

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* ==========================
   3. SIDEBAR NAVIGATION
========================== */

.dashboard-nav {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-bg-start) 0%, var(--sidebar-bg-end) 100%);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-lg);
}

    .dashboard-nav::-webkit-scrollbar {
        width: 6px;
    }

    .dashboard-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
    }

    .dashboard-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }

        .dashboard-nav::-webkit-scrollbar-thumb:hover {
            background: rgba(255, 255, 255, 0.3);
        }

    .dashboard-nav header {
        height: var(--header-height);
        padding: 0 1.5rem;
        display: flex;
        align-items: center;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        background: rgba(0, 0, 0, 0.2);
    }

.brand-logo {
    display: flex;
    align-items: center;
    color: white;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s ease;
}

    .brand-logo:hover {
        color: var(--primary-light);
        text-decoration: none;
    }

    .brand-logo i {
        font-size: 1.5rem;
        margin-right: 0.75rem;
        color: var(--primary-light);
    }

.menu-toggle {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    margin-right: 1rem;
    transition: all 0.3s ease;
    border: none;
}

    .menu-toggle:hover {
        background: rgba(255, 255, 255, 0.2);
    }

/* Navigation */
.dashboard-nav-list {
    padding: 1rem 0;
}

.nav-item-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1rem;
}

.dashboard-nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9375rem;
    font-weight: 500;
    position: relative;
}

    .dashboard-nav-item:hover {
        color: white;
        background: rgba(255, 255, 255, 0.08);
        text-decoration: none;
    }

    .dashboard-nav-item.active {
        color: white;
        background: rgba(79, 70, 229, 0.2);
    }

        .dashboard-nav-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 4px;
            background: var(--primary-light);
        }

    .dashboard-nav-item i {
        width: 24px;
        margin-right: 0.875rem;
        font-size: 1.125rem;
        text-align: center;
    }

/* Dropdown */
.dashboard-nav-dropdown-toggle {
    cursor: pointer;
}

    .dashboard-nav-dropdown-toggle::after {
        content: '\f107';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        margin-left: auto;
        transition: transform 0.3s ease;
        font-size: 0.875rem;
    }

.dashboard-nav-dropdown.show > .dashboard-nav-dropdown-toggle {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

    .dashboard-nav-dropdown.show > .dashboard-nav-dropdown-toggle::after {
        transform: rotate(180deg);
    }

.dashboard-nav-dropdown-menu {
    display: none;
    background: rgba(0, 0, 0, 0.2);
    animation: slideDown 0.3s ease;
}

.dashboard-nav-dropdown.show > .dashboard-nav-dropdown-menu {
    display: block;
}

.dashboard-nav-dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem 0.75rem 3.5rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    position: relative;
}

    .dashboard-nav-dropdown-item::before {
        content: '';
        position: absolute;
        left: 2.25rem;
        width: 6px;
        height: 6px;
        background: rgba(255, 255, 255, 0.3);
        border-radius: 50%;
    }

    .dashboard-nav-dropdown-item:hover {
        color: white;
        background: rgba(255, 255, 255, 0.05);
        text-decoration: none;
    }

/* ==========================
   4. MAIN CONTENT AREA
========================== */

.dashboard-app {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ==========================
   5. HEADER TOOLBAR
========================== */

.dashboard-toolbar {
    height: var(--header-height);
    background: var(--bg-primary);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1rem;
}

/* Theme Toggle */
.theme-toggle {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

    .theme-toggle:hover {
        background: var(--bg-tertiary);
        transform: scale(1.05);
    }

    .theme-toggle i {
        font-size: 1.25rem;
        transition: transform 0.3s ease;
    }

    .theme-toggle:hover i {
        transform: rotate(20deg);
    }

/* ==========================
   6. USER DROPDOWN
========================== */

.user-dropdown {
    position: relative;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

    .user-info:hover {
        background: var(--bg-tertiary);
    }

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary-light);
}

.user-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 0.5rem;
    display: none;
    animation: fadeInDown 0.3s ease;
    border: 1px solid var(--border-color);
    z-index: 1000;
}

    .dropdown-menu.show {
        display: block;
    }

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

    .dropdown-item:hover {
        background: var(--bg-secondary);
        color: var(--primary-color);
        text-decoration: none;
    }

    .dropdown-item i {
        margin-right: 0.75rem;
        width: 20px;
        text-align: center;
    }

/* ==========================
   7. BREADCRUMBS
========================== */

.breadcrumb-container {
    background: var(--bg-primary);
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
}

    .breadcrumb-item a {
        color: var(--text-secondary);
        text-decoration: none;
        transition: color 0.2s ease;
    }

        .breadcrumb-item a:hover {
            color: var(--primary-color);
        }

    .breadcrumb-item.active {
        color: var(--text-primary);
        font-weight: 600;
    }

    .breadcrumb-item + .breadcrumb-item::before {
        content: '\f054';
        font-family: 'Font Awesome 6 Free';
        font-weight: 900;
        font-size: 0.625rem;
        color: var(--text-secondary);
        margin-right: 0.5rem;
    }

/* ==========================
   8. CONTENT AREA
========================== */

.dashboard-content {
    flex: 1;
    padding: 2rem;
}

/* ==========================
   9. FOOTER
========================== */

footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
    transition: all 0.3s ease;
}

/* ==========================
   10. ANIMATIONS
========================== */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220,53,69,0.4);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(220,53,69,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220,53,69,0);
    }
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==========================
   11. ALERT OPERATIVI
========================== */

.modern-alert {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    animation: slideIn 0.3s ease;
    border-left: 4px solid;
}

.alert-success {
    background: #e6f4ea;
    color: #1e4620;
    border-left-color: #28a745;
}

.alert-danger {
    background: #fdecea;
    color: #842029;
    border-left-color: #dc3545;
}

.alert-warning {
    background: #fff4e5;
    color: #664d03;
    border-left-color: #ffc107;
}

.alert-info {
    background: #e7f3fa;
    color: #055160;
    border-left-color: #17a2b8;
}

.alert-critical {
    border-left-width: 6px;
    animation: pulse 2s infinite;
}

/* ==========================
   12. FORM & INPUT
========================== */

.form-control {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

    .form-control:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
    }


.pa-input-full {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-left: 3px solid var(--primary-color); /* sempre colorato */
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: var(--bg-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

    /* Focus */
    .pa-input-full:focus {
        border-color: var(--primary-color);
        outline: none;
        box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
        background-color: var(--bg-secondary);
    }

    /* Disabled */
    .pa-input-full:disabled {
        background-color: var(--bg-tertiary);
        border-left-color: var(--border-color);
        cursor: not-allowed;
    }


.mytext,
.mypassword,
.mydate,
.myselect {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.myamount {
    text-align: right;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
}

.mycurrency {
    text-align: right;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
}

.mytextcenter {
    text-align: center;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.mycheckbox {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.myreadonly {
    color: dimgray;
    background-color: #f1f1f1;
}

.mytextarea {
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    width: 100%;
    padding: 8px 12px;
    box-sizing: border-box;
    line-height: 1.4em;
    min-height: calc(1.4em * 3 + 16px); /* altezza minima circa 3 righe */
    max-height: 15em; /* altezza massima */
    resize: vertical; /* permette resize verticale manuale */
    overflow-y: auto; /* scrollbar verticale solo se necessario */
}

.checkbox-large {
    width: 32px !important;
    height: 32px !important;
    cursor: pointer;
    -webkit-appearance: none; /* disabilita aspetto nativo */
    -moz-appearance: none;
    appearance: none;
    border: 2px solid #ced4da;
    border-radius: 4px;
    position: relative;
    background-color: #fff;
    text-align: center !important;
    vertical-align: middle;
    transition: background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}

    .checkbox-large:checked {
        background-color: var(--primary-color);
        border-color: var(--primary-color);
    }

        .checkbox-large:checked::after {
            content: "";
            position: absolute;
            top: 4px;
            left: 8px;
            width: 5px;
            height: 10px;
            border: solid white;
            border-width: 0 2px 2px 0;
            transform: rotate(45deg);
        }

.form-check-label.custom-align {
    display: flex;
    align-items: center; /* allineamento verticale */
    padding-left: 5px; /* padding sinistro */
    cursor: pointer; /* migliora UX */
}

/* ==========================
   13. BADGE & STATUS
========================== */

.badge {
    font-weight: 500;
    font-size: 0.85rem;
    padding: 0.35em 0.65em;
}

.status {
    font-weight: 600;
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 20px;
    display: inline-block;
}

.status-offerta {
    background-color: #e0f2fe;
    color: #0369a1;
}

.status-contratto {
    background-color: #ede9fe;
    color: #5b21b6;
}

.status-fatturato {
    background-color: #fff7ed;
    color: #c2410c;
}

.status-incassato {
    background-color: #dcfce7;
    color: #166534;
}

.status-scaduto {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ==========================
   14. TABELLE
========================== */

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.table th,
.table td {
    vertical-align: middle;
}

/* ==========================
   HEADER
========================== */

thead th,
tr.cnftitolo th {
    text-align: center;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #fff;
    background: linear-gradient(180deg, var(--primary-color), var(--primary-dark));
    border: 1px solid var(--primary-dark);
}

/* ==========================
   RIGHE BASE
========================== */

tbody td,
tr.cnfrighe td {
    font-weight: bold;
    vertical-align: middle;
    border-bottom: 1px solid #e5e7eb;
}

tr.cnfrighe {
    cursor: pointer;
}

    tr.cnfrighe:nth-child(even) {
        background-color: #f9fbfd;
    }

    tr.cnfrighe:hover {
        background-color: #eaf2f8;
        transition: background-color 0.2s ease;
    }

/* ==========================
   RIEPILOGO
========================== */

tr.cnfrigheriepilogo td {
    font-weight: 700;
    background-color: #eef2f6;
    border-top: 2px solid var(--primary-color);
}

/* ==========================
   TABLE UTILITIES
========================== */

.table-hover tbody tr:hover {
    background-color: rgba(79, 70, 229, 0.05);
}

.table-active {
    background-color: #fff3cd !important;
}

/* ==========================
   VARIANTI DIMENSIONE
========================== */

/* === 16px (DEFAULT) === */
.cnfrighe td {
    font-size: 16px;
    height: 36px;
    padding: 6px 8px;
}

.cnftitolo th {
    font-size: 16px;
    padding: 10px;
}

/* === 12px === */
.cnfrighe_12 td {
    font-size: 12px;
    height: 30px;
    padding: 4px 6px;
}

.cnftitolo_12 th {
    font-size: 12px;
    padding: 8px;
}

/* === 10px === */
.cnfrighe_10 td {
    font-size: 10px;
    height: 24px;
    padding: 3px 5px;
}

.cnftitolo_10 th {
    font-size: 10px;
    padding: 6px;
}
/* ==========================
   15. NUMERI & IMPORTI
========================== */

.amount,
.total,
.important-number {
    font-weight: 700;
    letter-spacing: 0.4px;
}

td.amount,
td.currency {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

code {
    background-color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #333;
}

/* ==========================
   16. CARD STYLES
========================== */

.card {
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    margin-bottom: 1rem;
    overflow: hidden;
}

.card-header {
    font-weight: 600;
    font-size: 1.1rem;
    padding: 12px 16px;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
}

    .card-header.bg-primary {
        background: linear-gradient(180deg, var(--primary-color), var(--primary-dark)) !important;
        color: white;
    }

    .card-header.bg-success {
        background: linear-gradient(180deg, #28a745, #1e7e34) !important;
        color: white;
    }

    .card-header.bg-info {
        background: linear-gradient(180deg, #17a2b8, #117a8b) !important;
        color: white;
    }

    .card-header.bg-warning {
        background: linear-gradient(180deg, #ffc107, #e0a800) !important;
        color: #664d03;
    }

    .card-header.bg-secondary {
        background: linear-gradient(180deg, #6c757d, #545b62) !important;
        color: white;
    }

.card-body {
    padding: 16px;
}

.card-compact .card-body {
    padding: 12px;
}

.card.border-primary {
    border-left: 4px solid var(--primary-color);
}

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

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

.card.border-info {
    border-left: 4px solid #17a2b8;
}

.card.border-danger {
    border-left: 4px solid #dc3545;
}

.card.border-secondary {
    border-left: 4px solid #6c757d;
}

/* ==========================
   17. BUTTONS
========================== */

.btn {
    font-weight: 600;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    letter-spacing: 0.3px;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

    .btn-primary:hover {
        background-color: var(--primary-dark);
        border-color: var(--primary-dark);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
    }

.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-secondary:hover,
.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1.1rem;
}

.btn-outline-primary,
.btn-outline-secondary {
    font-weight: 500;
}

/* ==========================
   18. TABS & NAVIGATION
========================== */

.nav-tabs {
    border-bottom: 2px solid #e5e7eb;
}

    .nav-tabs .nav-link {
        font-weight: 600;
        color: #6c757d;
        border: none;
        border-bottom: 3px solid transparent;
        transition: all 0.2s ease;
    }

        .nav-tabs .nav-link:hover {
            border-bottom-color: var(--primary-color);
            color: var(--primary-color);
        }

        .nav-tabs .nav-link.active {
            color: var(--primary-color);
            border-bottom-color: var(--primary-color);
            background-color: transparent;
        }

/* ==========================
   19. STICKY HEADER & UTILITIES
========================== */

.data_sticky {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    z-index: 100;
    background-color: white;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    white-space: normal;
    overflow: visible;
}

.pa-right {
    text-align: right;
}

.action-icons a:hover {
    transform: scale(1.1);
}

/* ==========================
   20. LOADER
========================== */

.loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 9999;
}

/* ==========================
   21. FORM SWITCH
========================== */

.form-switch .form-check-input {
    width: 3rem;
    height: 1.5rem;
    cursor: pointer;
}

    .form-switch .form-check-input:checked {
        background-color: #28a745;
        border-color: #28a745;
    }

/* ==========================
   22. TABLE ACTIONS & BUTTONS
========================== */

.table-action {
    width: 60px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
}

    .table-action .btn {
        margin: 0 2px;
    }

.action-buttons {
    display: flex;
    gap: 4px;
    justify-content: center;
}

    .action-buttons .btn {
        padding: 4px 8px;
        font-size: 0.875rem;
    }

/* ==========================
   23. EMPTY STATE
========================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

    .empty-state i {
        font-size: 4rem;
        color: #cbd5e0;
        margin-bottom: 20px;
        display: block;
    }

    .empty-state p {
        color: #718096;
        font-size: 1.1rem;
    }

/* ==========================
   24. ICON COLORS
========================== */

.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: #28a745 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-info {
    color: #17a2b8 !important;
}

.text-secondary {
    color: #6c757d !important;
}

/* ==========================
   25. SPACING UTILITIES
========================== */

.pa-mb-1 {
    margin-bottom: 0.5rem;
}

.pa-mb-2 {
    margin-bottom: 1rem;
}

.pa-mb-3 {
    margin-bottom: 1.5rem;
}

.pa-mt-1 {
    margin-top: 0.5rem;
}

.pa-mt-2 {
    margin-top: 1rem;
}

.pa-mt-3 {
    margin-top: 1.5rem;
}

.pa-p-2 {
    padding: 1rem;
}

.pa-p-3 {
    padding: 1.5rem;
}

/* ==========================
   26. RESPONSIVE
========================== */

@media (max-width: 992px) {
    .dashboard-nav {
        transform: translateX(-100%);
    }

        .dashboard-nav.mobile-show {
            transform: translateX(0);
        }

    .dashboard-app {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .dashboard-content {
        padding: 1.5rem 1rem;
    }

    .dashboard-toolbar {
        padding: 0 1rem;
    }

    .user-details {
        display: none;
    }

    .breadcrumb-container {
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    table {
        font-size: 0.85rem;
    }

    .pa-input-full {
        font-size: 16px;
    }

    .modern-alert {
        font-size: 0.85rem;
    }

    .data_sticky .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .data_sticky .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .action-buttons {
        flex-direction: column;
    }
}

@media (max-width: 576px) {
    .dashboard-content {
        padding: 1rem 0.75rem;
    }

    .brand-logo span {
        display: none;
    }
}

/* ==========================
   27. PRINT STYLES
========================== */

@media print {
    .data_sticky,
    .btn,
    .nav-tabs,
    .table-action,
    .dashboard-nav,
    .dashboard-toolbar,
    .breadcrumb-container {
        display: none !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid #000;
    }

    body {
        font-size: 12pt;
    }

    .dashboard-app {
        margin-left: 0;
    }
}

/* ==========================
   28. LAYOUT UTILITIES (consolidate da HTML inline)
========================== */

/* Data Sticky - già presente, verifica che sia così */
.data_sticky {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    z-index: 100;
    background-color: white;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    white-space: normal;
    overflow: visible;
}

/* Variante per pagine con margin negativo */
.data_sticky-fullwidth {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    z-index: 100;
    background-color: var(--bg-primary);
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin: -2rem -2rem 1rem -2rem;
    white-space: normal;
    overflow: visible;
}

/* Relative Data Container */
.relative_data {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    z-index: 0;
}

/* Variante con top offset */
.relative_data-offset {
    position: relative;
    top: 50px;
    right: 0;
    width: 100%;
    z-index: 0;
}

/* Variante con width 97% e margin */
.relative_data-compact {
    position: relative;
    align-content: center;
    top: 0;
    right: 0;
    width: 97%;
    margin: 16px;
    z-index: 0;
}

/* ==========================
   29. INPUT NUMERICO INTERO
========================== */

.myinteger {
    text-align: right;
    font-weight: 600;
    color: #0f172a;
    background-color: #f0f9ff;
    border: 1px solid #cbd5e1;
    font-variant-numeric: tabular-nums;
    padding: 8px 12px;
    border-radius: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

    .myinteger:focus {
        background-color: #ffffff;
        border-color: var(--primary-color);
        box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
        outline: none;
    }

    /* Rimuove le frecce spinner per input number in Chrome/Safari */
    .myinteger::-webkit-outer-spin-button,
    .myinteger::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    /* Rimuove le frecce spinner per input number in Firefox */
    .myinteger[type=number] {
        -moz-appearance: textfield;
    }

    .myinteger:disabled {
        background-color: #f1f1f1;
        cursor: not-allowed;
    }

/* ==========================
   30. TEXTAREA AUTO-RESIZE
========================== */

.mytextarea {
    min-height: 60px;
    max-height: 300px;
    resize: vertical;
    overflow-y: auto;
    transition: height 0.2s ease;
}

/* ==========================
   31. CHECKBOX PERSONALIZZATO
========================== */

.checkbox-large {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.custom-align {
    vertical-align: middle;
    margin-left: 8px;
}


/* ==========================
   32. ALERT DASHBOARD
========================== */

.border-danger {
    border-left: 4px solid #dc3545 !important;
}

.border-warning {
    border-left: 4px solid #ffc107 !important;
}

.border-success {
    border-left: 4px solid #28a745 !important;
}

.list-group-item:hover {
    background-color: #f8f9fa;
}

.badge-custom {
    font-size: 0.85rem;
    font-weight: 600;
}


/* ==========================
   33. INPUT NUMERICO GRANDE PER PARAMETRI
========================== */

.myinteger-large {
    width: 120px;
    height: 80px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: #0f172a;
    background-color: #f0f9ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    font-variant-numeric: tabular-nums;
    padding: 15px;
    transition: all 0.3s ease;
}

    .myinteger-large:focus {
        background-color: #ffffff;
        border-color: #2563eb;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
        outline: none;
        transform: scale(1.05);
    }

    .myinteger-large:hover {
        border-color: #2563eb;
        background-color: #e0f2fe;
    }

    /* Rimuove le frecce spinner */
    .myinteger-large::-webkit-outer-spin-button,
    .myinteger-large::-webkit-inner-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }

    .myinteger-large[type=number] {
        -moz-appearance: textfield;
    }

    .myinteger-large:disabled {
        background-color: #f1f1f1;
        cursor: not-allowed;
        opacity: 0.6;
    }


/* ==========================================
   34. DASHBOARD FINANZIARIA
========================================== */
.dashboard-card {
    transition: transform 0.2s, box-shadow 0.2s;
}

    .dashboard-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 16px rgba(0,0,0,0.2) !important;
    }

.cash-flow-positive {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-left: 5px solid #28a745;
}

.cash-flow-negative {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-left: 5px solid #dc3545;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
}

/* Progress bars personalizzate */
.progress {
    border-radius: 10px;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.progress-bar {
    border-radius: 10px;
    transition: width 0.6s ease;
}

/* Tabelle responsive */
.table-responsive {
    border-radius: 8px;
    overflow: hidden;
}

.table-hover tbody tr:hover {
    background-color: rgba(0,123,255,0.05);
    cursor: pointer;
}

/* Badge personalizzati */
.badge-spesa {
    font-size: 0.85rem;
    padding: 0.4em 0.8em;
    font-weight: 500;
}

/* Card header con gradiente */
.card-header.bg-dark {
    background: linear-gradient(135deg, #343a40 0%, #23272b 100%) !important;
}

.card-header.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%) !important;
}

.card-header.bg-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

.card-header.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
}

/* Animazioni */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: slideInUp 0.4s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-number {
        font-size: 1.8rem;
    }

    .dashboard-card {
        margin-bottom: 15px;
    }
}
