/*
 * Панель управления Rockstones.
 *
 * Своя разметка, не тема поверх Django: ни одного селектора contrib.admin
 * здесь нет. Палитра и геометрия — из мобильного приложения: радиус 12,
 * мягкая тень, красный акцент, светлый фон.
 */

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

:root {
    --bg: #F2F2F2;
    --card: #FFFFFF;
    --card2: #FAFAFA;
    --border: rgba(0, 0, 0, .10);
    --border2: rgba(0, 0, 0, .16);

    --text: #1A1A1A;
    --text2: #444444;
    --text3: #6B6B6B;
    --on-dark: #FFFFFF;

    --red: #D92424;
    --red2: #B51818;
    --red-bg: rgba(217, 36, 36, .08);
    --green: #1F8F47;
    --green-bg: rgba(31, 143, 71, .10);
    --blue: #1D4ED8;
    --blue-bg: rgba(29, 78, 216, .10);
    --orange: #B86B00;
    --orange-bg: rgba(184, 107, 0, .10);

    --side: #17191C;
    --side-text: rgba(255, 255, 255, .72);
    --side-hover: rgba(255, 255, 255, .07);

    --radius: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, .08);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-theme="dark"] .chart__bar {
    background: linear-gradient(180deg, var(--red) 0%, rgba(229, 72, 77, .3) 100%);
}

html[data-theme="dark"] {
    --bg: #101113;
    --card: #17191C;
    --card2: #1C1F23;
    --border: rgba(255, 255, 255, .10);
    --border2: rgba(255, 255, 255, .18);

    --text: #ECEDEF;
    --text2: #A8ACB3;
    --text3: #7C8089;

    --red: #E5484D;
    --red2: #C93B40;
    --red-bg: rgba(229, 72, 77, .14);
    --green: #3FBF7F;
    --green-bg: rgba(63, 191, 127, .14);
    --blue: #6E93F7;
    --blue-bg: rgba(110, 147, 247, .14);
    --orange: #E0A72C;
    --orange-bg: rgba(224, 167, 44, .14);

    --side: #0B0C0E;
    --shadow: 0 4px 20px rgba(0, 0, 0, .45);
}

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

*, *::before, *::after { box-sizing: border-box; }

/* Свой display у элемента перебивает атрибут hidden — оверлей перехода
   и панель фильтров открывались бы сразу при загрузке. */
[hidden] { display: none !important; }

body {
    margin: 0;
    font: 14px/1.5 var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 650; margin: 0; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--text3); font-size: 13px; margin: 12px 0 0; }
.warn { color: var(--orange); font-size: 13px; margin: 12px 0 0; }
.rs-muted { color: var(--text3); }

.shell { display: flex; min-height: 100vh; }

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

.side {
    width: 236px;
    flex: 0 0 236px;
    background: var(--side);
    color: var(--side-text);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding-bottom: 24px;
}

.side__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 18px;
    color: #fff;
    font-weight: 650;
    font-size: 16px;
}
.side__brand:hover { text-decoration: none; }

.side__mark {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 9px;
    background: linear-gradient(135deg, var(--red), var(--red2));
    color: #fff; font-weight: 700;
}

.nav { display: flex; flex-direction: column; padding: 0 10px; }

.nav__group {
    margin: 18px 0 6px;
    padding: 0 8px;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .38);
}

.nav__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9px;
    color: var(--side-text);
    font-size: 13.5px;
    position: relative;
}
.nav__item:hover { background: var(--side-hover); color: #fff; text-decoration: none; }

.nav__item--on { background: var(--red-bg); color: #fff; }
.nav__item--on::before {
    content: '';
    position: absolute;
    left: -10px; top: 6px; bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--red);
}

.rs-icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: .85; }

/* --- Верхняя полоса ---------------------------------------------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    height: 56px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 5;
}

.top__crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text3); }
.top__crumbs a { color: var(--text3); }
.top__crumbs b { color: var(--text); font-weight: 600; }

.top__right { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.top__exit { color: var(--text3); }

.top__jump {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    padding: 0 8px 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text3);
    font: 13px var(--font);
    cursor: pointer;
}
.top__jump:hover { border-color: var(--border2); color: var(--text2); }
.top__jump kbd {
    padding: 1px 5px;
    border-radius: 5px;
    background: var(--card);
    border: 1px solid var(--border);
    font: 11px var(--mono);
    color: var(--text3);
}

.who { display: flex; align-items: center; gap: 9px; }
.who__face {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red), var(--red2));
    color: var(--on-dark);
    font-weight: 650;
    font-size: 13px;
}
.who__name { display: flex; flex-direction: column; line-height: 1.25; color: var(--text2); }
.who__name i { font-style: normal; font-size: 11px; color: var(--text3); }

.top__theme {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text2);
    width: 30px; height: 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.top__theme:hover { border-color: var(--border2); }

.content { padding: 24px 28px 48px; max-width: 1440px; width: 100%; }

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

.flash { padding: 16px 28px 0; }
.flash__item {
    margin: 0 0 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13.5px;
    background: var(--blue-bg);
    color: var(--blue);
}
.flash__item--success { background: var(--green-bg); color: var(--green); }
.flash__item--warning { background: var(--orange-bg); color: var(--orange); }
.flash__item--error { background: var(--red-bg); color: var(--red); }

/* --- Заголовок раздела -------------------------------------------------- */

.head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.head__hint { margin: 6px 0 0; color: var(--text3); font-size: 13px; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text);
    font: 600 13.5px/1 var(--font);
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { background: var(--card2); text-decoration: none; }

/* Ссылка-кнопка перебивается правилом для a:link, если не назвать
   псевдоклассы явно — тогда текст красный на красном и не читается. */
.btn--primary,
.btn--primary:link,
.btn--primary:visited {
    background: linear-gradient(135deg, var(--red), var(--red2));
    border-color: transparent;
    color: var(--on-dark);
}
.btn--primary:hover { filter: brightness(1.06); }

.btn--danger, .btn--danger:link, .btn--danger:visited {
    background: transparent;
    border-color: var(--red);
    color: var(--red);
}
.btn--danger:hover { background: var(--red-bg); }

/* --- Поиск и фильтры ---------------------------------------------------- */

.bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.bar__find { display: flex; gap: 8px; flex: 0 1 400px; min-width: 220px; }

.bar__search {
    flex: 1;
    min-width: 0;
    height: 38px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text);
    font: 14px var(--font);
}
.bar__search:focus { outline: 2px solid var(--red); outline-offset: -1px; }

.bar__count { color: var(--text3); font-size: 13px; margin-left: 4px; }
.bar__reset { font-size: 13px; margin-left: auto; }

/* --- Панель фильтров ------------------------------------------------------ */

/* Одна кнопка вместо ряда пилюль на каждое поле: шесть коробок разной
   ширины с повторяющимся «Все» читались как мешанина, а на разделе с
   восемью фильтрами ряд ушёл бы на вторую строку. */

.sheet-wrap { position: relative; }

.sheet__open { gap: 7px; }
.sheet__open b {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--red);
    color: var(--on-dark);
    font-size: 11px;
    font-weight: 700;
}
.sheet__open--on { border-color: var(--red); color: var(--red); }

.sheet {
    position: absolute;
    z-index: 30;
    top: calc(100% + 6px);
    left: 0;
    width: max-content;
    max-width: min(720px, calc(100vw - 80px));
    max-height: 70vh;
    overflow-y: auto;
    padding: 6px 18px 16px;
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.sheet__group { padding-top: 12px; }

.sheet__title {
    margin: 0 0 8px;
    color: var(--text3);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.sheet__opts { display: flex; flex-wrap: wrap; gap: 6px; }

.opt {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 11px;
    border-radius: 999px;
    border: 1px solid var(--border2);
    color: var(--text2);
    font-size: 13px;
    line-height: 18px;
}
.opt:hover { border-color: var(--text3); text-decoration: none; }
.opt b { color: var(--text3); font-weight: 500; font-variant-numeric: tabular-nums; }

.opt--on, .opt--on:link, .opt--on:visited {
    background: var(--red);
    border-color: var(--red);
    color: var(--on-dark);
}
.opt--on b { color: rgba(255, 255, 255, .8); }

/* Вариант, который ничего не найдёт, гасим: жать его незачем,
   но и прятать нельзя — ноль сам по себе ответ. */
.opt--empty { opacity: .4; }
.opt--empty.opt--on { opacity: 1; }

/* --- Применённый фильтр --------------------------------------------------- */

/* Видно всегда, не открывая панель: после перехода по ссылке со сводки
   иначе непонятно, почему в таблице три строки. */

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--red);
    background: var(--red-bg);
    color: var(--red);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.tag:hover { background: var(--red); color: var(--on-dark); text-decoration: none; }
.tag i { font-style: normal; font-weight: 400; opacity: .75; }
.tag b { font-size: 15px; font-weight: 400; opacity: .7; }

/* --- Карточки и таблица ------------------------------------------------- */

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    /* Именно clip, не hidden: hidden делает карточку контейнером
       прокрутки, и липкая шапка таблицы отступает внутрь неё,
       оставляя пустую полосу над заголовками. */
    overflow: clip;
    margin-bottom: 16px;
}
.card--pad { padding: 18px 20px; }

.card__title { margin-bottom: 14px; }
.card__title--pad { padding: 18px 20px 0; margin-bottom: 12px; }

/* Узкая колонка режет таблицу, и «Город» с кнопками становятся
   недоступны: карточка их просто обрезает. Поэтому прокрутка вбок.

   Липкие заголовки при этом приходится выключать: контейнер прокрутки
   становится для них точкой отсчёта, и они отъезжают внутрь него.
   На широком экране таблицы помещаются, там прокрутка не нужна и
   заголовки липнут. */
.tablescroll { overflow-x: auto; }

@media (min-width: 1200px) {
    .tablescroll { overflow: visible; }
    .tablescroll .table th {
        position: sticky;
        top: 56px;
        z-index: 2;
    }
}

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.table th {
    text-align: left;
    padding: 11px 14px;
    background: var(--card2);
    border-bottom: 1px solid var(--border);
    color: var(--text3);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--card2); }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table__pick { width: 36px; }
.table__go { width: 1%; white-space: nowrap; text-align: right; }

.empty { padding: 52px 14px; }
.empty > * { display: block; }
.empty b { font-size: 15px; color: var(--text2); margin-bottom: 5px; }
.empty span { color: var(--text3); font-size: 13.5px; margin-bottom: 16px; }
.empty .btn { display: inline-flex; }
.table .empty { text-align: center; }

.sort { color: inherit; display: inline-flex; gap: 4px; }
.sort::after { content: '↕'; opacity: .35; }
.sort--asc::after { content: '↑'; opacity: 1; color: var(--red); }
.sort--desc::after { content: '↓'; opacity: 1; color: var(--red); }

/* --- Значения ----------------------------------------------------------- */

.rs-badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--border);
    color: var(--text2);
    white-space: nowrap;
}
.rs-badge--ok { background: var(--green-bg); color: var(--green); }
.rs-badge--wait { background: var(--blue-bg); color: var(--blue); }
.rs-badge--warn { background: var(--orange-bg); color: var(--orange); }
.rs-badge--off { background: var(--red-bg); color: var(--red); }

.rs-bool { color: var(--text3); font-weight: 700; }
.rs-bool--on { color: var(--green); }

/* --- Массовые действия и страницы --------------------------------------- */

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: -4px 0 16px;
}
.actions__label { color: var(--text3); font-size: 13px; margin-right: 4px; }

.pages {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--text3);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

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

.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field__label { font-size: 12.5px; color: var(--text3); font-weight: 500; }
.field__hint { font-size: 12px; color: var(--text3); }
.field__error { font-size: 12px; color: var(--red); }

.field input[type="text"], .field input[type="email"], .field input[type="url"],
.field input[type="number"], .field input[type="password"], .field input[type="date"],
.field input[type="datetime-local"], .field input[type="time"], .field input[type="file"],
.field textarea, .field select {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text);
    font: 14px var(--font);
}
.field textarea { min-height: 96px; resize: vertical; }
/* Список выбора без своей высоты обрезает текст: у select в Django
   по умолчанию 30px, а строке нужно 38. */
.field select { height: auto; padding-right: 30px; }
.field select[multiple] { min-height: 120px; }
.field input:focus, .field textarea:focus, .field select:focus {
    outline: 2px solid var(--red);
    outline-offset: -1px;
}
.field input[type="checkbox"] { width: 17px; height: 17px; margin: 4px 0; }
.field--bad input, .field--bad textarea, .field--bad select { border-color: var(--red); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.facts dt { color: var(--text3); font-size: 12.5px; margin-bottom: 2px; }
.facts dd { margin: 0; font-weight: 600; }

.inline { display: flex; flex-direction: column; gap: 12px; }
.inline__row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--card2);
}

.submit { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.confirm { max-width: 560px; }
.confirm__list { color: var(--text2); font-size: 13.5px; }

/* --- Сводка -------------------------------------------------------------- */

.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid .card { margin-bottom: 0; }

.tile { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.tile__top { display: flex; align-items: center; gap: 7px; }
.tile__icon {
    display: grid;
    place-items: center;
    width: 24px; height: 24px;
    border-radius: 7px;
    background: var(--bg);
    color: var(--text3);
}
.tile--hot .tile__icon { background: var(--red-bg); color: var(--red); }
.tile__icon .rs-icon { width: 14px; height: 14px; }
.tile:hover { text-decoration: none; border-color: var(--border2); }
.tile__title { font-size: 13px; color: var(--text3); }
.tile__value { font-size: 30px; font-weight: 650; letter-spacing: -.02em; }
.tile__hint { font-size: 12.5px; color: var(--text3); }
.tile--hot .tile__value { color: var(--red); }

.money { display: flex; gap: 28px; flex-wrap: wrap; }
.money > div { display: flex; flex-direction: column; gap: 2px; }
.money__label { font-size: 12.5px; color: var(--text3); }
.money__value { font-size: 22px; font-weight: 650; }
.money__hint { font-size: 12.5px; color: var(--text3); }
.money__row { display: flex; align-items: center; gap: 8px; margin-top: 2px; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; }
.chart__col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
              align-items: center; gap: 6px; height: 100%; }
.chart__bar {
    width: 100%;
    /* Нулевой день тоже виден полоской — иначе провал читается как пропуск. */
    min-height: 3px;
    border-radius: 6px 6px 2px 2px;
    /* Приглушённый: столбцы — фон для чтения формы, а насыщенный красный
       в панели значит «требует внимания». */
    background: linear-gradient(180deg, var(--red) 0%, rgba(217, 36, 36, .35) 100%);
    transition: filter .12s ease;
}
.chart__col:hover .chart__bar { filter: brightness(.92) saturate(1.15); }

@media (prefers-reduced-motion: reduce) {
    .chart__bar { transition: none; }
}
.chart__day { font-size: 11px; color: var(--text3); }

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

.login { display: grid; place-items: center; min-height: 100vh; }

.login__card {
    width: 340px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 30px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
}
.login__card h1 { font-size: 20px; }
.login__mark {
    width: 44px; height: 44px;
    margin: 0 auto 4px;
    display: grid; place-items: center;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--red), var(--red2));
    color: #fff; font-weight: 700; font-size: 20px;
}
.login__hint { margin: 0 0 8px; color: var(--text3); font-size: 13px; }
.login__error {
    margin: 0;
    padding: 9px 12px;
    border-radius: 10px;
    background: var(--red-bg);
    color: var(--red);
    font-size: 13px;
}
.login__card label {
    display: flex; flex-direction: column; gap: 5px;
    text-align: left; font-size: 12.5px; color: var(--text3);
}
.login__card input {
    height: 38px; padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text);
    font: 14px var(--font);
}
.login__card input:focus { outline: 2px solid var(--red); outline-offset: -1px; }
.login__card .btn { margin-top: 6px; }

/* --- Узкий экран ---------------------------------------------------------- */

@media (max-width: 1000px) {
    .side { width: 60px; flex-basis: 60px; }
    .side__name, .nav__item span { display: none; }
    .who__name, .top__jump span { display: none; }
    .top__jump { padding: 0 8px; }
    /* Подпись группы превращается в разделитель. font-size: 0 —
       чтобы текст не выпирал из свёрнутого меню обрезанным. */
    .nav__group {
        height: 1px;
        padding: 0;
        margin: 10px 8px;
        font-size: 0;
        overflow: hidden;
        background: rgba(255, 255, 255, .12);
    }
    .nav__item { justify-content: center; }
    .content, .top { padding-left: 16px; padding-right: 16px; }
    .fields { grid-template-columns: 1fr; }
}

/* --- Поле связи с поиском ------------------------------------------------- */

.combo { position: relative; }
.combo__text { width: 100%; padding-right: 34px !important; }

.combo__clear {
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    width: 22px; height: 22px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text3);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}
.combo__clear:hover { background: var(--border); color: var(--text); }

.combo__menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0; right: 0;
    margin: 0;
    padding: 4px;
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.combo__menu li {
    padding: 7px 10px;
    border-radius: 7px;
    cursor: pointer;
    font-size: 13.5px;
}
.combo__menu li:hover { background: var(--card2); }
.combo__none { color: var(--text3); cursor: default !important; }

/* --- Быстрый переход (⌘K) ------------------------------------------------- */

/* С двадцатью семью разделами искать пункт глазами дольше, чем
   набрать три буквы. */

.jump {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    justify-items: center;
    align-items: start;
    padding-top: 14vh;
    background: rgba(0, 0, 0, .38);
    backdrop-filter: blur(2px);
}

.jump__card {
    width: min(520px, calc(100vw - 32px));
    padding: 8px;
    background: var(--card);
    border: 1px solid var(--border2);
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    animation: jump-in .12s ease-out;
}

@keyframes jump-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .jump__card { animation: none; }
}

.jump__input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 0;
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font: 16px var(--font);
}
.jump__input:focus { outline: none; }

.jump__list {
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
    max-height: 46vh;
    overflow-y: auto;
}

.jump__row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
}
.jump__row i { font-style: normal; font-size: 12px; color: var(--text3); }
.jump__row--on { background: var(--red); color: var(--on-dark); }
.jump__row--on i { color: rgba(255, 255, 255, .75); }

.jump__none { padding: 14px 12px; color: var(--text3); font-size: 13.5px; }

.jump__hint {
    margin: 4px 0 2px;
    padding: 0 12px;
    color: var(--text3);
    font-size: 11.5px;
}

/* --- Частые действия на сводке -------------------------------------------- */

.quick { display: flex; gap: 8px; flex-wrap: wrap; }

.quick__item {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 13px;
    border-radius: 9px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text2);
    font-size: 13px;
    font-weight: 500;
}
.quick__item:hover { border-color: var(--red); color: var(--red); text-decoration: none; }
.quick__item .rs-icon { width: 15px; height: 15px; }

/* --- Динамика и спарклайн -------------------------------------------------- */

.delta {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    background: var(--border);
    color: var(--text3);
}
.delta--up { background: var(--green-bg); color: var(--green); }
.delta--down { background: var(--red-bg); color: var(--red); }

.spark { width: 100%; height: 46px; margin-top: 16px; display: block; }

/* --- Действия в строке ------------------------------------------------------ */

.rowacts { display: inline-flex; align-items: center; gap: 4px; }

.rowact {
    padding: 4px 8px;
    border-radius: 7px;
    font-size: 13px;
    color: var(--red);
}
.rowact:hover { background: var(--red-bg); text-decoration: none; }

.rowact--del {
    color: var(--text3);
    font-size: 17px;
    line-height: 1;
    padding: 2px 8px 4px;
    /* Появляется только на своей строке: колонка из крестиков напротив
       каждой записи выглядит угрожающе и провоцирует случайный клик. */
    opacity: 0;
}
tr:hover .rowact--del, .rowact--del:focus-visible { opacity: 1; }
.rowact--del:hover { background: var(--red-bg); color: var(--red); }

/* --- Доступность ------------------------------------------------------------ */

:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

/* --- Карточка клиента ------------------------------------------------------ */

/* Форма отвечает «что записано», а перед звонком нужно другое: сколько
   потратил, что смотрел, чем кончился прошлый заказ. Эти данные лежат в
   семи таблицах — здесь они собраны на одном экране. */

.person { display: flex; align-items: flex-start; gap: 18px; }

.person__face {
    flex: 0 0 auto;
    width: 60px; height: 60px;
    display: grid; place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red), var(--red2));
    color: var(--on-dark);
    font-size: 24px;
    font-weight: 650;
}

.person__main { flex: 1; min-width: 0; }
.person__main h1 { font-size: 22px; }

.person__contacts { margin: 6px 0 0; color: var(--text2); font-size: 13.5px; }
.person__contacts span { color: var(--text3); margin: 0 6px; }

.person__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }

.person__side { text-align: right; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.person__since { margin: 0; color: var(--text3); font-size: 12.5px; }

.head__acts { display: flex; gap: 8px; }

.alarm {
    margin: -6px 0 16px;
    padding: 11px 15px;
    border-radius: var(--radius);
    background: var(--orange-bg);
    color: var(--orange);
    font-size: 13.5px;
}

.tile__value--sum { font-size: 22px; }

/* Две колонки: слева то, что человек делал, справа — что мы про него
   знаем и что можем ему отправить. */
.pair { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }
.pair__col { min-width: 0; }

@media (max-width: 1100px) {
    .pair { grid-template-columns: 1fr; }
}

.card__foot {
    margin: 0;
    padding: 12px 20px 16px;
    color: var(--text3);
    font-size: 12.5px;
}
.card--pad .card__foot { padding: 12px 0 0; }

.notify { display: flex; flex-direction: column; gap: 12px; }
.notify .btn { align-self: flex-start; }
.notify input, .notify select, .notify textarea {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--border2);
    background: var(--card);
    color: var(--text);
    font: 14px var(--font);
}
.notify select { height: auto; }
.notify textarea { resize: vertical; }
.notify input:focus, .notify select:focus, .notify textarea:focus {
    outline: 2px solid var(--red);
    outline-offset: -1px;
}

/* --- Лента событий ---------------------------------------------------------- */

.line { list-style: none; margin: 0; padding: 0; }

.line__row { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.line__row:last-child { padding-bottom: 0; }

/* Соединительная нить: без неё события читаются как отдельные строки,
   а не как последовательность. */
.line__row:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 4px; top: 14px; bottom: 2px;
    width: 1px;
    background: var(--border);
}

.line__dot {
    flex: 0 0 9px;
    width: 9px; height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--text3);
    z-index: 1;
}
.line__dot--ok { background: var(--green); }
.line__dot--wait { background: var(--blue); }
.line__dot--warn { background: var(--orange); }
.line__dot--off { background: var(--red); }

.line__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.line__body b { font-size: 13.5px; font-weight: 600; }
.line__body span { font-size: 13px; color: var(--text2); }
.line__body i { font-style: normal; font-size: 12px; color: var(--text3); }

/* --- Короткие списки --------------------------------------------------------- */

.notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.notes__row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--card2);
    border: 1px solid var(--border);
}
.notes__row b { font-size: 13.5px; }
.notes__row span { font-size: 13px; color: var(--text2); }
.notes__row i { font-style: normal; font-size: 12px; color: var(--text3); }

/* Непрочитанное помечаем полосой, а не цветом фона: фон спорил бы
   с окраской статусов в остальной панели. */
.notes__row--new { border-left: 3px solid var(--red); }

/* --- Состояние интеграций --------------------------------------------------- */

.state { border-left: 3px solid var(--border2); }
.state--ok { border-left-color: var(--green); }
.state--warn { border-left-color: var(--orange); }
.state--off { border-left-color: var(--red); }

.state__head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.state__head .card__title { margin: 0; flex: 1; }

.state__icon {
    display: grid;
    place-items: center;
    width: 26px; height: 26px;
    border-radius: 8px;
    background: var(--bg);
    color: var(--text3);
}
.state--ok .state__icon { background: var(--green-bg); color: var(--green); }
.state--warn .state__icon { background: var(--orange-bg); color: var(--orange); }
.state--off .state__icon { background: var(--red-bg); color: var(--red); }

.state__rows { margin: 0; display: flex; flex-direction: column; gap: 7px; }
.state__rows > div { display: flex; justify-content: space-between; gap: 16px; font-size: 13.5px; }
.state__rows dt { color: var(--text3); flex: 0 0 auto; }
.state__rows dd { margin: 0; text-align: right; word-break: break-word; }

.state__error {
    margin: 12px 0 0;
    padding: 9px 12px;
    border-radius: 9px;
    background: var(--red-bg);
    color: var(--red);
    font-size: 12.5px;
    font-family: var(--mono);
    word-break: break-word;
}

.state__check { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
