/* ==========================================================================
   QSmart — дизайн-система панели управления
   Тёмная тема на Ink (по умолчанию) + светлая. Фирменные цвета:
   Violet Light #8B6CFF, Violet Deep #3B2BD9, Ink #17181C.
   Основной цвет меняется в одном месте: --accent / --accent-2.
   ========================================================================== */
:root {
  --accent: #8b6cff;          /* Violet Light */
  --accent-2: #3b2bd9;        /* Violet Deep — второй цвет градиентов */
  --accent-hover: #a48fff;
  --accent-rgb: 139, 108, 255;
  --accent-2-rgb: 59, 43, 217;
  --grad: linear-gradient(135deg, #8b6cff 0%, #3b2bd9 100%);
  --grad-soft: linear-gradient(100deg, rgba(var(--accent-rgb), .30) 0%, rgba(var(--accent-2-rgb), .16) 60%, rgba(var(--accent-2-rgb), .08) 100%);

  --bg: #17181c;
  --bg-sidebar: #1b1c21;
  --bg-card: #202127;
  --bg-card-2: #26272e;
  --bg-hover: #2c2d36;
  --bg-input: #131418;
  --banner-bg: linear-gradient(100deg, #2b2468 0%, #231f55 55%, #1d1b43 100%);
  --banner-border: rgba(var(--accent-rgb), .28);
  --head-bg: linear-gradient(100deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-2-rgb), .10));

  --wash: 255, 255, 255;
  --border: rgba(var(--wash), .07);
  --border-strong: rgba(var(--wash), .13);

  --text: #f2f3f7;
  --text-2: #a5a8b5;
  --text-3: #6e717e;

  --success: #2fc36b;
  --success-dim: rgba(47, 195, 107, .15);
  --warning: #f5b030;
  --warning-dim: rgba(245, 176, 48, .15);
  --danger: #f0445a;
  --danger-dim: rgba(240, 68, 90, .15);
  --info: #2fb3e6;
  --info-dim: rgba(47, 179, 230, .16);

  --c-video: #ff6384;
  --c-image: #6fdc7a;
  --c-playlist: #ffcd56;
  --c-free: var(--accent);

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .55);
  --glow: 0 6px 22px rgba(var(--accent-rgb), .38);

  --ease: cubic-bezier(.22, .8, .24, 1);
  --t-fast: 160ms var(--ease);
  --t: 260ms var(--ease);

  --sidebar-w: 318px;
  --sidebar-w-collapsed: 84px;
  --topbar-h: 64px;

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-logo: "Lexend", "Manrope", system-ui, sans-serif;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f5f9;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-card-2: #f7f8fb;
  --bg-hover: #eff0f7;
  --bg-input: #f3f4f8;
  --banner-bg: linear-gradient(100deg, #ebe7ff 0%, #e2ddff 60%, #efedff 100%);
  --banner-border: rgba(var(--accent-rgb), .22);
  --head-bg: linear-gradient(100deg, rgba(var(--accent-rgb), .10), rgba(var(--accent-2-rgb), .05));
  --wash: 23, 24, 28;
  --border: rgba(var(--wash), .08);
  --border-strong: rgba(var(--wash), .15);
  --text: #17181c;
  --accent-hover: #4b38e3;    /* на светлом фоне текст-акцент темнее */
  --text-2: #5b5e6b;
  --text-3: #8d90a0;
  --shadow: 0 10px 30px rgba(23, 24, 28, .10);
  --shadow-lg: 0 30px 80px rgba(23, 24, 28, .22);
  color-scheme: light;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--t), color var(--t);
}
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
.icon { flex-shrink: 0; display: block; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
::selection { background: rgba(var(--accent-rgb), .35); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(var(--wash), .12); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--wash), .22); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Кнопки ---------- */
button, .btn {
  font: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-card-2);
  color: var(--text);
  font-weight: 600; font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast), color var(--t-fast), opacity var(--t-fast);
  user-select: none;
}
button:hover, .btn:hover { background: var(--bg-hover); border-color: rgba(var(--wash), .2); text-decoration: none; }
button:active, .btn:active { transform: translateY(1px) scale(.99); }
button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid rgba(var(--accent-rgb), .7); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary, .btn.primary {
  background: var(--grad); border-color: transparent; color: #fff;
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), .28);
  letter-spacing: .02em;
}
button.primary:hover, .btn.primary:hover { background: var(--grad); filter: brightness(1.1); box-shadow: var(--glow); }
button.grad { background: var(--grad); border: 0; color: #fff; box-shadow: var(--glow); }
button.grad:hover { filter: brightness(1.08); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
button.ghost:hover { background: rgba(var(--wash), .06); color: var(--text); }
button.danger { color: var(--danger); border-color: rgba(240, 68, 90, .35); background: var(--danger-dim); }
button.danger:hover { background: rgba(240, 68, 90, .24); }
button.danger.primary { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(240, 68, 90, .3); }
button.small { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
button.block { width: 100%; }
button.upper { text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.icon-btn {
  width: 38px; height: 38px; padding: 0; border-radius: var(--r-sm);
}
.icon-btn.small { width: 30px; height: 30px; border-radius: 7px; }
.icon-btn.round { border-radius: 50%; }
.act {
  /* мини-действия на карточках: прозрачные цветные иконки */
  width: 26px; height: 26px; padding: 0; border: 0; background: transparent;
  color: var(--accent-hover); border-radius: 7px;
}
.act:hover { background: rgba(var(--accent-rgb), .14); }
.act.muted-act { color: var(--text-3); }
.act.warn { color: var(--warning); }
.act.purple { color: #9c84ff; }
.act.blue { color: var(--info); }
.act.danger { color: var(--danger); background: transparent; }
.act.danger:hover { background: var(--danger-dim); }

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(var(--wash), .18); border-top-color: var(--accent);
  animation: spin .7s linear infinite; display: inline-block; flex-shrink: 0;
}
button.primary .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Поля ввода ---------- */
input, select, textarea {
  font: inherit; color: var(--text);
  width: 100%; height: 42px; padding: 0 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
textarea { height: auto; padding: 10px 14px; resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: rgba(var(--wash), .22); }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(var(--accent-rgb), .75); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .16); }
select {
  appearance: none; cursor: pointer; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a7a1b3' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
select option { background: var(--bg-card); color: var(--text); }
input[type="checkbox"] {
  width: 18px; height: 18px; padding: 0; margin: 0; flex-shrink: 0;
  appearance: none; border-radius: 5px; border: 1.5px solid var(--border-strong);
  background: var(--bg-input); cursor: pointer; display: inline-grid; place-content: center;
}
input[type="checkbox"]::after {
  content: ""; width: 10px; height: 10px; transform: scale(0);
  transition: transform var(--t-fast);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  background: #fff;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
input[type="checkbox"]:checked::after { transform: scale(1); }
label.field-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; margin: 16px 0 8px; color: var(--text);
}
.m-body > label.field-label:first-child, .panel-body > label.field-label:first-child { margin-top: 0; }
label.field-label .icon { color: var(--accent-hover); }
.field-hint { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.input-icon > input, .input-icon > select { padding-left: 40px; }
.input-group { display: flex; position: relative; }
.input-group input { padding-right: 46px; }
.input-group .ig-btn { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; padding: 0; border: 0; background: transparent; color: var(--text-2); }
.input-group .ig-btn:hover { color: var(--text); background: rgba(var(--wash), .06); }
.phone-group { display: flex; gap: 0; }
.phone-group select { width: 128px; border-radius: var(--r-sm) 0 0 var(--r-sm); border-right: 0; flex-shrink: 0; }
.phone-group input { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.pw-checks { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 5px; font-size: 12.5px; }
.pw-checks li { display: flex; align-items: center; gap: 7px; color: var(--text-3); transition: color var(--t-fast); }
.pw-checks li .dotc { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; display: grid; place-items: center; }
.pw-checks li.ok { color: var(--success); }
.pw-checks li.ok .dotc { background: var(--success); border-color: var(--success); color: #fff; }

/* Переключатель */
.switch { position: relative; display: inline-flex; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: rgba(var(--wash), .16); transition: background var(--t); cursor: pointer; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform var(--t); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* Переключатель темы — «пилюля» как в топбаре референса */
.theme-switch {
  position: relative; width: 60px; height: 32px; padding: 0; border-radius: 99px;
  background: linear-gradient(90deg, #d9dbe3, #eef0f5); border: 1px solid rgba(0,0,0,.08);
}
.theme-switch:hover { background: linear-gradient(90deg, #d9dbe3, #eef0f5); border-color: rgba(0,0,0,.12); }
.theme-switch .knob {
  position: absolute; top: 3px; left: 31px; width: 24px; height: 24px; border-radius: 50%;
  background: #23252c; color: #fff; display: grid; place-items: center;
  transition: left var(--t), background var(--t), color var(--t);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
:root[data-theme="light"] .theme-switch { background: linear-gradient(90deg, #2a2c34, #3a3d48); border-color: rgba(255,255,255,.1); }
:root[data-theme="light"] .theme-switch .knob { left: 3px; background: #fff; color: #e2a100; }

/* ---------- Логотип ---------- */
.logo-pill {
  display: inline-flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 20px 0 12px; border-radius: 99px;
  background: #0c0d10; color: #fff; text-decoration: none !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.logo-mark { width: 30px; height: 30px; flex-shrink: 0; display: block; }
.logo-word { font-family: var(--font-logo); font-weight: 600; font-size: 20px; letter-spacing: -.01em; color: #fff; line-height: 1; }
.logo-pill.lg { height: 54px; padding: 0 24px 0 14px; }
.logo-pill.lg .logo-mark { width: 34px; height: 34px; }
.logo-pill.lg .logo-word { font-size: 23px; }

/* ==========================================================================
   Каркас: сайдбар + топбар
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width var(--t), transform var(--t);
}
.sb-head {
  height: 92px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 18px 0 22px;
}
.sb-collapse {
  width: 28px; height: 28px; padding: 0; border-radius: 7px;
  background: rgba(var(--accent-rgb), .16); border: 0; color: var(--accent-hover);
}
.sb-collapse:hover { background: rgba(var(--accent-rgb), .28); }
.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 18px; position: relative; }
.nav-sep { height: 1px; margin: 10px 22px; background: linear-gradient(90deg, rgba(var(--accent-rgb), .45), rgba(var(--accent-rgb), .08)); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 14px;
  height: 46px; margin: 2px 10px; padding: 0 10px 0 18px;
  border-radius: 10px;
  color: var(--text); font-weight: 500; font-size: 14.5px;
  text-decoration: none !important;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
.nav-item .icon { color: var(--text-2); transition: color var(--t-fast), transform var(--t); }
.nav-item:hover { background: rgba(var(--wash), .04); }
.nav-item:hover .icon { color: var(--text); transform: translateX(1px); }
.nav-item .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item .nav-tools { display: none; gap: 6px; }
.nav-item.active { color: var(--text); }
.nav-item.active .icon { color: var(--accent-hover); }
.nav-item.active .nav-tools { display: flex; animation: fadeIn .3s var(--ease); }
.nav-tool {
  width: 28px; height: 28px; padding: 0; border-radius: 50%;
  background: rgba(var(--wash), .09); border: 0; color: var(--text);
}
.nav-tool:hover { background: rgba(var(--accent-rgb), .35); }
/* «Скользящая» подсветка активного пункта — плавно переезжает между пунктами */
.nav-indicator {
  position: absolute; left: 10px; right: 10px; top: 0; height: 46px;
  border-radius: 10px; pointer-events: none;
  background: var(--head-bg);
  border: 1px solid rgba(var(--accent-rgb), .45);
  box-shadow: inset 4px 0 0 var(--accent), 0 6px 20px rgba(var(--accent-rgb), .12);
  transition: transform 420ms var(--ease), opacity var(--t);
  opacity: 0;
}
.sb-foot { padding: 14px 16px 18px; border-top: 1px solid var(--border); }
.me-chip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: var(--r); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--grad);
}
.me-meta { min-width: 0; }
.me-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-role { font-size: 11.5px; color: var(--accent-hover); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Свёрнутый сайдбар */
.shell.collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.shell.collapsed .sb-head { padding: 0; justify-content: center; flex-direction: column; gap: 8px; }
.shell.collapsed .logo-pill { padding: 0 8px; }
.shell.collapsed .logo-word, .shell.collapsed .nav-label, .shell.collapsed .nav-tools, .shell.collapsed .me-meta { display: none !important; }
.shell.collapsed .nav-item { padding: 0; justify-content: center; }
.shell.collapsed .nav-sep { margin: 10px 18px; }
.shell.collapsed .me-chip { justify-content: center; }
.shell.collapsed .workspace { margin-left: var(--sidebar-w-collapsed); }

.workspace { flex: 1; min-width: 0; margin-left: var(--sidebar-w); transition: margin-left var(--t); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.tb-back {
  width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; flex-shrink: 0;
}
.tb-back:hover { background: var(--accent-hover); box-shadow: var(--glow); }
.tb-user { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-menu { display: none; }
.tb-icon { width: 38px; height: 38px; padding: 0; border: 0; background: transparent; color: var(--text); border-radius: 10px; }
.tb-icon:hover { background: rgba(var(--wash), .07); }
.pill-select {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 6px;
  border-radius: 99px; border: 1px solid var(--border-strong); background: rgba(var(--wash), .03);
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer;
}
.pill-select:hover { background: rgba(var(--wash), .07); }
.pill-select .dot-ic { width: 26px; height: 26px; border-radius: 50%; background: #fff; display: grid; place-items: center; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex-shrink: 0; }
.status-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(47, 195, 107, .2); animation: breathe 2.4s ease-in-out infinite; }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(240, 68, 90, .2); }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(47, 195, 107, .05); } }
.status-widget { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 10px); width: 300px; z-index: 50;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg); padding: 14px 16px;
  animation: popIn .22s var(--ease);
}
.pop-row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 13px; color: var(--text-2); border-bottom: 1px solid var(--border); }
.pop-row:last-child { border-bottom: 0; }
.pop-row b { color: var(--text); font-weight: 600; }
.pop-title { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); font-weight: 700; margin: 10px 0 2px; }
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 35; animation: fadeIn .2s; }

.main { padding: 40px 36px 60px; max-width: 1760px; width: 100%; margin: 0 auto; }

/* Плавная смена страниц */
.page { animation: pageIn 420ms var(--ease) both; }
.page.leaving { animation: pageOut 140ms ease-in both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes pageOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.stagger > * { animation: riseIn 460ms var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 20ms; } .stagger > *:nth-child(2) { animation-delay: 50ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; } .stagger > *:nth-child(4) { animation-delay: 110ms; }
.stagger > *:nth-child(5) { animation-delay: 140ms; } .stagger > *:nth-child(6) { animation-delay: 170ms; }
.stagger > *:nth-child(7) { animation-delay: 200ms; } .stagger > *:nth-child(8) { animation-delay: 230ms; }
.stagger > *:nth-child(n+9) { animation-delay: 260ms; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* ==========================================================================
   Баннер-заголовок страницы
   ========================================================================== */
.page-banner {
  background: var(--banner-bg);
  border: 1px solid var(--banner-border);
  border-radius: var(--r-lg);
  margin-bottom: 20px;
  position: relative; overflow: hidden;
}
.page-banner::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 160px at 12% -40%, rgba(var(--accent-rgb), .25), transparent 70%);
}
.pb-row { display: flex; align-items: center; gap: 14px; padding: 22px 24px; flex-wrap: wrap; position: relative; z-index: 1; }
.pb-row + .pb-row { border-top: 1px solid rgba(var(--accent-rgb), .22); padding-top: 16px; padding-bottom: 16px; }
.pb-icon, .tile-icon {
  width: 48px; height: 48px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: rgba(var(--accent-rgb), .16); color: var(--accent-hover);
}
.pb-title { font-size: 21px; font-weight: 700; }
.pb-title.big { font-size: 28px; font-weight: 600; color: var(--accent-hover); }
.pb-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pb-note {
  margin-left: auto; display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 99px; border: 1px solid rgba(var(--accent-rgb), .35);
  background: rgba(var(--accent-rgb), .08); font-size: 13px; font-weight: 600;
}
.pb-row .spacer { flex: 1; }
.pb-search { display: flex; gap: 10px; align-items: center; }
.pb-search input { width: 240px; height: 40px; background: var(--bg-input); }
.pb-search select { width: 150px; height: 40px; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px;
  background: rgba(var(--wash), .06); border: 1px solid var(--border);
}
.seg button { height: 32px; width: 34px; padding: 0; border: 0; background: transparent; color: var(--text-2); border-radius: 7px; }
.seg button:hover { color: var(--text); background: rgba(var(--wash), .06); }
.seg button.on { background: rgba(var(--wash), .14); color: var(--text); }
.round-tool { width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 0; background: rgba(var(--accent-rgb), .2); color: var(--accent-hover); }
.round-tool:hover, .round-tool.on { background: var(--accent); color: #fff; }

.tabs {
  display: inline-flex; flex-wrap: wrap; border-radius: 99px; overflow: hidden;
  background: rgba(0,0,0,.18); border: 1px solid rgba(var(--wash), .08);
}
:root[data-theme="light"] .tabs { background: rgba(255,255,255,.6); }
.tabs button {
  height: 44px; padding: 0 18px; border: 0; border-radius: 0; background: transparent;
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700; font-size: 13.5px; color: var(--text);
  border-right: 1px solid rgba(var(--wash), .08);
}
.tabs button:last-child { border-right: 0; }
.tabs button .icon { color: var(--text); }
.tabs button:hover { background: rgba(var(--wash), .06); }
.tabs button.on { background: rgba(var(--accent-rgb), .22); color: var(--accent-hover); }
.tabs button.on .icon { color: var(--accent-hover); }
.bulk-btn {
  height: 46px; padding: 0 20px; border-radius: 99px; border: 0;
  background: rgba(0,0,0,.25); text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
}
:root[data-theme="light"] .bulk-btn { background: rgba(255,255,255,.7); }
.bulk-btn.armed { background: var(--danger); color: #fff; box-shadow: 0 6px 20px rgba(240,68,90,.35); }

/* ==========================================================================
   Карточки, сводки, таблицы
   ========================================================================== */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; gap: 16px; padding: 20px 24px;
  background: var(--head-bg); border-bottom: 1px solid var(--banner-border);
}
.panel-head.solo { border-bottom: 0; }
.panel-head h2 { font-size: 20px; font-weight: 600; }
.panel-head .sub { font-size: 12.5px; font-weight: 700; margin-top: 8px; display: flex; justify-content: space-between; }
.panel-head .grow { flex: 1; min-width: 0; }
.panel-body { padding: 8px 24px 16px; }
.panel-title { font-size: 16px; font-weight: 700; text-align: center; padding: 22px 16px 14px; margin: 0 24px; border-bottom: 1px solid rgba(var(--accent-rgb), .18); }
.progress { height: 5px; border-radius: 99px; background: rgba(var(--wash), .09); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: var(--success); width: 0; transition: width 900ms var(--ease); }
.kv-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--text-2); }
.kv-row:last-child { border-bottom: 0; }
.kv-row .v { color: var(--text); font-weight: 700; text-align: right; min-width: 0; overflow-wrap: anywhere; }
.count-pill { min-width: 30px; height: 30px; padding: 0 9px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 700; font-size: 14px; background: rgba(var(--accent-rgb), .18); color: var(--accent-hover); }
.count-pill.green { background: var(--success-dim); color: var(--success); }
.count-pill.gray { background: rgba(var(--wash), .09); color: var(--text); }
.count-pill .status-dot { animation: none; box-shadow: none; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.dash-col { display: grid; gap: 24px; min-width: 0; }
.chart-wrap { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 20px 24px 24px; flex-wrap: wrap; min-height: 200px; }
.chart-foot { text-align: center; font-weight: 600; color: var(--text-2); padding: 0 0 22px; }
.legend { display: grid; gap: 7px; font-size: 13px; font-weight: 500; }
.legend span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend i { width: 38px; height: 12px; border: 2px solid #fff; display: inline-block; flex-shrink: 0; }
:root[data-theme="light"] .legend i { border-color: rgba(0,0,0,.2); }
.legend em { font-style: normal; color: var(--text-3); margin-left: 2px; }
.chart svg { display: block; overflow: visible; }
.chart .seg-arc { transition: stroke-dasharray 1s var(--ease); }
.chart .bar { transition: height 900ms var(--ease), y 900ms var(--ease); }
.chart-tip { font-size: 12px; }

.activity { display: grid; }
.act-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.act-item:last-child { border-bottom: 0; }
.act-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; background: rgba(var(--wash), .07); color: var(--text-2); }
.act-ic.success { background: var(--success-dim); color: var(--success); }
.act-ic.danger { background: var(--danger-dim); color: var(--danger); }
.act-ic.accent { background: rgba(var(--accent-rgb), .16); color: var(--accent-hover); }
.act-text { font-size: 13px; }
.act-time { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* Таблицы */
.table-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left; font-weight: 700; font-size: 12.5px; color: var(--text);
  padding: 16px 18px; white-space: nowrap; border-bottom: 1px solid var(--border);
}
table.data td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr { transition: background var(--t-fast); animation: riseIn 380ms var(--ease) both; }
table.data tbody tr:hover { background: rgba(var(--accent-rgb), .07); }
table.data tbody tr.hl { background: rgba(var(--accent-rgb), .12); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .actions-cell { white-space: nowrap; text-align: right; }
table.data .actions-cell .act { display: inline-grid; place-items: center; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-title { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-3); }
.mini-btn {
  height: 34px; padding: 0 12px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em;
  background: rgba(var(--wash), .05); border-color: var(--border-strong);
}

/* Нижняя панель: всего + пагинация + размер страницы */
.list-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-top: 16px; padding: 10px 12px; border-radius: var(--r);
  background: var(--bg-card); border: 1px solid var(--border);
}
.table-card .list-foot { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.total-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 8px; background: rgba(var(--accent-rgb), .1); font-weight: 600; font-size: 13px; }
.total-chip b { color: var(--accent-hover); }
.total-chip .icon { color: var(--accent-hover); opacity: .7; }
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pager button { width: 38px; height: 38px; padding: 0; border: 0; background: rgba(var(--wash), .07); font-size: 15px; }
.pager button.on { background: var(--accent); color: #fff; box-shadow: var(--glow); }
.pager .dots { color: var(--text-3); padding: 0 4px; }
.size-select { width: 88px; height: 42px; }

/* Бейджи и теги */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px;
  border-radius: 99px; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  background: rgba(var(--wash), .08); color: var(--text-2); white-space: nowrap;
}
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.online { background: var(--success-dim); color: var(--success); }
.badge.offline { background: rgba(var(--wash), .09); color: var(--text-2); }
.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 9px; border-radius: 99px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: rgba(var(--wash), .08); color: var(--text-2);
}
.pill.video { background: rgba(59, 155, 245, .18); color: #5aa9f7; }
.pill.image { background: rgba(111, 220, 122, .16); color: #5dcc6a; }
.pill.role { background: rgba(59, 155, 245, .14); color: #6fb2f8; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; height: 24px; padding: 0 10px; }
.pill.role.super { background: rgba(var(--accent-rgb), .18); color: var(--accent-hover); }
.pill.dark { background: #0c0d10; color: #fff; }
.pill.warn { background: var(--warning-dim); color: var(--warning); }
.pill.ok { background: var(--success-dim); color: var(--success); }
.pill.bad { background: var(--danger-dim); color: var(--danger); }
.status-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 20px; padding: 0 12px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; color: #fff; background: var(--success);
}
.status-chip.pending { background: var(--warning); color: #231a02; }
.status-chip.flagged { background: var(--danger); }
.state-btn { height: 28px; padding: 0 14px; border-radius: 99px; font-size: 12px; font-weight: 700; border: 0; }
.state-btn.on { background: #e3f7ea; color: #13823d; }
.state-btn.off { background: var(--danger-dim); color: var(--danger); }
.state-btn:hover { filter: brightness(.96); }
.state-btn.on:hover { background: #d3f2de; }

/* Пустое состояние / ошибки / загрузка */
.empty {
  grid-column: 1 / -1; text-align: center; padding: 56px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: rgba(var(--wash), .015);
}
.empty .e-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .14); color: var(--accent-hover); margin-bottom: 6px; }
.empty .e-title { font-weight: 700; font-size: 16px; }
.empty .e-desc { color: var(--text-2); max-width: 440px; }
.empty button { margin-top: 8px; }
.empty.error .e-ic { background: var(--danger-dim); color: var(--danger); }
.skeleton { background: linear-gradient(90deg, rgba(var(--wash), .04) 25%, rgba(var(--wash), .09) 37%, rgba(var(--wash), .04) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: var(--r-lg); }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.loading-row { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px; color: var(--text-2); }
.callout {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 14px 18px; margin-bottom: 18px; border-radius: var(--r);
  background: rgba(var(--accent-rgb), .08); border: 1px solid rgba(var(--accent-rgb), .3);
}
.callout .c-ic { color: var(--accent-hover); }
.callout .c-title { font-weight: 700; }
.callout .c-desc { font-size: 12.5px; color: var(--text-2); }
.code-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border-radius: 10px; background: var(--bg-card); border: 1px solid var(--border-strong); }
.code-chip .code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-weight: 700; font-size: 16px; letter-spacing: .18em; margin-right: 4px; }

/* ==========================================================================
   Устройства
   ========================================================================== */
.card-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.device-card {
  background: var(--bg-card-2); border: 1px solid var(--border); border-top: 3px solid rgba(var(--wash), .18);
  border-radius: var(--r); overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.device-card.is-online { border-top-color: var(--success); }
.device-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: rgba(var(--accent-rgb), .35); }
.dc-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 0; }
.dc-id { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; color: var(--text-3); }
.dc-shield { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: rgba(var(--wash), .07); color: var(--text-3); }
.dc-shield.ok { color: var(--success); background: var(--success-dim); }
.dc-body { display: flex; gap: 14px; padding: 12px 14px 14px; }
.dc-tiles { display: grid; gap: 10px; }
.dc-tile { width: 46px; height: 46px; border-radius: 11px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .16); color: var(--accent-hover); overflow: hidden; }
.dc-tile.shot { background: rgba(var(--wash), .09); color: var(--text-2); }
.dc-tile.shot img, .dc-tile.shot video { width: 100%; height: 100%; object-fit: cover; }
.dc-info { min-width: 0; display: grid; gap: 5px; align-content: start; }
.dc-name { font-weight: 800; font-size: 14px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-line { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); min-width: 0; }
.dc-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-foot { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--border); }
.dc-foot .spacer { flex: 1; }

/* Модальное «инфо» с двумя колонками (устройство / контент) */
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); align-items: start; }
.split-main { padding: 24px; border-right: 1px solid var(--border); min-width: 0; display: flex; flex-direction: column; gap: 18px; justify-content: center; }
.split-side { padding: 20px; display: grid; gap: 14px; align-content: start; }
.preview-box { border-radius: var(--r-lg); overflow: hidden; background: #000; aspect-ratio: 16 / 9; display: grid; place-items: center; color: var(--text-3); }
.preview-box video, .preview-box img { width: 100%; height: 100%; object-fit: contain; display: block; }
.info-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-card-2); padding: 16px 18px; }
.info-card h3 { display: flex; align-items: center; gap: 10px; font-size: 15px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid rgba(var(--accent-rgb), .2); }
.info-card h3 .icon { color: var(--accent-hover); }
.info-item { display: grid; grid-template-columns: 22px 1fr; gap: 2px 10px; margin-bottom: 14px; }
.info-item:last-child { margin-bottom: 0; }
.info-item .icon { color: var(--text-3); margin-top: 2px; }
.info-item .k { font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); }
.info-item .v { grid-column: 2; font-weight: 600; font-size: 13.5px; overflow-wrap: anywhere; margin-top: 4px; }
.ai-box { font-size: 13px; line-height: 1.55; padding: 12px 14px; border-radius: var(--r); background: rgba(var(--accent-2-rgb), .1); border: 1px solid rgba(var(--accent-2-rgb), .3); white-space: pre-wrap; }

/* ==========================================================================
   Контент
   ========================================================================== */
.content-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.content-card {
  position: relative; background: var(--bg-card-2); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; border-top: 4px solid #2f7de8;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.content-card.t-image { border-top-color: #3fb752; }
.content-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.content-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .5); }
.cc-top { display: flex; gap: 12px; padding: 16px 14px 14px; background: rgba(var(--wash), .03); min-height: 92px; }
.cc-thumb { width: 44px; height: 44px; border-radius: 11px; flex-shrink: 0; overflow: hidden; display: grid; place-items: center; background: var(--accent); color: #fff; position: relative; }
.cc-thumb img, .cc-thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t); }
.cc-thumb img.ready, .cc-thumb video.ready { opacity: 1; }
.cc-meta { min-width: 0; display: grid; gap: 5px; align-content: start; }
.cc-name { font-weight: 800; font-size: 13px; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-dur { font-size: 11.5px; color: var(--text-2); }
.cc-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; padding: 10px 10px 10px 12px; border-top: 1px solid var(--border); }
.cc-date { font-size: 11px; color: var(--text-3); line-height: 1.5; }
.cc-actions { display: flex; }
.cc-check { position: absolute; top: 10px; right: 10px; opacity: 0; transition: opacity var(--t-fast); }
.content-card:hover .cc-check, .selecting .cc-check, .content-card.selected .cc-check { opacity: 1; }

.dropzone {
  border: 2px dashed rgba(var(--accent-rgb), .45); border-radius: var(--r-lg);
  padding: 34px 20px; text-align: center; cursor: pointer;
  background: rgba(var(--accent-rgb), .05);
  transition: background var(--t), border-color var(--t), transform var(--t);
}
.dropzone:hover, .dropzone.over { background: rgba(var(--accent-rgb), .12); border-color: var(--accent); }
.dropzone.over { transform: scale(1.01); }
.dz-ic { width: 58px; height: 58px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: var(--glow); }
.dz-title { font-weight: 700; font-size: 15px; }
.dz-desc { color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.up-list { display: grid; gap: 8px; margin-top: 14px; }
.up-item { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--bg-card-2); border: 1px solid var(--border); animation: riseIn .3s var(--ease); }
.up-item .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: rgba(var(--accent-rgb), .16); color: var(--accent-hover); }
.up-item .nm { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .sz { font-size: 11.5px; color: var(--text-3); }
.up-item .progress { margin-top: 6px; height: 4px; }
.up-item .progress > i { background: var(--grad); transition: width .2s linear; }
.up-item .st { font-size: 12px; font-weight: 700; }
.up-item .st.ok { color: var(--success); } .up-item .st.err { color: var(--danger); }

/* ==========================================================================
   Стоковый контент
   ========================================================================== */
.stock-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.stock-card {
  background: var(--bg-card-2); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.stock-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: rgba(var(--accent-rgb), .4); }
.sc-media { position: relative; aspect-ratio: 16 / 9; background: #0c0d10; overflow: hidden; }
.sc-media img, .sc-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 600ms var(--ease); }
.sc-media video[hidden] { display: none; }
.stock-card:hover .sc-media img, .stock-card:hover .sc-media video { transform: scale(1.06); }
.sc-type { position: absolute; top: 10px; right: 10px; padding: 3px 7px; border-radius: 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; color: #fff; background: #2f6fe0; }
.sc-type.image { background: #2fa84a; }
.sc-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, rgba(12,13,16,.1), rgba(12,13,16,.7));
  opacity: 0; transition: opacity var(--t);
}
.stock-card:hover .sc-overlay, .stock-card:focus-within .sc-overlay { opacity: 1; }
.sc-overlay button { transform: translateY(8px); transition: transform var(--t), background var(--t-fast); }
.stock-card:hover .sc-overlay button { transform: none; }
.sc-body { padding: 10px 12px 12px; }
.sc-name { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--text-3); }
.sc-meta span { display: inline-flex; align-items: center; gap: 5px; }
.sc-cat { font-size: 11px; color: var(--accent-hover); font-weight: 600; margin-top: 2px; }

/* ==========================================================================
   Плейлисты
   ========================================================================== */
.pl-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pl-card { background: var(--bg-card-2); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; cursor: pointer; transition: transform var(--t), box-shadow var(--t), border-color var(--t); }
.pl-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(var(--accent-rgb), .45); }
.pl-mosaic { aspect-ratio: 16 / 8; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; background: #0c0d10; }
.pl-mosaic > div { background: rgba(var(--accent-rgb), .12); overflow: hidden; display: grid; place-items: center; color: rgba(var(--accent-rgb), .6); }
.pl-mosaic img, .pl-mosaic video { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-mosaic.one > div:first-child { grid-column: 1 / -1; grid-row: 1 / -1; }
.pl-body { padding: 14px 16px 16px; }
.pl-name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; min-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; font-size: 11.5px; color: var(--text-3); }

.editor { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.ed-col { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.ed-col-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--border); background: var(--head-bg); }
.ed-col-head h2 { font-size: 16px; }
.ed-col-head .grow { flex: 1; }
.ed-filter { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.ed-filter input { height: 36px; flex: 1; min-width: 140px; }
.mini-tabs { display: inline-flex; gap: 4px; }
.mini-tabs button { height: 36px; padding: 0 12px; font-size: 12px; background: transparent; border-color: var(--border); }
.mini-tabs button.on { background: rgba(var(--accent-rgb), .2); border-color: rgba(var(--accent-rgb), .5); color: var(--accent-hover); }
.lib-list, .seq-list { max-height: calc(100vh - 360px); min-height: 280px; overflow-y: auto; padding: 8px; }
.lib-item, .seq-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px;
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.lib-item:hover { background: rgba(var(--wash), .05); }
.thumb { width: 64px; height: 38px; border-radius: 7px; overflow: hidden; background: #0c0d10; flex-shrink: 0; position: relative; display: grid; place-items: center; color: var(--text-3); }
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.li-main { flex: 1; min-width: 0; }
.li-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.add-btn { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; background: rgba(var(--accent-rgb), .18); color: var(--accent-hover); }
.add-btn:hover { background: var(--accent); color: #fff; transform: rotate(90deg); }
.seq-item { background: var(--bg-card-2); border: 1px solid var(--border); margin-bottom: 8px; cursor: grab; animation: riseIn .3s var(--ease) both; }
.seq-item:hover { border-color: rgba(var(--accent-rgb), .35); }
.seq-item.dragging { opacity: .4; }
.seq-item.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.seq-item.drop-after { box-shadow: 0 3px 0 var(--accent); }
.seq-idx { width: 26px; text-align: center; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.grip { color: var(--text-3); cursor: grab; }
.dur-input { width: 74px; height: 32px; padding: 0 8px; text-align: center; font-size: 12.5px; }
.seq-empty { display: grid; place-items: center; text-align: center; gap: 8px; color: var(--text-2); min-height: 260px; border: 2px dashed var(--border-strong); border-radius: var(--r); margin: 4px; }
.stat-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 99px; background: rgba(0,0,0,.2); border: 1px solid rgba(var(--wash), .08); font-size: 12.5px; font-weight: 600; }
:root[data-theme="light"] .stat-chip { background: rgba(255,255,255,.7); }
.stat-chip .icon { color: var(--accent-hover); }
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); display: inline-block; animation: breathe 1.6s infinite; }
.inline-edit { background: transparent; border: 1px solid transparent; font-size: 21px; font-weight: 700; height: 40px; padding: 0 8px; margin-left: -8px; width: min(420px, 100%); }
.inline-edit:hover { border-color: var(--border-strong); background: rgba(0,0,0,.12); }

/* ==========================================================================
   Пользователи
   ========================================================================== */
.role-picker { position: relative; }
.role-trigger { width: 100%; justify-content: space-between; height: auto; min-height: 42px; padding: 6px 12px; background: var(--bg-input); font-weight: 500; flex-wrap: wrap; }
.role-trigger .chosen { display: flex; gap: 6px; flex-wrap: wrap; }
.role-trigger .ph { color: var(--text-3); }
.role-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5;
  background: var(--bg-card-2); border: 1px solid var(--border-strong); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 6px; animation: popIn .2s var(--ease);
  max-height: 320px; overflow-y: auto;
}
.role-opt { display: flex; align-items: flex-start; gap: 14px; padding: 11px 12px; border-radius: 9px; cursor: pointer; }
.role-opt:hover { background: rgba(var(--wash), .06); }
.role-opt input { margin-top: 2px; }
.role-opt .rk { font-weight: 800; font-size: 12.5px; letter-spacing: .03em; }
.role-opt .rd { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.role-opt.disabled { opacity: .45; cursor: not-allowed; }
.perm-cell { display: inline-flex; align-items: center; gap: 7px; color: var(--text-2); font-weight: 500; }
.matrix { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.matrix th, .matrix td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: center; white-space: nowrap; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix .yes { color: var(--success); display: inline-grid; }
.matrix .no { color: var(--text-3); opacity: .5; }
details.roles-info { margin-top: 20px; }
details.roles-info summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; padding: 16px 20px; font-weight: 700; }
details.roles-info summary::-webkit-details-marker { display: none; }
details.roles-info summary .chev { margin-left: auto; transition: transform var(--t); }
details.roles-info[open] summary .chev { transform: rotate(180deg); }
.user-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.user-card { background: var(--bg-card-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; display: grid; gap: 12px; transition: transform var(--t), box-shadow var(--t); }
.user-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tag-me { font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 2px 7px; border-radius: 5px; background: var(--grad); color: #fff; margin-left: 6px; vertical-align: middle; }

/* ==========================================================================
   Модальные окна и уведомления
   ========================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 11, 14, .66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .22s ease both;
}
.modal-backdrop.closing { animation: fadeOut .2s ease both; }
.modal-backdrop.closing .modal { animation: modalOut .2s ease both; }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes modalOut { to { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal {
  width: 100%; max-width: 580px; max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); overflow: hidden;
  animation: modalIn .34s var(--ease) both;
}
.modal.wide { max-width: 1200px; }
.modal.mid { max-width: 780px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.m-head {
  display: flex; align-items: center; gap: 16px; padding: 22px 26px;
  background: var(--grad); color: #fff; flex-shrink: 0;
}
.m-head.soft { background: var(--head-bg); color: var(--text); border-bottom: 1px solid var(--border); }
.m-head .m-ic { width: 52px; height: 52px; border-radius: 13px; display: grid; place-items: center; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.25); flex-shrink: 0; }
.m-head.soft .m-ic { background: var(--accent); border: 0; color: #fff; }
.m-head h2 { font-size: 20px; }
.m-head .m-sub { font-size: 13px; font-weight: 500; opacity: .9; margin-top: 3px; }
.m-head .grow { flex: 1; min-width: 0; }
.m-close { width: 32px; height: 32px; padding: 0; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--accent); }
.m-close:hover { background: #fff; transform: rotate(90deg); }
.m-head.soft .m-close { background: transparent; color: var(--text-2); }
.m-head.soft .m-close:hover { color: var(--text); background: rgba(var(--wash), .08); }
.m-body { padding: 24px 26px; overflow-y: auto; }
.m-body.flush { padding: 0; }
.m-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 16px 26px; border-top: 1px solid var(--border); flex-shrink: 0; }
.m-foot .spacer { flex: 1; }
.m-foot .ghost { color: var(--text); font-weight: 700; }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 420px;
  padding: 12px 16px; border-radius: var(--r);
  background: var(--bg-card-2); border: 1px solid var(--border-strong); border-left: 4px solid var(--info);
  box-shadow: var(--shadow-lg); font-weight: 500;
  animation: toastIn .38s var(--ease) both;
}
.toast.success { border-left-color: var(--success); } .toast.success .icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); } .toast.error .icon { color: var(--danger); }
.toast .icon { color: var(--info); }
.toast.leaving { animation: toastOut .3s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ==========================================================================
   Вход
   ========================================================================== */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  position: relative; overflow: hidden;
  background: radial-gradient(1200px 700px at 20% 10%, #2d2480 0%, transparent 60%),
              radial-gradient(900px 600px at 90% 90%, #1f1a66 0%, transparent 60%),
              linear-gradient(135deg, #17181c 0%, #14152b 50%, #17181c 100%);
}
:root[data-theme="light"] .login {
  background: radial-gradient(1200px 700px at 20% 10%, #ddd6ff 0%, transparent 60%),
              radial-gradient(900px 600px at 90% 90%, #e6e3ff 0%, transparent 60%),
              linear-gradient(135deg, #f1efff 0%, #fafaff 100%);
}
.login-top { position: absolute; top: 20px; right: 24px; display: flex; gap: 12px; z-index: 2; }
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 460px;
  padding: 44px 48px 38px; border-radius: 28px;
  background: rgba(23, 24, 28, .92); border: 1px solid rgba(255,255,255,.07);
  box-shadow: 0 40px 100px rgba(0,0,0,.5);
  text-align: center; animation: modalIn .6s var(--ease) both;
}
:root[data-theme="light"] .login-card { background: rgba(255,255,255,.94); border-color: rgba(23,24,28,.08); box-shadow: 0 40px 100px rgba(59,43,217,.14); }
.login-card h1 { font-size: 24px; margin-top: 28px; }
.login-card .sub { color: var(--text-2); font-size: 13.5px; margin-top: 10px; }
.login-form { margin-top: 30px; text-align: left; display: grid; gap: 6px; }
.u-field { position: relative; }
.u-field input {
  height: 44px; border: 0; border-bottom: 2px solid rgba(var(--wash), .18); border-radius: 8px 8px 0 0;
  background: rgba(var(--wash), .04); padding: 0 42px 0 12px; font-size: 16px;
}
.u-field input:focus { box-shadow: none; border-bottom-color: var(--accent); background: rgba(var(--accent-rgb), .06); }
.u-field.invalid input { border-bottom-color: var(--danger); }
.u-field .ig-btn { position: absolute; right: 4px; top: 5px; width: 34px; height: 34px; padding: 0; border: 0; background: transparent; color: var(--text-2); }
.u-err { min-height: 18px; font-size: 12px; color: var(--danger); padding: 3px 0 6px; }
.login-links { display: flex; justify-content: flex-end; margin: -4px 0 20px; }
.login-links a { font-size: 13px; color: var(--accent-hover); }
.login-btn { height: 50px; font-size: 16px; border-radius: 10px; }
.login-error { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--danger-dim); color: var(--danger); font-size: 13px; margin-bottom: 12px; animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.login-foot { margin-top: 22px; font-size: 12.5px; color: var(--text-3); }

/* Настройки */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 22px; align-items: start; }

/* ==========================================================================
   Адаптив
   ========================================================================== */
@media (max-width: 1280px) {
  .dash-grid { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .lib-list, .seq-list { max-height: 460px; }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .shell.collapsed .logo-word, .shell.collapsed .nav-label, .shell.collapsed .me-meta { display: initial !important; }
  .workspace, .shell.collapsed .workspace { margin-left: 0; }
  .tb-menu { display: inline-grid; }
  .sb-collapse { display: none; }
  .main { padding: 24px 16px 48px; }
  .split { grid-template-columns: 1fr; }
  .split-main { border-right: 0; border-bottom: 1px solid var(--border); }
  .pb-tools { margin-left: 0; width: 100%; }
  .pb-search { flex: 1; flex-wrap: wrap; }
  .pb-search input { flex: 1; width: auto; min-width: 140px; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .tb-user { font-size: 14px; }
  .tb-hide-sm { display: none !important; }
  .pb-row { padding: 16px; }
  .tabs button { height: 38px; padding: 0 12px; font-size: 11.5px; }
  .login-card { padding: 34px 22px 28px; }
  .m-head { padding: 18px; }
  .m-body { padding: 18px; }
  .m-foot { padding: 14px 18px; }
  .card-grid, .content-grid, .stock-grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Инфографика: радиальные шкалы, кольца и стековые полосы
   ========================================================================== */
.gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 20px 6px; }
.gauge { position: relative; line-height: 0; }
.gauge svg { overflow: visible; }
.gauge .g-track { stroke: rgba(var(--wash), .10); }
.gauge .g-val { transition: stroke-dasharray 1.1s var(--ease); }
.gauge .g-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.15; }
.gauge .g-num { font-size: 30px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.gauge .g-num small { font-size: 16px; font-weight: 700; margin-left: 1px; }
.gauge .g-cap { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-top: 2px; }
.gauge-legend { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin-top: 2px; }
.gauge-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.gauge-legend b { color: var(--text); font-weight: 700; }
.gauge-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.stack { padding: 6px 24px 20px; display: grid; gap: 14px; }
.stack-bar {
  display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: rgba(var(--wash), .09);
  box-shadow: inset 0 0 0 1px var(--border);
}
.stack-bar > i {
  display: block; height: 100%; width: 0;
  transition: width 1s var(--ease), filter var(--t-fast);
  cursor: default;
}
.stack-bar > i + i { box-shadow: inset 1px 0 0 rgba(0, 0, 0, .35); }
.stack-bar > i:hover { filter: brightness(1.18); }
.stack-rows { display: grid; gap: 2px; }
.stack-row {
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 8px; font-size: 13px;
  transition: background var(--t-fast);
}
.stack-row:hover { background: rgba(var(--wash), .05); }
.stack-row i { width: 12px; height: 12px; border-radius: 4px; }
.stack-row .s-name { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-row .s-val { font-weight: 700; font-variant-numeric: tabular-nums; }
.stack-row .s-pct { min-width: 46px; text-align: right; font-size: 12px; font-weight: 700; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stack-row.is-link { cursor: pointer; }
.stack-empty { text-align: center; color: var(--text-3); font-size: 13px; padding: 6px 0 2px; }

.mini-gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; padding: 16px 18px 6px; }
.mini-gauge { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mini-gauge .mg-label { font-size: 12px; font-weight: 600; color: var(--text-2); text-align: center; }
.mini-gauge .g-num { font-size: 20px; }
.mini-gauge .g-cap { font-size: 10px; }

/* ==========================================================================
   Клиенты и филиалы
   ========================================================================== */
.client-avatar {
  border-radius: 14px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 800; letter-spacing: .02em; color: #fff; background: var(--grad);
  box-shadow: 0 6px 18px rgba(var(--accent-rgb), .28);
}
.client-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.client-card {
  background: var(--bg-card-2); border: 1px solid var(--border); border-radius: var(--r-lg);
  cursor: pointer; overflow: hidden; display: flex; flex-direction: column;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.client-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: rgba(var(--accent-rgb), .45); }
.clc-head { display: flex; align-items: center; gap: 14px; padding: 18px 18px 12px; }
.clc-name { font-weight: 800; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clc-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 18px 12px; }
.clc-stats > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: rgba(var(--wash), .04); }
.clc-stats b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.clc-stats b.ok { color: var(--success); }
.clc-stats span { font-size: 11.5px; color: var(--text-3); }
.clc-branches { display: flex; gap: 6px; flex-wrap: wrap; padding: 14px 18px 4px; min-height: 40px; }
.clc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 12px 18px; margin-top: auto; border-top: 1px solid var(--border); }
.clc-foot .cell-sub { display: inline-flex; align-items: center; gap: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.branch-list { display: grid; gap: 18px; }
.branch-panel { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.branch-panel.muted-panel { border-style: dashed; }
.branch-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; background: var(--head-bg); border-bottom: 1px solid var(--border);
}
.muted-panel .branch-head { background: rgba(var(--wash), .02); }
.branch-name { font-weight: 800; font-size: 16px; }
.branch-empty { display: flex; align-items: center; gap: 10px; justify-content: center; padding: 22px; color: var(--text-3); font-size: 13px; }
.branch-add { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); background: rgba(var(--wash), .015); }
.branch-add select { height: 34px; max-width: 460px; font-size: 13px; }
table.data.compact td { padding: 10px 16px; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0; }
.inline-field .icon { color: var(--accent-hover); }
.inline-select { height: 34px; width: auto; min-width: 170px; max-width: 240px; font-size: 12.5px; padding: 0 32px 0 10px; background-position: right 10px center; }
.dc-client { color: var(--accent-hover) !important; font-weight: 600; }
.pill.client { background: rgba(var(--accent-rgb), .16); color: var(--accent-hover); }
.filter-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; width: 100%; }
.filter-row .inline-select { height: 38px; min-width: 160px; max-width: 220px; background-color: var(--bg-input); }
.filter-row .inline-select:disabled { opacity: .5; cursor: not-allowed; }

/* ==========================================================================
   Мониторинг — «стена» статусов
   ========================================================================== */
:root { --lv-ok: #56c26a; --lv-warn: #f2bf45; --lv-bad: #f06478; --lv-off: #5f6270; --lv-na: #5f6270; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(47,195,107,.6); animation: livePulse 1.8s infinite; display: inline-block; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(47,195,107,.55); } 70% { box-shadow: 0 0 0 9px rgba(47,195,107,0); } 100% { box-shadow: 0 0 0 0 rgba(47,195,107,0); } }

.mon-sums { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.mon-sum {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden;
}
.mon-sum::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent); }
.mon-sum.lv-ok::before { background: var(--lv-ok); } .mon-sum.lv-warn::before { background: var(--lv-warn); }
.mon-sum.lv-bad::before { background: var(--lv-bad); } .mon-sum.lv-na::before { background: var(--lv-na); }
.mon-sum span { font-size: 12px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.mon-sum b { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.mon-sum b small { font-size: 15px; color: var(--text-3); font-weight: 700; }
.mon-sum em { font-style: normal; font-size: 11.5px; color: var(--text-3); }
.mon-sum .progress { margin-top: 8px; }
.mon-sum .progress > i { transition: width .6s var(--ease); }

.mon-panel { background: #1a1b20; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px 16px; margin-bottom: 18px; }
:root[data-theme="light"] .mon-panel { background: var(--bg-card); }
.mon-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mon-head h2 { font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: .05em; }
.mon-head h2 .icon { color: var(--accent-hover); }
.mon-head span { font-size: 11.5px; color: var(--text-3); }
.mon-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.mon-two .mon-panel { margin-bottom: 18px; }

.lat-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.lat-tile {
  position: relative; overflow: hidden; border-radius: 6px; min-height: 74px; padding: 8px 10px;
  display: flex; flex-direction: column; justify-content: space-between; color: #0d1f10;
  background: var(--lv-ok); transition: background .4s var(--ease);
}
.lat-tile.lv-warn { background: var(--lv-warn); color: #2b1f00; }
.lat-tile.lv-bad { background: var(--lv-bad); color: #2d0710; }
.lat-tile.lv-off, .lat-tile.lv-na { background: #2a2c33; color: var(--text-2); }
.lt-spark { position: absolute; inset: auto 0 0 0; height: 60%; opacity: .45; pointer-events: none; }
.lt-spark .spark { width: 100%; height: 100%; display: block; }
.spark-area { fill: rgba(255,255,255,.55); }
.spark-line { fill: none; stroke: rgba(255,255,255,.95); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.lt-name { position: relative; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt-val { position: relative; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.lt-val small { font-size: 12px; font-weight: 700; opacity: .8; }
.lat-tile.lv-off .lt-val { font-size: 14px; }

.mg-grid { display: grid; gap: 6px 4px; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); justify-items: center; }
.mg { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; transition: opacity .3s; }
.mg.faded { opacity: .45; }
.mg svg { display: block; overflow: visible; }
.mg-track { stroke: rgba(var(--wash), .10); }
.mg-val { transition: stroke-dasharray .9s var(--ease), stroke .4s; }
.mg-val.lv-ok { stroke: var(--lv-ok); } .mg-val.lv-warn { stroke: var(--lv-warn); } .mg-val.lv-bad { stroke: var(--lv-bad); }
.mg-val.lv-off, .mg-val.lv-na { stroke: var(--lv-off); }
.mg-num { font-weight: 800; font-variant-numeric: tabular-nums; fill: var(--text); }
.mg-num.lv-ok { fill: var(--lv-ok); } .mg-num.lv-warn { fill: var(--lv-warn); } .mg-num.lv-bad { fill: var(--lv-bad); }
.mg-num.lv-off, .mg-num.lv-na { fill: var(--text-3); }
.mg-label { font-size: 10.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: -4px; }

.srv-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.srv-row .mg-label { max-width: 190px; text-transform: none; font-size: 11.5px; }
.srv-facts { display: grid; grid-template-columns: repeat(2, minmax(150px, 1fr)); gap: 10px 22px; margin-left: auto; }
.srv-facts div { display: flex; flex-direction: column; gap: 2px; }
.srv-facts span { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.srv-facts b { font-size: 15px; font-variant-numeric: tabular-nums; }

.mon-table tbody tr { animation: none !important; }
.mon-table td, .mon-table th { white-space: nowrap; }
.mon-table td:first-child { white-space: normal; min-width: 170px; }
.lvt { font-weight: 800; font-variant-numeric: tabular-nums; }
.lvt.lv-ok { color: var(--lv-ok); } .lvt.lv-warn { color: var(--lv-warn); } .lvt.lv-bad { color: var(--lv-bad); }
.lvt.lv-off, .lvt.lv-na { color: var(--text-3); }

/* Режим стены: только графики, на весь экран */
.wall-exit { display: none; }
body.wall .sidebar, body.wall .topbar, body.wall .sidebar-overlay { display: none !important; }
body.wall .workspace { margin-left: 0 !important; }
body.wall .main { max-width: none; padding: 14px 18px; }
body.wall .page-banner { margin-bottom: 12px; }
body.wall .page-banner .pb-row { padding: 10px 16px; }
body.wall #wallBtn, body.wall #monRange, body.wall #tvLinkBtn { display: none; }
body.wall .lat-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
body.wall .lat-tile { min-height: 88px; }
body.wall .lt-val { font-size: 28px; }
body.wall .mg-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); }
body.wall .wall-exit {
  display: grid; place-items: center; position: fixed; bottom: 16px; right: 16px; z-index: 60;
  width: 38px; height: 38px; padding: 0; border-radius: 50%; opacity: .25; transition: opacity var(--t);
}
body.wall .wall-exit:hover { opacity: 1; }
@media (max-width: 1100px) { .mon-two { grid-template-columns: 1fr; } .srv-facts { margin-left: 0; } }

.tv-key { display: flex; align-items: center; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-card-2); margin-bottom: 8px; }
.tv-url { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: var(--accent-hover); margin: 5px 0 3px; word-break: break-all; user-select: all; }
.callout.warn-callout { background: rgba(240, 100, 120, .08); border-color: rgba(240, 100, 120, .35); }
.callout.warn-callout .c-ic { color: var(--danger); }
.pill.opt-run .icon { animation: spin 1.2s linear infinite; }
