/* Brand palette (see public/brand/palette-areten.jpeg) */
:root {
    --areten-black: #000000;
    --areten-orange: #ff914d;
    --areten-orange-soft: rgba(255, 145, 77, 0.64);
    --areten-orange-muted: rgba(255, 145, 77, 0.18);
}

/* ARETEN layout overrides: sidebar full height, header inside content area */

@media (min-width: 992px) {
    body.aside-enabled #kt_aside.aside {
        top: 0 !important;
    }

    body.aside-enabled #kt_wrapper.wrapper {
        padding-top: 0 !important;
    }

    /*
     * Metronic default minimize slides aside off-screen: left:-265px + padding-left:0.
     * Override that with a slim rail so the hamburger (and icons) stay reachable.
     */
    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside.aside,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside {
        left: 0 !important;
        right: auto !important;
        width: 4.75rem !important;
        min-width: 4.75rem !important;
        max-width: 4.75rem !important;
        overflow-x: hidden !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
        z-index: 105 !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] #kt_wrapper.wrapper,
    body.aside-enabled[data-kt-aside-minimize="on"] .wrapper {
        padding-left: 4.75rem !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .aside .aside-menu {
        width: 4.75rem !important;
        min-width: 4.75rem !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .areten-aside-brand-text {
        display: none !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .areten-aside-brand {
        justify-content: center;
        flex-direction: column;
        gap: 0.35rem;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .areten-aside-brand-link {
        justify-content: center;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .areten-aside-logo {
        width: 2.5rem;
        height: 2.5rem;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .aside-toolbar {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }

    /* Icon-only rail: hide titles, arrows, section headings (Anagrafiche / Impostazioni) */
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-title,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-arrow,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-arrow:after,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-arrow:before,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-bullet,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-content,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-section,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-item > .menu-content {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-link {
        justify-content: center;
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-icon {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-sub {
        display: none !important;
    }

    /* Collapse accordion open state visually in rail mode */
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-item.menu-accordion.show > .menu-sub,
    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .menu-item.menu-accordion.here > .menu-sub {
        display: none !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] .aside-menu .areten-aside-section {
        display: none !important;
    }

    /* Hide Windows scrollbar up/down arrows in the slim rail */
    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside .hover-scroll-overlay-y,
    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside_menu_wrapper {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        margin-left: 0.35rem !important;
        margin-right: 0.35rem !important;
        scrollbar-width: none !important; /* Firefox */
        -ms-overflow-style: none !important; /* IE/Edge legacy */
    }

    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside .hover-scroll-overlay-y::-webkit-scrollbar,
    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside_menu_wrapper::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
        display: none !important;
        background: transparent !important;
    }

    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside .hover-scroll-overlay-y::-webkit-scrollbar-button,
    body.aside-enabled[data-kt-aside-minimize="on"] #kt_aside_menu_wrapper::-webkit-scrollbar-button {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }
}

/* Polished aside icon tooltips (rail mode) */
.tooltip.areten-aside-tooltip {
    --bs-tooltip-bg: #181c32;
    --bs-tooltip-color: #fff;
    --bs-tooltip-padding-x: 0.75rem;
    --bs-tooltip-padding-y: 0.45rem;
    --bs-tooltip-font-size: 0.8rem;
    --bs-tooltip-border-radius: 0.475rem;
    --bs-tooltip-opacity: 1;
    z-index: 1100;
}

.tooltip.areten-aside-tooltip .tooltip-inner {
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: 0 0.5rem 1.25rem rgba(24, 28, 50, 0.28);
    max-width: 16rem;
}

body.aside-enabled #kt_header.header {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    height: auto !important;
    box-shadow: none;
    border-bottom: 1px solid var(--bs-gray-200);
}

body.aside-enabled #kt_aside.aside {
    min-height: 100vh;
}

#kt_header .select2-container--default .select2-selection--single {
    min-height: 36px;
    border-color: var(--bs-gray-300);
}

#kt_header .select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    font-size: 0.925rem;
}

#kt_header .select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
}

/* Nicely styled row checkboxes in FP tables */
.form-check.form-check-sm .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.table .form-check {
    margin: 0;
    padding-left: 0;
    display: inline-flex;
    justify-content: center;
}

/* FP pivot tables (Banche, Effettivo, Fatturato, Simulato, Confronto) */
.areten-pivot-wrap {
    border: 1px solid var(--bs-gray-200);
    border-radius: 0.75rem;
    overflow: auto;
}

.areten-pivot-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--bs-gray-800);
    margin: 0 0 0.85rem;
}

.areten-pivot {
    --areten-sticky-bg: #fff;
    --areten-sticky-width: 11.5rem;
    --areten-check-width: 2.5rem;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 1100px;
}

.areten-pivot--macros {
    --areten-sticky-width: 16rem;
}

.areten-pivot--micro {
    --areten-sticky-width: 10rem;
    --areten-sticky-micro-width: 11rem;
    --areten-sticky-desc-width: 12rem;
    min-width: 1280px;
}

.areten-pivot--description {
    min-width: 1420px;
}

.areten-pivot__sticky--micro {
    left: var(--areten-sticky-width);
    min-width: var(--areten-sticky-micro-width);
    max-width: var(--areten-sticky-micro-width);
    z-index: 1;
    box-shadow: 1px 0 0 var(--bs-gray-200);
}

.areten-pivot__sticky--desc {
    left: calc(var(--areten-sticky-width) + var(--areten-sticky-micro-width));
    min-width: var(--areten-sticky-desc-width);
    max-width: var(--areten-sticky-desc-width);
    z-index: 1;
    box-shadow: 1px 0 0 var(--bs-gray-200);
}

.areten-pivot thead .areten-pivot__sticky--micro,
.areten-pivot thead .areten-pivot__sticky--desc {
    z-index: 3;
    background: var(--bs-gray-100);
}

.areten-pivot tbody tr:hover .areten-pivot__sticky--micro,
.areten-pivot tbody tr:hover .areten-pivot__sticky--desc {
    background: var(--bs-gray-100);
}

.areten-pivot--simulato {
    --areten-sticky-width: 14rem;
    --areten-check-width: 2.75rem;
    /* 3 icon buttons: calendar + edit + delete */
    --areten-actions-width: 7.25rem;
    min-width: 1400px;
}

/* Sticky block: checkbox | actions | description — opaque, nothing shows through */
.areten-pivot--simulato .areten-pivot__check,
.areten-pivot--simulato .areten-pivot__actions,
.areten-pivot--simulato .areten-pivot__sticky--after-check {
    position: sticky !important;
    background: #fff !important;
    background-clip: padding-box;
}

.areten-pivot--simulato .areten-pivot__check {
    left: 0 !important;
    z-index: 5 !important;
    width: var(--areten-check-width) !important;
    min-width: var(--areten-check-width) !important;
    max-width: var(--areten-check-width) !important;
}

.areten-pivot--simulato .areten-pivot__actions {
    left: var(--areten-check-width) !important;
    z-index: 5 !important;
    width: var(--areten-actions-width) !important;
    min-width: var(--areten-actions-width) !important;
    max-width: var(--areten-actions-width) !important;
    text-align: start !important;
    overflow: hidden;
    box-shadow: none;
}

.areten-pivot--simulato .areten-pivot__sticky--after-check {
    left: calc(var(--areten-check-width) + var(--areten-actions-width)) !important;
    z-index: 5 !important;
    min-width: var(--areten-sticky-width) !important;
    max-width: var(--areten-sticky-width) !important;
    width: var(--areten-sticky-width) !important;
    overflow: hidden !important;
    box-shadow: 8px 0 12px -6px rgba(0, 0, 0, 0.18);
}

.areten-pivot--simulato thead .areten-pivot__check,
.areten-pivot--simulato thead .areten-pivot__actions,
.areten-pivot--simulato thead .areten-pivot__sticky--after-check {
    z-index: 8 !important;
    background: var(--bs-gray-100) !important;
}

.areten-pivot--simulato tbody tr:hover .areten-pivot__check,
.areten-pivot--simulato tbody tr:hover .areten-pivot__actions,
.areten-pivot--simulato tbody tr:hover .areten-pivot__sticky--after-check {
    background: var(--bs-gray-100) !important;
}

.areten-pivot--simulato .areten-pivot__summary .areten-pivot__check,
.areten-pivot--simulato .areten-pivot__summary .areten-pivot__actions,
.areten-pivot--simulato .areten-pivot__summary .areten-pivot__sticky--after-check {
    background: #eef6ff !important;
}

.areten-pivot--simulato tbody tr.bg-light-primary .areten-pivot__check,
.areten-pivot--simulato tbody tr.bg-light-primary .areten-pivot__actions,
.areten-pivot--simulato tbody tr.bg-light-primary .areten-pivot__sticky--after-check {
    background: #f1faff !important;
}

/* Fallback for non-simulato tables that still use actions sticky */
.areten-pivot__actions {
    position: sticky;
    left: var(--areten-check-width);
    z-index: 4;
    width: var(--areten-actions-width, 7.25rem);
    min-width: var(--areten-actions-width, 7.25rem);
    max-width: var(--areten-actions-width, 7.25rem);
    background: #fff !important;
    text-align: start !important;
}

.areten-pivot--revenue {
    --areten-sticky-width: 7rem;
    min-width: 640px;
}

.areten-pivot thead th {
    background: var(--bs-gray-100);
    color: var(--bs-gray-700);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    white-space: nowrap;
    border-bottom: 1px solid var(--bs-gray-200);
    padding: 0.85rem 0.65rem;
    position: sticky;
    top: 0;
    z-index: 2;
}

.areten-pivot tbody td,
.areten-pivot tfoot td {
    border-bottom: 1px solid var(--bs-gray-100);
    padding: 0.75rem 0.65rem;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.areten-pivot tbody tr:hover td {
    background: var(--bs-gray-100);
}

.areten-pivot tbody tr:hover .areten-pivot__sticky,
.areten-pivot tbody tr:hover .areten-pivot__check {
    background: var(--bs-gray-100);
}

.areten-pivot__sticky {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--areten-sticky-bg);
    min-width: var(--areten-sticky-width);
    max-width: var(--areten-sticky-width);
    box-shadow: 1px 0 0 var(--bs-gray-200);
    text-align: left !important;
    overflow: hidden !important;
}

/* Ellipsis for labels inside sticky / narrow cells — never bleed into month columns */
.areten-text-ellipsis {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.areten-pivot__sticky .fw-semibold,
.areten-pivot__sticky .text-gray-800,
.areten-pivot--simulato .areten-pivot__sticky--after-check .fw-semibold,
.areten-pivot--simulato .areten-pivot__sticky--after-check .text-gray-800 {
    max-width: 100%;
    overflow: hidden;
}

.areten-pivot thead .areten-pivot__sticky {
    z-index: 3;
    background: var(--bs-gray-100);
}

.areten-pivot__check {
    position: sticky;
    left: 0;
    z-index: 1;
    width: var(--areten-check-width);
    min-width: var(--areten-check-width);
    max-width: var(--areten-check-width);
    background: var(--areten-sticky-bg);
    text-align: center !important;
    box-shadow: none;
}

.areten-pivot thead .areten-pivot__check {
    z-index: 3;
    background: var(--bs-gray-100);
}

.areten-pivot__sticky--after-check {
    left: var(--areten-check-width);
    white-space: normal;
    max-width: 16rem;
    overflow: hidden;
}

.areten-pivot thead .areten-pivot__sticky--after-check {
    z-index: 3;
}

.areten-pivot tbody tr:hover .areten-pivot__sticky--after-check {
    background: var(--bs-gray-100);
}

.areten-pivot__summary .areten-pivot__sticky--after-check {
    background: #eef6ff !important;
}

.areten-pivot__wrap {
    white-space: normal !important;
}

.areten-pivot__month {
    min-width: 4.75rem;
}

.areten-pivot__total-col {
    min-width: 6.5rem;
    background: rgba(54, 153, 255, 0.06);
    box-shadow: inset 1px 0 0 var(--bs-gray-200);
}

.areten-pivot thead .areten-pivot__total-col {
    background: #e8f2ff;
    color: var(--bs-primary);
}

.areten-pivot__meta-col {
    min-width: 5.5rem;
}

.areten-pivot__zero,
.areten-pivot__zero span {
    color: var(--bs-gray-400) !important;
}

.areten-pivot__footer td,
.areten-pivot tr.areten-pivot__footer > td {
    background: var(--bs-gray-100);
    border-top: 2px solid var(--bs-gray-300);
    border-bottom: none;
    font-weight: 700;
}

.areten-pivot__footer .areten-pivot__sticky,
.areten-pivot tr.areten-pivot__footer > .areten-pivot__sticky,
.areten-pivot tr.areten-pivot__footer > .areten-pivot__check {
    background: var(--bs-gray-100);
}

.areten-pivot__footer .areten-pivot__total-col,
.areten-pivot tr.areten-pivot__footer > .areten-pivot__total-col {
    background: #e8f2ff;
}

.areten-pivot__summary td,
.areten-pivot thead tr.areten-pivot__summary > th,
.areten-pivot thead tr.areten-pivot__summary > td {
    background: #eef6ff !important;
    font-weight: 700;
    border-bottom: 1px solid var(--bs-gray-200);
    color: var(--bs-gray-800);
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.8125rem;
}

.areten-pivot__summary .areten-pivot__sticky,
.areten-pivot__summary .areten-pivot__check {
    background: #eef6ff !important;
}

.areten-pivot__emphasis td {
    background: #e8f2ff !important;
    font-weight: 700;
}

.areten-pivot__emphasis .areten-pivot__sticky {
    background: #e8f2ff !important;
}

.areten-pivot__muted td {
    background: var(--bs-gray-50);
    color: var(--bs-gray-700);
}

.areten-pivot__muted .areten-pivot__sticky {
    background: var(--bs-gray-50);
}

.areten-pivot__highlight td {
    background: #fff8dd;
}

.areten-pivot__highlight .areten-pivot__sticky {
    background: #fff8dd;
}

.areten-pivot tbody tr.areten-pivot__highlight:hover td,
.areten-pivot tbody tr.areten-pivot__highlight:hover .areten-pivot__sticky {
    background: #fff3c4;
}

.areten-bank-dot {
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.areten-filter-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--bs-gray-500);
    margin: 0;
}

/* Aside brand + minimize toggle (Metronic-style) */
.areten-aside-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.areten-aside-brand-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.areten-aside-logo {
    width: 2.75rem;
    height: 2.75rem;
    object-fit: contain;
    border-radius: 0.45rem;
    background: #fff;
    flex-shrink: 0;
}

.areten-aside-toggle {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 0 !important;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
}

.areten-aside-toggle:hover,
.areten-aside-toggle:focus {
    background: var(--areten-orange-muted) !important;
    color: #fff !important;
}

.areten-aside-toggle.active,
body[data-kt-aside-minimize="on"] .areten-aside-toggle {
    background: rgba(255, 145, 77, 0.35) !important;
}

/* Login / guest brand panel */
.areten-login-logo {
    width: min(280px, 70vw);
    max-width: 100%;
    height: auto;
    display: block;
}

.areten-login .btn-primary {
    background-color: var(--areten-orange) !important;
    border-color: var(--areten-orange) !important;
}

.areten-login .btn-primary:hover,
.areten-login .btn-primary:focus {
    filter: brightness(0.95);
}

.areten-login .form-check-input:checked {
    background-color: var(--areten-orange);
    border-color: var(--areten-orange);
}

.areten-aside-toggle i {
    font-size: 1.15rem;
}

/* Full-width toolbar row for Simulato / Budget Eco filters */
.card-header > form#fpFilterForm {
    width: 100%;
    flex: 1 1 100%;
}

/* Costi bilancio: let description inputs use full cell width */
#linesTable .line-desc,
#adjTable input.form-control {
    min-width: 0;
    width: 100%;
}

/* Corrispettivi: larger editable cells so totals remain readable (PDF feedback) */
.js-corr-cell {
    min-width: 8rem !important;
    min-height: 2.75rem !important;
    height: 2.75rem !important;
    font-size: 1rem !important;
    padding: 0.55rem 0.65rem !important;
}
.areten-corr-table th,
.areten-corr-table td {
    min-width: 8.5rem;
}
.areten-corr-table th:first-child,
.areten-corr-table td:first-child {
    min-width: 7rem;
    width: 7rem;
}

/* Food Cost bilancio: widen code/saldo, tighten description */
#fcBilancioTable th:nth-child(1),
#fcBilancioTable td:nth-child(1) {
    width: 8rem;
    min-width: 7rem;
}
#fcBilancioTable th:nth-child(3),
#fcBilancioTable td:nth-child(3) {
    width: 9rem;
    min-width: 8rem;
}

/* ARETEN toastr — compact, opaque, polished */
#toastr-container {
    width: 480px;
    max-width: calc(100vw - 1.5rem);
    padding: 0.75rem 1rem 0 0;
}

#toastr-container > div,
#toastr-container > .toastr {
    width: 100% !important;
    max-width: 480px;
    min-height: 0 !important;
    opacity: 1 !important;
    margin: 0 0 0.65rem !important;
    padding: 0.85rem 2.5rem 0.9rem 3.6rem !important;
    border-radius: 0.75rem !important;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(24, 28, 50, 0.18) !important;
    background-position: 1.05rem center !important;
    background-size: 1.35rem 1.35rem !important;
    overflow: hidden;
}

#toastr-container > .toastr-success {
    background-color: #17c653 !important;
}

#toastr-container > .toastr-error {
    background-color: #f8285a !important;
}

#toastr-container > .toastr-warning {
    background-color: #f6c000 !important;
    color: #1e2129 !important;
}

#toastr-container > .toastr-info {
    background-color: #3e97ff !important;
}

#toastr-container .toastr-title {
    margin: 0 0 0.2rem;
    padding: 0;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.25;
}

#toastr-container .toastr-message {
    margin: 0;
    padding: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0.95;
}

#toastr-container .toastr-close-button {
    position: absolute !important;
    top: 0.55rem !important;
    right: 0.65rem !important;
    width: 1.25rem;
    height: 1.25rem;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    color: #fff !important;
    text-shadow: none !important;
    opacity: 0.75 !important;
}

#toastr-container > .toastr-warning .toastr-close-button {
    color: #1e2129 !important;
}

#toastr-container .toastr-close-button:hover,
#toastr-container .toastr-close-button:focus {
    opacity: 1 !important;
}

#toastr-container .toastr-progress {
    height: 3px !important;
    opacity: 0.28 !important;
    background-color: #000 !important;
}

#toastr-container > .toastr-warning .toastr-progress {
    background-color: #1e2129 !important;
    opacity: 0.2 !important;
}

/* Scadenziario PDC: keep row action buttons above overlapping table cells */
.scadenziario-pdc-table .areten-pdc-actions-col {
    position: relative;
    z-index: 2;
    min-width: 9.5rem;
    vertical-align: middle;
    background-color: var(--bs-body-bg, #fff);
}

.scadenziario-pdc-table tbody tr:hover .areten-pdc-actions-col {
    background-color: var(--bs-table-hover-bg, #f9f9f9);
}

.scadenziario-pdc-table .areten-pdc-actions {
    position: relative;
    z-index: 1;
}

.scadenziario-pdc-table .areten-pdc-actions .js-row-delete,
.scadenziario-pdc-table .areten-pdc-actions .btn {
    position: relative;
    z-index: 1;
}

