.sidebar-sticky {
    position: sticky;
    top: 5rem; /* pod paskiem nawigacji */
}

@media (max-width: 991.98px) {
    .sidebar-sticky { position: static; }
}

.month-card { scroll-margin-top: 5rem; }

.type-dot {
    display: inline-block;
    width: .65rem;
    height: .65rem;
    border-radius: 50%;
    margin-right: .4rem;
    background: var(--type-color, #6c757d);
    vertical-align: baseline;
}

.type-chip {
    display: inline-block;
    padding: .1rem .5rem;
    border-radius: 1rem;
    font-size: .8rem;
    line-height: 1.4;
    color: var(--bs-body-color);
    border: 1px solid var(--type-color, #6c757d);
    border-left-width: .4rem;
    background: var(--bs-body-bg);
    cursor: pointer;
}
.type-chip:hover { background: var(--bs-tertiary-bg); }
.type-chip.active {
    background: var(--type-color, #6c757d);
    color: #fff;
}
.type-filter.filtering .type-chip:not(.active) { opacity: .5; }

.expense-table > :not(caption) > * > * { padding-top: .2rem; padding-bottom: .2rem; }
.expense-table th { font-size: .85rem; }

.expense-table td { word-break: break-word; }

.range-list {
    max-height: 18rem;
    overflow-y: auto;
}

/* ---------- pożyczki ---------- */
.repayment {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    margin-right: .75rem;
    font-size: .85rem;
    white-space: nowrap;
}
.loan-settled { opacity: .7; }
h2[id] { scroll-margin-top: 5rem; }

/* ---------- firma ---------- */
.company-table td { font-size: .8rem; }
.company-table > :not(caption) > * > * { padding-top: .1rem; padding-bottom: .1rem; }
.company-compact { font-size: .85rem; }
.company-compact .form-label { font-size: .75rem; color: var(--bs-secondary-color); }
.company-compact .form-control-sm, .company-compact .form-select-sm { font-size: .8rem; padding-top: .15rem; padding-bottom: .15rem; }
.company-compact .other-check { margin-top: .1rem; }
.company-table tr.fixed-cost td { color: var(--bs-secondary-color); }
.settlement-table td { font-size: .8rem; padding-top: .15rem; padding-bottom: .15rem; }
.year-table td { font-size: .85rem; padding-top: .15rem; padding-bottom: .15rem; }
.settlement-box {
    margin-top: .75rem;
    padding: .5rem .75rem;
    border: 1px solid var(--bs-primary-border-subtle);
    border-left: .3rem solid var(--bs-primary);
    border-radius: .375rem;
    background: var(--bs-tertiary-bg);
}
.settlement-box .settlement-table > :not(caption) > * > * { background: transparent; }
@media (min-width: 768px) {
    .place-row > * + * { border-left: 1px dashed var(--bs-border-color); }
}

/* tabela pożyczek: trzy wyraźne strefy – pożyczka | zwroty | zostało */
.loan-table { border-collapse: separate; border-spacing: 0; border: 1px solid var(--bs-border-color); }
.loan-table > :not(caption) > * > * { padding: .4rem .45rem; border-bottom: 1px solid var(--bs-border-color); }
.loan-table > tbody > tr:last-child > * { border-bottom: 0; }
.loan-table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .02em; vertical-align: bottom; color: var(--bs-secondary-color); }
.loan-table th:nth-child(-n+2), .loan-table td:nth-child(-n+2) { background: var(--bs-primary-bg-subtle); }
.loan-table th:nth-child(3), .loan-table td:nth-child(3) { background: var(--bs-success-bg-subtle); border-left: 2px solid var(--bs-border-color); }
.loan-table th:nth-child(n+4), .loan-table td:nth-child(n+4) { background: var(--bs-tertiary-bg); }
.loan-table th:nth-child(4), .loan-table td:nth-child(4) { border-left: 2px solid var(--bs-border-color); }
.loan-table thead th { filter: brightness(.96); }
.loan-table .repayment {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-success-border-subtle);
    border-radius: 1rem;
    padding: .05rem .5rem;
    margin: .1rem .35rem .1rem 0;
    white-space: normal;
    font-size: .8rem;
}
.loan-table .repayment .edit-repayment { text-align: left; font-size: .8rem; }
.loan-table td:nth-child(3) { min-width: 11rem; }
.loan-table td:last-child { padding-left: .2rem; padding-right: .2rem; }
