:root {
    --sidebar-gap: 12px;
    --sidebar-radius: 16px;

    /* Styling „glass” – możesz się pobawić tymi wartościami */
    --sidebar-blur: 18px;
    --sidebar-bg-main: rgba(248, 246, 242, 0.92); /* jasne, lekko mleczne */
    --sidebar-bg-alt: rgba(255, 255, 255, 0.88);
    --sidebar-border: rgba(255, 255, 255, 0.55);
    --sidebar-shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.25);
    --sidebar-shadow-strong: 0 24px 55px rgba(15, 23, 42, 0.35);
}

/* Desktop – floating glass sidebar */
@media (min-width: 992px) {

    /* Kontener – gap od krawędzi aplikacji */
    .sidebar-wrapper {
        padding-left: var(--sidebar-gap);
        padding-top: var(--sidebar-gap);
        padding-bottom: var(--sidebar-gap);
    }

    #kt_app_sidebar {
        margin-left: var(--sidebar-gap);
        margin-top: var(--sidebar-gap);
        margin-bottom: var(--sidebar-gap);

        border-radius: var(--sidebar-radius);
        overflow: visible;

        /* Glassmorphism */
        background: linear-gradient(
            135deg,
            var(--sidebar-bg-main),
            var(--sidebar-bg-alt)
        );
        border: 1px solid var(--sidebar-border);

        box-shadow: var(--sidebar-shadow-soft);

        /* Smooth animacje */
        transition:
            transform 0.22s ease-out,
            box-shadow 0.22s ease-out,
            background 0.22s ease-out,
            border-color 0.22s ease-out;
    }

    /* Blur tylko tam, gdzie wspierane */
    @supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
        #kt_app_sidebar {
            backdrop-filter: blur(var(--sidebar-blur));
            -webkit-backdrop-filter: blur(var(--sidebar-blur));
        }
    }

    /* Subtelny lift na hoverze */
    #kt_app_sidebar:hover {
        transform: translateY(-2px);
        box-shadow: var(--sidebar-shadow-strong);
        border-color: rgba(255, 255, 255, 0.8);
    }
}

/* Mobile – klasyczny pełny sidebar bez bajerów */
@media (max-width: 991.98px) {
    .sidebar-wrapper {
        padding: 0;
    }

    #kt_app_sidebar {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: var(--bs-body-bg);
    }
}

/* User panel przyklejony do dołu */
.app-sidebar-user {
    position: sticky;
    bottom: 0;
    margin-top: auto;
}



/* ✅ Poprawa wyglądu Select2 multiple - ikonki usuwania */
.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice {
    background-color: #f1f1f2;
    border: 1px solid #e4e6ef;
    border-radius: 0.475rem;
    padding: 0.375rem 0.75rem;
    margin: 0.25rem 0.25rem 0.25rem 0;
    font-size: 0.925rem;
    font-weight: 500;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove {
    color: #a1a5b7;
    margin-right: 0.5rem;
    font-weight: bold;
    float: left;
    cursor: pointer;
}

.select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #f1416c;
}

/* Dla dark mode */
[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice {
    background-color: #1e1e2d;
    border-color: #2b2b40;
    color: #92929f;
}

[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove {
    color: #565674;
}

[data-bs-theme="dark"] .select2-container--bootstrap5 .select2-selection--multiple .select2-selection__choice__remove:hover {
    color: #f1416c;
}

.global-search-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.global-search-toggle.btn-primary {
    box-shadow: 0 0 0 3px rgba(80, 165, 241, 0.2);
}

/* Adjust search input padding when button is present */
[data-kt-filemanager-table-filter="search"] {
    padding-right: 50px !important;
}

/* Make parent position relative */
.d-flex.align-items-center.position-relative {
    position: relative !important;
}

.file-name-truncate {
    display: block; /* musi być blok */
    max-width: 100%; /* nie wychodzimy poza kontener */
    overflow: hidden; /* obetnij nadmiar */
    white-space: nowrap; /* bez zawijania */
    text-overflow: ellipsis; /* dodaj "..." */
}

/* Baza – spójne z ikonami Quilla */
.ql-toolbar .ql-attach .ql-ki-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    /* Metronic-like smoothness */
    transition:
        transform .18s ease,
        color .18s ease,
        filter .18s ease,
        opacity .18s ease;
    opacity: .85;
}

/* Duotone – bazowy kolor z tekstu toolbara */
.ql-toolbar .ql-attach .ql-ki-icon .path1,
.ql-toolbar .ql-attach .ql-ki-icon .path2 {
    transition: fill .18s ease, stroke .18s ease;
}

/* Hover – Metronic vibe: lekki zoom, podbity kolor, delikatny glow */
.ql-toolbar .ql-attach:hover .ql-ki-icon {
    transform: scale(1.12) translateY(-1px);
    opacity: 1;
    color: var(--bs-primary); /* Metronicowa zmienna */
    filter: drop-shadow(0 0 4px rgba(59, 125, 221, 0.45)); /* delikatny glow */
}

/* Jeśli chcesz też podbić duotone ścieżki pod primary */
.ql-toolbar .ql-attach:hover .ql-ki-icon .path1,
.ql-toolbar .ql-attach:hover .ql-ki-icon .path2 {
    fill: var(--bs-primary);
    stroke: var(--bs-primary);
}

/* Focus via klawiatura – bardziej dostępne */
.ql-toolbar .ql-attach:focus-visible .ql-ki-icon {
    outline: none;
    transform: scale(1.12) translateY(-1px);
    filter: drop-shadow(0 0 4px rgba(59, 125, 221, 0.7));
}

/* 1) BAZA: wszystkie przyciski w toolbarze Quilla */
.ql-toolbar button {
    position: relative;
    transition:
        background-color .18s ease,
        color .18s ease,
        box-shadow .18s ease;
    outline: none;
}

/* 2) BAZA IKON: Quill SVG + nasza KI-ikonka – rozmiar + smooth animacja */
.ql-toolbar button svg,
.ql-toolbar button .ql-ki-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 18px;

    transition:
        transform .18s ease,
        filter .18s ease,
        opacity .18s ease;
    opacity: .85;
}

/* 3) Kolory wewnątrz SVG Quilla – stroke/fill */
/* Quill standardowo używa klas .ql-stroke, .ql-fill itd. */
.ql-toolbar button .ql-stroke {
    stroke: currentColor;
    transition: stroke .18s ease;
}

.ql-toolbar button .ql-fill {
    fill: currentColor;
    transition: fill .18s ease;
}

/* 4) Bazowy kolor ikon – szary jak w Metronicu */
.ql-toolbar {
    color: #7e8299; /* możesz spiąć z jakąś zmienną Metronica, np. var(--bs-gray-600) */
}

/* 5) HOVER / FOCUS – efekt Metronic-like dla WSZYSTKICH klawiszy */
.ql-toolbar button:hover svg,
.ql-toolbar button:hover .ql-ki-icon,
.ql-toolbar button:focus-visible svg,
.ql-toolbar button:focus-visible .ql-ki-icon {
    transform: scale(1.12) translateY(-1px);
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(59, 125, 221, 0.45)); /* delikatny glow */
}

/* 6) Zmiana koloru na primary przy hover/focus */
.ql-toolbar button:hover,
.ql-toolbar button:focus-visible {
    color: var(--bs-primary);
}

/* Duotone KI – jeśli chcesz, żeby oba pathy też się podbarwiały */
.ql-toolbar button:hover .ql-ki-icon .path1,
.ql-toolbar button:hover .ql-ki-icon .path2,
.ql-toolbar button:focus-visible .ql-ki-icon .path1,
.ql-toolbar button:focus-visible .ql-ki-icon .path2 {
    fill: var(--bs-primary);
    stroke: var(--bs-primary);
}

/* 7) Aktywny przycisk (np. bold włączony) – lekko podkreślony */
.ql-toolbar button.ql-active {
    color: var(--bs-primary);
}

.ql-toolbar button.ql-active svg,
.ql-toolbar button.ql-active .ql-ki-icon {
    opacity: 1;
}

/* 8) Extra: konkretnie attach (możesz, ale nie musisz zostawiać – ujednoliciliśmy resztę) */
.ql-toolbar .ql-attach .ql-ki-icon {
    font-size: 18px;
}

.text-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ellipsis-2-lines {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-attachment {
    overflow: hidden;              /* nic nie wyjdzie poza szary box */
}

.note-attachment-name {
    display: block;
    max-width: calc(100% - 0.5rem);  /* ✨ obcinamy ~8px przed krawędzią */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Filters button badge */
.filter-count-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.5rem;
    min-width: 1.5rem;
    font-weight: 600;
}

/* Mobile */
@media (max-width: 767px) {
    .filter-count-badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
        min-width: 1.25rem;
    }
}