/* =====================================================================
   АвтоДилер Локальный — тема «как АвтоДилер Онлайн».
   Значения сняты со слепков живой программы (data/ad_export/_design/snap).
   1) токены  2) шрифт и база  3) оболочка (меню, вкладки)  4) компоненты.
   Памятка по компонентам: docs/design.md
   ===================================================================== */

/* ---------- 1. Дизайн-токены ---------- */
:root {
  /* меню */
  --ad-menu-bg: #182c4b;            /* тёмно-синее левое меню */
  --ad-menu-w: 188px;
  --ad-menu-w-collapsed: 64px;
  --ad-submenu-bg: #2f415d;
  --ad-menu-hover: rgba(255,255,255,.1);
  --ad-menu-caret: #768798;
  --ad-menu-logo: #5daeff;
  --ad-avatar-bg: #96a9bf;

  /* акцент и текст */
  --ad-blue: #369bff;               /* кнопки, активные вкладки, сортировка */
  --ad-blue-hover: #42a1ff;
  --ad-link: #3ea5ff;               /* ссылки в тексте */
  --ad-text: #000;
  --ad-text-2: #455363;             /* текст активной вкладки */
  --ad-gray: #768798;               /* серые подписи, вторые строки */
  --ad-gray-light: #a3abb7;
  --ad-red: #ff1744;                /* долг, минус, счётчик пропущенных */
  --ad-green: #21c11d;              /* рост в мониторе */
  --ad-dark-20: rgba(24,44,75,.2);  /* рамки кнопок */
  --ad-dark-16: rgba(24,44,75,.16); /* рамки «таблеток» фильтров */
  --ad-dark-40: rgba(24,44,75,.4);

  /* поверхности и линии */
  --ad-bg: #fff;
  --ad-tabs-bg: #e4ecf6;            /* полоса вкладок */
  --ad-tabs-edge: #bed2e8;
  --ad-line: rgba(54,155,255,.2);   /* линии под заголовком, фильтрами, над пагинацией */
  --ad-row-line: #ddf1ff;           /* линии между строками таблиц */
  --ad-row-hover-line: #bed2e8;
  --ad-row-active: #dceeff;         /* выделенная строка */
  --ad-input-border: #bed2e8;
  --ad-search-bg: rgba(228,236,246,.5);
  --ad-disabled-bg: rgba(190,210,232,.2);
  --ad-disabled-border: rgba(190,210,232,.4);
  --ad-disabled-text: rgba(0,0,0,.4);
  --ad-yellow-bg: #fffde7;          /* блок суммы, инфоблоки */
  --ad-yellow-border: rgba(24,44,75,.1);
  --ad-sum-bg: rgba(54,156,255,.1); /* сумма в форме документа */
  --ad-sum-border: rgba(54,156,255,.2);
  --ad-box-border: rgba(54,156,255,.2);
  --ad-divider: #dee2e6;

  /* тени и радиусы */
  --ad-shadow-btn: 0 1px 4px rgba(24,44,75,.32);
  --ad-shadow-btn-hover: 0 2px 6px rgba(24,44,75,.32);
  --ad-shadow-card: -4px 4px 8px rgba(9,56,102,.1);
  --ad-shadow-dropdown: 1px 4px 20px rgba(9,97,172,.17);
  --ad-shadow-kanban: 0 2px 4px rgba(0,0,0,.16);
  --ad-radius: 4px;

  /* бейджи статусов: фон / текст */
  --ad-badge-draft: #9fabb7;   --ad-badge-draft-fg: #fff;
  --ad-badge-done: #4cd864;    --ad-badge-done-fg: #fff;
  --ad-badge-deleted: #e1e1e1; --ad-badge-deleted-fg: #465464;
  --ad-badge-new: #f5e3f9;
  --ad-badge-work: #cce4ff;
  --ad-badge-ready: #dbf7e0;
  --ad-badge-issued: #e8e8e9;
  --ad-badge-wait: #fdf0c8;
  --ad-badge-danger: #ffe0e6;
  --ad-badge-default: #eef1f5;
  --ad-badge-fg: rgba(24,44,75,.8);

  /* колонки канбана (фон этапа) */
  --ad-stage-1: #f1f1f1; --ad-stage-2: #def4fe; --ad-stage-3: #cce4ff; --ad-stage-4: #e3f6e7;
  --ad-stage-5: #fdf0c8; --ad-stage-6: #f5e3f9;

  /* шрифт: у АвтоДилера Proxima Soft (коммерческий) — у нас свободный скруглённый Nunito */
  --ad-font: "Nunito", "Segoe UI", Arial, sans-serif;
}

/* ---------- 2. Шрифт и база ---------- */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("../fonts/nunito-cyrillic-wght-normal.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("../fonts/nunito-cyrillic-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("../fonts/nunito-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("../fonts/nunito-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+20BD, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/21px var(--ad-font); color: var(--ad-text); background: var(--ad-bg);
  -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font-family: inherit; }
a { color: var(--ad-link); text-decoration: none; }
a:hover { text-decoration: none; color: var(--ad-blue); }
[x-cloak] { display: none !important; }
.ico { width: 18px; height: 16px; flex: none; fill: currentColor; vertical-align: middle; }
.gray, .muted { color: var(--ad-gray); }
.red, .neg { color: var(--ad-red); }
.small { font-size: 12px; line-height: 16px; }
.nowrap { white-space: nowrap; }
.num, .text-right { text-align: right; white-space: nowrap; }
.ad-link { color: var(--ad-link); cursor: pointer; }
::placeholder { color: var(--ad-gray); opacity: 1; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #c9d6e6; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 3. Оболочка ---------- */
.ad-shell { display: flex; height: 100vh; overflow: hidden; }

/* левое меню */
.ad-menu { position: relative; flex: none; width: var(--ad-menu-w); height: 100%; background: var(--ad-menu-bg);
  color: #fff; display: flex; flex-direction: column; padding-top: 20px; z-index: 230; user-select: none; }
.ad-logo { display: flex; align-items: center; margin: 0 0 12px 20px; color: #fff; height: 33px; }
.ad-logo:hover { color: #fff; }
.ad-logo .ico { width: 32px; height: 32px; color: var(--ad-menu-logo); margin-right: 7px; }
.ad-logo__text { display: flex; flex-direction: column; line-height: 1; white-space: nowrap; }
.ad-logo__name { font-size: 20px; font-weight: 600; letter-spacing: -.2px; }
.ad-logo__sub { font-size: 11px; color: var(--ad-menu-logo); margin-top: 2px; font-weight: 600; }
.ad-menu__items { flex: 1; min-height: 0; }
.ad-menu__bottom { margin-top: 12px; }
.ad-mi { position: relative; }
.ad-mi__main { display: flex; align-items: center; height: 41px; padding: 10px 18px 9px 26px; color: #fff; cursor: pointer;
  white-space: nowrap; font-size: 14px; line-height: 20px; }
.ad-mi__main:hover, .ad-mi:hover > .ad-mi__main, .ad-mi.is-open > .ad-mi__main { background: var(--ad-menu-hover); color: #fff; }
.ad-mi__icon { width: 20px; height: 20px; margin-right: 8px; display: inline-flex; align-items: center; justify-content: center; opacity: .6;
  transition: opacity .2s; }
.ad-mi__icon .ico { width: 18px; height: 18px; }
.ad-mi:hover .ad-mi__icon, .ad-mi.active .ad-mi__icon { opacity: 1; }
.ad-mi__name { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.ad-mi__caret { position: absolute; right: 10px; top: calc(50% - 6px); width: 8px; height: 12px; color: var(--ad-menu-caret); }
.ad-mi:hover .ad-mi__caret { color: #fff; }
.ad-count { display: inline-block; min-width: 20px; margin-left: 5px; padding: 0 6px; border-radius: 10px; background: var(--ad-red);
  color: #fff; font-weight: 700; font-size: 13px; line-height: 20px; text-align: center; }
/* выпадающее подменю справа */
.ad-sub { position: absolute; left: 100%; top: 0; min-width: 236px; padding: 6px 0; background: var(--ad-submenu-bg);
  border-radius: 6px; box-shadow: 0 2px 8px rgba(24,44,75,.48); display: none; z-index: 300; }
.ad-mi--bottom .ad-sub { top: auto; bottom: 0; }
.ad-mi:hover > .ad-sub, .ad-mi.is-open > .ad-sub { display: block; }
.ad-sub__title { padding: 6px 16px 4px; color: var(--ad-menu-caret); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.ad-sub__row { display: flex; align-items: center; }
.ad-sub__row:hover { background: var(--ad-menu-hover); }
.ad-sub__fav { flex: none; width: 34px; height: 34px; padding: 0 0 0 14px; border: 0; background: none; color: #a3abb7; cursor: pointer;
  display: flex; align-items: center; }
.ad-sub__fav .ico { width: 14px; height: 14px; }
.ad-sub__fav:hover { color: #fff; }
.ad-sub__fav.on { color: #ffc107; }
.ad-sub a { flex: 1; display: block; padding: 7px 24px 7px 6px; color: #fff; font-size: 14px; line-height: 20px; white-space: nowrap; }
.ad-sub a:hover { color: #fff; }
.ad-sub a.current { color: #7cc0ff; }
.ad-sub a.stub { color: rgba(255,255,255,.45); }
/* вложенное подменю (sections.Item.children): «Управление → Зарплата ▸», «+» быстрого создания */
.ad-sub__row--group { position: relative; }
.ad-sub__caret { flex: none; width: 8px; height: 12px; margin-right: 12px; color: var(--ad-menu-caret); }
.ad-sub__row--group:hover > .ad-sub__caret { color: #fff; }
.ad-mi .ad-sub.ad-sub--nested { left: 100%; top: -6px; bottom: auto; }
.ad-mi .ad-sub__row--group:hover > .ad-sub--nested { display: block; }
.ad-sub a.ad-sub__add { flex: none; padding: 7px 14px; color: var(--ad-menu-caret); }
.ad-sub a.ad-sub__add:hover { color: #fff; }
.ad-sub__add .ico { width: 14px; height: 14px; }.ad-sub__empty { display: block; padding: 7px 16px; color: rgba(255,255,255,.5); font-size: 13px; white-space: nowrap; }
/* пользователь внизу */
.ad-user { position: relative; margin-top: 12px; padding: 9px 0 26px; border-top: 1px solid rgba(255,255,255,.2); cursor: pointer; }
.ad-user__row { display: flex; align-items: center; height: 44px; padding: 6px 0 6px 20px; }
.ad-user__row:hover { background: var(--ad-menu-hover); }
.ad-user__pic { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--ad-avatar-bg); color: #fff; font-size: 18px;
  font-weight: 500; line-height: 32px; text-align: center; text-transform: uppercase; }
.ad-user__name { margin-left: 16px; max-width: 98px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-user__id { position: absolute; left: 20px; bottom: 3px; font-size: 12px; line-height: 15px; color: #d1d5db; white-space: nowrap; }
.ad-user .ad-sub { min-width: 200px; }
.ad-sub button.ad-sub__btn { flex: 1; display: flex; align-items: center; gap: 8px; padding: 7px 16px; border: 0; background: none; color: #fff;
  font: inherit; text-align: left; cursor: pointer; }
.ad-sub a.ad-sub__btn { display: flex; align-items: center; gap: 8px; padding: 7px 16px; }
.ad-sub__btn .ico { width: 14px; height: 14px; opacity: .7; }
/* кнопка сворачивания меню */
.ad-menu__toggler { position: absolute; top: 21px; right: -15px; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 0;
  box-shadow: 0 2px 8px rgba(24,44,75,.48); color: #768798; cursor: pointer; opacity: 0; transition: opacity .2s; z-index: 240;
  display: flex; align-items: center; justify-content: center; }
.ad-menu:hover .ad-menu__toggler { opacity: 1; }
.ad-menu__toggler .ico { width: 12px; height: 12px; }
.menu-collapsed .ad-menu { width: var(--ad-menu-w-collapsed); }
.menu-collapsed .ad-logo__text, .menu-collapsed .ad-mi__name, .menu-collapsed .ad-mi__caret, .menu-collapsed .ad-user__name,
.menu-collapsed .ad-user__id { display: none; }
.menu-collapsed .ad-mi__main { padding-left: 22px; }
.menu-collapsed .ad-mi__main .ad-count { position: absolute; left: 34px; top: 4px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; }
.menu-collapsed .ad-logo { margin-left: 16px; }
.menu-collapsed .ad-user__row { padding-left: 16px; }
.menu-collapsed .ad-menu__toggler .ico { transform: rotate(180deg); }

/* рабочая область */
.ad-work { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
/* полоса вкладок открытых разделов */
.ad-tabs { flex: none; display: flex; height: 34px; background: var(--ad-tabs-bg); box-shadow: inset 0 -1px 0 var(--ad-tabs-edge); }
.ad-tabs__list { flex: 1; min-width: 0; display: flex; overflow: hidden; }
.ad-tab { position: relative; flex: 0 1 255px; min-width: 80px; max-width: 255px; height: 34px; display: flex; align-items: center;
  padding: 0 34px 0 7px; color: var(--ad-gray); border-right: 1px solid var(--ad-dark-20); cursor: pointer; font-size: 13px; line-height: 16px; }
.ad-tab:hover { color: var(--ad-text-2); }
.ad-tab__icon { flex: none; width: 16px; height: 16px; margin-right: 6px; color: #97b3d1; }
.ad-tab__text { overflow: hidden; white-space: nowrap; }
.ad-tab__close { position: absolute; right: 3px; top: 0; bottom: 0; width: 34px; display: flex; align-items: center; justify-content: center;
  padding-left: 10px; color: rgba(24,44,75,.4); background: linear-gradient(270deg, var(--ad-tabs-bg) 50%, rgba(255,255,255,0)); }
.ad-tab__close .ico { width: 10px; height: 10px; }
.ad-tab__close:hover { color: var(--ad-text-2); }
.ad-tab.active { background: #fff; color: var(--ad-text-2); box-shadow: inset 0 2px 0 var(--ad-blue); }
.ad-tab.active .ad-tab__close { background: linear-gradient(270deg, #fff 50%, rgba(255,255,255,0)); }
.ad-tabs__side { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 10px 0 7px; }
.ad-tabs__help { display: flex; color: var(--ad-blue); cursor: pointer; border: 0; background: none; padding: 0; }
.ad-tabs__help .ico { width: 20px; height: 20px; }

.ad-page { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: auto; }
.ad-page--fixed { overflow: hidden; }        /* список с карточкой: прокручиваются только таблица и карточка */
.ad-content { padding: 24px; }

/* ---------- 4. Компоненты ---------- */

/* 4.1 Кнопки (как app-btn АвтоДилера) */
.ad-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 13px; border: 1px solid var(--ad-dark-20);
  border-radius: var(--ad-radius); background: #fff; color: var(--ad-blue); font: 700 14px/20px var(--ad-font); letter-spacing: .28px;
  text-transform: uppercase; white-space: nowrap; cursor: pointer; text-decoration: none; }
.ad-btn:hover { color: var(--ad-blue); background: linear-gradient(0deg, rgba(54,155,255,.06), rgba(54,155,255,.06)), #fff; }
.ad-btn .ico { width: 16px; height: 16px; }
.ad-btn--main { background: var(--ad-blue); border-color: var(--ad-blue); color: #fff; box-shadow: var(--ad-shadow-btn); }
.ad-btn--main:hover { background: var(--ad-blue-hover); color: #fff; box-shadow: var(--ad-shadow-btn-hover); }
.ad-btn--big { height: 48px; padding: 0 24px; font-size: 15px; width: 100%; }
.ad-btn--round { width: 36px; padding: 0; border-radius: 14px; color: var(--ad-text); }
.ad-btn--round .ico { width: 16px; height: 16px; }
.ad-btn--round.active { background: var(--ad-blue); border-color: var(--ad-blue); color: #fff; }
.ad-btn--icon38 { width: 38px; padding: 0; border-radius: 14px; }
.ad-btn--icon38 .ico { width: 21px; height: 21px; }
.ad-btn--danger { color: var(--ad-red); }
.ad-btn--text { border-color: transparent; background: none; text-transform: none; font-weight: 400; letter-spacing: 0; padding: 0 4px; }
.ad-btn--text:hover { background: none; text-decoration: underline; }
.ad-btn[disabled] { opacity: .5; cursor: not-allowed; }
.ad-more .ico { width: 12px; height: 12px; margin-left: 4px; }
.ad-close-link { display: inline-flex; align-items: center; gap: 12px; color: var(--ad-blue); font-size: 14px; line-height: 14px; padding: 11px 0;
  border: 0; background: none; cursor: pointer; }
.ad-close-link .ico { width: 12px; height: 14px; color: var(--ad-gray); }
.ad-close-link:hover .ico { color: var(--ad-blue); }

/* 4.2 Заголовок раздела (catalogs-header) */
.ad-header { flex: none; display: flex; align-items: center; height: 81px; border-bottom: 1px solid var(--ad-line); padding-right: 0; background: #fff; }
.ad-header__create { flex: none; width: 96px; display: flex; align-items: center; padding-left: 22px; }
.ad-create { width: 48px; height: 48px; border-radius: 20px; background: var(--ad-blue); color: #fff; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; box-shadow: var(--ad-shadow-btn); }
.ad-create:hover { background: var(--ad-blue-hover); color: #fff; }
.ad-create .ico { width: 22px; height: 22px; }
.ad-header__title { margin: 0; font-size: 32px; font-weight: 500; line-height: 38px; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.ad-header--plain .ad-header__title { padding-left: 24px; }
.ad-header__mark { border: 0; background: none; padding: 0; color: rgba(24,44,75,.3); cursor: pointer; display: flex; }
.ad-header__mark .ico { width: 16px; height: 16px; }
.ad-header__mark.on { color: #ffc107; }
.ad-header__search { flex: 1; min-width: 200px; display: flex; padding: 0 20px 0 32px; margin-left: 35px; }
.ad-scope { position: relative; flex: none; }
.ad-scope select { height: 48px; padding: 0 30px 0 11px; border: 1px solid var(--ad-dark-20); border-radius: 4px 0 0 4px; background: #fff;
  color: var(--ad-gray); font: inherit; appearance: none; cursor: pointer; }
.ad-scope .ico { position: absolute; right: 10px; top: 18px; width: 10px; height: 10px; pointer-events: none; color: var(--ad-gray); }
.ad-search { position: relative; flex: 1; }
.ad-search input { width: 100%; height: 48px; padding: 0 20px 0 56px; border: 0; border-radius: 0 4px 4px 0; background: var(--ad-search-bg);
  color: var(--ad-text); font: inherit; line-height: 16px; outline: none; }
.ad-search--alone input { border-radius: 4px; }
.ad-search input:focus { box-shadow: inset 0 0 0 1px var(--ad-input-border); }
.ad-search .ico { position: absolute; left: 22px; top: 16px; width: 16px; height: 16px; color: var(--ad-gray); pointer-events: none; }
.ad-header__tools { flex: none; display: flex; align-items: center; gap: 12px; padding-right: 16px; margin-left: auto; }
.ad-header__tools form { margin: 0; }
.ad-header__extra { display: flex; align-items: center; gap: 12px; }

/* 4.3 Строка фильтров-«таблеток» */
.ad-filters { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 55px; padding: 11px 16px 11px 24px;
  border-bottom: 1px solid var(--ad-line); background: #fff; }
.ad-pill { position: relative; display: inline-flex; align-items: center; height: 30px; border: 1px solid var(--ad-dark-16); border-radius: 99px;
  background: #fff; color: var(--ad-text); cursor: pointer; }
.ad-pill select { field-sizing: content; height: 28px; max-width: 260px; padding: 0 30px 0 14px; border: 0; background: transparent; font: inherit; color: inherit;
  appearance: none; cursor: pointer; outline: none; }
.ad-pill .ico { position: absolute; right: 10px; width: 10px; height: 10px; pointer-events: none; color: var(--ad-text); }
.ad-pill.is-set { background: var(--ad-blue); border-color: var(--ad-blue); color: #fff; }
.ad-pill.is-set .ico { color: #fff; }
.ad-pill input[type=date] { height: 28px; border: 0; background: transparent; padding: 0 10px; font: inherit; color: inherit; outline: none; }
.ad-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; margin: 0 8px; }
.ad-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ad-switch__track { position: relative; width: 33px; height: 16px; border-radius: 60px; background: var(--ad-dark-40); transition: background .15s; }
.ad-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s; }
.ad-switch input:checked + .ad-switch__track { background: var(--ad-blue); }
.ad-switch input:checked + .ad-switch__track::after { left: 19px; }
.ad-reset { display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; color: var(--ad-blue); font-size: 13px; font-weight: 600;
  line-height: 16px; cursor: pointer; border: 0; background: none; }
.ad-reset .ico { width: 10px; height: 10px; }
.ad-reset:hover { color: var(--ad-blue-hover); }

/* 4.4 Список с карточкой справа */
.ad-split { flex: 1; min-height: 0; display: flex; position: relative; }
.ad-split__list { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.ad-split__card { flex: none; width: 600px; max-width: 55%; position: relative; z-index: 50; display: flex; flex-direction: column;
  background: #fff; box-shadow: var(--ad-shadow-card); }
.ad-split__card:empty { display: none; }
.ad-detail-toggle { position: absolute; top: 8px; width: 20px; height: 32px; padding: 7px 3px; border: 0; cursor: pointer; z-index: 21;
  display: flex; align-items: center; justify-content: center; color: #fff; }
.ad-detail-toggle .ico { width: 14px; height: 14px; }
.ad-detail-toggle--left { left: 0; background: var(--ad-blue); border-radius: 0 4px 4px 0; }
.ad-detail-toggle--right { left: -20px; background: var(--ad-gray-light); border-radius: 4px 0 0 4px; }
.ad-detail-toggle--right:hover, .ad-detail-toggle--right.blue { background: var(--ad-blue); }
.ad-list-scroll { flex: 1; min-height: 0; overflow: auto; }
.ad-table { width: 100%; border-collapse: separate; border-spacing: 0; background: #fff; }
.ad-table th { position: sticky; top: 0; z-index: 10; height: 48px; padding: 7px 10px 6px; background: #fff; color: var(--ad-gray);
  font-size: 13px; font-weight: 600; line-height: 16px; text-align: left; white-space: nowrap; vertical-align: middle;
  box-shadow: inset 0 -1px 0 var(--ad-row-line), 0 1px 0 var(--ad-row-line); }
.ad-table th.num, .ad-table td.num { text-align: right; }
.ad-table th a, .ad-table th .sortable { color: var(--ad-blue); cursor: pointer; }
.ad-table th .ico { width: 8px; height: 10px; margin-left: 3px; }
.ad-table td { max-width: 380px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 15px 10px 11px; vertical-align: top; box-shadow: inset 0 1px 0 var(--ad-row-line); line-height: 21px; }
.ad-table tbody tr { cursor: default; }
.ad-table tbody tr.clickable { cursor: pointer; }
.ad-table tbody tr:hover td { box-shadow: inset 0 1px 0 var(--ad-row-hover-line), inset 0 -1px 0 var(--ad-row-hover-line); }
.ad-table tbody tr.active td { background: var(--ad-row-active); }
.ad-table td.empty { text-align: center; color: var(--ad-gray); padding: 40px 10px; }
.ad-table td.wrap { white-space: normal; color: var(--ad-gray); font-size: 13px; line-height: 18px; max-width: 520px; }
.ad-table .col-check { width: 48px; min-width: 48px; max-width: 48px; padding-left: 23px; padding-right: 7px; }
.ad-table th.col-check { padding-top: 15px; }
.ad-table .col-menu { width: 48px; min-width: 48px; max-width: 48px; position: sticky; right: 0; padding: 15px 10px 11px; text-align: center; }
.ad-table th.col-menu { z-index: 11; padding: 7px 10px 6px; }
.ad-table td.col-menu { overflow: visible; background: linear-gradient(to right, rgba(255,255,255,0), #fff 30%, #fff); }
.ad-table tr.active td.col-menu { background: linear-gradient(to right, rgba(220,238,255,0), var(--ad-row-active) 30%, var(--ad-row-active)); }
.ad-table td.col-menu .ad-dots { visibility: hidden; }
.ad-table tr:hover td.col-menu .ad-dots, .ad-table tr.active td.col-menu .ad-dots { visibility: visible; }
.ad-table .row-label { width: 4px; min-width: 4px; max-width: 4px; padding: 0; }
.ad-gear { border: 0; background: none; padding: 0; color: var(--ad-gray-light); cursor: pointer; display: inline-flex; }
.ad-gear .ico { width: 20px; height: 20px; }
.ad-gear:hover { color: var(--ad-blue); }
/* ячейка в две строки: основная + серая (cell() из apps.core.templatetags.ui) */
.cell-main { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cell-sub { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; color: var(--ad-gray); line-height: 14px; font-size: 14px; }
.cell-sub + .cell-sub { margin-top: 4px; }
.cell-badge { display: block; margin-top: 4px; }
.cell-num { font-weight: 400; }

/* чекбокс как у АвтоДилера (для всех чекбоксов программы) */
input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; border: 2px solid rgba(24,44,75,.4);
  border-radius: 4px; background: #fff; cursor: pointer; vertical-align: middle; position: relative; }
input[type=checkbox]:checked { background: var(--ad-blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round' d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/12px no-repeat;
  border-color: var(--ad-blue); }
input[type=checkbox]:disabled { opacity: .5; cursor: not-allowed; }
input[type=radio] { accent-color: var(--ad-blue); width: 16px; height: 16px; }

/* 4.5 Пагинация */
.ad-pager { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 72px; padding: 17px 16px 13px 24px;
  border-top: 1px solid var(--ad-line); background: #fff; color: var(--ad-gray); white-space: nowrap; }
.ad-pager select, .ad-pager input { height: 40px; border: 1px solid var(--ad-input-border); border-radius: 4px; background: #fff; color: #000;
  font: inherit; }
.ad-pager select { width: 62px; padding: 0 20px 0 10px; appearance: none;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23bed2e8' d='M5 9h14l-7 7.5z'/%3E%3C/svg%3E") right 6px center/12px no-repeat; }
.ad-pager input { width: 62px; padding: 0 9px; }
.ad-pager__total { flex: 1; }
.ad-pager__page { display: flex; align-items: center; }
.ad-pager__next { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 40px; color: var(--ad-gray); }
.ad-pager__next .ico { width: 10px; height: 10px; }
.ad-pager__next:hover { color: var(--ad-blue); }
.ad-pager__next.disabled { opacity: .3; pointer-events: none; }

/* 4.6 Карточка справа (просмотр записи) */
.ad-card { display: flex; flex-direction: column; height: 100%; min-height: 0; background: #fff; }
.ad-card__head { flex: none; display: flex; align-items: center; gap: 12px; height: 40px; padding: 4px 16px 4px 24px; border-bottom: 1px solid var(--ad-line); }
.ad-card__kind { display: flex; align-items: center; gap: 4px; color: var(--ad-gray); font-size: 18px; font-weight: 500; line-height: 24px; white-space: nowrap; }
.ad-card__kind .ico { width: 16px; height: 16px; }
.ad-card__org { flex: 1; min-width: 0; text-align: right; color: var(--ad-gray); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 16px; }
.ad-card__body { flex: 1; min-height: 0; overflow: auto; padding: 0 24px 0 24px; }
.ad-card__top { display: flex; gap: 16px; margin-top: 16px; }
.ad-card__titles { flex: 1; min-width: 0; }
.ad-card__title { display: flex; align-items: center; gap: 6px; margin: 0; padding-top: 4px; font-size: 24px; font-weight: 600; line-height: 36px;
  overflow: hidden; text-overflow: ellipsis; }
.ad-card__title .ad-header__mark { margin-left: -7px; }
.ad-card__meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 9px 0; }
.ad-card__meta b { font-weight: 600; }
.ad-card__badges { display: flex; flex-wrap: wrap; gap: 8px; min-height: 22px; }
.ad-card__badges:not(:has(*)), .ad-card__meta:not(:has(*)) { display: none; }
.ad-card__foot { flex: none; position: relative; padding: 12px 24px 24px; background: linear-gradient(rgba(255,255,255,.85), rgba(247,247,247,.95) 29%, #fff);
  box-shadow: 0 -8px 8px -8px #fff; }
.ad-card__foot .ad-btn--big { box-shadow: var(--ad-shadow-btn); }
.ad-card__section { margin: 12px 0 24px; }
.ad-card__label { display: block; margin-bottom: 0; font-weight: 600; line-height: 20px; }
.ad-props { width: 100%; border-collapse: collapse; margin: 12px 0; }
.ad-props th { width: 160px; padding: 6px 12px 6px 0; text-align: left; font-weight: 600; vertical-align: top; line-height: 20px; }
.ad-props td { padding: 6px 0; vertical-align: top; line-height: 20px; word-break: break-word; }
.ad-box { border: 1px solid var(--ad-box-border); border-radius: 6px; padding: 14px 24px 11px; margin-top: 4px; }
.ad-box__title { font-size: 18px; font-weight: 500; line-height: 24px; }
.ad-box__sub { color: var(--ad-gray); line-height: 18px; }
a.ad-box { display: block; color: inherit; }
a.ad-box:hover { border-color: var(--ad-blue); }
/* сумма в жёлтом блоке */
.ad-sum { flex: none; align-self: flex-start; display: inline-block; padding: 8px; background: var(--ad-yellow-bg); border: 1px solid var(--ad-yellow-border);
  border-radius: 4px; text-align: right; white-space: nowrap; }
.ad-sum__value { display: block; font-size: 24px; font-weight: 600; line-height: 28px; }
.ad-sum__sub { display: block; line-height: 20px; color: var(--ad-red); }
.ad-sum--small { padding: 6px; }
.ad-sum--small .ad-sum__value { font-size: 18px; font-weight: 500; line-height: 24px; }

/* 4.7 Вкладки внутри карточки/формы (с верхними счётчиками) */
.ad-itabs { display: flex; flex-wrap: nowrap; gap: 24px; margin: 22px 0 0; padding: 0; list-style: none; border-bottom: 1px solid var(--ad-line);
  overflow-x: auto; overflow-y: hidden; }
.ad-itab { position: relative; padding: 0 0 2px; font-size: 18px; line-height: 24px; color: var(--ad-gray); cursor: pointer; white-space: nowrap;
  border: 0; background: none; font-family: inherit; }
.ad-itab:hover { color: var(--ad-blue); }
.ad-itab.active { color: var(--ad-blue); }
.ad-itab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; border-bottom: 2px solid var(--ad-blue); }
.ad-itab sup { position: relative; top: -12px; left: 1px; font-size: 11px; font-weight: 600; line-height: 0; vertical-align: baseline; }
.ad-itab.has-error { color: var(--ad-red); }
.ad-itab-pane { padding: 20px 0 30px; }

/* 4.8 Форма редактирования документа */
.ad-form { display: flex; flex-direction: column; min-height: 100%; background: #fff; }
.ad-form__buttons { display: flex; align-items: center; gap: 16px; padding: 24px 24px 20px; }
.ad-form__buttons-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.ad-form__header { display: flex; align-items: center; gap: 16px; padding: 0 24px; min-height: 48px; }
.ad-form__title { display: flex; align-items: center; min-width: 96px; margin: 0; font-size: 24px; font-weight: 600; line-height: 48px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.ad-form__title:has(.ad-header__mark) { margin-left: -10px; }
.ad-form__title .ad-header__mark { flex: none; width: 24px; margin-right: 2px; justify-content: center; }
.ad-form__badges { display: flex; align-items: center; gap: 8px; }
.ad-form__meta { margin-left: 16px; white-space: nowrap; }
.ad-form__sum { margin-left: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-width: 200px; max-width: 260px;
  padding: 10px 16px 10px 12px; background: var(--ad-sum-bg); border: 1px solid var(--ad-sum-border); border-radius: 4px; }
.ad-form__sum .ico { width: 16px; height: 16px; color: var(--ad-gray); margin-left: 4px; }
.ad-form__sum-value { font-size: 20px; font-weight: 500; line-height: 26px; white-space: nowrap; }
.ad-form__tabs { padding: 0 24px; }
.ad-form__tabs .ad-itabs { margin-top: 20px; }
.ad-form__body { flex: 1; padding: 4px 24px 32px; }
.ad-pencil { width: 32px; height: 32px; border: 1px solid var(--ad-dark-20); border-radius: 14px; background: #fff; color: var(--ad-gray); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; margin: 0 10px 0 6px; }
.ad-pencil .ico { width: 14px; height: 14px; }
/* поля: подпись сверху (600), красная звёздочка, поле 48px */
.ad-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; }
.ad-fields--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ad-field { margin-top: 20px; min-width: 0; }
.ad-field--wide { grid-column: 1 / -1; }
.ad-field--check { display: flex; align-items: flex-end; padding-bottom: 14px; }
.ad-field > label, .ad-field__head > label, .ad-label { display: inline-block; margin-bottom: 0; font-weight: 600; line-height: 24px; }
.ad-field .req, .ad-label .req { color: var(--ad-red); font-weight: 600; position: relative; top: -4px; margin-left: 1px; }
.ad-field__help { display: block; margin-top: 4px; color: var(--ad-gray); font-size: 13px; line-height: 16px; }
.ad-field__error { display: block; margin-top: 4px; color: var(--ad-red); font-size: 13px; line-height: 16px; }
.ad-field.has-error .input, .ad-field.has-error .ad-input { border-color: var(--ad-red); }
.ad-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; line-height: 20px; }
.ad-input, .ad-form .input, .ad-card .input { width: 100%; height: 48px; padding: 0 16px; border: 1px solid var(--ad-input-border); border-radius: 4px; background: #fff;
  color: var(--ad-text); font: 400 14px/25px var(--ad-font); outline: none; }
textarea.ad-input, .ad-form textarea.input, .ad-card textarea.input { height: auto; min-height: 84px; padding: 12px 16px; line-height: 20px; resize: vertical; }
.ad-input:focus, .ad-form .input:focus, .ad-card .input:focus { border-color: var(--ad-blue); }
.ad-input:disabled, .ad-input[readonly], .ad-form .input:disabled, .ad-card .input:disabled, fieldset:disabled .input {
  background: var(--ad-disabled-bg); border-color: var(--ad-disabled-border); color: var(--ad-disabled-text); cursor: not-allowed; }
/* жёлтый инфоблок */
.ad-info { padding: 12px 16px; background: var(--ad-yellow-bg); border: 1px solid var(--ad-yellow-border); border-radius: 4px; line-height: 20px; }
.ad-info__title { font-weight: 600; margin-bottom: 6px; }
.ad-section-title { margin: 28px 0 0; font-size: 18px; font-weight: 500; line-height: 24px; }

/* 4.9 Таблица строк документа (работы/товары) */
.ad-lines { width: 100%; border-collapse: separate; border-spacing: 0; }
.ad-lines th { height: 48px; padding: 7px 10px 6px; color: var(--ad-gray); font-size: 13px; font-weight: 600; line-height: 16px; text-align: left; white-space: nowrap;
  box-shadow: inset 0 -1px 0 var(--ad-row-line), 0 1px 0 var(--ad-row-line); background: #fff; position: sticky; top: 0; z-index: 2; }
.ad-lines th .sortable { color: var(--ad-blue); }
.ad-lines td { padding: 15px 10px 10px; vertical-align: top; box-shadow: inset 0 1px 0 var(--ad-row-line); }
.ad-lines tbody tr:hover td { box-shadow: inset 0 1px 0 var(--ad-row-hover-line), inset 0 -1px 0 var(--ad-row-hover-line); }
.ad-lines .col-check { width: 28px; padding-left: 3px; padding-right: 7px; }
.ad-lines .num { text-align: right; white-space: nowrap; }
.ad-lines .sum { font-weight: 600; text-align: right; white-space: nowrap; }
.ad-lines tfoot td { box-shadow: inset 0 1px 0 var(--ad-row-line); padding: 20px 0 0; }
.ad-quickadd { display: flex; gap: 8px; align-items: stretch; margin-top: 20px; }
.ad-quickadd__input { position: relative; flex: 1; min-width: 0; }
.ad-quickadd__input > .ico { position: absolute; left: 16px; top: 16px; width: 12px; height: 16px; color: var(--ad-blue); }
.ad-quickadd__input input { width: 100%; height: 48px; padding: 0 140px 0 42px; border: 1px solid var(--ad-input-border); border-radius: 4px;
  font: inherit; color: var(--ad-text); outline: none; }
.ad-quickadd__input input:focus { border-color: var(--ad-blue); }
.ad-quickadd__folder { position: absolute; right: 6px; top: 6px; height: 36px; display: inline-flex; align-items: center; gap: 10px; padding: 0 9px;
  border: 0; border-radius: 4px; background: #fff; color: var(--ad-blue); font: 700 14px/16px var(--ad-font); letter-spacing: .28px; text-transform: uppercase; cursor: pointer; }
.ad-quickadd__folder .ico { width: 18px; height: 16px; color: var(--ad-gray); }
.ad-quickadd .ad-btn { height: 48px; padding: 0 16px; }
.ad-quickadd .ad-btn .ico { width: 20px; height: 20px; color: var(--ad-gray); }
.ad-total { display: flex; justify-content: flex-end; align-items: baseline; margin-top: 10px; padding: 5px 0; border-right: 3px solid var(--ad-blue); }
.ad-total__name { text-align: right; white-space: nowrap; }
.ad-total__value { padding: 0 26px 0 32px; font-weight: 700; text-align: right; white-space: nowrap; min-width: 130px; }
.ad-total + .ad-total { margin-top: 0; }

/* 4.10 Бейджи статусов */
.ad-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 2px; background: var(--ad-badge-default);
  color: var(--ad-badge-fg); font-size: 11px; font-weight: 700; line-height: 17px; letter-spacing: .84px; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.ad-badge--list { padding: 0 6px; font-size: 12px; line-height: 18px; }
.cell-badge .ad-badge { padding: 0 6px; font-size: 12px; }
.ad-badge--draft { background: var(--ad-badge-draft); color: var(--ad-badge-draft-fg); }
.ad-badge--done { background: var(--ad-badge-done); color: var(--ad-badge-done-fg); }
.ad-badge--deleted { background: var(--ad-badge-deleted); color: var(--ad-badge-deleted-fg); }
.ad-badge--new { background: var(--ad-badge-new); }
.ad-badge--work { background: var(--ad-badge-work); }
.ad-badge--ready { background: var(--ad-badge-ready); }
.ad-badge--issued { background: var(--ad-badge-issued); }
.ad-badge--wait { background: var(--ad-badge-wait); }
.ad-badge--danger { background: var(--ad-badge-danger); color: var(--ad-red); }
.ad-chip { display: inline-block; padding: 0 4px; border-radius: 2px; background: var(--ad-badge-work); font-weight: 600; line-height: 20px; }

/* 4.11 Выпадающее меню «⋮» и меню «ЕЩЁ» */
.ad-dd { position: relative; display: inline-flex; }
.ad-dots { width: 24px; height: 24px; border: 0; background: none; padding: 0; color: rgba(24,44,75,.6); cursor: pointer; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center; }
.ad-dots:hover { color: var(--ad-blue); }
.ad-dots .ico { width: 16px; height: 16px; }
.ad-dd__menu { position: absolute; right: 0; top: calc(100% + 4px); min-width: 200px; padding: 6px 0; background: #fff; border: 1px solid #d5e0ee;
  border-radius: 6px; box-shadow: var(--ad-shadow-dropdown); z-index: 1000; text-align: left; }
.ad-dd__menu--left { left: 0; right: auto; }
.ad-dd__menu--up { top: auto; bottom: calc(100% + 4px); }
.ad-dd__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 16px; border: 0; background: none; color: var(--ad-text);
  font: 400 14px/20px var(--ad-font); text-align: left; text-transform: none; letter-spacing: 0; white-space: nowrap; cursor: pointer; }
.ad-dd__item:hover { background: var(--ad-row-active); color: var(--ad-text); }
.ad-dd__item .ico { width: 16px; height: 16px; color: var(--ad-gray); }
.ad-dd__item--danger { color: var(--ad-red); }
.ad-dd__item--danger .ico { color: var(--ad-red); }
.ad-dd__sep { height: 1px; margin: 6px 0; background: var(--ad-row-line); }
.ad-dd form { margin: 0; }

/* 4.12 Модальное окно */
.ad-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px 16px;
  background: rgba(24,44,75,.4); overflow: auto; }
.ad-modal__dialog { width: 560px; max-width: 100%; background: #fff; border-radius: 8px; box-shadow: 0 10px 40px rgba(9,56,102,.3); }
.ad-modal__dialog--wide { width: 860px; }
.ad-modal__head { display: flex; align-items: center; gap: 12px; padding: 24px 24px 0; }
.ad-modal__title { flex: 1; margin: 0; font-size: 24px; font-weight: 600; line-height: 32px; }
.ad-modal__close { border: 0; background: none; color: var(--ad-gray); cursor: pointer; padding: 4px; display: flex; }
.ad-modal__close .ico { width: 14px; height: 14px; }
.ad-modal__close:hover { color: var(--ad-blue); }
.ad-modal__body { padding: 16px 24px 8px; }
.ad-modal__foot { display: flex; justify-content: flex-end; gap: 16px; padding: 16px 24px 24px; }

/* 4.13 Канбан (CRM) */
.ad-kanban { display: flex; gap: 0; height: 100%; min-height: 0; padding: 12px 12px 20px 0; overflow-x: auto; align-items: stretch; }
.ad-kcol { flex: none; width: 360px; padding-left: 16px; display: flex; flex-direction: column; min-height: 0; }
.ad-kcol__head { flex: none; display: flex; align-items: center; gap: 8px; height: 50px; padding: 16px 10px 10px; border-radius: 8px 8px 0 0;
  background: var(--stage, var(--ad-stage-1)); box-shadow: inset 0 2px 0 rgba(0,0,0,.08), inset 2px 0 0 rgba(0,0,0,.08), inset -2px 0 0 rgba(0,0,0,.08); }
.ad-kcol__title { min-width: 0; font-size: 18px; font-weight: 500; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-kcol__count { flex: none; min-width: 22px; padding: 0 3px; border: 2px solid rgba(0,0,0,.08); border-radius: 8px; line-height: 18px; text-align: center; font-size: 13px; }
.ad-kcol__sum { margin-left: auto; padding-right: 0; font-weight: 600; white-space: nowrap; }
.ad-kcol__body { flex: 1; min-height: 120px; overflow-y: auto; padding: 10px; background: var(--stage, var(--ad-stage-1));
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.08), inset 2px 0 0 rgba(0,0,0,.08), inset -2px 0 0 rgba(0,0,0,.08); }
.ad-kcard { display: block; position: relative; max-width: 100%; margin-bottom: 12px; padding: 12px; background: #fff; border-radius: 4px;
  box-shadow: var(--ad-shadow-kanban); color: var(--ad-text); cursor: pointer; }
.ad-kcard:hover { color: var(--ad-text); box-shadow: 0 3px 8px rgba(0,0,0,.2); }
.ad-kcard__num { display: inline-block; padding: 2px 4px; background: rgba(24,44,75,.06); font-size: 12px; line-height: 18px; }
.ad-kcard__row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.ad-kcard__car { display: inline-block; max-width: 200px; padding: 0 8px; border: 1px solid rgba(0,0,0,.16); border-radius: 4px; font-size: 18px;
  font-weight: 600; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-kcard__plate { margin-left: auto; white-space: nowrap; }
.ad-kcard__title { margin-top: 12px; font-size: 18px; font-weight: 500; line-height: 24px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-kcard__line { margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-kcard__foot { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.ad-kcard__sum { font-weight: 600; }
.ad-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: rgba(24,44,75,.08); color: var(--ad-text); font-size: 12px; font-weight: 600;
  line-height: 28px; text-align: center; text-transform: uppercase; }

/* 4.14 Карточки-плитки (монитор отчётов, главная) */
.ad-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
.ad-tile { display: block; padding: 24px; border-radius: 8px; background: #fff; color: var(--ad-text);
  box-shadow: inset 0 0 0 1px rgba(54,156,255,.2); }
a.ad-tile:hover, .ad-tile.active { color: var(--ad-text); box-shadow: inset 0 0 0 2px #369cff; }
.ad-tile__title { font-weight: 600; line-height: 20px; padding-bottom: 8px; }
.ad-tile__value { font-size: 18px; font-weight: 500; line-height: 24px; }
.ad-tile__delta { margin-left: 6px; font-size: 14px; }
.ad-tile__delta.up { color: var(--ad-green); }
.ad-tile__delta.down { color: var(--ad-red); }
.ad-tile__sub { color: var(--ad-gray); line-height: 20px; }
.ad-tile__row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--ad-divider); }
.ad-tile__row:last-child { border-bottom: 0; }
.ad-tile__section { padding: 20px 0; border-bottom: 1px solid var(--ad-divider); }
.ad-tile__section:first-child { padding-top: 0; }
.ad-tile__section:last-child { border-bottom: 0; padding-bottom: 0; }
.ad-tile--link { display: flex; align-items: center; gap: 14px; padding: 16px 20px; }
.ad-tile--link .ico { width: 22px; height: 22px; color: var(--ad-blue); }
.ad-tile--link small { display: block; color: var(--ad-gray); font-size: 12px; line-height: 16px; }
.ad-page-title { margin: 0; padding: 20px 24px 12px; font-size: 32px; font-weight: 400; line-height: 48px; border-bottom: 1px solid var(--ad-divider); }

/* 4.15 Сообщения (всплывают сверху справа) */
.ad-toasts { position: fixed; top: 44px; right: 16px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; width: 360px; max-width: calc(100vw - 32px); }
.ad-toast { padding: 12px 16px; border-radius: 6px; background: #fff; border: 1px solid #d5e0ee; box-shadow: var(--ad-shadow-dropdown);
  border-left: 4px solid var(--ad-blue); line-height: 20px; }
.ad-toast--success { border-left-color: #4cd864; }
.ad-toast--error { border-left-color: var(--ad-red); }
.ad-toast--warning { border-left-color: #ffb300; }

/* 4.16 Пустое состояние */
.ad-empty { padding: 60px 20px; text-align: center; color: var(--ad-gray); }
.ad-empty .ico { width: 48px; height: 48px; color: #c4d2e3; margin-bottom: 12px; }
.ad-empty h2 { margin: 0 0 8px; color: var(--ad-text); font-size: 20px; font-weight: 600; }

@media (max-width: 900px) {
  .ad-header__search { margin-left: 8px; padding-left: 8px; }
  .ad-split__card { position: absolute; right: 0; top: 0; bottom: 0; max-width: 100%; }
}

/* ---------- 5. Сборка панели/карточки ---------- */
.ad-card-host { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.ad-card-host > .ad-card, .panel-body > .ad-card { flex: 1; min-height: 0; }
.ad-card__form { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ad-card .input, .ad-card .ad-input { height: 40px; }
.ad-card textarea.input { height: auto; }
.ad-card .ad-field { margin-top: 16px; }
.ad-card .ad-itabs { margin-top: 18px; }
.panel-body:has(.ad-card) + .panel-close { display: none; }
.ad-sub__title { display: none; }
.menu-collapsed .ad-sub__title { display: block; }
.ad-menu .ad-mi.active > .ad-mi__main { background: rgba(255,255,255,.06); }
@media print {
  .ad-menu, .ad-tabs, .ad-header__tools, .ad-header__create, .ad-header__search, .ad-filters, .ad-pager, .ad-split__card, .col-check, .col-menu { display: none !important; }
  .ad-shell, .ad-page { height: auto; overflow: visible; display: block; }
}

/* ---------- 6. Формы создания (docs/forms-contract.md) ---------- */
/* 6.1 Поиск клиента (core/widgets/client_search.html) */
.ad-cs { position: relative; }
.ad-cs__group { position: relative; }
.ad-cs__input { padding-right: 86px !important; }
.ad-cs__input:focus { border-color: var(--ad-blue); box-shadow: 0 0 8px rgba(54,155,255,.15), inset 0 0 0 1px var(--ad-blue); }
.ad-cs__btns { position: absolute; right: 6px; top: 6px; height: 36px; display: flex; align-items: center; }
.ad-cs__loading { width: 18px; height: 18px; margin-right: 6px; }
.ad-cs__btn { width: 36px; height: 36px; padding: 0 9px; border: 0; border-radius: 4px; background: #fff; color: rgba(24,44,75,.4); cursor: pointer;
  display: flex; align-items: center; justify-content: center; }
.ad-cs__btn .ico { width: 18px; height: 16px; }
.ad-cs__btn--edit { width: 34px; }
.ad-cs__btn--edit .ico { width: 16px; height: 16px; }
.ad-cs__btn:hover { color: var(--ad-blue); }
.has-error .ad-cs__input { border-color: var(--ad-red); }
.ad-cs__dd { position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 500; background: #fff; border-radius: 6px;
  border: 1px solid #d5e0ee; box-shadow: var(--ad-shadow-dropdown); max-height: 360px; display: flex; flex-direction: column; }
.ad-cs__dd--up { top: auto; bottom: calc(100% + 2px); }
.ad-cs__head { flex: none; display: grid; grid-template-columns: 60% 40%; padding: 14px 16px 6px; color: var(--ad-gray); line-height: 20px; }
.ad-cs__list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.ad-cs__row { display: grid; grid-template-columns: 60% 40%; align-items: start; }
.ad-cs__name { padding: 6px 16px; cursor: pointer; line-height: 20px; min-height: 32px; }
.ad-cs__phone { margin-left: 8px; color: var(--ad-gray); font-size: 13px; }
.ad-cs__car { padding: 6px 16px 6px 0; cursor: pointer; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-cs__car-title { margin-right: 4px; }
.ad-cs__name.active, .ad-cs__car.active, .ad-cs__create.active { background: var(--ad-row-active); }
.ad-cs__car.match .ad-cs__car-title { font-weight: 600; }
.ad-cs__empty, .ad-cs__more { padding: 8px 16px; color: var(--ad-gray); }
.ad-cs__create { flex: none; padding: 12px 16px; border-top: 1px solid var(--ad-row-line); color: var(--ad-link); cursor: pointer; line-height: 20px; }
.ad-plate-l { font-size: .82em; text-transform: lowercase; }

/* 6.2 Красный тост ошибки (как «Не выбрано предприятие») — adToast('текст') */
.ad-snack-box { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; }
.ad-snack { display: flex; align-items: center; min-width: 400px; max-width: 800px; padding: 14px 8px 14px 16px; background: #ffe3e9;
  border: 1px solid var(--ad-red); color: var(--ad-text); }
.ad-snack__icon { width: 24px; height: 24px; color: var(--ad-red); }
.ad-snack__text { flex: 1; padding: 0 18px; line-height: 20px; white-space: pre-line; }
.ad-snack__close { border: 0; background: none; padding: 3px 8px; color: var(--ad-gray); cursor: pointer; display: flex; }
.ad-snack__close .ico { width: 8px; height: 8px; }

/* 6.3 Подсказки у полей */
.ad-field__error { display: block; margin-top: 4px; color: var(--ad-red); font-size: 12px; line-height: 16px; }
.ad-field__prev { display: flex; align-items: center; gap: 4px; margin-top: 5px; font-size: 12px; white-space: nowrap; color: var(--ad-gray); }
.ad-field__prev b { font-weight: 400; color: var(--ad-blue); }
.ad-field__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-height: 24px; }
.ad-count-chars { font-size: 13px; line-height: 10px; color: var(--ad-gray); margin-bottom: 6px; white-space: nowrap; }
.ad-ref { display: inline-flex; vertical-align: middle; color: #a3abb7; cursor: help; margin-left: 4px; }
.ad-ref .ico { width: 16px; height: 16px; }
.ad-label-link { margin-left: 16px; font-weight: 400; color: var(--ad-link); cursor: pointer; }
.ad-label-check { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; font-weight: 400; color: var(--ad-gray); line-height: 20px; cursor: pointer; }
.ad-input-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.ad-input-wrap .ad-input { flex: 1; }
.ad-input-pencil { flex: none; width: 32px; height: 32px; border: 0; background: none; color: rgba(24,44,75,.4); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.ad-input-pencil .ico { width: 16px; height: 16px; }
.ad-input-pencil:hover, .ad-input-pencil.on { color: var(--ad-blue); }
.ad-radios { display: flex; align-items: center; gap: 36px; height: 48px; }
.ad-radio { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.ad-radio input { appearance: none; -webkit-appearance: none; width: 16px; height: 16px; margin: 0; border: 2px solid rgba(24,44,75,.4); border-radius: 50%; cursor: pointer; }
.ad-radio input:checked { border: 5px solid var(--ad-blue); }
.ad-help-text { color: var(--ad-gray); font-size: 13px; line-height: 18px; }

/* 6.4 Вложения: «Перетащите файлы сюда или добавьте вложение…» */
.ad-attach__drop { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 84px; padding: 16px; border: 1px dashed var(--ad-input-border);
  border-radius: 4px; color: var(--ad-gray); text-align: center; }
.ad-attach__drop.drag { border-color: var(--ad-blue); background: rgba(54,155,255,.05); }
.ad-attach__drop a, .ad-attach__drop button { border: 0; background: none; padding: 0; font: inherit; color: var(--ad-link); cursor: pointer; }
.ad-attach__list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ad-attach__item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--ad-box-border); border-radius: 4px; }
.ad-attach__item .ico { width: 14px; height: 14px; color: var(--ad-gray); }
.ad-attach__item button { border: 0; background: none; padding: 0 2px; color: var(--ad-gray); cursor: pointer; display: flex; }
.ad-attach__item button:hover { color: var(--ad-red); }

/* 6.5 Диалог «Данные были изменены. Сохранить изменения?» и модальное окно как в АвтоДилере */
.ad-modal { background: rgba(2,19,37,.5); padding-top: 169px; }
.ad-modal__dialog { border-radius: 6px; }
.ad-modal__dialog--confirm { width: 425px; min-width: 400px; }
.ad-modal__dialog--confirm .ad-modal__head { position: relative; padding: 30px 38px 0 24px; }
.ad-modal__dialog--confirm .ad-modal__title { font-size: 18px; font-weight: 500; line-height: 24px; white-space: pre-wrap; margin-bottom: 14px; }
.ad-modal__dialog--confirm .ad-modal__close { position: absolute; top: 16px; right: 12px; padding: 6px; }
.ad-modal__dialog--confirm .ad-modal__close .ico { width: 12px; height: 12px; }
.ad-modal__dialog--confirm .ad-modal__foot { padding: 48px 24px 24px; gap: 8px; }
.ad-btn--flat { border-color: transparent; padding: 8px; }
.ad-modal__dialog--form { width: 1000px; max-width: calc(100vw - 48px); }
.ad-modal__dialog--form .ad-form { min-height: 0; border-radius: 6px; }
.ad-modal__loading { padding: 40px; text-align: center; color: var(--ad-gray); }
.ad-modal:has(.ad-modal__dialog--form) { padding-top: 40px; }

/* 6.6 Блоки внутри формы клиента */
.ad-subsection { margin-top: 32px; font-size: 18px; font-weight: 500; line-height: 24px; }
.ad-phones { width: 100%; border-collapse: collapse; margin-top: 12px; }
.ad-phones th { padding: 0 12px 4px 0; text-align: left; font-weight: 600; line-height: 24px; white-space: nowrap; }
.ad-phones td { padding: 0 12px 12px 0; vertical-align: middle; }
.ad-phones td.c { text-align: center; }
.ad-phones .ad-input { height: 48px; }
.ad-box-form { margin-top: 16px; padding: 20px 24px 24px; border: 1px solid var(--ad-box-border); border-radius: 6px; position: relative; }
.ad-box-form__title { font-size: 18px; font-weight: 500; line-height: 24px; }
.ad-box-form__remove { position: absolute; top: 16px; right: 16px; border: 0; background: none; color: var(--ad-gray); cursor: pointer; display: flex; }
.ad-box-form__remove:hover { color: var(--ad-red); }
.ad-row { display: grid; column-gap: 24px; }
.ad-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-row--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ad-row--help { grid-template-columns: 400px minmax(0, 1fr); column-gap: 80px; align-items: center; }
/* переключатель-«сегменты» (Нормочас / Фиксированная стоимость) */
.ad-seg { height: 31px; padding: 9px 10px; border: 1px solid var(--ad-dark-16); border-radius: 4px; background: #fff; color: var(--ad-text);
  font: 400 14px/12px var(--ad-font); cursor: pointer; }
.ad-seg + .ad-seg { margin-left: 8px; }
.ad-seg.active { background: var(--ad-blue); border-color: var(--ad-blue); color: #fff; }
.ad-cs__btn--label { width: auto; gap: 10px; color: var(--ad-blue); font: 700 14px/16px var(--ad-font); letter-spacing: .28px; text-transform: uppercase; }
.ad-cs__btn--label .ico { color: rgba(24,44,75,.4); }
.ad-cs__input--label { padding-right: 150px !important; }

.ad-table th .sortable { display: inline-flex; align-items: center; }
.ad-table th .sortable .ico.desc { transform: rotate(180deg); }
.ad-table th .sortable.is-sorted { color: var(--ad-blue); }


.ad-code { margin: 8px 0 12px; padding: 12px 16px; background: #f5f8fc; border: 1px solid var(--ad-box-border); border-radius: 4px; font: 13px/20px Consolas, monospace; white-space: pre-wrap; }


.ad-cols-menu { right: 8px; top: 40px; min-width: 240px; max-height: 360px; overflow-y: auto; font-weight: 400; color: var(--ad-text); }
.ad-cols-menu__title { padding: 6px 16px 8px; color: var(--ad-gray); font-size: 13px; font-weight: 600; }
.ad-cols-menu .ad-dd__item { cursor: pointer; }


/* Пункты выпадающего списка всегда чёрным по белому: у выбранного фильтра (.ad-pill.is-set) сам список белым текстом */
select option, select optgroup { color: #000; background: #fff; }
