/* ==========================================================
   FeedPP — Admin Design System
   Django + Unfold | Light / Dark | Responsive
   Replace the existing static/css/feedpp-admin.css with this file.
   ========================================================== */

/* 1. Design tokens */
:root {
    color-scheme: light;
    --fp-accent: #7548e8;
    --fp-accent-hover: #6235d5;
    --fp-accent-soft: #f1ebff;
    --fp-focus-ring: rgb(117 72 232 / 18%);
    --fp-page: #f6f7fb;
    --fp-surface: #ffffff;
    --fp-surface-soft: #fafaff;
    --fp-surface-hover: #f5f3fc;
    --fp-border: #e5e7ef;
    --fp-border-strong: #cfd4e2;
    --fp-text: #202437;
    --fp-text-secondary: #596277;
    --fp-text-muted: #81899c;
    --fp-success: #16845b;
    --fp-warning: #a76408;
    --fp-danger: #c9364b;
    --fp-radius-sm: 7px;
    --fp-radius-md: 10px;
    --fp-radius-lg: 14px;
    --fp-shadow-sm: 0 1px 2px rgb(20 26 45 / 5%);
    --fp-shadow-md: 0 5px 18px rgb(20 26 45 / 6%);
    --fp-control-height: 42px;
}

.dark {
    color-scheme: dark;
    --fp-accent: #a991ff;
    --fp-accent-hover: #c0b0ff;
    --fp-accent-soft: #2b2342;
    --fp-focus-ring: rgb(169 145 255 / 23%);
    --fp-page: #0f1420;
    --fp-surface: #171e2b;
    --fp-surface-soft: #1b2433;
    --fp-surface-hover: #222d40;
    --fp-border: #2b3548;
    --fp-border-strong: #414d63;
    --fp-text: #edf0f8;
    --fp-text-secondary: #b0bacd;
    --fp-text-muted: #8995ab;
    --fp-success: #5bd6a1;
    --fp-warning: #f5bd68;
    --fp-danger: #ff8b98;
    --fp-shadow-sm: 0 1px 2px rgb(0 0 0 / 18%);
    --fp-shadow-md: 0 5px 20px rgb(0 0 0 / 18%);
}

/* 2. Base / typography */
html { scroll-behavior: smooth; }
body {
    background: var(--fp-page);
    color: var(--fp-text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
body, #container, #content, #content-main { min-width: 0; }
#container, .dark #container { background: var(--fp-page); }
h1, h2, h3, h4 { color: var(--fp-text); letter-spacing: -0.02em; }
h1, h2 { font-weight: 700; }
label, .aligned label { color: var(--fp-text); font-weight: 550; }
p, .help, .helptext, p.help, .form-row .help, .form-row .helptext,
fieldset .description, .help-tooltip { line-height: 1.6; }
.help, .helptext, p.help, .form-row .help, .form-row .helptext,
fieldset .description { color: var(--fp-text-secondary); font-size: .8125rem; }
::selection { background: var(--fp-accent-soft); color: var(--fp-text); }

/* 3. Page surfaces, cards and fieldsets */
fieldset, .module {
    border-color: var(--fp-border) !important;
    border-radius: var(--fp-radius-lg) !important;
}
fieldset { margin-bottom: 18px; }
fieldset > h2, fieldset > legend { font-weight: 650; letter-spacing: -.015em; }
.module, .dashboard .module { box-shadow: var(--fp-shadow-sm); }
.form-row { border-bottom-color: var(--fp-border) !important; }
.form-row:last-child { border-bottom: 0; }
.aligned .form-row { gap: 10px 22px; }
.aligned .form-row > div { min-width: 0; }

/* 4. Unified text, numeric, date and multiline controls.
   Exclude Unfold's own search input: it is styled separately below. */
#content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not(#searchbar),
#content select,
#content textarea,
#content form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not(#searchbar),
#content form select,
#content form textarea {
    box-sizing: border-box !important;
    min-width: 0;
    min-height: var(--fp-control-height) !important;
    padding: 9px 12px !important;
    border: 1px solid var(--fp-border-strong) !important;
    border-radius: var(--fp-radius-md) !important;
    background-color: var(--fp-surface) !important;
    color: var(--fp-text) !important;
    -webkit-text-fill-color: var(--fp-text);
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.45 !important;
    box-shadow: none !important;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease !important;
}
#content textarea, #content form textarea {
    min-height: 112px !important;
    padding: 11px 12px !important;
    resize: vertical;
}
#content input[type="file"], #content form input[type="file"] {
    max-width: 100%;
    color: var(--fp-text-secondary);
    font-size: 13px;
}
#content input::placeholder, #content textarea::placeholder,
#content form input::placeholder, #content form textarea::placeholder {
    color: var(--fp-text-muted) !important;
    -webkit-text-fill-color: var(--fp-text-muted);
    opacity: 1 !important;
}
#content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not(#searchbar):hover,
#content select:hover, #content textarea:hover,
#content form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not(#searchbar):hover,
#content form select:hover, #content form textarea:hover {
    border-color: var(--fp-accent) !important;
}
#content input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not(#searchbar):focus,
#content select:focus, #content textarea:focus,
#content form input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="hidden"]):not([type="file"]):not([type="image"]):not(#searchbar):focus,
#content form select:focus, #content form textarea:focus {
    outline: none !important;
    border-color: var(--fp-accent) !important;
    box-shadow: 0 0 0 3px var(--fp-focus-ring) !important;
}
#content input:disabled, #content select:disabled, #content textarea:disabled,
#content form input:disabled, #content form select:disabled, #content form textarea:disabled {
    opacity: .58 !important;
    cursor: not-allowed !important;
    background-color: var(--fp-page) !important;
}
#content select, #content form select {
    max-width: 100%;
    padding-right: 36px !important;
    cursor: pointer;
}
#content select option, #content form select option {
    background: var(--fp-surface);
    color: var(--fp-text);
}
#content select[multiple], #content form select[multiple] {
    min-height: 120px !important;
    padding: 6px !important;
}
#content select[multiple] option, #content form select[multiple] option { padding: 7px 9px; }

/* 5. Search bars — one visible border, no nested-input border */
#changelist-search { max-width: 100%; }
#changelist-search > div {
    box-sizing: border-box !important;
    min-height: 48px !important;
    padding: 4px 10px !important;
    border: 1px solid var(--fp-border) !important;
    border-radius: 12px !important;
    background: var(--fp-surface) !important;
    box-shadow: var(--fp-shadow-sm) !important;
    transition: border-color 150ms ease, box-shadow 150ms ease !important;
}
#changelist-search > div:focus-within {
    border-color: var(--fp-accent) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px var(--fp-focus-ring) !important;
}
#changelist-search #searchbar {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    border: 0 !important;
    border-radius: 7px !important;
    outline: none !important;
    background: transparent !important;
    color: var(--fp-text) !important;
    -webkit-text-fill-color: var(--fp-text);
    box-shadow: none !important;
    font: inherit !important;
}
#changelist-search #searchbar:focus { border: 0 !important; box-shadow: none !important; }
#changelist-search button { border: 0 !important; box-shadow: none !important; background: transparent !important; }
#changelist-search kbd {
    border-color: var(--fp-border) !important;
    border-radius: 5px !important;
    background: var(--fp-page) !important;
    color: var(--fp-text-secondary) !important;
}

/* Sidebar search: input is transparent; wrapper owns the border */
#nav-filter {
    box-sizing: border-box !important;
    width: 100%;
    min-width: 0 !important;
    min-height: 38px !important;
    padding: 7px 9px !important;
    border: 0 !important;
    border-radius: 7px !important;
    outline: none !important;
    background: transparent !important;
    color: var(--fp-text) !important;
    -webkit-text-fill-color: var(--fp-text);
    box-shadow: none !important;
    font: inherit !important;
}
#nav-filter::placeholder { color: var(--fp-text-muted) !important; -webkit-text-fill-color: var(--fp-text-muted); }
#nav-filter:focus { border: 0 !important; outline: none !important; box-shadow: none !important; }
/* Modern browsers: focus the containing search field, not the input twice. */
div:has(> #nav-filter) {
    border-radius: 10px !important;
    transition: border-color 150ms ease, box-shadow 150ms ease !important;
}
div:has(> #nav-filter):focus-within {
    border-color: var(--fp-accent) !important;
    box-shadow: 0 0 0 3px var(--fp-focus-ring) !important;
}

/* 6. Checkboxes and radios */
#content input[type="checkbox"], #content input[type="radio"],
#content form input[type="checkbox"], #content form input[type="radio"] {
    accent-color: var(--fp-accent) !important;
    cursor: pointer;
}
#content input[type="checkbox"]:focus-visible, #content input[type="radio"]:focus-visible,
#content form input[type="checkbox"]:focus-visible, #content form input[type="radio"]:focus-visible {
    outline: 2px solid var(--fp-accent) !important;
    outline-offset: 2px !important;
}

/* 7. Buttons: preserve Unfold color utilities while standardizing shape */
#content button, #content input[type="submit"], #content input[type="button"],
#content input[type="reset"], #content .button, #content a.button,
#content [role="button"], #content form button, #content form input[type="submit"] {
    box-sizing: border-box;
    border-radius: 9px !important;
    font-family: inherit !important;
    font-weight: 600 !important;
    transition: box-shadow 150ms ease, border-color 150ms ease, filter 150ms ease, transform 100ms ease !important;
}
#content button:focus-visible, #content input[type="submit"]:focus-visible,
#content input[type="button"]:focus-visible, #content .button:focus-visible,
#content a.button:focus-visible, #content [role="button"]:focus-visible {
    outline: 3px solid var(--fp-focus-ring) !important;
    outline-offset: 2px !important;
}
#content button:active, #content input[type="submit"]:active,
#content input[type="button"]:active, #content .button:active { transform: translateY(1px); }
#content button:disabled, #content input:disabled, #content .button[aria-disabled="true"] { cursor: not-allowed !important; }

/* 8. Tables and changelist */
#result_list, table { border-color: var(--fp-border); }
#result_list thead th, table thead th { color: var(--fp-text-secondary); font-weight: 650; }
#result_list td, #result_list th, table td, table th { border-color: var(--fp-border); }
#result_list tbody tr, table tbody tr { transition: background-color 120ms ease; }
#result_list tbody tr:hover { background-color: var(--fp-surface-hover); }
#result_list tbody tr:hover td { background-color: transparent; }
#result_list a { color: inherit; }

/* 9. Header status select inserted into table heading */
#result_list thead select,
#result_list th select,
select[name="status"] {
    box-sizing: border-box !important;
    min-height: 40px !important;
    max-width: 100%;
    padding: 8px 34px 8px 12px !important;
    border: 1px solid var(--fp-border-strong) !important;
    border-radius: 10px !important;
    background-color: var(--fp-surface) !important;
    color: var(--fp-text) !important;
    -webkit-text-fill-color: var(--fp-text);
    font-size: 13px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}
#result_list thead select:focus, #result_list th select:focus, select[name="status"]:focus {
    border-color: var(--fp-accent) !important;
    box-shadow: 0 0 0 3px var(--fp-focus-ring) !important;
    outline: none !important;
}

/* 10. Links and keyboard focus */
a { transition: color 120ms ease; }
a:focus-visible { outline: 2px solid var(--fp-accent); outline-offset: 3px; border-radius: 3px; }

/* 11. Messages, tags and validation */
.messagelist li {
    border: 1px solid var(--fp-border) !important;
    border-radius: var(--fp-radius-md) !important;
    line-height: 1.6;
    box-shadow: var(--fp-shadow-sm);
}
.errorlist { color: var(--fp-danger) !important; font-size: .8125rem; }
#content input[aria-invalid="true"], #content select[aria-invalid="true"],
#content textarea[aria-invalid="true"], #content .error input,
#content .error select, #content .error textarea {
    border-color: var(--fp-danger) !important;
}
#content input[aria-invalid="true"]:focus, #content select[aria-invalid="true"]:focus,
#content textarea[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgb(201 54 75 / 15%) !important;
}

/* 12. Dark-mode autofill and native controls */
.dark #content input:-webkit-autofill, .dark #content input:-webkit-autofill:hover,
.dark #content input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--fp-text) !important;
    caret-color: var(--fp-text);
    box-shadow: 0 0 0 1000px var(--fp-surface) inset !important;
    transition: background-color 9999s ease-out;
}
.dark input, .dark textarea { color-scheme: dark; }
/* Не задаємо фон усім формам глобально: Unfold використовує form також
   для фільтрів, пошуку, модальних вікон та службових елементів. */

/* 13. Responsive refinements */
@media (max-width: 768px) {
    .form-row { padding: 13px 12px; }
    .aligned .form-row { display: block; }
    .aligned .form-row > div { width: 100%; }
    #content input:not([type="checkbox"]):not([type="radio"]),
    #content select, #content textarea { max-width: 100%; }
    #changelist-search { width: 100%; }
}

/* 14. Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}



/* Панель масових дій Django Admin / Unfold */
#changelist-form .actions,
#changelist-form .actions label,
#changelist-form .actions .action-counter {
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}

/* Кнопка запуску вибраної дії */
#changelist-form .actions button[type="submit"],
#changelist-form .actions input[type="submit"],
#changelist-form .actions button,
#changelist-form .actions input[type="button"] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    min-height: 38px !important;
    padding: 8px 16px !important;
    border: 1px solid #ffffff !important;
    border-radius: 8px !important;
    background: #ffffff !important;
    color: #7548e8 !important;
    -webkit-text-fill-color: #7548e8 !important;
    font-weight: 700 !important;
    cursor: pointer !important;
}

/* 9. Фіксована панель дій не має перекривати останній рядок списку (його чекбокс) */
#changelist-form {
    padding-bottom: 7rem;
}

/* 10. Колонка «Категорія» у списку товарів */
.fp-cat { display: flex; flex-direction: column; gap: 2px; min-width: 150px; max-width: 280px; }
.fp-cat__leaf { font-weight: 600; color: var(--fp-text); line-height: 1.25; }
.fp-cat__parent { font-size: 12px; color: var(--fp-text-muted); line-height: 1.25; }
.fp-cat__empty { color: var(--fp-text-muted); }
.fp-cat__badge {
    align-self: flex-start; margin-top: 3px; padding: 1px 8px; border-radius: 999px;
    font-size: 11px; font-weight: 600; background: var(--fp-accent-soft); color: var(--fp-accent);
}
.fp-cat__badge--manual { background: rgb(22 132 91 / 13%); color: var(--fp-success); }
.fp-cat__badge--ai { background: rgb(167 100 8 / 13%); color: var(--fp-warning); }

/* 11. Нижня панель масових дій: колір із теми, м'який список без чорного на білому */
#changelist-actions > div {
    background: linear-gradient(135deg, var(--fp-accent), var(--fp-accent-hover)) !important;
    border-radius: 14px !important;
    box-shadow: 0 10px 28px rgb(117 72 232 / 30%) !important;
}
#changelist-form .actions select {
    min-width: 260px;
    background-color: rgb(255 255 255 / 15%) !important;
    border: 1px solid rgb(255 255 255 / 40%) !important;
    border-radius: 10px !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}
#changelist-form .actions select:focus {
    border-color: #ffffff !important;
    box-shadow: 0 0 0 3px rgb(255 255 255 / 28%) !important;
}
#changelist-form .actions select option {
    background: #f6f2ff !important;
    color: #3f2a8f !important;
    -webkit-text-fill-color: #3f2a8f !important;
    padding: 8px 10px;
}
#changelist-form .actions select option[value=""] { color: #8d7fc4 !important; -webkit-text-fill-color: #8d7fc4 !important; }
#changelist-form .actions select option:checked {
    background: #7548e8 !important;
    color: #ffffff !important;
    -webkit-text-fill-color: #ffffff !important;
}
.dark #changelist-form .actions select option {
    background: #251d3d !important;
    color: #e9e2ff !important;
    -webkit-text-fill-color: #e9e2ff !important;
}
.dark #changelist-form .actions select option:checked { background: #6d4fe0 !important; color: #ffffff !important; }

/* 12. Випадайка фільтра з пошуком (static/catalog/searchable_filter.js) */
.fp-combo { position: relative; width: 100%; }
.fp-combo__button {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    padding: 8px 12px; border: 1px solid var(--fp-border); border-radius: var(--fp-radius-md);
    background: var(--fp-surface); color: var(--fp-text); font-size: 14px; text-align: left; cursor: pointer;
}
.fp-combo__button:hover { border-color: var(--fp-border-strong); }
.fp-combo__button:focus-visible { outline: none; border-color: var(--fp-accent); box-shadow: var(--fp-focus-ring); }
.fp-combo__value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-combo__chevron { color: var(--fp-text-muted); flex: none; }
.fp-combo__panel {
    margin-top: 6px; border: 1px solid var(--fp-border); border-radius: var(--fp-radius-md);
    background: var(--fp-surface); overflow: hidden; box-shadow: var(--fp-shadow-sm);
}
.fp-combo__search {
    display: block; width: 100%; padding: 9px 12px; border: 0 !important; border-bottom: 1px solid var(--fp-border) !important;
    border-radius: 0 !important; background: transparent !important; color: var(--fp-text); font-size: 14px; outline: none; box-shadow: none !important;
}
.fp-combo__list { list-style: none; margin: 0; padding: 4px; max-height: 280px; overflow: auto; }
.fp-combo__item { padding: 7px 10px; border-radius: var(--fp-radius-sm); font-size: 14px; color: var(--fp-text); cursor: pointer; }
.fp-combo__item.is-active { background: var(--fp-accent-soft); color: var(--fp-accent); }
.fp-combo__item.is-selected { font-weight: 600; }
.fp-combo__empty { padding: 12px; color: var(--fp-text-muted); font-size: 13px; }
.fp-combo [hidden] { display: none !important; }

/* 15. Меню користувача: виразна панель і компактний адаптивний перемикач теми */
div:has(> .fp-user-theme-switch) {
    box-sizing: border-box;
    border: 1px solid var(--fp-border) !important;
    border-radius: 14px !important;
    background: var(--fp-surface) !important;
    box-shadow:
        0 16px 40px rgb(15 23 42 / 16%),
        0 4px 12px rgb(15 23 42 / 8%) !important;
    overflow: hidden;
    z-index: 60;
}

.dark div:has(> .fp-user-theme-switch) {
    box-shadow:
        0 18px 44px rgb(0 0 0 / 42%),
        0 4px 14px rgb(0 0 0 / 24%) !important;
}

.fp-user-theme-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    padding: 9px 10px;
    border-bottom: 1px solid var(--fp-border);
    background: var(--fp-surface);
}

.fp-user-theme-switch__option {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-sizing: border-box;
    min-width: 0;
    min-height: 60px;
    padding: 7px 4px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--fp-text-secondary);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.fp-user-theme-switch__option .material-symbols-outlined {
    font-size: 20px;
    line-height: 1;
}

.fp-user-theme-switch__option:hover {
    border-color: var(--fp-border);
    background: var(--fp-surface-hover);
    color: var(--fp-text);
}

.fp-user-theme-switch__option:focus-visible {
    outline: 2px solid var(--fp-accent);
    outline-offset: 1px;
}

.fp-user-theme-switch__option.is-active {
    border-color: var(--fp-accent);
    background: var(--fp-accent-soft);
    color: var(--fp-accent);
}

.fp-user-theme-switch__label {
    display: block;
    max-width: 100%;
    overflow-wrap: anywhere;
}

@media (max-width: 360px) {
    .fp-user-theme-switch {
        gap: 3px;
        padding: 8px 7px;
    }

    .fp-user-theme-switch__option {
        min-height: 56px;
        padding: 6px 2px;
        font-size: 11px;
    }
}


/* Product image inline: keep ordering control compact in the admin gallery. */
.fp-image-position-input {
    width: 78px !important;
    min-width: 78px !important;
    max-width: 78px !important;
    text-align: center;
}


/* ==========================================================
   FeedPP — Django Admin login / Cloudflare Turnstile
   Keep the password control visible and separate the challenge.
   ========================================================== */
body.login #login-form,
body.login form#login-form,
#login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.login #login-form .form-row,
#login-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 0;
}

body.login #login-form label,
#login-form label {
    display: block;
    margin: 0 0 7px;
    color: var(--fp-text, #202437);
    font-size: 13px;
    font-weight: 600;
}

body.login #login-form input[name="username"],
body.login #login-form input[name="password"],
#login-form input[name="username"],
#login-form input[name="password"],
.feedpp-login-password-control input[type="password"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 11px 13px !important;
    border: 1px solid var(--fp-border-strong, #cfd4e2) !important;
    border-radius: 10px !important;
    background: var(--fp-surface, #fff) !important;
    color: var(--fp-text, #202437) !important;
    -webkit-text-fill-color: var(--fp-text, #202437) !important;
    font: inherit !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    box-shadow: none !important;
}

body.login #login-form input[name="username"]:focus,
body.login #login-form input[name="password"]:focus,
#login-form input[name="username"]:focus,
#login-form input[name="password"]:focus,
.feedpp-login-password-control input[type="password"]:focus {
    outline: none !important;
    border-color: var(--fp-accent, #7548e8) !important;
    box-shadow: 0 0 0 3px var(--fp-focus-ring, rgb(117 72 232 / 18%)) !important;
}

.feedpp-login-password-control {
    display: block;
    width: 100%;
    margin: 0;
}

.feedpp-turnstile-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    margin: 18px 0 22px;
    padding: 14px;
    box-sizing: border-box;
    border: 1px solid var(--fp-border, #e5e7ef);
    border-radius: 12px;
    background: var(--fp-surface-soft, #fafaff);
}

.feedpp-turnstile-label {
    color: var(--fp-text-secondary, #596277);
    font-size: 12px;
    font-weight: 650;
    line-height: 1.4;
}

.feedpp-turnstile-wrap .cf-turnstile {
    display: block;
    width: 100%;
    min-height: 65px;
    overflow: visible;
}

.feedpp-turnstile-wrap iframe {
    max-width: 100%;
}

body.login #login-form input[type="submit"],
#login-form input[type="submit"],
#login-form button[type="submit"] {
    display: block;
    width: 100%;
    min-height: 46px;
    margin-top: 2px;
    border-radius: 10px !important;
}

@media (max-width: 420px) {
    .feedpp-turnstile-wrap {
        padding: 10px;
    }
    .feedpp-turnstile-wrap .cf-turnstile {
        transform-origin: left top;
    }
}


/* ==========================================================
   FeedPP — єдиний перемикач лічильників фільтрів Django Admin.
   Стан визначає JS за поточним параметром URL _facets.
   ========================================================== */
#changelist-filter-extra-actions {
    margin: 12px 0 8px !important;
    padding: 0 !important;
}

#changelist-filter-extra-actions a,
#changelist-filter-extra-actions a.show-facets {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    box-sizing: border-box !important;
    width: 100% !important;
    min-height: 42px !important;
    padding: 9px 12px !important;
    border: 1px solid var(--fp-border, #e5e7ef) !important;
    border-radius: 10px !important;
    background: var(--fp-surface, #fff) !important;
    color: var(--fp-text, #202437) !important;
    font-size: 0 !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    text-decoration: none !important;
    transition: border-color 140ms ease, background-color 140ms ease !important;
}

#changelist-filter-extra-actions a::before {
    content: "Показувати кількість";
    color: var(--fp-text, #202437);
    font-size: 12px;
    font-weight: 600;
}

#changelist-filter-extra-actions a::after {
    content: "";
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background-color: #cbd1dc;
    background-image: radial-gradient(circle at 10px 10px, #fff 0 7px, transparent 7.5px);
    box-shadow: inset 0 0 0 1px rgb(15 23 42 / 8%);
    transition: background-color 160ms ease, background-image 160ms ease;
}

#changelist-filter-extra-actions.fp-facets-enabled a {
    border-color: var(--fp-accent, #8b20f5) !important;
    background: var(--fp-surface-hover, #f8f6ff) !important;
}

#changelist-filter-extra-actions.fp-facets-enabled a::after {
    background-color: var(--fp-accent, #8b20f5);
    background-image: radial-gradient(circle at 26px 10px, #fff 0 7px, transparent 7.5px);
}

#changelist-filter-extra-actions a:hover {
    border-color: var(--fp-accent, #8b20f5) !important;
    background: var(--fp-surface-hover, #f8f6ff) !important;
}

#changelist-filter-extra-actions a:focus-visible {
    outline: 2px solid var(--fp-accent, #8b20f5) !important;
    outline-offset: 2px !important;
}

.dark #changelist-filter-extra-actions a {
    background: var(--fp-surface, #171923) !important;
    color: var(--fp-text, #f3f4f6) !important;
}

.dark #changelist-filter-extra-actions a::before {
    color: var(--fp-text, #f3f4f6);
}


/* 17. Персональне налаштування лічильників у меню облікового запису */
.fp-account-preference {
    margin: 0 0 8px;
    padding: 8px 10px 10px;
    border: 1px solid var(--fp-border);
    border-radius: var(--fp-radius-md);
    background: var(--fp-surface-soft);
}
.fp-account-preference__label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100%;
    margin: 0;
    color: var(--fp-text);
    cursor: pointer;
    font-size: .8125rem;
    font-weight: 600;
    line-height: 1.35;
}
.fp-account-preference__text {
    min-width: 0;
}
.fp-account-preference__switch {
    position: relative;
    display: inline-flex;
    flex: 0 0 38px;
    width: 38px;
    height: 22px;
}
.fp-account-preference__switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}
.fp-account-preference__slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: var(--fp-border-strong);
    transition: background .16s ease;
}
.fp-account-preference__slider::before {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    content: "";
    box-shadow: 0 1px 2px rgb(0 0 0 / 18%);
    transition: transform .16s ease;
}
.fp-account-preference__switch input:checked + .fp-account-preference__slider {
    background: var(--fp-accent);
}
.fp-account-preference__switch input:checked + .fp-account-preference__slider::before {
    transform: translateX(16px);
}
.fp-account-preference__switch input:focus-visible + .fp-account-preference__slider {
    outline: 3px solid var(--fp-focus-ring);
    outline-offset: 2px;
}
.fp-account-preference__switch input:disabled + .fp-account-preference__slider {
    opacity: .55;
    cursor: wait;
}

/* Приховуємо лише штатний перемикач Django Facets у панелі фільтрів.
   Самі назви фільтрів і серверні лічильники залишаються видимими. */
#changelist-filter-extra-actions {
    display: none !important;
}
