/* Stili applicazione - integra Bootstrap 5 */

body {
    font-size: .95rem;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 48px;
    height: calc(100vh - 48px);
    z-index: 100;
    padding: 0;
    box-shadow: inset -1px 0 0 rgba(0,0,0,.1);
}
@media (max-width: 767.98px) {
    .sidebar {
        position: static;
        height: auto;
    }
}
/* la sidebar scorre da sola: non allunga mai la pagina */
.sidebar .position-sticky {
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    padding-top: .5rem !important;
}
@media (max-width: 767.98px) {
    .sidebar .position-sticky {
        max-height: none;
        overflow-y: visible;
    }
}
.sidebar .nav-link {
    color: #333;
    border-radius: .375rem;
    margin: 1px 8px;
    padding: .3rem .75rem;
}
/* intestazioni di gruppo piu compatte */
.sidebar .nav-item.mt-2 {
    margin-top: .45rem !important;
}
.sidebar .nav-item > span.text-uppercase {
    display: block;
    padding-top: .15rem;
    line-height: 1.3;
}
.sidebar .nav-link:hover {
    background-color: #e9ecef;
}
.sidebar .nav-link.active {
    color: #fff;
    background-color: #0d6efd;
}
.sidebar .nav-link i {
    margin-right: .4rem;
}

/* Card statistiche dashboard */
.stat-card {
    border: none;
    border-radius: .75rem;
    color: #fff;
}
.stat-card .display-6 {
    font-weight: 600;
}
.stat-entrate { background: linear-gradient(135deg,#198754,#20c997); }
.stat-uscite  { background: linear-gradient(135deg,#dc3545,#fd7e14); }
.stat-saldo   { background: linear-gradient(135deg,#0d6efd,#6610f2); }
.stat-iva     { background: linear-gradient(135deg,#6c757d,#495057); }
.stat-sospeso { background: linear-gradient(135deg,#fd7e14,#ffc107); }
.stat-proiezione { background: linear-gradient(135deg,#0dcaf0,#0d6efd); }
/* Riga statistiche dashboard: card tutte della stessa altezza */
.stat-row .card-body { min-height: 11.5rem; }
.stat-row .display-6 { font-size: 1.45rem; }
.stat-row .card-body .small { font-size: .82rem; }
.stat-split {
    border-top: 1px solid rgba(255,255,255,.35);
    margin-top: .5rem;
    padding-top: .4rem;
    font-size: .82rem;
    line-height: 1.4;
}

/* Tabelle responsive */
.table-sm td, .table-sm th { vertical-align: middle; }

/* Badge tipo movimento */
.badge-entrata { background-color: #198754; }
.badge-uscita  { background-color: #dc3545; }

/* Login */
.login-wrapper {
    max-width: 420px;
    margin: 8vh auto;
}
.login-card {
    border-radius: 1rem;
    box-shadow: 0 .5rem 2rem rgba(0,0,0,.1);
}

/* Intestazioni di tabella ordinabili */
th.sortable a { cursor: pointer; }
th.sortable a:hover { color: #0d6efd !important; }
th.sortable { white-space: nowrap; }

/* Campi dei form: select e input devono avere la stessa altezza e lo stesso
   corpo del testo (Bootstrap li lascia a 1rem, piu grandi del body) */
.form-control, .form-select {
    font-size: .95rem;
}
.form-select:not([multiple]):not([size]),
input.form-control:not([type="file"]) {
    height: calc(1.5em + .75rem + calc(var(--bs-border-width) * 2));
}
.form-control-sm, .form-select-sm {
    font-size: .85rem;
}
.form-select-sm:not([multiple]):not([size]),
input.form-control-sm:not([type="file"]) {
    height: calc(1.5em + .5rem + calc(var(--bs-border-width) * 2));
}

/* Editor WYSIWYG dei modelli di delega */
.editor-wysiwyg .editor-area {
    min-height: 340px;
    max-height: 60vh;
    overflow-y: auto;
    background: #fff;
    font-size: .95rem;
    line-height: 1.5;
}
.editor-wysiwyg .editor-area:focus { outline: none; }
.editor-wysiwyg .editor-area p { margin-bottom: .6rem; }
.editor-wysiwyg .editor-area h1 { font-size: 1.4rem; }
.editor-wysiwyg .editor-area h2 { font-size: 1.2rem; }
.editor-wysiwyg .editor-area h3 { font-size: 1.05rem; }
.editor-wysiwyg .btn.active { background-color: var(--bs-secondary); color: #fff; }

/* Filtro a scelta multipla (dropdown con checkbox + badge) */
.multiselect .dropdown-menu { min-width: 240px; max-height: 260px; overflow-y: auto; }
.multiselect .dropdown-item { cursor: pointer; }
.multiselect .dropdown-item:active { color: inherit; background-color: var(--bs-tertiary-bg); }
.multiselect-badge { cursor: pointer; }

/* Riquadro grafici dashboard: altezza fissa e uguale per tutti */
.grafico-box { position: relative; height: 280px; }
@media (max-width: 991.98px) { .grafico-box { height: 240px; } }

/* Autocompletamento su tendina (assets/js/autocomplete.js) */
.ac-box { position: relative; }
.ac-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1060;
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #ced4da);
    border-radius: .375rem;
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
    max-height: 260px;
    overflow-y: auto;
}
.ac-menu .ac-info {
    padding: .25rem .625rem;
    font-size: .72rem;
    color: var(--bs-secondary-color, #6c757d);
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.ac-menu .ac-voce {
    padding: .3rem .625rem;
    font-size: .85rem;
    cursor: pointer;
}
.ac-menu .ac-voce:hover { background: var(--bs-tertiary-bg, #f8f9fa); }
.ac-menu .ac-voce.sel { background: var(--bs-primary, #0d6efd); color: #fff; }
.ac-menu .ac-voce mark { background: #ffe38a; color: inherit; padding: 0; }
.ac-menu .ac-voce.sel mark { background: transparent; color: #fff; font-weight: 600; }
.ac-menu .ac-azzera {
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    color: var(--bs-secondary-color, #6c757d);
}
.ac-menu .ac-vuoto {
    padding: .45rem .625rem;
    font-size: .85rem;
    color: var(--bs-secondary-color, #6c757d);
    font-style: italic;
}

/* ---- Guida ---- */
.guida-indice { top: 64px; max-height: calc(100vh - 80px); overflow-y: auto; }
.guida-capitolo { scroll-margin-top: 64px; transition: box-shadow .4s; }
.guida-capitolo.guida-evidenza { box-shadow: 0 0 0 .2rem rgba(13, 110, 253, .35); }
.guida-capitolo .card-body > :last-child { margin-bottom: 0; }
.guida dd { margin-bottom: .6rem; }
