/* ==========================================================================
   Дизайн-система «Наследие»: цвета и типографика заданы токенами,
   тёмная тема — отдельный набор значений, а не инверсия светлой.
   NOTE: Контраст подобран по APCA (ADR-0041), как в ББД: на фоне --paper основной текст --ink-soft — Lc 92,
   служебный --muted — Lc 80, ссылки --brand — Lc 88. Меняя цвет, проверять Lc, а не только на глаз.
   ========================================================================== */

:root,
[data-bs-theme="light"] {
    --paper: #f6f4ef;
    --surface: #ffffff;
    --surface-raised: #ffffff;
    --surface-sunken: #efece5;
    --ink: #1c2430;
    --ink-soft: #2b3440;
    --muted: #4a5361;
    --line: #e2ded5;
    --line-strong: #a8a295;

    --brand: #173f73;
    --brand-strong: #102c52;
    /* NOTE: Фирменный цвет эмблемы ИНИОН РАН: на странице входа, которая всегда светлая. */
    --inion-blue: #2c5477;
    --brand-soft: #e6edf6;
    --on-brand: #ffffff;

    --hero: #173f73;
    --hero-ink: #ffffff;
    --hero-muted: #e3ebf6;
    --hero-line: rgba(255, 255, 255, .22);
    --hero-bar: #9fbfe3;
    --hero-bar-hover: #ffffff;

    --bar: #7ea2cf;
    --marker: #ffe08a;
    --marker-ink: #1c2430;

    --ok: #1b6e4b;
    --ok-soft: #e2f1ea;
    --danger: #b3261e;
    --danger-soft: #fae9e7;

    --shadow-sm: 0 1px 2px rgba(28, 36, 48, .06);
    --shadow-md: 0 8px 24px -12px rgba(28, 36, 48, .22);

    --bs-body-bg: var(--paper);
    --bs-body-color: var(--ink);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--line);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 23, 63, 115;
    --bs-link-hover-color: var(--brand-strong);
    --bs-link-hover-color-rgb: 16, 44, 82;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 23, 63, 115;
    --bs-tertiary-bg: var(--surface-sunken);
    --bs-focus-ring-color: rgba(23, 63, 115, .3);
}

[data-bs-theme="dark"] {
    --paper: #12161c;
    --surface: #1a2028;
    --surface-raised: #212833;
    --surface-sunken: #0e1216;
    --ink: #e8eaed;
    --ink-soft: #dfe3e8;
    --muted: #c5cbd3;
    --line: #2c343f;
    --line-strong: #66717f;

    --brand: #c8dbf5;
    --brand-strong: #e1ecfa;
    --inion-blue: #2c5477;
    --brand-soft: #1e2c40;
    --on-brand: #10161f;

    --hero: #141d2b;
    --hero-ink: #f1f4f8;
    --hero-muted: #d3dbe6;
    --hero-line: rgba(255, 255, 255, .14);
    --hero-bar: #5f88bd;
    --hero-bar-hover: #bcd3f2;

    --bar: #5f88bd;
    --marker: #5e490e;
    --marker-ink: #fff6d8;

    --ok: #74cfa5;
    --ok-soft: #16302a;
    --danger: #f2a39d;
    --danger-soft: #3a1f1e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 28px -12px rgba(0, 0, 0, .7);

    --bs-body-bg: var(--paper);
    --bs-body-color: var(--ink);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--line);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: 200, 219, 245;
    --bs-link-hover-color: var(--brand-strong);
    --bs-link-hover-color-rgb: 225, 236, 250;
    --bs-primary: var(--brand);
    --bs-primary-rgb: 200, 219, 245;
    --bs-tertiary-bg: var(--surface-sunken);
    --bs-focus-ring-color: rgba(200, 219, 245, .35);
}

:root {
    --font-serif: Georgia, "Noto Serif", "PT Serif", "Times New Roman", serif;
    --font-sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: Consolas, "SFMono-Regular", Menlo, monospace;
    --radius: .625rem;
    --radius-sm: .375rem;
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: 1rem;
    --bs-body-line-height: 1.55;
    --bs-border-radius: var(--radius-sm);
    --header-height: 3.75rem;
}

/* Base
   ========================================================================== */

html {
    scroll-padding-top: calc(var(--header-height) + 1rem);
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--paper);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .serif {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -.01em;
    color: var(--ink);
}

h1 { font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem); line-height: 1.2; }
h2 { font-size: 1.375rem; line-height: 1.3; }
h3 { font-size: 1.125rem; line-height: 1.35; }

a {
    color: var(--brand);
    text-decoration: none;
    text-underline-offset: .18em;
}

a:hover {
    color: var(--brand-strong);
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 2px;
}

.text-muted { color: var(--muted) !important; }
.tabular { font-variant-numeric: tabular-nums; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 1100;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--brand);
    color: var(--on-brand);
}

.skip-link:focus { top: .5rem; color: var(--on-brand); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        animation: none !important;
    }
}

/* Индикатор ожидания: страница ждёт ответ сервера на поиск */

.page-loading {
    position: fixed;
    top: 1rem;
    left: 50%;
    z-index: 1090;
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .625rem 1rem;
    transform: translateX(-50%);
    border: 1px solid var(--line-strong);
    border-radius: 2rem;
    background: var(--surface);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    white-space: nowrap;
}

.page-loading[hidden] { display: none; }
.page-loading .spinner-border { color: var(--brand); }

/* Bootstrap components on tokens
   ========================================================================== */

.btn {
    --bs-btn-border-radius: var(--radius-sm);
    --bs-btn-font-weight: 500;
}

.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-color: var(--on-brand);
    --bs-btn-hover-bg: var(--brand-strong);
    --bs-btn-hover-border-color: var(--brand-strong);
    --bs-btn-hover-color: var(--on-brand);
    --bs-btn-active-bg: var(--brand-strong);
    --bs-btn-active-border-color: var(--brand-strong);
    --bs-btn-active-color: var(--on-brand);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
    --bs-btn-disabled-color: var(--on-brand);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: var(--brand-soft);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-hover-color: var(--brand-strong);
    --bs-btn-active-bg: var(--brand-soft);
    --bs-btn-active-border-color: var(--brand);
    --bs-btn-active-color: var(--brand-strong);
}

.btn-quiet,
.btn-light,
.btn-outline-secondary {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: var(--surface-sunken);
    --bs-btn-hover-border-color: var(--line-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-active-bg: var(--surface-sunken);
    --bs-btn-active-border-color: var(--line-strong);
    --bs-btn-active-color: var(--ink);
}

.btn-outline-danger {
    --bs-btn-color: var(--danger);
    --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: var(--danger-soft);
    --bs-btn-hover-border-color: var(--danger);
    --bs-btn-hover-color: var(--danger);
    --bs-btn-active-bg: var(--danger-soft);
    --bs-btn-active-border-color: var(--danger);
    --bs-btn-active-color: var(--danger);
}

.btn-outline-success {
    --bs-btn-color: var(--ok);
    --bs-btn-border-color: var(--ok);
    --bs-btn-hover-bg: var(--ok-soft);
    --bs-btn-hover-border-color: var(--ok);
    --bs-btn-hover-color: var(--ok);
    --bs-btn-active-bg: var(--ok-soft);
    --bs-btn-active-border-color: var(--ok);
    --bs-btn-active-color: var(--ok);
}

.form-control,
.form-select {
    background-color: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--surface);
    border-color: var(--brand);
    color: var(--ink);
    box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

.form-control::placeholder { color: var(--muted); }

.form-check-input {
    background-color: var(--surface);
    border-color: var(--line-strong);
}

.form-check-input:checked {
    background-color: var(--brand);
    border-color: var(--brand);
}

.form-check-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

.form-label-sm {
    display: block;
    margin-bottom: .25rem;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--ink-soft);
}

.dropdown-menu {
    --bs-dropdown-bg: var(--surface-raised);
    --bs-dropdown-border-color: var(--line);
    --bs-dropdown-color: var(--ink);
    --bs-dropdown-link-color: var(--ink);
    --bs-dropdown-link-hover-bg: var(--surface-sunken);
    --bs-dropdown-link-hover-color: var(--ink);
    --bs-dropdown-link-active-bg: var(--brand-soft);
    --bs-dropdown-link-active-color: var(--brand-strong);
    --bs-dropdown-header-color: var(--muted);
    box-shadow: var(--shadow-md);
}

.modal-content {
    --bs-modal-bg: var(--surface-raised);
    --bs-modal-border-color: var(--line);
    --bs-modal-header-border-color: var(--line);
    --bs-modal-footer-border-color: var(--line);
    color: var(--ink);
}

.modal-title { font-family: var(--font-serif); font-weight: 400; }
.modal-body h4, .modal-body h5 { font-family: var(--font-serif); font-weight: 400; }

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--ink);
    --bs-table-border-color: var(--line);
    --bs-table-hover-bg: var(--surface-sunken);
    --bs-table-hover-color: var(--ink);
}

.table thead th {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
}

.alert-success {
    --bs-alert-bg: var(--ok-soft);
    --bs-alert-color: var(--ok);
    --bs-alert-border-color: transparent;
}

/* Pagination tag helpers (Structr): разметка фиксирована, поэтому только стили */

.pagination {
    --bs-pagination-color: var(--ink-soft);
    --bs-pagination-bg: transparent;
    --bs-pagination-border-color: transparent;
    --bs-pagination-hover-color: var(--brand-strong);
    --bs-pagination-hover-bg: var(--brand-soft);
    --bs-pagination-hover-border-color: transparent;
    --bs-pagination-focus-color: var(--brand-strong);
    --bs-pagination-focus-bg: var(--brand-soft);
    --bs-pagination-active-color: var(--on-brand);
    --bs-pagination-active-bg: var(--brand);
    --bs-pagination-active-border-color: var(--brand);
    --bs-pagination-disabled-color: var(--line-strong);
    --bs-pagination-disabled-bg: transparent;
    --bs-pagination-disabled-border-color: transparent;
    --bs-pagination-border-radius: var(--radius-sm);
    gap: .125rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 0;
}

.page-link { border-radius: var(--radius-sm) !important; font-variant-numeric: tabular-nums; }

/* NOTE: Хелпер пагинации выводит многоточие в испорченной кодировке — подменяем символ. */
.pagination-ellipses .page-link { font-size: 0; }
.pagination-ellipses .page-link::after { content: "…"; font-size: 1rem; }

.page-info { color: var(--muted); font-size: .9375rem; font-variant-numeric: tabular-nums; }

.page-size .dropdown-toggle::before {
    content: "На странице: ";
    font-weight: 400;
    color: var(--muted);
}

/* Header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.site-header .navbar {
    --bs-navbar-padding-y: .5rem;
    --bs-navbar-color: var(--ink-soft);
    --bs-navbar-hover-color: var(--ink);
    --bs-navbar-active-color: var(--brand);
    --bs-navbar-toggler-border-color: var(--line-strong);
    min-height: var(--header-height);
}

.brand {
    display: flex;
    align-items: center;
    gap: .625rem;
    margin-right: 1.5rem;
    color: var(--ink);
    line-height: 1.15;
}

.brand:hover { color: var(--ink); text-decoration: none; }
/* NOTE: Эмблема ИНИОН РАН (_Emblem.cshtml) в цвете темы: в тёмной теме --brand светлее. */
.brand-mark {
    display: inline-flex;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    color: var(--brand);
}

.brand-mark svg { width: 100%; height: 100%; }
.brand-title { display: block; white-space: nowrap; font-family: var(--font-serif); font-size: 1.0625rem; }
/* NOTE: Не мельче 12px: APCA не рекомендует меньший кегль для текста, который нужно прочитать (ADR-0041). */
.brand-subtitle { display: block; font-size: .75rem; letter-spacing: .02em; color: var(--muted); }

.site-nav .nav-link {
    white-space: nowrap;
    padding: .375rem .625rem;
    border-radius: var(--radius-sm);
    font-size: .9375rem;
}

.site-nav .nav-link:hover {
    background: var(--surface-sunken);
    text-decoration: none;
}

.site-nav .nav-link.active {
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 500;
}

/* Без min-width: 0 поле не сжимается, и значки администратора выталкивают строку за край узкого экрана. */
.site-header .navbar-collapse,
.header-search { min-width: 0; }

.header-search {
    position: relative;
    width: 15rem;
}

.header-search .bi {
    position: absolute;
    left: .625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

.header-search input {
    padding-left: 2rem;
    padding-right: 1.75rem;
    background: var(--surface-sunken);
    border-color: transparent;
    font-size: .875rem;
}

.header-search kbd {
    position: absolute;
    right: .5rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 .3rem;
    background: var(--surface);
    border: 1px solid var(--line-strong);
    color: var(--muted);
    font-size: .75rem;
    pointer-events: none;
}

.header-search input:focus ~ kbd { display: none; }

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--ink-soft);
}

.icon-button:hover { background: var(--surface-sunken); color: var(--ink); }
.icon-button.is-active { background: var(--brand-soft); color: var(--brand-strong); }

[data-bs-theme="light"] .theme-icon-light,
[data-bs-theme="dark"] .theme-icon-dark { display: none; }

.navbar-toggler-icon { filter: none; }
[data-bs-theme="dark"] .navbar-toggler-icon { filter: invert(1) brightness(1.4); }

/* Page frame
   ========================================================================== */

.site-main {
    flex: 1 0 auto;
    padding-top: 1.75rem;
    padding-bottom: 3rem;
}

.site-main--bare { padding: 0; }

.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin-bottom: .25rem; }
.page-lede { color: var(--muted); margin: 0; max-width: 46rem; }

.page-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem .5rem;
    margin: 0 0 .75rem;
    padding: 0;
    list-style: none;
    font-size: .875rem;
    color: var(--muted);
}

.page-crumbs li + li::before {
    content: "/";
    margin-right: .5rem;
    color: var(--line-strong);
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel-body { padding: 1.25rem; }
.panel-title {
    margin-bottom: .75rem;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
    font-family: var(--font-sans);
}

.site-footer {
    flex-shrink: 0;
    padding: 1.5rem 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .875rem;
}

.site-footer a { color: var(--ink-soft); }

/* NOTE: Кнопка в списке ссылок подвала выглядит как ссылка. */
.site-footer .footer-link-button {
    padding: 0;
    border: 0;
    font: inherit;
    color: var(--ink-soft);
    vertical-align: baseline;
}
.footer-emblem { display: inline-block; width: 1.75rem; height: 1.75rem; margin-right: .375rem; vertical-align: middle; color: var(--brand); }
.footer-emblem svg { display: block; width: 100%; height: 100%; }

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Home
   ========================================================================== */

.hero {
    background: var(--hero);
    color: var(--hero-ink);
}

.hero-inner { padding-top: clamp(2.5rem, 6vw, 4.5rem); }

.hero-eyebrow {
    margin-bottom: .75rem;
    font-size: .8125rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--hero-muted);
}

.hero h1 {
    max-width: 44rem;
    margin-bottom: 1rem;
    font-size: clamp(2rem, 1.3rem + 3vw, 3.25rem);
    line-height: 1.1;
    color: var(--hero-ink);
}

.hero-lede {
    max-width: 44rem;
    margin-bottom: 1.75rem;
    font-size: 1.0625rem;
    color: var(--hero-muted);
}

.hero-search {
    display: flex;
    max-width: 44rem;
    padding: .375rem;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.hero-search input {
    flex: 1 1 auto;
    min-width: 0;
    padding: .5rem .75rem;
    border: 0;
    background: transparent;
    color: #1c2430;
    font-size: 1.0625rem;
}

.hero-search input:focus { outline: none; }
.hero-search input::placeholder { color: #4a5361; }
.hero-search:focus-within { outline: 2px solid var(--hero-bar-hover); outline-offset: 2px; }

.hero-search .btn {
    --bs-btn-bg: #1f4e8c;
    --bs-btn-border-color: #1f4e8c;
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: #163a6b;
    --bs-btn-hover-border-color: #163a6b;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #163a6b;
    --bs-btn-active-border-color: #163a6b;
    --bs-btn-active-color: #fff;
    flex-shrink: 0;
}

.hero-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.25rem;
    max-width: 44rem;
    margin-top: .75rem;
    font-size: .875rem;
    color: var(--hero-muted);
}

.hero-options .form-check-input { background-color: transparent; border-color: var(--hero-muted); }
.hero-options .form-check-input:checked { background-color: var(--hero-bar-hover); border-color: var(--hero-bar-hover); }
.hero-options a { color: var(--hero-ink); text-decoration: underline; text-decoration-color: var(--hero-line); }
.hero-options a:hover { color: var(--hero-ink); text-decoration-color: currentColor; }

/* Шкала фонда: один ряд, поэтому один цвет и без легенды; каждая колонка — ссылка на поиск за десятилетие. */

.timeline { margin-top: clamp(2rem, 5vw, 3rem); }

.timeline-title {
    margin-bottom: .75rem;
    font-size: .875rem;
    color: var(--hero-muted);
}

.timeline-plot {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: clamp(5.5rem, 14vw, 9rem);
    border-bottom: 1px solid var(--hero-line);
}

.timeline-col {
    position: relative;
    display: flex;
    flex: 1 1 0;
    align-items: flex-end;
    min-width: 0;
    height: 100%;
    color: inherit;
}

.timeline-bar {
    display: block;
    width: 100%;
    height: var(--h);
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    background: var(--hero-bar);
    transition: background-color .12s;
}

.timeline-col:hover .timeline-bar,
.timeline-col:focus-visible .timeline-bar { background: var(--hero-bar-hover); }

.timeline-col--empty .timeline-bar { min-height: 0; height: 0; }

.timeline-col::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(var(--h) + .375rem);
    left: 50%;
    z-index: 2;
    padding: .25rem .5rem;
    transform: translateX(-50%);
    border-radius: var(--radius-sm);
    background: #fff;
    color: #1c2430;
    font-size: .8125rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
}

.timeline-col:hover::after,
.timeline-col:focus-visible::after { opacity: 1; }

/* NOTE: Подсказки крайних колонок не должны вылезать за край экрана. */
.timeline-col:nth-child(-n+3)::after { left: 0; transform: none; }
.timeline-col:nth-last-child(-n+3)::after { left: auto; right: 0; transform: none; }

.timeline-axis {
    position: relative;
    height: 1.75rem;
    font-size: .75rem;
    color: var(--hero-muted);
    font-variant-numeric: tabular-nums;
}

.timeline-axis span {
    position: absolute;
    top: .375rem;
    transform: translateX(-50%);
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 1rem 2rem;
    padding: 1.5rem 0;
}

.stat-value {
    display: block;
    font-family: var(--font-serif);
    font-size: clamp(1.625rem, 1.3rem + 1vw, 2.125rem);
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: lining-nums;
}

.stat-label { font-size: .875rem; color: var(--muted); }

.browse {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 1rem;
}

.browse-card {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: 1.25rem;
    color: var(--ink);
    transition: border-color .12s, box-shadow .12s;
}

.browse-card:hover {
    border-color: var(--brand);
    box-shadow: var(--shadow-md);
    color: var(--ink);
    text-decoration: none;
}

.browse-card .bi { font-size: 1.375rem; color: var(--brand); }
.browse-card h3 { margin: .25rem 0 0; }
.browse-card p { margin: 0; font-size: .9375rem; color: var(--muted); }

/* Search
   ========================================================================== */

.search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.search-bar .input-group { flex: 1 1 24rem; }
.search-bar .input-group .form-select { flex: 0 0 auto; width: auto; max-width: 11rem; }
.search-bar .input-group .form-control { font-size: 1.0625rem; }

@media (max-width: 575.98px) {
    .search-bar .input-group .form-select { max-width: 6.5rem; }
}

.search-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin-top: .625rem;
    font-size: .9375rem;
}

.search-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

@media (min-width: 992px) {
    .search-layout { grid-template-columns: 17.5rem minmax(0, 1fr); gap: 2rem; }
    .filters-toggle { display: none; }
    #collapseFilters.collapse { display: block !important; height: auto !important; visibility: visible; }
}

.filter-group + .filter-group { margin-top: .875rem; }

.filter-section + .filter-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line);
}

.filter-pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

/* Ползунок диапазона лет: два поля range друг над другом, события получают только их бегунки. */

.year-slider {
    position: relative;
    height: 1.75rem;
    margin-top: .5rem;
}

.year-slider[hidden] { display: none; }

.year-slider-track {
    position: absolute;
    top: 50%;
    right: .5rem;
    left: .5rem;
    height: 4px;
    transform: translateY(-50%);
    border-radius: 2px;
    background: var(--line-strong);
}

.year-slider-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    border-radius: 2px;
    background: var(--brand);
}

.year-slider input[type=range] {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    margin: 0;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
}

.year-slider input[type=range]::-webkit-slider-runnable-track { background: none; }
.year-slider input[type=range]::-moz-range-track { background: none; }

.year-slider input[type=range]::-webkit-slider-thumb {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--brand);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    pointer-events: auto;
    -webkit-appearance: none;
    appearance: none;
}

.year-slider input[type=range]::-moz-range-thumb {
    width: 1rem;
    height: 1rem;
    box-sizing: border-box;
    border: 2px solid var(--brand);
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    pointer-events: auto;
}

.year-slider input[type=range]:focus-visible { outline: none; }
.year-slider input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }
.year-slider input[type=range]:focus-visible::-moz-range-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }

.facet-list { margin: 0; padding: 0; list-style: none; }

.facet-row {
    position: relative;
    display: flex;
    justify-content: space-between;
    gap: .75rem;
    padding: .25rem .375rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    color: var(--ink-soft);
}

.facet-row::before {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    width: var(--v);
    height: 2px;
    border-radius: 1px;
    background: var(--bar);
}

.facet-row:hover {
    background: var(--brand-soft);
    color: var(--brand-strong);
    text-decoration: none;
}

.facet-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.active-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .375rem;
    margin-bottom: 1rem;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    max-width: 100%;
    padding: .1875rem .375rem .1875rem .625rem;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: .875rem;
}

.chip:hover { color: var(--brand-strong); text-decoration: none; background: var(--line); }
.chip-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-key { color: var(--muted); }

/* Справка по запросам */

.help-lede { margin-bottom: 1.25rem; color: var(--ink-soft); }

.help-heading {
    margin: 0 0 .75rem;
    font-family: var(--font-sans);
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
}

.help-operators { margin: 0 0 1.5rem; padding: 0; list-style: none; }

.help-operator {
    display: grid;
    grid-template-columns: 4rem minmax(0, 1fr);
    gap: .5rem 1rem;
    align-items: center;
    padding: .75rem 0;
    border-top: 1px solid var(--line);
}

.help-operator:last-child { border-bottom: 1px solid var(--line); }

.help-symbol {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0 .25rem;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-family: var(--font-mono);
    font-size: .8125rem;
    font-weight: 600;
    white-space: nowrap;
}

.help-operator-text strong { display: block; font-weight: 600; }
.help-operator-text span { display: block; color: var(--muted); font-size: .875rem; }

.help-example {
    display: inline-flex;
    grid-column: 2;
    justify-self: start;
    align-items: center;
    gap: .375rem;
    max-width: 100%;
    padding: .25rem .625rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    color: var(--brand);
    font-family: var(--font-mono);
    font-size: .8125rem;
    overflow-wrap: anywhere;
}

.help-example:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-strong);
    text-decoration: none;
}

@media (min-width: 768px) {
    .help-operator { grid-template-columns: 4rem minmax(0, 1fr) 13.5rem; }
    .help-example { grid-column: 3; justify-self: stretch; }
}

.help-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
}

@media (min-width: 768px) {
    .help-cards { grid-template-columns: 1fr 1fr; }
    .help-card-wide { grid-column: 1 / -1; }
}

.help-card {
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--surface-sunken);
    font-size: .9375rem;
}

.help-card h4 {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
    font-family: var(--font-sans);
    font-size: .9375rem;
    font-weight: 600;
}

.help-card h4 .bi { color: var(--brand); }
.help-card p { margin-bottom: .75rem; color: var(--ink-soft); }
.help-card .tag-solid { background: var(--surface-raised); }

.results-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--line-strong);
}

.results-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.results-toolbar .form-select { width: auto; }

.results-footer {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.results { margin: 0; padding: 0; list-style: none; }

.result {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .5rem 1.25rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--line);
}

@media (min-width: 768px) {
    .result { grid-template-columns: minmax(0, 1fr) auto; }
}

.result-title {
    margin-bottom: .375rem;
    font-size: 1.1875rem;
    line-height: 1.3;
}

.result-title .result-number {
    margin-right: .375rem;
    font-family: var(--font-sans);
    font-size: .8125rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.result-bib { margin-bottom: .5rem; font-size: .9375rem; color: var(--ink-soft); }

.result-annotation { margin-bottom: .5rem; font-size: .9375rem; color: var(--ink-soft); }
.result-label { font-weight: 600; }

.js .clampable {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

.js .clampable.is-open { display: block; }

/* NOTE: Две строки меток — у части записей десятки ключевых слов, они не должны вытеснять остальную выдачу. */
.js .clampable-tags { max-height: 3.35rem; overflow: hidden; }
.js .clampable-tags.is-open { max-height: none; }

.clamp-toggle {
    display: block;
    margin: -.25rem 0 .5rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font-size: .875rem;
}

.clamp-toggle:hover { text-decoration: underline; }

.result-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: .375rem;
}

@media (min-width: 768px) {
    .result-actions { flex-direction: column; align-items: stretch; width: 7.5rem; }
}

/* На узком экране кнопки в строке: одной ширины и высоты, как в колонке на широком. */
@media (max-width: 767.98px) {
    .result-actions { align-items: stretch; width: 100%; }
    .result-actions > .btn { flex: 1 1 0; min-width: 0; max-width: 16rem; }
    .result-actions > .collection-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; }
}

.result-pdf-size { font-size: .75rem; font-weight: 400; opacity: .8; }

.tag-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .25rem .375rem;
    margin-bottom: .375rem;
}

.tag-row-label {
    margin-right: .25rem;
    font-size: .8125rem;
    color: var(--muted);
}

.tag {
    display: inline-block;
    padding: .0625rem .5rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--ink-soft);
    font-size: .8125rem;
    line-height: 1.5;
}

a.tag:hover {
    border-color: var(--brand);
    color: var(--brand-strong);
    text-decoration: none;
}

.tag.is-active {
    border-color: transparent;
    background: var(--marker);
    color: var(--marker-ink);
}

.tag-solid {
    border-color: transparent;
    background: var(--surface-sunken);
}

.highlight {
    padding: 0 .125em;
    border-radius: 2px;
    background: var(--marker);
    color: var(--marker-ink);
}

b.highlight { font-weight: inherit; }

.empty-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
}

.empty-state .bi { font-size: 2rem; color: var(--muted); }
.empty-state h2 { margin: .75rem 0 .5rem; }
.empty-state p { max-width: 34rem; margin: 0 auto .75rem; color: var(--muted); }

/* Select2 on tokens (тема bootstrap-5 задаёт цвета жёстко)
   ========================================================================== */

.select2-container--bootstrap-5 .select2-selection {
    background-color: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
    font-size: .9375rem;
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
    border-color: var(--brand);
    box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--ink); }
/* NOTE: В Select2 4.1 подсказка вложена в .select2-selection__rendered: без второго селектора тема красит её своим серым. */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__placeholder,
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__placeholder { color: var(--muted); }

.select2-container--bootstrap-5 .select2-dropdown {
    background-color: var(--surface-raised);
    border-color: var(--line-strong);
    color: var(--ink);
}

.select2-container--bootstrap-5 .select2-dropdown .select2-search .select2-search__field {
    background-color: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option { color: var(--ink); font-size: .9375rem; }

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option--highlighted,
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted {
    background-color: var(--brand-soft);
    color: var(--brand-strong);
}

.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option--selected,
.select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option[aria-selected=true]:not(.select2-results__option--highlighted) {
    background-color: var(--brand);
    color: var(--on-brand);
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered .select2-selection__clear { filter: none; }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection__clear { filter: invert(1); }

.is-set + .select2-container--bootstrap-5 .select2-selection { border-color: var(--brand); }

/* Publication and person cards
   ========================================================================== */

.record-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
}

@media (min-width: 992px) {
    .record-layout { grid-template-columns: minmax(0, 1fr) 19rem; gap: 2rem; align-items: start; }
    .record-aside { position: sticky; top: calc(var(--header-height) + 1rem); }
}

.record-title { margin-bottom: .5rem; }
.record-subtitle { margin-bottom: .5rem; font-size: 1.0625rem; color: var(--ink-soft); }

.record-authors {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1rem;
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

.record-section + .record-section { margin-top: 1.5rem; }

.bib-block {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    line-height: 1.55;
}

.facts {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .125rem 1.25rem;
    margin: 0;
}

@media (min-width: 576px) {
    .facts { grid-template-columns: 11rem minmax(0, 1fr); }
}

.facts dt { font-weight: 400; color: var(--muted); font-size: .9375rem; }
.facts dd { margin-bottom: .625rem; }

.rubric-links { margin: 0; padding: 0; list-style: none; }
.rubric-links li + li { margin-top: .25rem; }

.code {
    font-family: var(--font-mono);
    font-size: .875em;
    color: var(--muted);
}

.action-stack { display: grid; gap: .5rem; }

.reader {
    width: 100%;
    height: min(85vh, 60rem);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface-sunken);
}

.prose {
    max-width: 46rem;
    font-family: var(--font-serif);
    font-size: 1.0625rem;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.prose p { margin-bottom: 1em; }

/* NOTE: Переносы обязательны: без них при выравнивании по ширине в узкой колонке появляются широкие пробелы. */
.prose-justified { max-width: none; }

/* NOTE: На телефоне в короткой строке выравнивание по ширине даёт большие пробелы между словами. */
@media (min-width: 576px) {
    .prose-justified {
        text-align: justify;
        hyphens: auto;
    }
}

.bibliography {
    margin: 0;
    padding-left: 1.75rem;
}

.bibliography li { padding: .375rem 0; }
.bibliography li::marker { color: var(--muted); font-variant-numeric: tabular-nums; }
.bibliography a { overflow-wrap: anywhere; }
.bibliography-plain { padding-left: 0; list-style: none; }

.record-pager {
    display: grid;
    grid-template-columns: 1fr;
    gap: .75rem;
    margin-top: 2.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--line-strong);
}

@media (min-width: 576px) {
    .record-pager { grid-template-columns: 1fr 1fr; }
    .record-pager-next { grid-column: 2; text-align: right; }
}

.record-pager-link {
    display: block;
    padding: .75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
}

.record-pager-link:hover {
    border-color: var(--brand);
    color: var(--ink);
    text-decoration: none;
}

.record-pager-label { display: block; font-size: .8125rem; color: var(--muted); }

/* NOTE: Заглавия публикаций бывают на абзац — в ссылке достаточно двух строк. */
.record-pager-name {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-family: var(--font-serif);
    color: var(--brand);
    overflow-wrap: anywhere;
}

.life-dates { font-size: 1.0625rem; color: var(--ink-soft); }

/* Alphabetical indexes and rubricator
   ========================================================================== */

.alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: .125rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.alphabet a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 .375rem;
    border-radius: var(--radius-sm);
    color: var(--ink-soft);
    font-size: .9375rem;
}

.alphabet a:hover { background: var(--brand-soft); color: var(--brand-strong); text-decoration: none; }
.alphabet a.active { background: var(--brand); color: var(--on-brand); }

.similar-note {
    margin-bottom: .75rem;
    padding: .5rem .75rem;
    border-radius: var(--radius-sm);
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.index-list {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 992px) {
    .index-list { columns: 2; column-gap: 3rem; }
}

.index-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    padding: .4375rem 0;
    border-bottom: 1px solid var(--line);
    break-inside: avoid;
}

.index-years { margin-left: .375rem; color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; }
.index-count { flex-shrink: 0; font-size: .875rem; font-variant-numeric: tabular-nums; }

.rubric-row {
    display: grid;
    grid-template-columns: 4.5rem minmax(0, 1fr);
    gap: .125rem 1rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--line);
}

@media (min-width: 768px) {
    .rubric-row { grid-template-columns: 4.5rem minmax(0, 1fr) 11rem; align-items: baseline; }
}

.rubric-head {
    display: none;
    padding: 0 0 .5rem;
    border-bottom: 1px solid var(--line-strong);
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
}

@media (min-width: 768px) {
    .rubric-head { display: grid; }
}

.rubric-count { font-size: .875rem; font-variant-numeric: tabular-nums; }

.rubric-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .5rem;
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: .875rem;
}

/* NOTE: Число-ссылка оформлено кнопкой: как обычный текст в таблице его не замечали. */
.count-link {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .125rem .625rem;
    border: 1px solid var(--brand);
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-size: .875rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    transition: background-color .12s, color .12s;
}

a.count-link:hover,
a.count-link:focus-visible {
    background: var(--brand);
    color: var(--on-brand);
    text-decoration: none;
}

@media (min-width: 768px) {
    .rubric-count { text-align: right; }
}

@media (max-width: 767.98px) {
    .rubric-count { grid-column: 2; color: var(--muted); }
    .rubric-count[data-label]::before { content: attr(data-label) ": "; }
}

/* NOTE: Дорожка показывает полную длину, без неё заливку не с чем сравнить. Минимальная длина — чтобы малые рубрики были заметны. */
.rubric-share {
    display: block;
    align-self: center;
    height: .4375rem;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
    print-color-adjust: exact;
}

.rubric-share-fill {
    display: block;
    height: 100%;
    width: var(--v);
    min-width: .25rem;
    border-radius: 999px;
    background: var(--bar);
    print-color-adjust: exact;
}

@media (min-width: 768px) {
    .rubric-row--share { grid-template-columns: 4.5rem minmax(0, 1fr) clamp(6rem, 18vw, 12rem) 11rem; }
}

@media (max-width: 767.98px) {
    .rubric-share { grid-column: 2; margin: .375rem 0; }
}

/* Текстовая страница */

.text-page { max-width: 46rem; }

/* NOTE: На узком экране выравнивание по ширине даёт большие пробелы между словами, а переносы есть не во всех браузерах. */
@media (min-width: 768px) {
    .text-page p,
    .page-lede--justify,
    .hero-lede { text-align: justify; hyphens: auto; }
}

.text-page h2 { margin-top: 1.75rem; font-size: 1.25rem; }
.text-page h3 { margin-top: 1.25rem; font-size: 1.0625rem; }

/* NOTE: Библиографическое описание отделено чертой, как цитата; переносы в адресах — по любому символу, иначе узкий экран прокручивается. */
.text-page .citation {
    margin: 0 0 .75rem;
    padding: .75rem 1rem;
    border-left: 3px solid var(--brand);
    background: var(--surface-sunken);
    overflow-wrap: anywhere;
    text-align: left;
    hyphens: manual;
}

/* Плашка о cookie */

/* NOTE: sticky, а не fixed: плашка занимает своё место внизу страницы и не закрывает подвал. */
.cookie-notice {
    position: sticky;
    bottom: 0;
    z-index: 1030;
    flex-shrink: 0;
    padding: .5rem 0;
    border-top: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: .875rem;
}

.cookie-notice[hidden] { display: none; }

.cookie-notice .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.cookie-notice-text { margin: 0; }

/* NOTE: Кнопки одинаковые: отказ не должен быть менее заметным, чем согласие. */
.cookie-notice-actions {
    display: flex;
    flex-shrink: 0;
    gap: .5rem;
}

@media (max-width: 575.98px) {
    .cookie-notice .container {
        flex-direction: column;
        align-items: stretch;
        gap: .5rem;
    }

    .cookie-notice-actions .btn { flex: 1; }
}

@media print {
    .cookie-notice { display: none; }
}

/* Подборка читателя */

.collection-toggle[aria-pressed="true"] {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.collection-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1rem;
    margin-bottom: 1rem;
}

.collection-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
}

.collection-export {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .375rem;
}

.collection-item {
    margin-bottom: .75rem;
}

.collection-remove {
    display: block;
    margin-top: .25rem;
}

@media print {
    .collection-remove, .collection-export, [data-collection-clear] { display: none !important; }
}

/* Admin
   ========================================================================== */

.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: .75rem;
}

.tile { padding: 1rem; }

.visibility-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    margin-bottom: 1.25rem;
    padding: .75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.visibility-panel.is-hidden {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.visibility-form { display: flex; flex: 1 1 18rem; gap: .5rem; }
.visibility-form input[type=text] { flex: 1 1 auto; min-width: 0; }

.status {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: .875rem;
    font-weight: 600;
}

.status-ok { color: var(--ok); }
.status-danger { color: var(--danger); }

.visibility-note { flex-basis: 100%; font-size: .875rem; }
.visibility-note--ok { color: var(--ok); }
.visibility-note--error { color: var(--danger); }

/* Standalone pages: login and errors
   ========================================================================== */

.center-page {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card { width: 100%; max-width: 26rem; }
.login-logo { display: block; padding: .75rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
/* NOTE: Страница входа всегда светлая, поэтому эмблема — фирменного цвета, а не цвета темы. */
.login-logo svg { display: block; width: 7.5rem; height: 7.5rem; margin: 0 auto; color: var(--inion-blue); }

.error-page { max-width: 32rem; text-align: center; }
/* Управление пользователями (ADR-0044) */
.user-form { max-width: 32rem; }
.users-table tr.is-inactive td:not(:last-child) { color: var(--muted); }
/* NOTE: Без своего позиционирования скрытая подпись столбца (.visually-hidden, position: absolute) выходит из-под обрезки
   прокручиваемой обёртки и растягивает страницу на узком экране. */
.users-table-scroll { position: relative; }

/* NOTE: Страница технических работ (ADR-0043) построена на разметке страницы ошибки. */
.maintenance-emblem { display: block; width: 6rem; height: 6rem; margin: 0 auto; }
.maintenance-until { color: var(--muted); }
.error-code { font-family: var(--font-serif); font-size: clamp(4rem, 12vw, 6.5rem); line-height: 1; color: var(--brand); }
.error-url { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }

/* Print
   ========================================================================== */

@media print {
    .site-header, .site-footer, .search-bar, .search-options, .filters-toggle, #collapseFilters,
    .results-toolbar-actions, .results-footer, .result-actions, .record-aside, .visibility-panel, .record-pager,
    .skip-link, .clamp-toggle, .page-crumbs {
        display: none !important;
    }

    .search-layout, .record-layout { display: block; }
    .panel { border: 0; box-shadow: none; }
    .js .clampable { display: block; overflow: visible; -webkit-line-clamp: unset; }
    body { background: #fff; }
}
