/* Moderní tabulky sdílejí layout; nativní Nette pole zůstávají zdrojem hodnot. */
/* Nápověda přímo na popisku používá společnou bublinu, bez ikony a nativního title. */
.bsd-filter-label { position: relative; display: inline-block; cursor: help; }
.bsd-filter-label:focus-visible { outline: 1px dotted #668aa5; outline-offset: 2px; }
.bsd-filter-label .bsd-filter-label__tooltip {
    left: 0; min-width: 0; width: min(320px, calc(100vw - 32px)); max-width: none;
    box-sizing: border-box; text-align: left; font-weight: 400;
    transform: translateY(4px) scale(.95); transform-origin: bottom left;
}
.bsd-filter-label .bsd-filter-label__tooltip::before,
.bsd-filter-label .bsd-filter-label__tooltip::after { left: 20px; }
.bsd-filter-label:is(:hover, :focus) .bsd-filter-label__tooltip {
    opacity: 1; visibility: visible; transform: translateY(0) scale(1); transition-delay: 800ms;
}

.entity-table > .filters {
    --multiselect-accent: var(--entity-table-accent, var(--hn-table-header-background-color));
    --filter-border: #cbd3de;
    color: var(--hn-basic-text-color, #334155);
    font-size: var(--hn-basic-text-size, 14px);
}
.entity-table > .filters[data-checkbox-filters]:not(.is-opened) > form { display: none; }
.entity-table > .filters.is-opened:not(.column-filter-open) { padding: 0; box-shadow: 0 1px 3px #23303c0a; }
.entity-table > .filters.is-opened:not(.column-filter-open) > form {
    max-height: none; overflow: visible; padding: 12px; box-sizing: border-box; transition: none;
}
.entity-table > .filters:not(.column-filter-open) form > fieldset {
    margin: 0 0 12px; padding: 0; min-width: 0; border: 0; border-radius: 0;
}
.entity-table > .filters:not(.column-filter-open) form > fieldset > legend {
    width: 100%; box-sizing: border-box; margin: 0 0 9px; padding: 0 0 6px;
    background: transparent !important; color: inherit !important; line-height: 1.4;
    font: inherit; font-weight: 600;
    border-bottom: 1px solid color-mix(in srgb, var(--multiselect-accent) 24%, #e2e8ef);
}
.entity-table > .filters:not(.column-filter-open) tbody {
    display: grid !important; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
    gap: 10px 14px; align-items: start;
}
.entity-table > .filters:not(.column-filter-open) tr {
    width: 100%; min-width: 0; max-width: none; gap: 5px;
}
.entity-table > .filters th {
    color: inherit; font: inherit; font-weight: 500; line-height: 1.3; text-align: left;
}
.entity-table > .filters td { min-width: 0; padding: 0; }
.entity-table > .filters select[hidden] { display: none !important; }
.entity-table > .filters :is(input[type=text], input[type=number], input[type=date], input[type=search], select),
.entity-table > .filters .multiselect-checkbox__trigger,
.entity-table > .filters .select2-container .select2-selection--single {
    width: 100% !important; min-width: 0 !important; max-width: none !important;
    min-height: 34px !important; height: 34px !important; box-sizing: border-box;
    margin: 0; padding: 6px 10px !important; border: 1px solid var(--filter-border) !important;
    border-radius: 2px !important; background: #f8fafc !important; color: inherit;
    font: inherit !important; line-height: 20px !important;
}
.entity-table > .filters select,
.entity-table > .filters .multiselect-checkbox__trigger { padding-right: 30px !important; }
.entity-table > .filters .select2-container { width: 100% !important; max-width: 100%; }
.entity-table > .filters .select2-selection--single .select2-selection__rendered,
.invoice-section-form #invoice-vazba-entity-wrapper .select2-selection__rendered {
    padding: 0 20px 0 0 !important; color: inherit; font: inherit; line-height: 20px !important;
    background: transparent !important;
}
.entity-table > .filters .select2-selection--single .select2-selection__arrow { height: 32px; right: 7px; }
.entity-table > .filters :is(input, select, button):focus-visible,
.entity-table > .filters .select2-container--focus .select2-selection {
    outline: none; box-shadow: 0 0 0 3px rgba(75, 143, 226, 0.2);
}
.entity-table > .filters .multiselect-checkbox { position: relative; }
/* Otevřený multiselect má stejný světle modrý efekt jako otevřený select (filterForm.css) */
.entity-table > .filters .multiselect-checkbox__trigger[aria-expanded=true] {
    box-shadow: 0 0 0 3px rgba(75, 143, 226, 0.2);
}
.entity-table > .filters .multiselect-checkbox__menu {
    position: absolute; left: 0; right: 0; z-index: 40; max-height: 260px;
    border-radius: 2px; font: inherit; background: #fff;
}
.entity-table > .filters .multiselect-checkbox__menu label {
    font: inherit; padding: 6px 8px; min-height: 30px;
}
.entity-table > .filters .multiselect-checkbox__menu label:is(:hover, :focus-within) {
    background: color-mix(in srgb, var(--multiselect-accent) 10%, #fff);
}
.entity-table > .filters .multiselect-checkbox__menu [hidden] { display: none !important; }
.entity-table > .filters .multiselect-checkbox__menu input[type=checkbox] {
    width: 100%; min-width: 0; max-width: none; height: 100%;
}
/* Obecné pravidlo pro vstupy filtrů přebíjí sdílené pole hledání; v nabídce musí zůstat přes celou šířku bez ohraničení a mezer. */
.entity-table > .filters .multiselect-checkbox__menu > .multiselect-checkbox__search {
    min-height: 40px !important; height: 40px !important; margin: 0; padding: 0 12px !important;
    border: 0 !important; border-bottom: 1px solid #d7dfe9 !important; border-radius: 0 !important;
    background: #fff !important;
}
.multiselect-checkbox__group, .multiselect-checkbox__empty { padding: 7px 8px; font-size: inherit; }
.multiselect-checkbox__group { font-weight: 600; border-bottom: 1px solid #e2e8f0; }
.entity-table > .filters:not(.column-filter-open) :is(table, tbody):has(.filter-button) {
    display: block !important; width: 100%;
}
.entity-table > .filters:not(.column-filter-open) tr:has(.filter-button) { width: 100%; max-width: none !important; }
.entity-table > .filters:not(.column-filter-open) td:has(.filter-button) {
    display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px;
    border-top: 1px solid #e2e8ef; padding-top: 10px;
}
.entity-table > .filters .filter-button {
    min-width: 125px !important; min-height: 34px; margin: 0;
    border: 1px solid var(--action-button-color); border-radius: 2px;
    background: var(--action-button-color); color: #fff; font: inherit;
}
.entity-table > .filters .filter-button-reset {
    background: #f8fafc; color: inherit; border-color: var(--filter-border);
}
.entity-table > .filters.column-filter-open .multiselect-checkbox__menu { position: static; }
@media (max-width: 650px) {
    .entity-table > .filters.is-opened:not(.column-filter-open) > form { padding: 10px; }
    .entity-table > .filters:not(.column-filter-open) tbody { grid-template-columns: 1fr; }
    .entity-table > .filters:not(.column-filter-open) td:has(.filter-button) { justify-content: stretch; }
    .entity-table > .filters:not(.column-filter-open) .filter-button { flex: 1; min-width: 0 !important; }
}

/* Sjednocená tlačítka křížku pro vymazání filtru */
.filters .filter-input-wrapper {
    position: relative;
    width: 100%;
}
.filters .filter-clear-button,
.filters .litepicker-clear-button,
.invoice-section-form #invoice-vazba-entity-wrapper .select2-selection__clear {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #64748b;
    padding: 0;
    margin: 0;
    z-index: 2;
    transition: color 0.15s ease;
}
.filters .filter-clear-button:hover,
.filters .litepicker-clear-button:hover,
.invoice-section-form #invoice-vazba-entity-wrapper .select2-selection__clear:hover {
    color: #0f172a;
}
.filters .filter-input-wrapper .filter-clear-button,
.filters .litepicker-input-wrapper .litepicker-clear-button {
    right: 8px;
}
.filters .multiselect-checkbox .filter-clear-button {
    right: 28px;
}
.filters .select2-selection--single .filter-clear-button,
.filters .filter-input-wrapper .select-native-clear-button,
.invoice-section-form #invoice-vazba-entity-wrapper .select2-selection__clear {
    right: 26px;
}
.filters .filter-input-wrapper input {
    padding-right: 32px !important;
}
.filters .multiselect-checkbox__trigger {
    padding-right: 48px !important;
}
.filters .select2-selection--single .select2-selection__rendered,
.invoice-section-form #invoice-vazba-entity-wrapper .select2-selection__rendered {
    padding-right: 44px !important;
}
.filters .filter-input-wrapper select {
    padding-right: 44px !important;
}


/* Panel filtrů přebírá barvy z akcentu tabulky (--table-accent-* v tables.css) */
.entity-table > .filters {
    --filter-border: var(--table-accent-border-strong, #cbd3de);
}
.entity-table > .filters.is-opened:not(.column-filter-open) {
    border: 1px solid var(--table-accent-border, #e2e8ef); border-radius: 2px; background: #fff;
}
.entity-table > .filters :is(input[type=text], input[type=number], input[type=date], input[type=search], select),
.entity-table > .filters .multiselect-checkbox__trigger,
.entity-table > .filters .select2-container .select2-selection--single {
    background: var(--table-accent-soft, #f8fafc) !important;
}
.entity-table > .filters:not(.column-filter-open) form > fieldset > legend {
    color: var(--table-accent-dark, inherit) !important;
    border-bottom-color: var(--table-accent-border, #e2e8ef);
}
.entity-table > .filters .filter-button:not(.filter-button-reset) {
    background: var(--table-accent); border-color: var(--table-accent);
}
.entity-table > .filters .filter-button:not(.filter-button-reset):hover {
    background: var(--table-accent-dark); border-color: var(--table-accent-dark);
}
.entity-table > .filters .filter-button-reset {
    background: #fff; border-color: var(--table-accent-border-strong); color: var(--table-accent-dark);
}
.entity-table > .filters .filter-button-reset:hover { background: var(--table-accent-tint); }
.entity-table > .filters:not(.column-filter-open) td:has(.filter-button) { border-top-color: var(--table-accent-border); }

/* Spodní lišta panelu filtrů (tlačítka) je ve světlé barvě akcentu přes celou šířku panelu */
.entity-table > .filters:not(.column-filter-open) td:has(.filter-button) {
    margin: 0 -12px -12px; padding: 10px 12px; background: var(--table-accent-tint);
    border-top: 1px solid var(--table-accent-border);
}

/* Potvrzovací tlačítko (Filtrovat data) je vpravo, Resetovat filtry vlevo od něj; pořadí v DOM zůstává pro klávesnici */
.entity-table > .filters:not(.column-filter-open) td:has(.filter-button) {
    flex-direction: row-reverse; justify-content: flex-start;
}
