.table-clickable tbody tr {
    background: #f2f3ff;
    outline: none;
    cursor: pointer;
}

.dt-info {
    margin-top: 18px;
    font-size: 0.9em;
    float: left;
}

.dt-paging {
    float: right;
}

div.dt-container div.dt-paging {
    margin-top: 12px;
    margin-bottom: 16px;
}

.table-responsive {
    /* box-shadow: 1px 1px 12px -2px rgb(155 168 179 / 76%); */
    padding-block-start: 20px;
    padding-block-end: 10px;
    padding-left: 10px;
    padding-right: 10px;
}



:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 70px;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--hb-primary);
    color: var(--hb-light);
    transition: all 0.3s;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar > .border-bottom {
    flex: 0 0 auto;
}

/* Nav area scrolls independently of the main page once it exceeds the viewport height */
.sidebar > nav {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

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

.sidebar > nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar > nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar .nav-link {
    /* color: rgba(255, 255, 255, 0.8); */
    color: var(--hb-light);
    padding: 0.4rem 1rem;
    border-radius: 5px;
    margin: 0.1rem 0;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    /* background-color: rgba(255, 255, 255, 0.1); */
    color: var(--hb-info);
}

.sidebar .nav-link i {
    width: 24px;
    margin-right: 0.5rem;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar .nav-sublink {
    padding-left: 2.5rem;
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
    font-size: 0.85em;
}

.sidebar .nav-chevron {
    transition: transform 0.2s;
    font-size: 0.75rem;
}

.sidebar [aria-expanded="true"] .nav-chevron {
    transform: rotate(180deg);
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: 0.5rem;
    transition: margin-left 0.3s;
}

.main-content.expanded {
    margin-left: var(--sidebar-collapsed-width);
}

.toggle-sidebar {
    background: none;
    border: none;
    color: var(--hb-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.card-stat {
    border-left: 4px solid;
}

.card-stat.primary {
    border-color:rgba(var(--hb-primary-rgb))!important;
}

.card-stat.success {
    border-color:rgba(var(--hb-success-rgb))!important;
}

.card-stat.warning {
    border-color:rgba(var(--hb-warning-rgb))!important;
}

.card-stat.danger {
    border-color:rgba(var(--hb-danger-rgb))!important;
}

@media (max-width: 1200px) {
    .sidebar {
        width: var(--sidebar-collapsed-width);
    }

    .sidebar .nav-text {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed-width);
    }
}

/* Custom DataTables Pagination */
.page-item.active .page-link {
    background-color: var(--hb-primary);
    border-color: var(--hb-primary);
    color: var(--hb-light);
    /* Using the light variable for text */
}

.page-link {
    background-color: var(--hb-primary) !important;
    border-color: var(--hb-primary) !important;
    color: var(--hb-light) !important;
}

.page-link:hover {
    color: var(--hb-info) !important;
    /* Highlight color on hover */
    background-color: rgba(var(--hb-primary-rgb), 0.1) !important;
    /* Subtle background tint */
}

/* DataTables: right-aligned columns — keep flex row direction and push title+arrow to the right */
table.dataTable thead th.dt-type-date,
table.dataTable thead th.dt-type-num,
table.dataTable thead th.text-end {
    flex-direction: row !important;
    justify-content: flex-end !important;
}

/* ---------------------------------------------------------------
   Controlling-Cockpit (/finanzen/controlling/)
   --------------------------------------------------------------- */
.kpi-delta-gut { color: #006300; }
.kpi-delta-schlecht { color: #d03b3b; }

/* Dimension-Umschalter der Analyse-Tabelle: kompakte Pills */
.ctl-pills .nav-link {
    padding: 0.2rem 0.65rem;
    font-size: 0.85rem;
    border: 0;
}

/* Sortierbare Spalten */
th.ctl-sort { cursor: pointer; user-select: none; white-space: nowrap; }
th.ctl-sort::after {
    content: "↕";
    opacity: 0.35;
    font-size: 0.7em;
    margin-left: 0.25rem;
}
th.ctl-sort.sorted-asc::after { content: "↑"; opacity: 1; }
th.ctl-sort.sorted-desc::after { content: "↓"; opacity: 1; }

/* Aufklapp-Chevron dreht bei geöffnetem Breakdown */
.ctl-chevron { display: inline-block; transition: transform 0.15s; font-size: 0.8rem; }
[aria-expanded="true"] > .ctl-chevron { transform: rotate(90deg); }

/* Inline-Datenbalken hinter dem Deckungsbeitrag (relative Grösse) */
td.ctl-db { position: relative; }
td.ctl-db .ctl-balken {
    position: absolute;
    right: 0.25rem;
    top: 18%;
    height: 64%;
    background: rgba(42, 120, 214, 0.14);
    border-radius: 2px;
    max-width: calc(100% - 0.5rem);
    pointer-events: none;
}
td.ctl-db .ctl-balken.negativ { background: rgba(227, 73, 72, 0.16); }
td.ctl-db .ctl-db-wert { position: relative; }

/* htmx-Ladeindikator: Tabelle während des Nachladens abblenden */
#analyse-tabelle.htmx-request { opacity: 0.5; transition: opacity 0.15s; }

/* ---------------------------------------------------------------
   Select2 multi-select - compact (small) variant
   Opt-in: pass
     selectionCssClass: 'select2--small',
     dropdownCssClass:  'select2--small'
   to $(...).select2({...}). Matches form-select-sm height and keeps the
   pills + inline search on a single row until they really overflow.
   --------------------------------------------------------------- */
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small {
    min-height: calc(1.5em + 0.5rem + 2px) !important;
    height: auto !important;
    max-height: none !important;
    padding: 0.125rem 0.375rem !important;
    line-height: 1.5;
    display: flex !important;
    align-items: center;
}
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small > textarea,
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small > .select2-search--inline {
    display: none !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small .select2-selection__rendered {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem;
    padding: 0 !important;
    margin: 0 !important;
    min-height: 0 !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small .select2-selection__choice {
    display: inline-flex !important;
    align-items: center;
    flex: 0 0 auto;
    margin: 0 !important;
    padding: 0 0.375rem !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    border-radius: 0.2rem;
}
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small .select2-selection__choice__remove {
    margin: 0 0.25rem 0 0 !important;
    padding: 0 0.25rem !important;
    border: 0 !important;
    line-height: 1.4 !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small .select2-search--inline {
    flex: 1 1 4ch;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}
.select2-container--bootstrap-5 .select2-selection--multiple.select2--small .select2-search--inline .select2-search__field {
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 0.875rem !important;
    line-height: 1.4 !important;
    border: 0 !important;
    box-shadow: none !important;
}
