/* ============================================================
   МойФинансист — Дизайн-система платформы
   Стиль: как moysklad.ru, но зелёный акцент. Desktop-first.
   ============================================================ */

/* ---------- 1. Токены ---------- */
:root {
  /* Акцент — зелёный (средний насыщенный, зеркало синего МойСклада) */
  --primary-700: #17864A;
  --primary-600: #1E9E57;
  --primary-500: #33B06B;
  --primary-100: #CBEBD8;
  --primary-50:  #E9F7EF;

  /* Нейтральные */
  --text-primary:   #1F2933;
  --text-secondary: #5E6C84;
  --text-disabled:  #97A0AF;
  --border:         #DFE1E6;
  --bg-page:        #F4F5F7;
  --surface:        #FFFFFF;
  --hover-row:      #F7F8FA;

  /* Семантические */
  --success: #1E9E57;
  --warning: #EA9A2E;
  --error:   #E5493A;
  --info:    #2E86D8;
  --neutral: #8A94A6;
  --purple:  #8E5FC0;

  --success-bg: #E9F7EF;
  --warning-bg: #FCF3E1;
  --error-bg:   #FCEBE9;
  --info-bg:    #EAF2FF;

  /* Радиусы, тени */
  --radius: 6px;
  --radius-pill: 12px;
  --shadow-pop: 0 4px 12px rgba(0,0,0,.08);
  --shadow-card: 0 1px 2px rgba(0,0,0,.04);

  /* Размеры */
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --row-h: 40px;

  /* Типографика */
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

/* ---------- 2. Сброс / база ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-primary);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

h1 { font-size: 24px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
.muted { color: var(--text-secondary); }
.text-sm { font-size: 12px; }

/* ---------- 3. Оболочка (shell) ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

/* Сайдбар */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__logo {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 16px;
}
.sidebar__logo .dot {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary-600);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 700;
}
.nav { padding: 8px; overflow-y: auto; flex: 1; }
.nav__group { margin-top: 14px; }
.nav__group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-disabled); padding: 4px 10px; font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  color: var(--text-primary); font-weight: 500; cursor: pointer;
  margin-bottom: 2px;
}
.nav__item:hover { background: var(--hover-row); text-decoration: none; }
.nav__item.is-active { background: var(--primary-50); color: var(--primary-700); }
.nav__item.is-active svg { color: var(--primary-600); }
.nav__item svg { width: 18px; height: 18px; color: var(--text-secondary); }
.nav__item .badge-count {
  margin-left: auto; background: var(--primary-600); color: #fff;
  font-size: 11px; border-radius: 10px; padding: 1px 7px; font-weight: 600;
}
.nav__item.is-locked { color: var(--text-disabled); }
.nav__item.is-locked svg { color: var(--text-disabled); }

/* Основная область */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px; position: sticky; top: 0; z-index: 10;
}
.topbar__search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  background: var(--bg-page); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px; color: var(--text-secondary);
}
.topbar__search input { border: none; background: none; outline: none; flex: 1; font-size: 14px; }
.topbar__spacer { flex: 1; }
.topbar__user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary-100); color: var(--primary-700);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
}

/* Кнопка сворачивания меню (в топбаре, слева) */
.topbar__toggle {
  background: none; border: none; cursor: pointer; color: var(--text-secondary);
  padding: 6px; border-radius: var(--radius); display: inline-flex; align-items: center;
}
.topbar__toggle:hover { background: var(--hover-row); }
.topbar__toggle svg { width: 20px; height: 20px; }

/* Свёрнутый сайдбар — остаются только иконки (56px) */
.app.nav-collapsed { grid-template-columns: 56px 1fr; }
.nav-collapsed .sidebar__logo { justify-content: center; padding: 0; font-size: 0; }
.nav-collapsed .sidebar__logo .dot { font-size: 13px; }
.nav-collapsed .nav__group-title { display: none; }
.nav-collapsed .nav__item { justify-content: center; padding: 8px 0; font-size: 0; }
.nav-collapsed .nav__item .badge-count { display: none; }
.nav-collapsed .nav__item svg { width: 18px; height: 18px; }

/* Индикатор синхронизации */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; cursor: pointer;
}
.sync-pill.is-idle { background: var(--success-bg); color: var(--primary-700); }
.sync-pill.is-running { background: var(--info-bg); color: #2b6cb0; }
.sync-pill.is-error { background: var(--error-bg); color: var(--error); }
.sync-pill .dot-status { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.sync-pill.is-running .dot-status { animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* Контент */
.content { padding: 20px 24px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.page-head .grow { flex: 1; }
.page-head p { color: var(--text-secondary); margin-top: 4px; }
.breadcrumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; }
.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs .sep { color: var(--text-disabled); }

/* ---------- 3b. Верхняя навигация (стиль МойСклада) ---------- */
/* Зелёная модульная панель */
.topnav {
  background: var(--primary-600); color: #fff; height: 52px;
  display: flex; align-items: stretch; padding: 0 12px; gap: 2px;
  position: sticky; top: 0; z-index: 20;
}
.topnav__brand {
  display: flex; align-items: center; gap: 8px; font-weight: 700; color: #fff;
  padding: 0 12px 0 4px; margin-right: 8px; white-space: nowrap;
}
.topnav__brand .dot {
  width: 24px; height: 24px; border-radius: 6px; background: #fff; color: var(--primary-700);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.topnav__tabs { display: flex; align-items: stretch; }
.topnav__tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: 0 14px; color: rgba(255,255,255,.9); font-size: 11px; font-weight: 500;
  cursor: pointer; border: none; background: none; white-space: nowrap;
}
.topnav__tab svg { width: 20px; height: 20px; }
.topnav__tab:hover { background: rgba(255,255,255,.12); color: #fff; text-decoration: none; }
.topnav__tab.is-active { background: var(--primary-700); color: #fff; }
.topnav__tab.is-locked { color: rgba(255,255,255,.45); cursor: default; }
.topnav__spacer { flex: 1; }
.topnav__right { display: flex; align-items: center; gap: 4px; }
.topnav__icon { color: #fff; padding: 8px; border-radius: 6px; display: inline-flex; cursor: pointer; position: relative; }
.topnav__icon:hover { background: rgba(255,255,255,.12); }
.topnav__icon svg { width: 20px; height: 20px; }
.topnav__count {
  position: absolute; top: 2px; right: 2px; background: var(--error); color: #fff;
  font-size: 10px; min-width: 15px; height: 15px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; padding: 0 3px; font-weight: 600;
}
.topnav__user { display: flex; align-items: center; gap: 8px; color: #fff; padding: 4px 8px; border-radius: 6px; cursor: pointer; margin-left: 4px; }
.topnav__user:hover { background: rgba(255,255,255,.12); text-decoration: none; }
.topnav__user .avatar { background: #fff; color: var(--primary-700); }
.topnav__user-meta { line-height: 1.2; text-align: right; }
.topnav__user-meta .name { font-size: 13px; font-weight: 600; }
.topnav__user-meta .sub { font-size: 11px; color: rgba(255,255,255,.8); }

/* Белая под-панель (разделы активного модуля) */
.subnav {
  background: var(--surface); border-bottom: 1px solid var(--border); height: 44px;
  display: flex; align-items: center; gap: 2px; padding: 0 16px;
  position: sticky; top: 52px; z-index: 19;
}
.subnav__link { padding: 6px 12px; color: var(--primary-600); font-weight: 500; font-size: 13px; border-radius: 6px; }
.subnav__link:hover { background: var(--primary-50); text-decoration: none; }
.subnav__link.is-active { color: var(--text-primary); font-weight: 600; }

/* ---------- 4. Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--primary-600); color: #fff; }
.btn--primary:hover { background: var(--primary-700); text-decoration: none; }
.btn--secondary { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.btn--secondary:hover { background: var(--hover-row); text-decoration: none; }
.btn--danger { background: var(--error); color: #fff; }
.btn--danger:hover { background: #c93b2d; text-decoration: none; }
.btn--text { background: none; color: var(--primary-600); padding: 8px 8px; }
.btn--text:hover { background: var(--primary-50); text-decoration: none; }
.btn--sm { padding: 5px 10px; font-size: 13px; }
.btn--block { width: 100%; }
.btn:disabled, .btn.is-disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 5. Поля ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text-primary);
  padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary-500); box-shadow: 0 0 0 3px var(--primary-50);
}
.textarea { min-height: 72px; resize: vertical; }
.field__hint { font-size: 12px; color: var(--text-secondary); margin-top: 5px; }
.field.is-error .input, .field.is-error .select { border-color: var(--error); }
.field.is-error .field__hint { color: var(--error); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }

/* Переключатели */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track {
  position: absolute; inset: 0; background: var(--border); border-radius: 12px; transition: .15s; cursor: pointer;
}
.switch .track::before {
  content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.switch input:checked + .track { background: var(--primary-600); }
.switch input:checked + .track::before { transform: translateX(16px); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary-600); }

/* Сегмент-переключатель */
.segmented { display: inline-flex; background: var(--bg-page); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px; }
.segmented button {
  border: none; background: none; font-family: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 14px; border-radius: 4px; cursor: pointer; color: var(--text-secondary);
}
.segmented button.is-active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-card); }

/* ---------- 6. Карточки / KPI ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.card__head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card__head h3 { flex: 1; }
.card__body { padding: 16px; }
.grid { display: grid; gap: 16px; }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.kpi__label { color: var(--text-secondary); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi__value { font-size: 32px; font-weight: 600; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi__delta { font-size: 12px; margin-top: 4px; }
.kpi__delta.up { color: var(--success); }
.kpi__delta.down { color: var(--error); }
.kpi--accent { border-left: 3px solid var(--primary-600); }

/* ---------- 7. Бейджи / статус-пиллы ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 4px; color: #fff;
}
.badge .dot { display: none; }               /* сплошные пиллы — точка не нужна */
.badge--success { background: var(--success); }
.badge--warning { background: var(--warning); }
.badge--error   { background: var(--error); }
.badge--info    { background: var(--info); }
.badge--neutral { background: var(--neutral); }
.badge--purple  { background: var(--purple); }

/* ---------- 8. Таблица ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; }
/* Реестр: колонки не переносятся, таблица уезжает по горизонтали внутри своего контейнера,
   а панель фильтров/тулбар (снаружи контейнера) остаются на месте. */
#registryTable { min-width: max-content; }
#registryTable th, #registryTable td { white-space: nowrap; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky; top: 0; background: #FAFBFC; text-align: left;
  font-weight: 500; color: var(--text-secondary); font-size: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table thead th.sortable { cursor: pointer; }
.table thead th.sortable::after { content: ' ↕'; color: var(--text-disabled); }
.table tbody td { padding: 0 12px; height: var(--row-h); border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--hover-row); }
.table .col-num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-actions { display: flex; gap: 6px; opacity: 0; }
.table tbody tr:hover .row-actions { opacity: 1; }
.table-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.table-toolbar .grow { flex: 1; }
.pagination { display: flex; align-items: center; gap: 8px; padding: 10px 12px; color: var(--text-secondary); font-size: 13px; }
.pagination .grow { flex: 1; }

/* ---------- 9. Дровер / модалка / оверлей ---------- */
.overlay { position: fixed; inset: 0; background: rgba(23,43,77,.35); display: flex; z-index: 50; }
.overlay.right { justify-content: flex-end; }
.overlay.center { align-items: center; justify-content: center; }
.drawer { width: 480px; max-width: 92vw; background: var(--surface); height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-pop); }
.drawer__head, .modal__head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.drawer__head h3, .modal__head h3 { flex: 1; }
.drawer__body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer__foot, .modal__foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.icon-btn { background: none; border: none; cursor: pointer; color: var(--text-secondary); padding: 4px; border-radius: 4px; display: inline-flex; }
.icon-btn:hover { background: var(--hover-row); }
.modal { width: 460px; max-width: 92vw; background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-pop); overflow: hidden; }
.modal__body { padding: 20px; }

/* Определение (dl) */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13px; }
.dl dt { color: var(--text-secondary); }
.dl dd { color: var(--text-primary); }

/* ---------- 10. Прогресс / степпер ---------- */
.progress { height: 8px; background: var(--bg-page); border-radius: 6px; overflow: hidden; }
.progress__bar { height: 100%; background: var(--primary-600); border-radius: 6px; transition: width .3s; }

.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 24px; }
.step { display: flex; align-items: center; gap: 10px; }
.step__num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; background: var(--bg-page); color: var(--text-secondary); border: 1px solid var(--border); }
.step__label { font-weight: 500; font-size: 13px; color: var(--text-secondary); }
.step.is-active .step__num { background: var(--primary-600); color: #fff; border-color: var(--primary-600); }
.step.is-active .step__label { color: var(--text-primary); }
.step.is-done .step__num { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-100); }
.step__line { width: 48px; height: 1px; background: var(--border); margin: 0 12px; }

/* Список загрузки сущностей */
.sync-list { list-style: none; }
.sync-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sync-list li:last-child { border: none; }
.sync-list .ico { width: 18px; height: 18px; display: inline-flex; }
.sync-list .done { color: var(--success); }
.sync-list .running { color: var(--info); }
.sync-list .wait { color: var(--text-disabled); }
.sync-list .count { margin-left: auto; color: var(--text-secondary); font-variant-numeric: tabular-nums; }

/* ---------- 11. Тосты ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 80; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary-600); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 12px 14px; min-width: 280px; display: flex; gap: 10px; align-items: flex-start; }
.toast.is-success { border-left-color: var(--success); }
.toast.is-error { border-left-color: var(--error); }
.toast__title { font-weight: 500; font-size: 13px; }
.toast__msg { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ---------- 12. Состояния (empty / error / skeleton) ---------- */
.state { text-align: center; padding: 56px 20px; color: var(--text-secondary); }
.state__icon { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--text-disabled); display: flex; align-items: center; justify-content: center; background: var(--bg-page); border-radius: 50%; }
.state h3 { color: var(--text-primary); margin-bottom: 6px; }
.state p { margin-bottom: 16px; }
.skeleton { background: linear-gradient(90deg, #eef0f2 25%, #f6f7f8 37%, #eef0f2 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; border-radius: 4px; }
@keyframes shimmer { 0% { background-position: 100% 0 } 100% { background-position: -100% 0 } }
.skel-line { height: 12px; margin: 8px 0; }

/* ---------- 13. Вход (auth) ---------- */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-page); }
.auth__card { width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-card); padding: 32px; }
.auth__logo { display: flex; align-items: center; gap: 10px; justify-content: center; font-weight: 700; font-size: 20px; margin-bottom: 6px; }
.auth__logo .dot { width: 28px; height: 28px; border-radius: 7px; background: var(--primary-600); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.auth__sub { text-align: center; color: var(--text-secondary); margin-bottom: 24px; font-size: 13px; }

/* Онбординг-контейнер */
.onb { max-width: 640px; margin: 40px auto; }
.onb__card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-card); padding: 32px; }

/* Утилиты */
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.mt-8{margin-top:8px}.mt-16{margin-top:16px}.mt-24{margin-top:24px}
.mb-8{margin-bottom:8px}.mb-16{margin-bottom:16px}.mb-24{margin-bottom:24px}
.gap-8{gap:8px}.gap-16{gap:16px}
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.stub { border: 1px dashed var(--border); border-radius: var(--radius); background: var(--bg-page); padding: 14px; color: var(--text-secondary); font-size: 13px; margin-top: 12px; display: flex; align-items: center; gap: 8px; }
.stub svg { width: 16px; height: 16px; flex: none; }
.is-hidden { display: none !important; }

/* ---------- 14. Реестр / таблица-компонент (стиль МойСклада) ---------- */
/* Шапка реестра */
.registry-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.registry-head h1 { margin-right: 2px; }
.head-icons { display: flex; gap: 0; }
.head-icons .icon-btn svg { width: 18px; height: 18px; }
.registry-head .grow { flex: 1; }
.search-box { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 7px 10px; min-width: 260px; color: var(--text-secondary); }
.search-box input { border: none; outline: none; background: none; flex: 1; font-size: 14px; color: var(--text-primary); }
.btn .chev { transition: transform .15s; }
.btn.is-open .chev { transform: rotate(180deg); }

/* Панель фильтров */
.filter-panel { background: #EEF0F3; border: 1px solid var(--border); border-radius: 8px; padding: 16px; margin-bottom: 16px; display: flex; gap: 20px; }
.filter-actions { display: flex; flex-direction: column; gap: 8px; min-width: 120px; }
.filter-grid { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 16px; }
.filter-field label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.filter-field label::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--primary-500); flex: none; }
.filter-field .input, .filter-field .select { padding: 6px 8px; font-size: 13px; }
.filter-presets { display: inline-flex; gap: 6px; margin-left: auto; font-weight: 400; }
.filter-presets a { font-size: 11px; }
.range { display: flex; align-items: center; gap: 6px; }
.range .input { text-align: right; }
.icon-circle { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-secondary); }
.icon-circle:hover { background: var(--hover-row); }
.icon-circle svg { width: 16px; height: 16px; }

/* Тулбар таблицы */
.tbl-toolbar { display: flex; align-items: center; gap: 16px; padding: 8px 2px; }
.tbl-toolbar .count { font-weight: 600; }
.tbl-action { color: var(--primary-600); font-weight: 500; display: inline-flex; align-items: center; gap: 3px; cursor: pointer; background: none; border: none; font-size: 14px; font-family: inherit; }
.tbl-action:hover { text-decoration: underline; }
.tbl-action.is-disabled { color: var(--text-disabled); cursor: default; text-decoration: none; }
.tbl-action svg { width: 15px; height: 15px; }
.tbl-toolbar .grow { flex: 1; }

/* Сортируемые заголовки (переопределяем старый ::after) */
.table thead th.sortable::after { content: none; }
.table thead th .th-inner { display: flex; align-items: center; gap: 6px; }
.table thead th.col-num .th-inner { justify-content: flex-end; }
.table thead th .sort-ico { width: 13px; height: 13px; color: var(--text-disabled); flex: none; }
.table thead th.sorted-asc .sort-ico, .table thead th.sorted-desc .sort-ico { color: var(--primary-600); }
.table thead th .col-check, .table td.col-check { width: 34px; }
.table thead th input, .table td input[type=checkbox] { accent-color: var(--primary-600); }

/* Условная подсветка ячеек */
td.cell-ok { background: #E9F7EF; }     /* размечено правилом */
td.cell-warn { background: #FCEFDD; }    /* на проверку (AI) */

/* Номер-ссылка + меню строки */
.num-cell { display: flex; align-items: center; gap: 6px; }
.num-link { color: var(--primary-600); font-weight: 500; }
.row-menu { color: var(--text-disabled); opacity: 0; cursor: pointer; display: inline-flex; }
.row-menu svg { width: 15px; height: 15px; }
.table tbody tr:hover .row-menu { opacity: 1; }

/* Выпадающие меню (настройка колонок / полей фильтра) */
.dropdown { position: relative; display: inline-flex; }
.dropdown__menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow-pop); padding: 10px; min-width: 250px; z-index: 30; }
.dropdown__menu h4 { font-size: 11px; text-transform: uppercase; color: var(--text-disabled); margin: 4px 4px 8px; letter-spacing: .04em; }
.dropdown__menu .check { display: flex; padding: 6px 6px; border-radius: 4px; font-size: 13px; }
.dropdown__menu .check:hover { background: var(--hover-row); }
.dropdown__menu .divider { margin: 8px 0; }
.dropdown__menu .field { margin-bottom: 0; padding: 4px 6px; }
.tag-ok { color: var(--success); } .tag-warn { color: var(--warning); } .tag-err { color: var(--error); }
