/*
 * Админка в языке мобильного приложения.
 *
 * Основа — экраны приложения, а не только файл токенов: белые карточки
 * без обводок на светло-сером фоне, крупные скругления, мягкая красная
 * подложка у вторичного действия, жирные числа, воздух между блоками.
 *
 * Светлая тема — основная, как в приложении. Тёмная включается только
 * переключателем Django, а не системной настройкой: инструмент должен
 * выглядеть так же, как продукт, если человек специально не попросил иначе.
 */

/* --- Токены ----------------------------------------------------------- */

:root {
    --rs-bg: #F2F3F5;
    --rs-elevated: #FFFFFF;
    --rs-surface: #F1F2F4;
    --rs-surface-deep: #E7E8EB;
    --rs-stroke: #ECEDEF;
    --rs-stroke-strong: #DCDEE2;

    --rs-text: #14161A;
    --rs-text-2: #5A5E66;
    --rs-text-3: #8A8F98;

    --rs-accent: #D0021B;
    --rs-accent-pressed: #A80016;
    --rs-on-accent: #FFFFFF;
    /* Подпись вторичного действия: «В корзину», «В рассрочку». */
    --rs-accent-soft: rgba(208, 2, 27, 0.09);
    --rs-accent-soft-hover: rgba(208, 2, 27, 0.15);

    --rs-success: #1E8F57;
    --rs-success-soft: rgba(30, 143, 87, 0.10);
    --rs-warning: #B37D0C;
    --rs-warning-soft: rgba(179, 125, 12, 0.12);

    /* Скругления. Карточка крупная, элемент управления мягкий, чип — пилюля. */
    --rs-r-card: 20px;
    --rs-r-inner: 14px;
    --rs-r-control: 12px;
    --rs-r-tile: 16px;
    --rs-r-pill: 999px;

    --rs-h-control: 44px;

    --rs-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
               "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --rs-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo,
                    Consolas, monospace;

    /* Карточки держатся тенью, а не обводкой: в приложении рамок нет. */
    --rs-shadow: 0 1px 2px rgba(20, 22, 26, 0.03),
                 0 4px 16px rgba(20, 22, 26, 0.05);
    --rs-shadow-hover: 0 2px 6px rgba(20, 22, 26, 0.05),
                       0 10px 28px rgba(20, 22, 26, 0.09);
}

/* Тёмная — только по явному выбору. Системную настройку не слушаем:
   приложение светлое, и админка по умолчанию должна совпадать с ним. */
html[data-theme="dark"] {
    --rs-bg: #0E0F11;
    --rs-elevated: #17191C;
    --rs-surface: #1F2226;
    --rs-surface-deep: #26292E;
    --rs-stroke: #232629;
    --rs-stroke-strong: #3A3E44;

    --rs-text: #F4F5F7;
    --rs-text-2: #9BA0A8;
    --rs-text-3: #6B7078;

    --rs-accent: #E5484D;
    --rs-accent-pressed: #C93B40;
    --rs-accent-soft: rgba(229, 72, 77, 0.14);
    --rs-accent-soft-hover: rgba(229, 72, 77, 0.22);

    --rs-success: #3FBF7F;
    --rs-success-soft: rgba(63, 191, 127, 0.14);
    --rs-warning: #E0A72C;
    --rs-warning-soft: rgba(224, 167, 44, 0.14);

    --rs-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 4px 16px rgba(0, 0, 0, 0.3);
    --rs-shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* --- Переменные Django через наши ------------------------------------- */

:root,
html[data-theme="dark"],
html[data-theme="light"] {
    --primary: var(--rs-accent);
    --secondary: var(--rs-elevated);
    --accent: var(--rs-accent);
    --primary-fg: var(--rs-on-accent);

    --body-fg: var(--rs-text);
    --body-bg: var(--rs-bg);
    --body-quiet-color: var(--rs-text-2);
    --body-medium-color: var(--rs-text-2);
    --body-loud-color: var(--rs-text);

    --header-color: var(--rs-text);
    --header-branding-color: var(--rs-text);
    --header-bg: var(--rs-elevated);
    --header-link-color: var(--rs-text);

    --breadcrumbs-fg: var(--rs-text-3);
    --breadcrumbs-link-fg: var(--rs-text-2);
    --breadcrumbs-bg: transparent;

    /* Красный работает на действии. Ссылка в списке — обычный текст,
       акцент появляется на наведении. */
    --link-fg: var(--rs-text);
    --link-hover-color: var(--rs-accent);
    --link-selected-fg: var(--rs-accent);

    --hairline-color: var(--rs-stroke);
    --border-color: var(--rs-stroke);
    --error-fg: var(--rs-accent);

    --message-success-bg: var(--rs-success-soft);
    --message-warning-bg: var(--rs-warning-soft);
    --message-error-bg: var(--rs-accent-soft);

    --darkened-bg: var(--rs-surface);
    --selected-bg: var(--rs-surface);
    --selected-row: var(--rs-accent-soft);

    --button-fg: var(--rs-on-accent);
    --button-bg: var(--rs-accent);
    --button-hover-bg: var(--rs-accent-pressed);
    --default-button-bg: var(--rs-accent);
    --default-button-hover-bg: var(--rs-accent-pressed);
    --close-button-bg: var(--rs-surface);
    --close-button-hover-bg: var(--rs-surface-deep);
    --delete-button-bg: var(--rs-accent-soft);
    --delete-button-hover-bg: var(--rs-accent-soft-hover);

    --object-tools-fg: var(--rs-accent);
    --object-tools-bg: var(--rs-accent-soft);
    --object-tools-hover-bg: var(--rs-accent-soft-hover);

    --font-family-primary: var(--rs-font);
    --font-family-monospace: var(--rs-font-mono);
}

/* --- Основа ----------------------------------------------------------- */

body {
    background: var(--rs-bg);
    color: var(--rs-text);
    font-family: var(--rs-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 2px solid var(--rs-accent);
    outline-offset: 2px;
}

/* box-sizing обязателен: у Django #content задан по ширине родителя,
   и добавленное поле выталкивало его за окно — кнопка «Добавить»
   уезжала за правый край. */
#content {
    box-sizing: border-box;
    padding: 24px 28px 48px;
}

#content > h1 {
    margin: 0 0 20px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.6px;
    color: var(--rs-text);
}

/* Артикулы и номера — моноширинным, как в приложении. */
.rs-mono,
#result_list .field-article,
#result_list .field-number,
#result_list .field-bin {
    font-family: var(--rs-font-mono);
    font-size: 13px;
    letter-spacing: -0.2px;
}

/* --- Шапка ------------------------------------------------------------ */

#header {
    background: var(--rs-elevated);
    color: var(--rs-text);
    border-bottom: none;
    box-shadow: 0 1px 0 var(--rs-stroke);
    padding: 16px 28px;
    align-items: center;
}

#branding h1, #site-name a {
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.4px;
    color: var(--rs-text);
}

#branding h1::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 10px;
    border-radius: var(--rs-r-pill);
    background: var(--rs-accent);
    vertical-align: middle;
}

#user-tools {
    font-size: 13px;
    font-weight: 500;
    color: var(--rs-text-2);
    text-transform: none;
    letter-spacing: 0;
}

#user-tools a { border-bottom: none; color: var(--rs-text-2); }
#user-tools a:hover { color: var(--rs-accent); }

div.breadcrumbs {
    background: transparent;
    color: var(--rs-text-3);
    border-bottom: none;
    padding: 14px 28px 0;
    font-size: 13px;
    font-weight: 500;
}

div.breadcrumbs a { color: var(--rs-text-2); }
div.breadcrumbs a:hover { color: var(--rs-accent); }

/* --- Боковое меню ----------------------------------------------------- */

/* box-sizing обязателен: ширина меню у Django фиксирована и под неё же
   отведено место справа. Без него добавленное поле расширяло меню, и вся
   правая часть уезжала за окно — кнопка «Добавить» обрезалась. */
#nav-sidebar {
    box-sizing: border-box;
    background: var(--rs-elevated);
    border-right: 1px solid var(--rs-stroke);
    padding: 8px 10px 24px;
}

#nav-sidebar .module {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    margin-bottom: 6px;
}

#nav-sidebar .module th,
#nav-sidebar .module caption {
    background: transparent;
    color: var(--rs-text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 16px 12px 6px;
    border: none;
}

#nav-sidebar tbody th,
#nav-sidebar tbody td { border: none; padding: 1px 0; }

#nav-sidebar tbody th a {
    display: block;
    color: var(--rs-text-2);
    font-size: 14px;
    font-weight: 500;
    padding: 9px 12px;
    border-radius: var(--rs-r-control);
    text-transform: none;
}

#nav-sidebar tbody tr:hover th a { background: var(--rs-surface); color: var(--rs-text); }

#nav-sidebar tr.current-model th a {
    background: var(--rs-accent-soft);
    color: var(--rs-accent);
    font-weight: 700;
}

/* Меню — просто список разделов, как навигация в приложении.
   Ссылки «Добавить» из него убраны: они висели вторым столбцом с зелёной
   иконкой, ломали язык и удваивали высоту каждой строки. Кнопка
   «Добавить» никуда не делась — она есть на самом списке. */
#nav-sidebar table { width: 100%; }
#nav-sidebar tbody th { width: 100%; }
#nav-sidebar .addlink { display: none; }

#nav-filter {
    background: var(--rs-surface);
    border: none;
    border-radius: var(--rs-r-inner);
    color: var(--rs-text);
    margin: 8px 4px 10px;
    padding: 11px 14px;
    width: calc(100% - 8px);
    font-size: 14px;
}

#nav-filter::placeholder { color: var(--rs-text-3); }

/* --- Карточки --------------------------------------------------------- */

.module, .inline-group, #changelist-filter, .submit-row, .dashboard .module {
    background: var(--rs-elevated);
    border: none;
    border-radius: var(--rs-r-card);
    box-shadow: var(--rs-shadow);
    overflow: hidden;
}

.module h2, .module caption, .inline-group h2, #changelist-filter h2 {
    background: transparent;
    color: var(--rs-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 18px 20px 12px;
    border-bottom: none;
}

/* --- Таблицы ---------------------------------------------------------- */

#changelist { background: transparent; }

#changelist table {
    background: var(--rs-elevated);
    border-radius: var(--rs-r-card);
}

#changelist table thead th {
    background: transparent;
    color: var(--rs-text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--rs-stroke);
    padding: 14px 12px;
}

#changelist table tbody td,
#changelist table tbody th {
    border-bottom: 1px solid var(--rs-stroke);
    padding: 15px 12px;
    font-size: 14px;
    vertical-align: middle;
}

#changelist table tbody tr:last-child td,
#changelist table tbody tr:last-child th { border-bottom: none; }

#changelist table tbody tr:hover { background: var(--rs-surface); }

.row1, .row2 { background: var(--rs-elevated); }

/* --- Кнопки ----------------------------------------------------------- */

.button, input[type=submit], input[type=button], .submit-row input, a.button {
    background: var(--rs-accent);
    color: var(--rs-on-accent);
    border: none;
    border-radius: var(--rs-r-control);
    padding: 0 22px;
    height: var(--rs-h-control);
    line-height: var(--rs-h-control);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.1px;
    transition: background 0.15s ease, transform 0.08s ease;
}

.button:hover, input[type=submit]:hover, .submit-row input:hover {
    background: var(--rs-accent-pressed);
}

.button:active, input[type=submit]:active { transform: scale(0.985); }

/* Вторичное действие — мягкая красная подложка с красной подписью.
   Это подпись приложения: «В корзину», «В рассрочку». */
.object-tools a,
.submit-row a.closelink,
.submit-row a.deletelink,
.button.cancel-link {
    background: var(--rs-accent-soft);
    color: var(--rs-accent);
    border: none;
    border-radius: var(--rs-r-control);
    height: var(--rs-h-control);
    line-height: var(--rs-h-control);
    padding: 0 20px;
    font-size: 14px;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}

.object-tools a:hover,
.submit-row a.closelink:hover,
.submit-row a.deletelink:hover {
    background: var(--rs-accent-soft-hover);
    color: var(--rs-accent);
}

.object-tools { margin-top: 0; }

.submit-row {
    padding: 16px 20px;
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}

/* --- Формы ------------------------------------------------------------ */

fieldset.module { padding-bottom: 4px; }

.form-row {
    border-bottom: 1px solid var(--rs-stroke);
    padding: 16px 20px;
}

.form-row:last-child { border-bottom: none; }

label {
    color: var(--rs-text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Поля залиты, а не обведены — как строка поиска в приложении. */
input[type=text], input[type=password], input[type=email], input[type=url],
input[type=number], input[type=tel], input[type=search],
textarea, select, .vTextField {
    background: var(--rs-surface);
    color: var(--rs-text);
    border: 1px solid transparent;
    border-radius: var(--rs-r-inner);
    padding: 11px 14px;
    font-size: 15px;
    font-family: var(--rs-font);
    min-height: var(--rs-h-control);
    box-sizing: border-box;
    transition: background 0.15s ease, border-color 0.15s ease;
}

input:hover, textarea:hover, select:hover { background: var(--rs-surface-deep); }

input:focus, textarea:focus, select:focus, .vTextField:focus {
    background: var(--rs-elevated);
    border-color: var(--rs-accent);
    outline: none;
}

.help, .helptext, div.help {
    color: var(--rs-text-3);
    font-size: 13px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    padding-top: 4px;
}

/* --- Сообщения -------------------------------------------------------- */

ul.messagelist li {
    background: var(--rs-success-soft);
    color: var(--rs-success);
    border: none;
    border-radius: var(--rs-r-inner);
    font-size: 14px;
    font-weight: 600;
    padding: 14px 18px;
    margin: 0 0 10px;
}

ul.messagelist li.warning { background: var(--rs-warning-soft); color: var(--rs-warning); }
ul.messagelist li.error { background: var(--rs-accent-soft); color: var(--rs-accent); }

.errornote, ul.errorlist li {
    background: var(--rs-accent-soft);
    color: var(--rs-accent);
    border: none;
    border-radius: var(--rs-r-inner);
    font-size: 13px;
    font-weight: 600;
    padding: 11px 14px;
}

/* --- Фильтры пилюлями ------------------------------------------------- */

#changelist-filter { padding-bottom: 12px; }

#changelist-filter h3 {
    color: var(--rs-text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 12px 20px 8px;
    margin: 0;
}

#changelist-filter ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 20px 8px;
    margin: 0;
    border-bottom: none;
}

#changelist-filter li { padding: 0; border: none; }

#changelist-filter li a {
    display: block;
    padding: 7px 14px;
    border-radius: var(--rs-r-pill);
    background: var(--rs-surface);
    color: var(--rs-text-2);
    font-size: 13px;
    font-weight: 600;
    border: none;
}

#changelist-filter li a:hover { background: var(--rs-surface-deep); color: var(--rs-text); }

#changelist-filter li.selected a,
#changelist-filter li.selected > a {
    background: var(--rs-accent);
    color: var(--rs-on-accent);
    border-left: none;
    font-weight: 700;
}

/* --- Поиск и действия ------------------------------------------------- */

#toolbar {
    background: transparent;
    border: none;
    padding: 0 20px 12px;
}

#toolbar form#changelist-search { display: flex; gap: 8px; align-items: center; }
#toolbar form input[type=text] { flex: 1; min-height: var(--rs-h-control); }
#toolbar #searchbar { margin: 0; }

.actions {
    background: var(--rs-surface);
    border: none;
    border-radius: var(--rs-r-inner);
    margin: 0 20px 12px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--rs-text-2);
}

.actions select { min-height: 38px; padding: 6px 12px; }

.paginator {
    background: transparent;
    border-top: 1px solid var(--rs-stroke);
    color: var(--rs-text-3);
    font-size: 13px;
    padding: 16px 20px;
}

.paginator a, .paginator .this-page {
    border-radius: var(--rs-r-pill);
    padding: 6px 13px;
    font-weight: 600;
    background: var(--rs-surface);
    color: var(--rs-text-2);
}

.paginator .this-page { background: var(--rs-accent); color: var(--rs-on-accent); }

/* --- Вход ------------------------------------------------------------- */

body.login { background: var(--rs-bg); }

.login #container {
    background: var(--rs-elevated);
    border: none;
    border-radius: var(--rs-r-card);
    box-shadow: var(--rs-shadow);
    padding-bottom: 12px;
    width: 25em;
}

.login #header {
    border-radius: var(--rs-r-card) var(--rs-r-card) 0 0;
    box-shadow: none;
    justify-content: center;
    padding: 26px 20px 10px;
}

.login .form-row { border-bottom: none; padding: 8px 24px; }
.login .submit-row { box-shadow: none; padding: 14px 24px 4px; margin: 0; }
.login .submit-row input[type=submit] { width: 100%; }

/* --- Сводка на главной ------------------------------------------------ */

/* В dashboard.css у Django «#content { width: 600px }» под свою главную. */
.dashboard #content { width: auto; max-width: none; margin-right: 0; }

.rs-dash { max-width: 1320px; padding-bottom: 24px; }

.rs-eyebrow {
    display: block;
    color: var(--rs-text-3);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Карточки «требует действия» */
.rs-cards {
    display: grid;
    /* 200px — чтобы четыре карточки держались одним рядом уже на 1280. */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.rs-card {
    display: block;
    background: var(--rs-elevated);
    border-radius: var(--rs-r-card);
    padding: 20px;
    text-decoration: none;
    box-shadow: var(--rs-shadow);
    transition: box-shadow 0.18s ease, transform 0.12s ease;
}

.rs-card:hover { box-shadow: var(--rs-shadow-hover); transform: translateY(-2px); }

/* Красный — только там, где есть что разбирать. Ноль остаётся спокойным. */
.rs-card--urgent { background: var(--rs-accent-soft); box-shadow: none; }
.rs-card--urgent:hover { background: var(--rs-accent-soft-hover); box-shadow: none; }

.rs-card__title {
    display: block;
    color: var(--rs-text-2);
    font-size: 14px;
    font-weight: 600;
}

.rs-card--urgent .rs-card__title { color: var(--rs-accent); }

.rs-card__value {
    display: block;
    margin: 10px 0 4px;
    color: var(--rs-text);
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.rs-card--urgent .rs-card__value { color: var(--rs-accent); }

.rs-card__hint {
    display: block;
    color: var(--rs-text-3);
    font-size: 12.5px;
    line-height: 1.45;
}

.rs-card--urgent .rs-card__hint { color: var(--rs-accent); opacity: 0.75; }

/* Сетка */
.rs-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

@media (max-width: 1100px) {
    .rs-grid { grid-template-columns: minmax(0, 1fr); }
}

.rs-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.rs-block {
    background: var(--rs-elevated);
    border-radius: var(--rs-r-card);
    box-shadow: var(--rs-shadow);
    padding: 20px;
}

.rs-block__title {
    margin: 0 0 16px;
    color: var(--rs-text);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

/* Деньги */
.rs-money { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.rs-money__item {
    background: var(--rs-surface);
    border-radius: var(--rs-r-inner);
    padding: 18px;
}

.rs-money__sum {
    display: block;
    margin: 8px 0 3px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.7px;
    font-variant-numeric: tabular-nums;
    color: var(--rs-text);
}

.rs-money__count { display: block; color: var(--rs-text-3); font-size: 13px; }

/* График */
.rs-chart { display: flex; align-items: flex-end; gap: 7px; height: 148px; padding-top: 8px; }

.rs-chart__col {
    display: flex; flex: 1; flex-direction: column;
    align-items: center; justify-content: flex-end;
    height: 100%; min-width: 0;
}

.rs-chart__bar {
    width: 100%;
    min-height: 4px;
    border-radius: 8px 8px 4px 4px;
    background: var(--rs-accent);
    transition: height 0.25s ease;
}

.rs-chart__col:has(.rs-chart__bar[style*="height: 0%"]) .rs-chart__bar {
    background: var(--rs-surface-deep);
}

.rs-chart__label {
    margin-top: 8px;
    color: var(--rs-text-3);
    font-size: 10.5px;
    font-variant-numeric: tabular-nums;
}

/* Таблица последних заказов */
.rs-table { width: 100%; border-collapse: collapse; }

.rs-table td {
    border-bottom: 1px solid var(--rs-stroke);
    padding: 13px 8px;
    font-size: 14px;
}

.rs-table tr:last-child td { border-bottom: none; }

.rs-table a { color: var(--rs-text); font-weight: 600; text-decoration: none; }
.rs-table a:hover { color: var(--rs-accent); }

.rs-muted { color: var(--rs-text-2); }
.rs-nowrap { white-space: nowrap; }

.rs-num {
    text-align: right;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: -0.3px;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rs-table .rs-mono, .rs-table .rs-num, .rs-table .rs-pill { white-space: nowrap; }

.rs-table td:nth-child(2) {
    max-width: 0; width: 99%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.rs-table td:first-child, .rs-table td:last-child,
.rs-table td:nth-child(3), .rs-table td:nth-child(4) { width: 1%; }

/* Пилюли статуса — как метка наличия в карточке товара. */
.rs-pill {
    display: inline-block;
    padding: 5px 12px;
    border-radius: var(--rs-r-pill);
    background: var(--rs-surface);
    color: var(--rs-text-2);
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}

.rs-pill--awaiting_payment, .rs-pill--needs_payment {
    background: var(--rs-warning-soft); color: var(--rs-warning);
}

.rs-pill--paid, .rs-pill--delivered {
    background: var(--rs-success-soft); color: var(--rs-success);
}

.rs-pill--cancelled { background: var(--rs-accent-soft); color: var(--rs-accent); }

/* Статистика каталога */
.rs-stats { margin: 0; display: flex; flex-direction: column; }

.rs-stats > div {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 12px; padding: 13px 0;
    border-bottom: 1px solid var(--rs-stroke);
}

.rs-stats > div:last-child { border-bottom: none; }

.rs-stats dt { color: var(--rs-text-2); font-size: 14px; }

.rs-stats dd {
    margin: 0; color: var(--rs-text);
    font-size: 19px; font-weight: 800; letter-spacing: -0.4px;
    font-variant-numeric: tabular-nums;
}

.rs-stats__of {
    margin-left: 7px; color: var(--rs-text-3);
    font-size: 12.5px; font-weight: 500; letter-spacing: 0;
}

/* Заметки */
.rs-note { margin: 14px 0 0; color: var(--rs-text-3); font-size: 12.5px; line-height: 1.5; }

.rs-alert {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: var(--rs-r-inner);
    background: var(--rs-warning-soft);
    color: var(--rs-warning);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.45;
}

.rs-alert__detail {
    display: block; margin-top: 5px;
    font-family: var(--rs-font-mono); font-size: 11px; font-weight: 400;
    opacity: 0.85; overflow-wrap: anywhere;
}

.rs-empty {
    margin: 0; padding: 28px 0;
    color: var(--rs-text-3); font-size: 14px; text-align: center;
}

/* Журнал действий */
.rs-log { display: flex; flex-direction: column; }

.rs-log__row {
    display: flex; gap: 12px; align-items: baseline;
    padding: 11px 0;
    border-bottom: 1px solid var(--rs-stroke);
}

.rs-log__row:last-child { border-bottom: none; }

.rs-log__mark {
    flex: none; width: 7px; height: 7px;
    border-radius: var(--rs-r-pill);
    background: var(--rs-text-3);
}

.rs-log__mark--add { background: var(--rs-success); }
.rs-log__mark--delete { background: var(--rs-accent); }

.rs-log__body { min-width: 0; flex: 1; }

.rs-log__object {
    display: block; color: var(--rs-text);
    font-size: 14px; font-weight: 600; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

a.rs-log__object:hover { color: var(--rs-accent); }

.rs-log__meta {
    display: block; margin-top: 2px;
    color: var(--rs-text-3); font-size: 12px;
}

/* --- Списки: номера одной строкой ------------------------------------- */

#result_list .field-number, #result_list .field-article,
#result_list .field-bin, #result_list .field-idempotency_key {
    white-space: nowrap;
}

/* Иконки Django рядом со связанными полями цветные — зелёный плюс,
   синий глаз, красный крестик. В языке приложения цвет несёт смысл,
   поэтому глушим их до серого, а на наведении даём акцент. */
.related-widget-wrapper-link img,
.related-lookup img,
.deletelink img,
.addlink img,
.changelink img,
.viewlink img {
    filter: grayscale(1) opacity(0.45);
    transition: filter 0.15s ease;
}

.related-widget-wrapper-link:hover img,
.related-lookup:hover img { filter: grayscale(0) opacity(1); }

/* Кнопка «История» и подобные — вторичное действие. */
.object-tools li { margin-left: 8px; }
