/* Read-only list filters: two full-size horizontal rows at every breakpoint. */
/* Scope is the long report panel, not a filter-height wrapper or scroll box. */
body.workspace-page [data-report-sticky-scope] {
    overflow: visible; animation: none; transform: none;
}
body.workspace-page [data-report-sticky-filters] {
    position: sticky; top: var(--report-filter-sticky-top, 8px); z-index: 35;
    min-width: 0; max-width: 100%; overflow: visible;
    background: var(--surface); box-shadow: 0 4px 12px rgb(0 0 0 / .08);
    animation: none; transform: none;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] {
    display: flex !important; flex-direction: column !important; align-items: stretch !important;
    gap: 6px !important; min-width: 0; max-width: 100%;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters]:is([hidden], .catalog-filter-empty-form) { display: none !important; }
body:is(.workspace-page, .admin-portal-page) .report-filter-row {
    display: flex; flex-wrap: nowrap; align-items: end; gap: 7px;
    min-width: 0; width: 100%; max-width: 100%; padding: 2px 1px 4px;
    margin: 0; overflow-x: auto; overscroll-behavior-inline: contain;
    scrollbar-width: thin; scroll-padding-inline: 8px;
}
.report-filter-row:empty { display: none !important; }
.report-filter-row > * { flex-shrink: 0; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-filter-grid, .catalog-period-controls, .product-store-filter-pair,
    [data-finance-catalog-row], [data-finance-period-row], [data-finance-extra-row]
) { display: contents !important; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-filter-field, label:not(:has(input[type=checkbox], input[type=radio]))
) {
    display: flex; flex-direction: column; flex: 0 0 170px;
    width: 170px; min-width: 170px; max-width: none; gap: 3px; margin: 0 !important;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row-primary .catalog-filter-field { flex-grow: 1; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not(.catalog-month-native), select, .catalog-month-trigger
) { box-sizing: border-box; height: 32px !important; min-height: 32px !important; font-size: 12px; }
form[data-report-filters] .catalog-filter-input { padding-block: 5px !important; }
form[data-report-filters] .catalog-filter-clear { height: 29px; top: 1px; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-period-modes, .catalog-finance-period-modes, .catalog-period-buttons,
    .stock-valuation-toggles, .orders-filter-actions, .stocks-filter-actions,
    .dynamics-filter-actions, .advertising-filter-actions, .feedback-filter-actions,
    .product-filter-actions, .demand-filter-actions, .ozon-ad-filter-actions, [data-finance-action-row]
) {
    display: flex !important; flex-direction: row !important; flex-wrap: nowrap !important;
    align-items: end; align-self: end !important; flex: 0 0 auto; gap: 6px; width: auto !important;
    min-width: max-content; margin: 0; padding-top: 0;
}
form[data-report-filters] .report-filter-row :is(.button, button[type=submit]) {
    flex: 0 0 auto; width: auto; min-height: 32px; white-space: nowrap;
}
form[data-report-filters] :is(.catalog-period-modes, .catalog-finance-period-modes) { align-self: end; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row .catalog-finance-period-modes {
    flex-direction: column !important; align-items: stretch; gap: 3px;
}
form[data-report-filters] .catalog-filter-status { flex: 0 0 auto; max-width: 300px; margin: 0; }
form[data-report-filters] .stock-valuation-toggles > label { flex: 0 0 290px; min-width: 290px; }
form[data-report-filters] .stock-valuation-toggles > .stock-value-toggle { box-sizing: border-box; height: 32px; min-height: 32px; padding: 0 6px; align-items: center; }
form[data-report-filters] .stock-value-toggle :is(b, small) { display: block; white-space: nowrap; line-height: 1.15; }
form[data-report-filters] .stock-value-toggle b { font-size: 11px; }
form[data-report-filters] .stock-value-toggle small { font-size: 10px; }
form[data-report-filters] .dynamics-mode { flex: 0 0 170px; min-width: 170px; }
form[data-report-filters] .dynamics-mode .segmented span { box-sizing: border-box; min-height: 32px; height: 32px; }
form[data-report-filters] :is(.warehouse-picker, .product-picker) { flex: 0 0 170px; width: 170px; }
.report-filter-popup {
    position: fixed !important; box-sizing: border-box; margin: 0;
    max-width: calc(100vw - 24px); overflow: auto; overscroll-behavior: contain; z-index: 1300;
}
/* Multiple original form owners share the same two visual rows, never nesting forms. */
[data-report-filter-host] { display: grid; grid-template-columns: minmax(0, 40%) minmax(0, 1fr); grid-template-rows: auto auto; gap: 6px 8px; min-width: 0; }
body:is(.workspace-page, .admin-portal-page) [data-report-filter-host] > form[data-report-filters] { display: contents !important; }
[data-report-filter-host] > form > .report-filter-row-primary { grid-column: 1 / -1; grid-row: 1; }
[data-report-filter-host] > form > .report-filter-row-secondary { grid-column: 2; grid-row: 2; }
[data-report-filter-host] > .stocks-view-toolbar {
    grid-column: 1; grid-row: 2; display: flex; flex-direction: row !important; flex-wrap: nowrap;
    gap: 8px; min-width: 0; width: 100%; max-width: 100%; overflow-x: auto; margin: 0; padding: 0 0 4px;
}
[data-report-filter-host] .stocks-view-modes { display: flex; flex: 0 0 auto; flex-direction: row !important; flex-wrap: nowrap; width: max-content; }
[data-report-filter-host] .stocks-view-modes a { white-space: nowrap; }
[data-report-filter-host] .stocks-slice-form { flex: 0 0 170px; min-width: 170px; }
body.workspace-page .dashboard-toolbar[data-report-dashboard] {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: auto auto;
    box-sizing: border-box; gap: 6px 8px; min-width: 0; max-width: 100%;
    margin: 3px 0 16px; padding: 12px 14px; overflow: visible;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); animation: none; transform: none;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] > form[data-report-filters] { display: contents !important; }
body.workspace-page .dashboard-toolbar[data-report-dashboard] > form.dashboard-marketplace-filters:not([data-report-filters]) {
    grid-column: 1 / -1; grid-row: 1; width: 100%; min-width: 0;
}
/* Outrank the legacy overview grid, including its narrow-screen row overrides. */
body.workspace-page .dashboard-toolbar[data-report-dashboard] .report-filter-row-primary { grid-column: 1 / -1; grid-row: 1; }
body.workspace-page .dashboard-toolbar[data-report-dashboard] .report-filter-row-secondary { grid-column: 2; grid-row: 2; width: auto; }
body.workspace-page .dashboard-toolbar[data-report-dashboard] > .dashboard-period-controls {
    grid-column: 1; grid-row: 2; display: flex; flex-direction: row; flex-wrap: nowrap;
    align-items: center; align-self: end; min-width: 0; max-width: 100%; overflow-x: auto;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] .period-tabs {
    box-sizing: border-box; width: max-content; height: 32px; min-height: 32px;
    padding: 2px; flex-wrap: nowrap; flex: 0 0 auto; max-width: none;
    background: var(--soft); border: 1px solid var(--line); border-radius: 8px;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] .period-tabs a {
    box-sizing: border-box; height: 26px; min-height: 26px; padding: 0 10px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 11px; line-height: 1.2;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] .dashboard-custom-period { flex: 0 0 auto; }
body.workspace-page .dashboard-toolbar[data-report-dashboard] .dashboard-custom-period > summary {
    box-sizing: border-box; height: 32px; min-height: 32px; max-height: 32px;
    padding: 0 10px; border-radius: 8px; font-size: 12px;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] .dashboard-custom-period form { gap: 7px; }
body.workspace-page .dashboard-toolbar[data-report-dashboard] .dashboard-custom-period label {
    display: flex; flex-direction: column; gap: 3px; margin: 0;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] .dashboard-custom-period label > span {
    box-sizing: border-box; height: 14px; min-height: 14px; margin: 0;
    font-size: 11px; line-height: 14px; font-weight: 700;
    text-transform: none; letter-spacing: normal; white-space: nowrap;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] .dashboard-custom-period :is(input, .button) {
    box-sizing: border-box; height: 32px; min-height: 32px; margin: 0;
}
body.workspace-page .dashboard-toolbar[data-report-dashboard] > .sync-note { grid-column: 3; grid-row: 2; max-width: 160px; align-self: center; font-size: 11px; }
body.finance-page [data-finance-sticky-filters]:has([data-report-filters]) { max-height: none; overflow: visible; }
@media (max-width: 700px) {
    body.finance-page [data-finance-sticky-filters]:has([data-report-filters]) { max-height: none; overflow: visible; }
    body.workspace-page .dashboard-toolbar[data-report-dashboard] > .sync-note { max-width: 105px; }
}

/* One set of control and caption dimensions for every list/report filter. */
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] {
    --report-control-height: 32px; --report-caption-height: 14px; --report-field-gap: 3px;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-filter-field, label:not(:has(input[type=checkbox], input[type=radio])), .catalog-finance-period-modes
) { gap: var(--report-field-gap) !important; justify-content: flex-start; align-self: end; line-height: var(--report-caption-height); }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row .dynamics-mode {
    display: flex; flex-direction: column; gap: var(--report-field-gap); align-self: end;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-filter-caption, .catalog-period-caption, .dynamics-mode > span:first-child,
    label:not(:has(input[type=checkbox], input[type=radio])) > span:first-child:not(.catalog-month):not(.mp-select)
) {
    display: block; box-sizing: border-box; height: var(--report-caption-height);
    min-height: var(--report-caption-height); margin: 0 !important; padding: 0;
    font-size: 11px; line-height: var(--report-caption-height); font-weight: 700;
    text-transform: none; letter-spacing: normal; white-space: nowrap;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    input:not([type=hidden]):not([type=checkbox]):not([type=radio]):not(.catalog-month-native),
    select, .catalog-month-trigger, .mp-select-trigger, .filter-multiselect-trigger, .catalog-period-buttons,
    .warehouse-picker > summary, .product-picker > summary, .rnp-metric-picker > summary,
    .catalog-period-modes:not(.catalog-finance-period-modes)
) {
    box-sizing: border-box; height: var(--report-control-height) !important;
    min-height: var(--report-control-height) !important; max-height: var(--report-control-height);
    margin-block: 0 !important; font-size: 12px;
}
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-month-trigger, .filter-multiselect-trigger
) { padding-block: 0; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-filter-input-wrap, .catalog-month, .mp-select, .filter-multiselect
) { height: var(--report-control-height); min-height: var(--report-control-height); margin: 0 !important; padding-block: 0; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-period-buttons, .catalog-period-modes:not(.catalog-finance-period-modes)
) { padding: 2px; align-items: center; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(
    .catalog-period-buttons button, .catalog-period-modes:not(.catalog-finance-period-modes) > button
) { box-sizing: border-box; height: calc(var(--report-control-height) - 6px); min-height: 0; padding-block: 0; line-height: 1.2; }
body:is(.workspace-page, .admin-portal-page) form[data-report-filters] .report-filter-row :is(.button, button[type=submit]) {
    box-sizing: border-box; height: var(--report-control-height); min-height: var(--report-control-height);
    margin-block: 0; padding-block: 0; display: inline-flex; align-items: center; justify-content: center;
}

/* Disclosure never disables, clones or removes an original field. */
.report-filter-toggle-bar { display: flex; justify-content: flex-end; align-items: center; min-width: 0; width: 100%; margin: 0; }
.report-filter-toggle {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-height: 24px; padding: 2px 6px; margin: 0; border: 0; border-radius: 5px;
    font: inherit; font-size: 12px; line-height: 1.25; color: var(--muted); background: transparent; cursor: pointer;
}
.report-filter-toggle::before { content: '⌃'; font-size: 15px; line-height: 1; }
.report-filter-toggle[aria-expanded="false"]::before { transform: rotate(180deg); }
.report-filter-toggle:hover { color: var(--primary); background: var(--primary-soft); }
.report-filter-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
body:is(.workspace-page, .admin-portal-page) [data-report-filter-disclosure][data-report-filter-collapsed="true"] { display: block !important; }
body:is(.workspace-page, .admin-portal-page) [data-report-filter-disclosure][data-report-filter-collapsed="true"] > :not([data-report-filter-toggle-bar]) { display: none !important; }
[data-report-filter-host][data-report-filter-disclosure] { grid-template-rows: auto auto auto; }
[data-report-filter-host][data-report-filter-disclosure] > .report-filter-toggle-bar { grid-column: 1 / -1; grid-row: 1; }
[data-report-filter-host][data-report-filter-disclosure] > form > .report-filter-row-primary { grid-row: 2; }
[data-report-filter-host][data-report-filter-disclosure] > form > .report-filter-row-secondary,
[data-report-filter-host][data-report-filter-disclosure] > .stocks-view-toolbar { grid-row: 3; }
body.workspace-page .dashboard-toolbar[data-report-dashboard][data-report-filter-disclosure] { grid-template-rows: auto auto auto; }
body.workspace-page .dashboard-toolbar[data-report-dashboard][data-report-filter-disclosure] > .report-filter-toggle-bar { grid-column: 1 / -1; grid-row: 1; }
body.workspace-page .dashboard-toolbar[data-report-dashboard][data-report-filter-disclosure] .report-filter-row-primary { grid-row: 2; }
body.workspace-page .dashboard-toolbar[data-report-dashboard][data-report-filter-disclosure] .report-filter-row-secondary,
body.workspace-page .dashboard-toolbar[data-report-dashboard][data-report-filter-disclosure] > .dashboard-period-controls,
body.workspace-page .dashboard-toolbar[data-report-dashboard][data-report-filter-disclosure] > .sync-note { grid-row: 3; }
