/* ════════════════════════════════════════════════════════════════════════
   ZEKKERT CRM — THEME ENGINE (v3)
   Кастомные темы оформления, прозрачность стекла, акцент-цвет.
   Принцип: всё приложение построено на CSS-переменных (--primary, --surface,
   --bg, --text...). Меняя переменные под body[data-skin], перекрашиваем UI
   целиком. Для тёмных тем добавлен слой совместимости с Tailwind-нейтралями
   (bg-white/slate-*, text-slate-*, border-slate-*), чтобы контент оставался
   читаемым на любой теме. Дизайн рабочих экранов не ломается — только палитра.
   ════════════════════════════════════════════════════════════════════════ */

/* ── Базовые переменные движка (накладываются поверх :root из app.css) ──── */
:root {
  --accent: var(--primary);            /* персональный акцент = primary по умолчанию */
  --glass-blur: 14px;
  --glass-alpha: 0.72;                 /* непрозрачность «стекла» (data-glass med) */
  --surface-2: #f1f5f9;               /* вторичная поверхность (hover/zebra) */
  --surface-3: #e2e8f0;
  --header-bg: rgba(255,255,255,0.82);
  --sidebar-bg: #ffffff;
  --ring: rgba(0,70,173,0.12);
}

/* Прозрачность стекла — регулятор */
body[data-glass="low"]  { --glass-alpha: 0.94; --glass-blur: 6px; }
body[data-glass="med"]  { --glass-alpha: 0.80; --glass-blur: 14px; }
body[data-glass="high"] { --glass-alpha: 0.58; --glass-blur: 22px; }

/* ════════════════════════════════════════════════════════════════════════
   СВЕТЛЫЕ ТЕМЫ
   ════════════════════════════════════════════════════════════════════════ */

/* corporate — ZEKKERT Blue (дефолт, совпадает с :root app.css) */
body[data-skin="corporate"] {
  --primary:#0046ad; --primary-hover:#003785;
  --primary-soft:#eff6ff; --primary-border:#bfdbfe;
  --bg:#f4f7fc; --surface:#ffffff; --surface-2:#f1f5f9; --surface-3:#e6ebf3;
  --border:#e2e8f0; --text:#16233c; --text-muted:#5a6a85; --text-soft:#94a3b8;
  --header-bg:rgba(255,255,255,0.82); --sidebar-bg:#ffffff; --ring:rgba(0,70,173,0.12);
}

/* emerald — изумруд, светлая */
body[data-skin="emerald"] {
  --primary:#059669; --primary-hover:#047857;
  --primary-soft:#ecfdf5; --primary-border:#a7f3d0;
  --bg:#eef6f2; --surface:#ffffff; --surface-2:#eef6f2; --surface-3:#dce8e0;
  --border:#dbe7e1; --text:#0f2a22; --text-muted:#4b6a5f; --text-soft:#93a89f;
  --header-bg:rgba(255,255,255,0.82); --sidebar-bg:#ffffff; --ring:rgba(5,150,105,0.14);
}

/* sunset — тёплая светлая */
body[data-skin="sunset"] {
  --primary:#ea580c; --primary-hover:#c2410c;
  --primary-soft:#fff7ed; --primary-border:#fed7aa;
  --bg:#fbf3ee; --surface:#fffdfb; --surface-2:#f9efe8; --surface-3:#f0e0d4;
  --border:#ecddd0; --text:#3a2415; --text-muted:#7c5e4c; --text-soft:#b39a87;
  --header-bg:rgba(255,253,251,0.82); --sidebar-bg:#fffdfb; --ring:rgba(234,88,12,0.14);
}

/* sakura — роза, светлая */
body[data-skin="sakura"] {
  --primary:#e11d48; --primary-hover:#be123c;
  --primary-soft:#fff1f3; --primary-border:#fecdd3;
  --bg:#fdf1f3; --surface:#fffbfc; --surface-2:#fceef1; --surface-3:#f6dde3;
  --border:#f1dbe0; --text:#3d1622; --text-muted:#855160; --text-soft:#c39aa6;
  --header-bg:rgba(255,251,252,0.82); --sidebar-bg:#fffbfc; --ring:rgba(225,29,72,0.13);
}

/* nord — скандинавская, светлая */
body[data-skin="nord"] {
  --primary:#2563eb; --primary-hover:#1d4ed8;
  --primary-soft:#eef2fb; --primary-border:#c7d2fe;
  --bg:#eef1f6; --surface:#ffffff; --surface-2:#eaeef5; --surface-3:#dde3ee;
  --border:#dde3ec; --text:#1e2a3a; --text-muted:#56657d; --text-soft:#9aa6b8;
  --header-bg:rgba(255,255,255,0.82); --sidebar-bg:#ffffff; --ring:rgba(37,99,235,0.12);
}

/* ════════════════════════════════════════════════════════════════════════
   ТЁМНЫЕ ТЕМЫ  (на body также ставится data-theme-dark — см. theme.js)
   ════════════════════════════════════════════════════════════════════════ */

/* midnight — глубокий синий */
body[data-skin="midnight"] {
  --primary:#3b82f6; --primary-hover:#60a5fa;
  --primary-soft:rgba(59,130,246,0.16); --primary-border:rgba(59,130,246,0.42);
  --bg:#0a1120; --surface:#111c30; --surface-2:#16243c; --surface-3:#1d2f4c;
  --border:#22324d; --text:#e6edf7; --text-muted:#9fb0c9; --text-soft:#6c7e98;
  --header-bg:rgba(13,23,43,0.72); --sidebar-bg:#0d1729; --ring:rgba(59,130,246,0.28);
}

/* graphite — графит + индиго */
body[data-skin="graphite"] {
  --primary:#818cf8; --primary-hover:#a5b4fc;
  --primary-soft:rgba(129,140,248,0.16); --primary-border:rgba(129,140,248,0.42);
  --bg:#16181d; --surface:#1e2128; --surface-2:#262a33; --surface-3:#30353f;
  --border:#2e333d; --text:#e8eaef; --text-muted:#a6abb8; --text-soft:#71788a;
  --header-bg:rgba(22,24,29,0.74); --sidebar-bg:#1a1c22; --ring:rgba(129,140,248,0.28);
}

/* carbon — чистый чёрный OLED + неон-циан */
body[data-skin="carbon"] {
  --primary:#00e5ff; --primary-hover:#22d3ee;
  --primary-soft:rgba(0,229,255,0.14); --primary-border:rgba(0,229,255,0.40);
  --bg:#000000; --surface:#0a0d12; --surface-2:#11151c; --surface-3:#1a212b;
  --border:#1c232e; --text:#eaf2f6; --text-muted:#93a3b3; --text-soft:#5f6f7e;
  --header-bg:rgba(0,0,0,0.66); --sidebar-bg:#06090d; --ring:rgba(0,229,255,0.30);
}

/* amethyst — аметист */
body[data-skin="amethyst"] {
  --primary:#a855f7; --primary-hover:#c084fc;
  --primary-soft:rgba(168,85,247,0.16); --primary-border:rgba(168,85,247,0.42);
  --bg:#140f1f; --surface:#1d1630; --surface-2:#261b3f; --surface-3:#33254f;
  --border:#2f2447; --text:#efe9f7; --text-muted:#b6a8cd; --text-soft:#7e7196;
  --header-bg:rgba(20,15,31,0.72); --sidebar-bg:#180f28; --ring:rgba(168,85,247,0.28);
}

/* ════════════════════════════════════════════════════════════════════════
   ПЕРЕКРАСКА «КОРПУСА» (shell) ПО ID-СЕЛЕКТОРАМ
   ID-селектор сильнее Tailwind-утилит (одинаковый класс), поэтому надёжно
   переопределяет bg-white/bg-slate-50 на структурных узлах без правки HTML.
   ════════════════════════════════════════════════════════════════════════ */
body { background: var(--bg) !important; color: var(--text); }
body::before {
  /* мягкий радиальный акцент фона под текущий primary */
  content:''; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background: radial-gradient(circle at 85% -10%, color-mix(in srgb, var(--primary) 10%, transparent), transparent 42%);
}

#app-shell > header {
  background: var(--header-bg) !important;
  -webkit-backdrop-filter: saturate(160%) blur(var(--glass-blur));
  backdrop-filter: saturate(160%) blur(var(--glass-blur));
  border-bottom: 1px solid var(--border) !important;
}
#sidebar { background: var(--sidebar-bg) !important; border-right: 1px solid var(--border) !important; }
@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
#content, main.flex-1 {
  background:
    radial-gradient(ellipse 80% 60% at 0% 50%, rgba(0, 70, 173, 0.18) 0%, transparent 50%),
    radial-gradient(ellipse 60% 50% at 100% 20%, rgba(14, 165, 233, 0.22) 0%, transparent 50%),
    radial-gradient(ellipse 50% 50% at 50% 80%, rgba(0, 70, 173, 0.10) 0%, transparent 50%),
    var(--bg) !important;
  background-size: 200% 200% !important;
  animation: gradientFlow 14s ease-in-out infinite !important;
}
@media (prefers-reduced-motion: reduce) {
  #content, main.flex-1 { animation: none !important; background: var(--bg) !important; }
}
#user-menu, #quick-search-modal > div, #modal-card,
#quick-search-results { background: var(--surface) !important; color: var(--text); border-color: var(--border) !important; }
#modal-header, #modal-footer { background: var(--surface) !important; border-color: var(--border) !important; }
#modal-footer { background: var(--surface-2) !important; }

/* «online» статус-пилюля и kbd */
#app-shell header kbd { background: var(--surface-2) !important; border-color: var(--border) !important; color: var(--text-muted) !important; }

/* ════════════════════════════════════════════════════════════════════════
   СЛОЙ СОВМЕСТИМОСТИ ДЛЯ ТЁМНЫХ ТЕМ
   Контент CRM использует Tailwind-нейтрали. Под тёмной темой переопределяем
   их на переменные, чтобы текст/поверхности/границы оставались читаемыми.
   Семантические цвета (rose/amber/emerald/blue) оставляем — они работают.
   ════════════════════════════════════════════════════════════════════════ */
body[data-theme-dark] .bg-white { background-color: var(--surface) !important; }
body[data-theme-dark] .bg-slate-50 { background-color: var(--surface-2) !important; }
body[data-theme-dark] .bg-slate-100 { background-color: var(--surface-3) !important; }
body[data-theme-dark] .bg-gray-50 { background-color: var(--surface-2) !important; }

body[data-theme-dark] .text-slate-900,
body[data-theme-dark] .text-slate-800,
body[data-theme-dark] .text-\[\#1e293b\] { color: var(--text) !important; }
body[data-theme-dark] .text-slate-700,
body[data-theme-dark] .text-slate-600 { color: var(--text-muted) !important; }
body[data-theme-dark] .text-slate-500,
body[data-theme-dark] .text-slate-400 { color: var(--text-soft) !important; }

body[data-theme-dark] .border-slate-200,
body[data-theme-dark] .border-slate-100 { border-color: var(--border) !important; }
body[data-theme-dark] .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
body[data-theme-dark] .divide-slate-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }

body[data-theme-dark] .hover\:bg-slate-50:hover,
body[data-theme-dark] .hover\:bg-slate-100:hover { background-color: var(--surface-2) !important; }
body[data-theme-dark] .bg-slate-200 { background-color: var(--surface-3) !important; }

/* Цветные «soft» подложки в тёмной теме делаем полупрозрачными к акценту фона */
body[data-theme-dark] .bg-rose-50   { background-color: rgba(244,63,94,0.12) !important; }
body[data-theme-dark] .bg-amber-50  { background-color: rgba(245,158,11,0.12) !important; }
body[data-theme-dark] .bg-emerald-50{ background-color: rgba(16,185,129,0.12) !important; }
body[data-theme-dark] .bg-blue-50,
body[data-theme-dark] .bg-sky-50    { background-color: rgba(59,130,246,0.12) !important; }

/* KPI-карточки: убрать светлый градиент, посадить на surface */
body[data-theme-dark] .kpi-card { background: var(--surface) !important; }
body[data-theme-dark] .table tr:hover td { background: var(--surface-2) !important; }
body[data-theme-dark] .table th:hover { background: var(--surface-3) !important; }
body[data-theme-dark] .registry-card .table tbody td:nth-child(2),
body[data-theme-dark] .registry-card .table thead.sticky th:nth-child(2) { background: var(--surface) !important; }

/* Скроллбар под тёмную тему */
body[data-theme-dark] *::-webkit-scrollbar-thumb { background: var(--surface-3); }
body[data-theme-dark] * { scrollbar-color: var(--surface-3) transparent; }

/* Логин-экран наследует акцент темы */
#login-screen { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 40%, #0a1f44)) !important; }

/* KPI tone-иконки — мягкая подложка из акцента (работает в любой теме) */
.kpi-card .kpi-icon { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.kpi-blue .kpi-icon   { background: color-mix(in srgb, #3b82f6 16%, transparent); color:#3b82f6; }
.kpi-rose .kpi-icon   { background: color-mix(in srgb, #f43f5e 16%, transparent); color:#f43f5e; }
.kpi-amber .kpi-icon  { background: color-mix(in srgb, #f59e0b 18%, transparent); color:#f59e0b; }
.kpi-emerald .kpi-icon{ background: color-mix(in srgb, #10b981 16%, transparent); color:#10b981; }
.kpi-card { background: var(--surface); }

/* Card / nav уже на переменных — подчистим градиент карточки под surface */
.card { background: var(--surface); }

/* ── «Apple»-стекло: полупрозрачные панели с фоновым размытием ─────────────
   Прозрачность завязана на регулятор --glass-alpha (low/med/high). Сквозь
   панели мягко просвечивает акцентный фон (body::before), даёт «фростед»-вид.
   Читаемость сохраняется: surface остаётся доминирующим тоном, а тяжёлый
   грид реестра намеренно держим непрозрачным и без блюра (производительность
   + чёткость 55 колонок). */
.card, .kpi-card, .chart-wrap, .modal-card, .col-filter-pop {
  background: color-mix(in srgb, var(--surface) calc(var(--glass-alpha) * 100%), transparent) !important;
  -webkit-backdrop-filter: saturate(150%) blur(var(--glass-blur));
  backdrop-filter: saturate(150%) blur(var(--glass-blur));
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.registry-card {
  background: var(--surface) !important;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ════════════════════════════════════════════════════════════════════════
   АНИМИРОВАННЫЙ ЛОГОТИП В ШАПКЕ
   Знак Z и слово ZEKKERT — отдельные SVG-слои. Слово абсолютно спозиционировано
   справа от знака (не занимает место в потоке → нет сдвига layout). При загрузке
   виден полный логотип, затем слово уезжает влево и прячется под знаком (collapsed).
   Hover по логотипу — слово выезжает обратно (reveal). Всё на CSS-transition,
   режимом управляет theme.js. Вектор → чётко на 4K/8K.
   ════════════════════════════════════════════════════════════════════════ */
.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  width: 46px;                 /* компактная ширина = знак; слово абсолютно поверх */
  flex-shrink: 0;
  text-decoration: none;
  --mark-w: 46px;
  -webkit-tap-highlight-color: transparent;
}
.brand-mark {
  height: 38px; width: var(--mark-w);
  display: block; position: relative; z-index: 2;
  color: var(--primary);
  filter: drop-shadow(0 1px 1px color-mix(in srgb, var(--primary) 30%, transparent));
  transition: transform .35s var(--ease-out, cubic-bezier(.22,1,.36,1));
}
.brand-word {
  height: 26px; width: auto;
  display: block; position: absolute;
  left: calc(var(--mark-w) - 2px); top: 50%;
  transform: translateY(-50%);
  color: var(--primary); z-index: 1;
  transform-origin: left center;
  transition: transform .55s var(--ease-out, cubic-bezier(.22,1,.36,1)), opacity .45s ease;
  will-change: transform, opacity;
}
/* свёрнутое состояние — слово ушло под знак */
.brand.is-collapsed .brand-word {
  transform: translate(calc(-1 * var(--mark-w) - 6px), -50%) scaleX(.86);
  opacity: 0;
}
/* hover — слово возвращается (специфичность равна, правило ниже → перебивает) */
.brand:hover .brand-mark { transform: scale(1.04); }
.brand:hover .brand-word { transform: translateY(-50%); opacity: 1; }
/* «дыхание» (mode=breathing): короткий peek */
@keyframes brandPeek {
  0%, 92%, 100% { transform: translate(calc(-1 * var(--mark-w) - 6px), -50%) scaleX(.86); opacity: 0; }
  40%, 60%      { transform: translateY(-50%); opacity: 1; }
}
.brand.is-breathing .brand-word { animation: brandPeek 7s ease-in-out 1; }
@media (prefers-reduced-motion: reduce) {
  .brand-word { transition: none !important; }
  .brand.is-collapsed .brand-word { transform: translateY(-50%); opacity: 1; }  /* статичный полный логотип */
  .brand { width: auto; }
  .brand.is-breathing .brand-word { animation: none; }
}

/* ════════════════════════════════════════════════════════════════════════
   КНОПКИ В ШАПКЕ (инъекция theme.js): тема + уведомления
   ════════════════════════════════════════════════════════════════════════ */
.hdr-btn {
  position: relative;
  padding: 8px;
  border-radius: 10px;
  color: var(--text-muted);
  background: transparent;
  border: none; cursor: pointer;
  transition: background .16s, color .16s, transform .16s;
  display: inline-flex; align-items: center; justify-content: center;
}
.hdr-btn:hover { background: color-mix(in srgb, var(--primary) 10%, transparent); color: var(--primary); }
.hdr-btn:active { transform: scale(.94); }
.hdr-btn .material-symbols-outlined { font-size: 22px; }
.hdr-badge {
  position: absolute; top: 3px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--header-bg);
}
.hdr-badge.hidden { display: none; }

/* ── Drawer (правая выезжающая панель) — темы / уведомления / профиль ───── */
.zk-drawer-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,16,28,0.38);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  opacity: 0; transition: opacity .25s ease;
}
.zk-drawer-backdrop.show { opacity: 1; }
.zk-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1001;
  width: min(420px, 92vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -20px 0 60px rgba(10,16,28,0.22);
  transform: translateX(100%);
  transition: transform .32s var(--ease-out, cubic-bezier(.22,1,.36,1));
  display: flex; flex-direction: column;
  color: var(--text);
}
.zk-drawer.show { transform: translateX(0); }
.zk-drawer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.zk-drawer-head h3 { font-size: 15px; font-weight: 800; letter-spacing: -.01em; margin: 0; flex: 1; }
.zk-drawer-head .material-symbols-outlined { color: var(--primary); }
.zk-drawer-body { padding: 16px 18px; overflow-y: auto; flex: 1; }
.zk-x { padding: 6px; border-radius: 8px; cursor: pointer; color: var(--text-soft); border: none; background: transparent; display: inline-flex; }
.zk-x:hover { background: var(--surface-2); color: var(--text); }

/* ── Галерея тем ──────────────────────────────────────────────────────── */
.zk-sec-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft); margin: 4px 0 10px; }
.theme-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 22px; }
.theme-swatch {
  border: 2px solid var(--border); border-radius: 14px; padding: 10px;
  cursor: pointer; background: var(--surface); text-align: left;
  transition: border-color .18s, transform .18s, box-shadow .18s;
  display: flex; flex-direction: column; gap: 8px;
}
.theme-swatch:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.theme-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.theme-preview { height: 42px; border-radius: 9px; position: relative; overflow: hidden; display: flex; }
.theme-preview .tp-side { width: 30%; height: 100%; }
.theme-preview .tp-main { flex: 1; height: 100%; position: relative; }
.theme-preview .tp-bar { position: absolute; left: 8px; right: 8px; height: 6px; border-radius: 3px; top: 9px; }
.theme-preview .tp-bar.b2 { top: 21px; right: 28px; opacity: .6; }
.theme-preview .tp-dot { position: absolute; right: 8px; bottom: 7px; width: 12px; height: 12px; border-radius: 50%; }
.theme-name { font-size: 12px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 6px; }
.theme-name .tn-check { color: var(--primary); font-size: 16px; opacity: 0; }
.theme-swatch.active .tn-check { opacity: 1; }

/* ── Аккорд-ползунок (стекло) + акценты ───────────────────────────────── */
.glass-row { display: flex; gap: 8px; margin-bottom: 22px; }
.glass-opt {
  flex: 1; padding: 10px 6px; border: 2px solid var(--border); border-radius: 11px;
  background: var(--surface-2); cursor: pointer; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  transition: border-color .16s, color .16s;
}
.glass-opt.active { border-color: var(--primary); color: var(--primary); }
.accent-row { display: flex; flex-wrap: wrap; gap: 10px; }
.accent-dot {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--border);
  transition: transform .16s, box-shadow .16s;
}
.accent-dot:hover { transform: scale(1.12); }
.accent-dot.active { box-shadow: 0 0 0 3px var(--primary); transform: scale(1.08); }

/* ── Поповер уведомлений (из bell) ────────────────────────────────────── */
.notif-pop {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: min(380px, 92vw); max-height: 70vh; overflow: hidden;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow-xl); z-index: 60;
  display: flex; flex-direction: column;
  animation: popIn .16s var(--ease-out, ease) both; transform-origin: top right;
}
.notif-head { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.notif-head h4 { margin: 0; font-size: 14px; font-weight: 800; flex: 1; }
.notif-head a { font-size: 12px; color: var(--primary); font-weight: 700; text-decoration: none; }
.notif-list { overflow-y: auto; }
.notif-item { display: flex; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; transition: background .14s; }
.notif-item:hover { background: var(--surface-2); }
.notif-ic { width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.notif-ic.high { background: rgba(244,63,94,.14); color: #f43f5e; }
.notif-ic.medium { background: rgba(245,158,11,.16); color: #f59e0b; }
.notif-ic.info { background: color-mix(in srgb, var(--primary) 14%, transparent); color: var(--primary); }
.notif-ic .material-symbols-outlined { font-size: 19px; }
.notif-tt { font-size: 13px; font-weight: 700; color: var(--text); }
.notif-bd { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.notif-empty { padding: 34px 16px; text-align: center; color: var(--text-soft); }
.notif-empty .material-symbols-outlined { font-size: 40px; color: var(--text-soft); display: block; margin: 0 auto 8px; }

/* ════════════════════════════════════════════════════════════════════════
   КАСТОМИЗАЦИЯ ВИДЖЕТОВ ДАШБОРДА (drag-reorder + show/hide)
   ════════════════════════════════════════════════════════════════════════ */
.dash-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-customize-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  border: 1px dashed var(--primary-border); border-radius: var(--radius);
}
.dash-customize-bar .dc-title { font-weight: 700; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.dash-customize-bar .dc-title .material-symbols-outlined { color: var(--primary); }
.wchip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  cursor: pointer; transition: all .16s;
}
.wchip.on { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface)); }
.wchip .material-symbols-outlined { font-size: 16px; }

.dash-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.dash-widget { grid-column: span 12; min-width: 0; }
.dash-widget[data-span="6"] { grid-column: span 6; }
.dash-widget[data-span="5"] { grid-column: span 5; }
.dash-widget[data-span="4"] { grid-column: span 4; }
.dash-widget[data-span="7"] { grid-column: span 7; }
.dash-widget[data-span="8"] { grid-column: span 8; }
.dash-widget.is-hidden { display: none; }
.dash-widget.dragging { opacity: .45; }
.dash-widget.drop-before { box-shadow: -3px 0 0 var(--primary); }
.dash-widget.drop-after { box-shadow: 3px 0 0 var(--primary); }
.w-drag {
  cursor: grab; color: var(--text-soft); padding: 2px; border-radius: 6px;
  opacity: 0; transition: opacity .16s, background .16s;
}
.dash-widget:hover .w-drag { opacity: 1; }
.w-drag:hover { background: var(--surface-2); color: var(--text); }
body.dash-edit .w-drag { opacity: 1; }
body.dash-edit .dash-widget { outline: 1px dashed var(--primary-border); outline-offset: 3px; border-radius: var(--radius); }

@media (max-width: 900px) {
  .dash-widget[data-span], .dash-widget { grid-column: span 12 !important; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .brand-word { display: none; }            /* на телефоне всегда компактный знак */
  .hdr-btn .material-symbols-outlined { font-size: 20px; }
}

/* грип перетаскивания виджета (абсолютно в углу) */
.dash-widget { position: relative; }
.dash-widget > .w-drag {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  background: var(--surface); border: 1px solid var(--border);
}
.dash-widget > .w-drag .material-symbols-outlined { font-size: 18px; }
body:not(.dash-edit) .dash-widget[data-id="kpi"] > .w-drag { top: -2px; right: 0; }

/* ============================================================
   Dashboard 3.0 — виджеты (приветствие, area, donut, attention,
   таблица последних отгрузок). Все цвета через тему. */

/* приветствие */
.dash-greet { display: flex; flex-direction: column; gap: 2px; }
.dash-greet .page-title { font-size: 22px; }
.dash-greet-sub { color: var(--text-muted); font-size: 13px; }

/* area-график */
.area-wrap { padding: 12px 14px 6px; min-height: 0; }
.area-wrap svg { display: block; }
.area-wrap svg text { font-family: inherit; }

/* donut статусов */
.donut-wrap { display: flex; align-items: center; gap: 18px; padding: 14px 16px; flex-wrap: wrap; }
.donut-svg-wrap { flex: 0 0 auto; line-height: 0; }
.donut-svg text { font-family: inherit; }
.donut-legend { flex: 1 1 160px; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.donut-lg { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-sw { width: 11px; height: 11px; border-radius: 3px; flex: 0 0 auto; }
.donut-name { color: var(--text); flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-n { color: var(--text-muted); font-weight: 700; font-variant-numeric: tabular-nums; }

/* «Требует внимания» — alert-строки */
.attn-list { display: flex; flex-direction: column; }
.attn-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 16px;
  border-top: 1px solid var(--border); text-decoration: none; transition: background .14s;
}
.attn-row:first-child { border-top: 0; }
.attn-row:hover { background: var(--surface-2); }
.attn-tag {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 auto;
  display: grid; place-items: center;
}
.attn-tag .material-symbols-outlined { font-size: 19px; }
.attn-tag.attn-bad  { background: color-mix(in srgb, #f43f5e 16%, transparent); color: #f43f5e; }
.attn-tag.attn-warn { background: color-mix(in srgb, #f59e0b 18%, transparent); color: #f59e0b; }
.attn-main { flex: 1 1 auto; min-width: 0; }
.attn-t { font-size: 13.5px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-d { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-pill {
  flex: 0 0 auto; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.attn-pill.attn-bad  { background: color-mix(in srgb, #f43f5e 14%, transparent); color: #e11d48; }
.attn-pill.attn-warn { background: color-mix(in srgb, #f59e0b 16%, transparent); color: #b45309; }
.attn-empty {
  display: flex; align-items: center; gap: 8px; padding: 18px 16px;
  color: #10b981; font-size: 13.5px; font-weight: 600;
}
.attn-empty .material-symbols-outlined { font-size: 20px; }

/* таблица последних отгрузок */
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table thead th {
  text-align: left; padding: 9px 16px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.dash-table tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.dash-table tbody tr:last-child td { border-bottom: 0; }
.dash-trow { cursor: pointer; transition: background .14s; }
.dash-trow:hover { background: var(--surface-2); }
.dash-table .cell-strong { font-weight: 700; color: var(--text); white-space: nowrap; }
.dash-table .cell-muted { color: var(--text-muted); }
.dash-table .ta-right { text-align: right; }
.dash-table .tnum { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* ранг в «Топ поставщиков» */
.suppl-rank {
  width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary);
}
