/* ==========================================================================
   ETL Sync v3.0 — дизайн-система веб-панели
   Светлая / тёмная тема, боковое меню, карточки, анимации.
   ========================================================================== */

:root {
  --font: "Segoe UI Variable Text", "Segoe UI", "Inter", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "Cascadia Mono", "Consolas", "JetBrains Mono", ui-monospace, monospace;

  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f8f9fd;
  --surface-3: #f1f3f9;
  --ink: #1d2433;
  --ink-2: #3b4458;
  --muted: #6b7489;
  --line: #e4e8f1;
  --line-2: #d6dbe7;
  --shadow-sm: 0 1px 2px rgba(22, 28, 45, .05);
  --shadow: 0 1px 2px rgba(22, 28, 45, .04), 0 4px 16px -4px rgba(22, 28, 45, .08);
  --shadow-lg: 0 10px 40px -10px rgba(22, 28, 45, .25), 0 2px 6px rgba(22, 28, 45, .06);

  --primary: #5b5bf0;
  --primary-2: #8b5cf6;
  --primary-ink: #ffffff;
  --primary-soft: #ececfe;
  --primary-soft-ink: #4338ca;
  --grad: linear-gradient(135deg, #5b5bf0 0%, #8b5cf6 100%);

  --green: #10b981;  --green-soft: #e3f8f0;  --green-ink: #047857;
  --blue: #0ea5e9;   --blue-soft: #e2f4fd;   --blue-ink: #0369a1;
  --amber: #f59e0b;  --amber-soft: #fef3dc;  --amber-ink: #b45309;
  --red: #ef4444;    --red-soft: #fde8e8;    --red-ink: #b91c1c;
  --violet: #8b5cf6; --violet-soft: #f0eafe; --violet-ink: #6d28d9;
  --gray-soft: #eef0f5; --gray-ink: #545d72;

  --side-bg: #111427;
  --side-bg-2: #171b35;
  --side-ink: #b9bfd6;
  --side-ink-strong: #ffffff;
  --side-hover: rgba(255, 255, 255, .06);
  --side-active: rgba(124, 124, 255, .18);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --side-w: 250px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #0c0f1d;
  --bg-2: #10142a;
  --surface: #151a30;
  --surface-2: #1a2039;
  --surface-3: #1f2644;
  --ink: #e7eaf5;
  --ink-2: #c3c9dd;
  --muted: #8b93ad;
  --line: #262d4b;
  --line-2: #323a5c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 20px -6px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 50px -12px rgba(0, 0, 0, .7);
  --primary-soft: rgba(124, 124, 255, .16);
  --primary-soft-ink: #b4b4ff;
  --green-soft: rgba(16, 185, 129, .15);  --green-ink: #4ade9f;
  --blue-soft: rgba(14, 165, 233, .15);   --blue-ink: #5cc5f5;
  --amber-soft: rgba(245, 158, 11, .15);  --amber-ink: #fbbf49;
  --red-soft: rgba(239, 68, 68, .15);     --red-ink: #fb7b7b;
  --violet-soft: rgba(139, 92, 246, .17); --violet-ink: #c4a7ff;
  --gray-soft: rgba(148, 163, 184, .12);  --gray-ink: #aab3c8;
  --side-bg: #090b17;
  --side-bg-2: #0e1123;
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--surface-3); padding: 1px 6px; border-radius: 6px; }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--surface);
  font-size: 11px; color: var(--muted); text-align: center;
}
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 24px; margin: 0; font-weight: 700; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 15px; margin: 0 0 10px; font-weight: 650; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
::selection { background: var(--primary-soft); }

.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; vertical-align: -2px; }
.icon-lg { width: 22px; height: 22px; }
.spin { animation: spin 1s linear infinite; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  display: flex; flex-direction: column;
  background: radial-gradient(1200px 400px at -20% -10%, rgba(124, 92, 255, .22), transparent 60%),
              linear-gradient(180deg, var(--side-bg-2), var(--side-bg));
  color: var(--side-ink);
  border-right: 1px solid rgba(255, 255, 255, .04);
  transition: width .3s var(--ease), transform .3s var(--ease);
}
.brand {
  display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px;
  color: var(--side-ink-strong); text-decoration: none !important;
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 11px; flex: none;
  display: grid; place-items: center; background: var(--grad);
  box-shadow: 0 6px 18px -4px rgba(124, 92, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-logo .icon { width: 21px; height: 21px; color: #fff; }
.brand-logo:hover .icon { animation: spin 1.2s var(--ease); }
.brand-name { font-weight: 750; font-size: 16.5px; letter-spacing: -.01em; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--side-ink); opacity: .75; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #6f7699;
  padding: 16px 12px 6px; font-weight: 650; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 2px 0; border-radius: 10px;
  color: var(--side-ink); font-weight: 520; text-decoration: none; white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav a .icon { opacity: .85; transition: transform .25s var(--ease); }
.nav a:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.nav a:hover .icon { transform: scale(1.12); }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px;
  border-radius: 0 4px 4px 0; background: var(--grad); box-shadow: 0 0 12px rgba(139, 92, 246, .8);
}
.nav a.active .icon { opacity: 1; color: #c7c4ff; }
.nav .count {
  margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 20px;
  background: rgba(255, 255, 255, .08); color: #d9dcf0;
}
.nav .count.live { background: rgba(16, 185, 129, .2); color: #6ee7b7; }

.side-foot { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.side-license { display: flex; gap: 6px; align-items: center; margin: 8px 4px 0; font-size: 11px; color: var(--side-ink);
  opacity: .8; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-license span { overflow: hidden; text-overflow: ellipsis; }
html[data-side="mini"] .side-license span { display: none; }
.server-pill {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .05); color: var(--side-ink-strong); font-size: 12.5px;
}
.server-pill small { display: block; color: var(--side-ink); font-size: 11px; }
.side-toggle {
  margin-top: 8px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 7px; border-radius: 10px; border: 0; cursor: pointer; background: transparent; color: #7c83a6;
  font: inherit; font-size: 12px;
}
.side-toggle:hover { background: var(--side-hover); color: #fff; }

html[data-side="mini"] { --side-w: 76px; }
html[data-side="mini"] .brand-text, html[data-side="mini"] .nav-group,
html[data-side="mini"] .nav a span, html[data-side="mini"] .nav .count,
html[data-side="mini"] .server-pill .sp-text, html[data-side="mini"] .side-toggle span { display: none; }
html[data-side="mini"] .nav a { justify-content: center; }
html[data-side="mini"] .brand { justify-content: center; padding-left: 0; padding-right: 0; }
html[data-side="mini"] .server-pill { justify-content: center; }
html[data-side="mini"] .side-toggle .icon { transform: rotate(180deg); }

.main { flex: 1; min-width: 0; margin-left: var(--side-w); transition: margin-left .3s var(--ease); }

.topbar {
  position: sticky; top: 0; z-index: 30; height: 64px;
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar .burger { display: none; }
.page-title { display: flex; flex-direction: column; min-width: 0; }
.page-title .crumb { font-size: 12px; color: var(--muted); }
.page-title h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 260px; height: 38px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  cursor: pointer; font: inherit; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.search-trigger:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.search-trigger kbd { margin-left: auto; }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
  transition: all .2s var(--ease);
}
.icon-btn:hover { color: var(--primary); border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow); }
.icon-btn:active { transform: scale(.94); }
.theme-toggle .i-sun { display: none; }
html[data-theme="dark"] .theme-toggle .i-sun { display: block; }
html[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px 0 5px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit;
  transition: all .2s var(--ease);
}
.user-btn:hover { box-shadow: var(--shadow); }
.avatar {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 12px; text-transform: uppercase;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transform-origin: top right;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.user-menu.open .dropdown { opacity: 1; transform: none; pointer-events: auto; }
.dropdown a, .dropdown button {
  display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown .dd-head { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dropdown .danger { color: var(--red-ink); }

.page { padding: 26px 28px 60px; max-width: 1480px; margin: 0 auto; }
.page > :not(.modal-back) { animation: fadeUp .45s var(--ease) both; }
.page > :nth-child(2):not(.modal-back) { animation-delay: .04s; }
.page > :nth-child(3):not(.modal-back) { animation-delay: .08s; }
.page > :nth-child(4):not(.modal-back) { animation-delay: .12s; }
.page > :nth-child(5):not(.modal-back) { animation-delay: .16s; }
.page > :nth-child(n+6):not(.modal-back) { animation-delay: .2s; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 760px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- grid */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 18px; }
.hstack { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 18px; } .mt-s { margin-top: 10px; } .mt-xs { margin-top: 6px; } .mb { margin-bottom: 18px; } .mb-s { margin-bottom: 10px; }

/* --------------------------------------------------------------- cards */
.card, .panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 20px;
}
.panel { margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 12px; margin: -4px 0 16px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-icon {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary-soft-ink);
}
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--line); }

.stat {
  position: relative; overflow: hidden; display: flex; gap: 14px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 18px; transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%;
  background: currentColor; opacity: .06; color: var(--primary);
}
.stat .bubble {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary-soft-ink);
}
.stat .bubble .icon { width: 22px; height: 22px; }
.stat .num { font-size: 26px; font-weight: 750; line-height: 1.05; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 12.5px; }
.stat.green .bubble { background: var(--green-soft); color: var(--green-ink); } .stat.green::after { color: var(--green); }
.stat.blue .bubble { background: var(--blue-soft); color: var(--blue-ink); } .stat.blue::after { color: var(--blue); }
.stat.amber .bubble { background: var(--amber-soft); color: var(--amber-ink); } .stat.amber::after { color: var(--amber); }
.stat.red .bubble { background: var(--red-soft); color: var(--red-ink); } .stat.red::after { color: var(--red); }
.stat.violet .bubble { background: var(--violet-soft); color: var(--violet-ink); } .stat.violet::after { color: var(--violet); }

.hero {
  position: relative; overflow: hidden; border-radius: 20px; padding: 24px 26px; color: #fff;
  background: radial-gradient(600px 200px at 90% -20%, rgba(255, 255, 255, .25), transparent 60%), var(--grad);
  box-shadow: 0 16px 40px -18px rgba(91, 91, 240, .8);
}
.hero h2 { color: #fff; font-size: 21px; margin: 0 0 4px; }
.hero p { margin: 0; opacity: .9; }
.hero .hero-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero .hero-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .btn { background: rgba(255, 255, 255, .16); color: #fff; border-color: rgba(255, 255, 255, .25); }
.hero .btn:hover { background: rgba(255, 255, 255, .26); }
.hero.warn { background: radial-gradient(600px 200px at 90% -20%, rgba(255, 255, 255, .25), transparent 60%), linear-gradient(135deg, #f59e0b, #ef6c3a); }
.hero-ring {
  width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
}
.hero-ring .icon { width: 26px; height: 26px; }

/* ------------------------------------------------------------- buttons */
.btn {
  --b-bg: var(--surface); --b-ink: var(--ink); --b-line: var(--line-2);
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 11px; border: 1px solid var(--b-line);
  background: var(--b-bg); color: var(--b-ink); font: inherit; font-weight: 600; font-size: 13.5px;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; user-select: none;
  transition: transform .18s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s, color .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--line-2); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; }
.btn:focus-visible, .input:focus-visible, .icon-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 1px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary {
  --b-ink: #fff; --b-line: transparent; background: var(--grad);
  box-shadow: 0 6px 16px -8px rgba(91, 91, 240, .9), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 10px 22px -10px rgba(91, 91, 240, 1); border-color: transparent; }
.btn-success { --b-ink: #fff; --b-line: transparent; background: linear-gradient(135deg, #10b981, #0ea37a); box-shadow: 0 6px 16px -8px rgba(16, 185, 129, .9); }
.btn-success:hover { filter: brightness(1.06); border-color: transparent; }
.btn-danger { --b-bg: var(--red-soft); --b-ink: var(--red-ink); --b-line: transparent; }
.btn-danger:hover { --b-bg: var(--red); --b-ink: #fff; border-color: transparent; }
.btn-warning { --b-bg: var(--amber-soft); --b-ink: var(--amber-ink); --b-line: transparent; }
.btn-soft { --b-bg: var(--primary-soft); --b-ink: var(--primary-soft-ink); --b-line: transparent; }
.btn-ghost { --b-bg: transparent; --b-line: transparent; --b-ink: var(--ink-2); }
.btn-ghost:hover { --b-bg: var(--surface-3); box-shadow: none; }
.btn-sm { height: 31px; padding: 0 11px; border-radius: 9px; font-size: 12.5px; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-lg { height: 46px; padding: 0 22px; border-radius: 13px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 31px; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: nowrap; }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25;
  animation: ripple .6s var(--ease); pointer-events: none; }

/* -------------------------------------------------------------- forms */
label, .label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=email],
input:not([type]), select, textarea, .input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
textarea, textarea.input { height: auto; min-height: 90px; padding: 10px 12px; line-height: 1.45; resize: vertical; }
textarea.code, .code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus, .input:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
}
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
.row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; align-items: flex-end; }
.row > div { flex: 1; min-width: 150px; }
.row > .fit { flex: 0 0 auto; min-width: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }

.chk, .switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--ink); margin: 0; }
.chk input[type=checkbox], .chk input[type=radio] { width: 17px; height: 17px; accent-color: var(--primary); margin: 0; cursor: pointer; }
.switch input { display: none; }
.switch .track { position: relative; width: 38px; height: 22px; border-radius: 22px; background: var(--line-2); transition: background .2s var(--ease); flex: none; }
.switch .track::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }

.search-box { position: relative; min-width: 240px; flex: 1; max-width: 420px; }
.search-box .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 38px; padding-right: 64px; height: 40px; }
.search-box .sb-right { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 6px; }
.search-box .sb-clear { border: 0; background: var(--surface-3); color: var(--muted); width: 22px; height: 22px; border-radius: 6px; cursor: pointer; display: none; place-items: center; }
.search-box.has-value .sb-clear { display: grid; }
.search-box.has-value kbd { display: none; }
.filter-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-count { color: var(--muted); font-size: 12.5px; }
mark { background: color-mix(in srgb, var(--amber) 35%, transparent); color: inherit; border-radius: 4px; padding: 0 1px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 31px; padding: 0 12px; border-radius: 20px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 550; transition: all .18s var(--ease);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px -6px var(--primary); }
.chip .n { font-size: 11px; opacity: .75; }

/* ---------------------------------------------------------- segmented */
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font: inherit; font-size: 12.5px;
  font-weight: 600; color: var(--muted); cursor: pointer; transition: all .18s var(--ease); display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeUp .3s var(--ease); }

/* ---------------------------------------------------------------- table */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: auto; background: var(--surface); box-shadow: var(--shadow); }
.table-wrap.tall { max-height: calc(100vh - 290px); }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.2px; }
.card table.data, .panel table.data { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
table.data th {
  position: sticky; top: 0; z-index: 1; text-align: left; font-weight: 650; font-size: 11.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted); background: var(--surface-2); padding: 11px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data th.sortable { cursor: pointer; }
table.data th.sortable:hover { color: var(--ink); }
table.data th .sort-ind { opacity: .4; margin-left: 4px; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tr.is-running { background: color-mix(in srgb, var(--primary) 5%, transparent); }
table.data tr.row-flash { animation: rowFlash 1.4s var(--ease); }
table.data td.nowrap, .nowrap { white-space: nowrap; }
table.data .actions-cell { text-align: right; white-space: nowrap; }
/* кнопки действий всегда видны, даже если таблица шире экрана */
table.sticky-actions td.actions-cell, table.sticky-actions th:last-child { position: sticky; right: 0; z-index: 1; background: var(--surface);
  box-shadow: -10px 0 12px -10px rgba(22, 28, 45, .18); }
table.sticky-actions th:last-child { background: var(--surface-2); }
table.sticky-actions tr:hover td.actions-cell { background: inherit; }
.t-main { font-weight: 600; color: var(--ink); }
.t-sub { font-size: 12px; color: var(--muted); }
.t-arrow { color: var(--muted); margin: 0 4px; }

/* ---------------------------------------------------------------- badges */
.badge, .tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 650; white-space: nowrap; background: var(--gray-soft); color: var(--gray-ink);
}
.badge .icon { width: 13px; height: 13px; }
.b-green { background: var(--green-soft); color: var(--green-ink); }
.b-blue { background: var(--blue-soft); color: var(--blue-ink); }
.b-amber { background: var(--amber-soft); color: var(--amber-ink); }
.b-red { background: var(--red-soft); color: var(--red-ink); }
.b-violet { background: var(--violet-soft); color: var(--violet-ink); }
.b-primary { background: var(--primary-soft); color: var(--primary-soft-ink); }
.b-outline { background: transparent; border: 1px solid var(--line-2); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; flex: none; position: relative; }
.dot.green { background: var(--green); } .dot.amber { background: var(--amber); } .dot.red { background: var(--red); } .dot.blue { background: var(--blue); }
.dot.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: pulse 1.8s ease-out infinite; }

.ok { color: var(--green-ink); } .off, .err { color: var(--red-ink); } .warn-t { color: var(--amber-ink); }
.running { color: var(--primary-soft-ink); font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.feat-ico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; margin-right: 3px; }

/* -------------------------------------------------------------- progress */
.progress { position: relative; height: 8px; border-radius: 10px; background: var(--surface-3); overflow: hidden; min-width: 120px; }
.progress .bar { height: 100%; border-radius: inherit; background: var(--grad); transition: width .6s var(--ease); position: relative; }
.progress .bar::after {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(45deg, rgba(255, 255, 255, .25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .25) 50%, rgba(255, 255, 255, .25) 75%, transparent 75%);
  background-size: 18px 18px; animation: stripes 1s linear infinite;
}
.progress.indeterminate .bar { width: 35% !important; position: absolute; animation: indet 1.3s var(--ease) infinite; }
.prog-line { display: flex; align-items: center; gap: 10px; }
.prog-line .pct { font-weight: 700; font-size: 12px; min-width: 36px; text-align: right; }
.bar-fill { height: 100%; background: var(--grad); }  /* совместимость */

/* ---------------------------------------------------------------- flash / alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: 12px; margin-bottom: 16px;
  border: 1px solid transparent; background: var(--blue-soft); color: var(--blue-ink); }
.alert .icon { margin-top: 1px; }
.alert.warn { background: var(--amber-soft); color: var(--amber-ink); }
.alert.error { background: var(--red-soft); color: var(--red-ink); }
.alert.success { background: var(--green-soft); color: var(--green-ink); }
.alert b { color: inherit; }
.flash { display: none; }

/* ---------------------------------------------------------------- empty */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .empty-ico { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary-soft-ink); animation: float 4s ease-in-out infinite; }
.empty .empty-ico .icon { width: 28px; height: 28px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }

/* ---------------------------------------------------------------- modal */
.modal-back {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px; overflow-y: auto; background: rgba(9, 12, 26, .45); backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none; transition: opacity .22s var(--ease);
}
.modal-back.open { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 24px; transform: translateY(14px) scale(.97); transition: transform .28s var(--ease);
}
.modal.wide { max-width: 980px; }
.modal-back.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }
.modal-head .close { margin-left: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------------------------------------------------------------- toasts */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 14px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: toastIn .35s var(--ease) both; position: relative; overflow: hidden;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast .t-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue-ink); }
.toast.success .t-ico { background: var(--green-soft); color: var(--green-ink); }
.toast.error .t-ico { background: var(--red-soft); color: var(--red-ink); }
.toast.warn .t-ico { background: var(--amber-soft); color: var(--amber-ink); }
.toast .t-body { flex: 1; padding-top: 4px; font-size: 13.5px; word-break: break-word; }
.toast .t-close { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 4px; }
.toast .t-timer { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--grad); animation: shrink linear forwards; }

/* ---------------------------------------------------------------- palette */
.palette-back { align-items: flex-start; padding-top: 12vh; }
.palette { max-width: 640px; padding: 0; overflow: hidden; }
.palette .p-input { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.palette .p-input input { border: 0; box-shadow: none !important; height: 32px; padding: 0; font-size: 16px; background: transparent; }
.palette .p-list { max-height: 55vh; overflow-y: auto; padding: 8px; }
.palette .p-group { padding: 8px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 650; }
.palette .p-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--ink); text-decoration: none !important; }
.palette .p-item .p-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.palette .p-item.sel, .palette .p-item:hover { background: var(--primary-soft); }
.palette .p-item.sel .p-ico { background: var(--primary); color: #fff; }
.palette .p-item .p-sub { font-size: 12px; color: var(--muted); }
.palette .p-foot { display: flex; gap: 14px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- misc components */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 550; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px dashed var(--line); }
.list-item:last-child { border-bottom: 0; }
.timeline { position: relative; display: flex; flex-direction: column; gap: 2px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.tl-item { display: grid; grid-template-columns: 58px 1fr; gap: 10px; padding: 7px 4px; border-radius: 8px; font-size: 13px; animation: fadeUp .35s var(--ease) both; }
.tl-item:hover { background: var(--surface-2); }
.tl-time { color: var(--muted); font-family: var(--mono); font-size: 12px; padding-top: 1px; }
.tl-item.error .tl-text { color: var(--red-ink); } .tl-item.warn .tl-text { color: var(--amber-ink); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 600; }
.countdown.soon { color: var(--amber-ink); }
.countdown.due { color: var(--primary-soft-ink); }
.pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; max-height: 360px; overflow: auto; }
.conn-card { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; margin-bottom: 10px; }
.conn-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--line-2); }
.conn-card .db-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--blue-soft); color: var(--blue-ink); }
.conn-card .db-ico.mysql { background: var(--amber-soft); color: var(--amber-ink); }
.conn-card .db-ico.postgresql { background: var(--violet-soft); color: var(--violet-ink); }
.conn-card .ci { font-weight: 650; }
.conn-card .ca { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tabgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin: 8px 0 14px; }
.tabgrid .chk { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.combo { position: relative; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 60; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 5px; display: none; }
.combo.open .combo-list { display: block; animation: fadeUp .18s var(--ease); }
.combo-item { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.combo-item:hover, .combo-item.sel { background: var(--primary-soft); }
.combo-item .ci-sub { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.combo-more { padding: 8px 10px; font-size: 12px; color: var(--muted); }
.dep-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px; cursor: help;
  background: var(--primary-soft); color: var(--primary); font-weight: 600; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.dep-pill b { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 7px; font-size: 11px; line-height: 18px; }
.dep-pill:hover, .dep-pill:focus { transform: translateY(-1px); box-shadow: var(--shadow); outline: none; }
.has-pop .pop-content { display: none; }
.pop-float { position: fixed; z-index: 400; max-width: 360px; max-height: 60vh; overflow-y: auto; padding: 8px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: fadeUp .16s var(--ease); pointer-events: auto; }
.pop-float .pop-title { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 8px 6px; }
.pop-float .pop-item { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.pop-float .pop-item:hover { background: var(--surface-2); }
.t-link { color: inherit; text-decoration: none; cursor: pointer; }
.t-link:hover { color: var(--primary); text-decoration: underline; }
.dep-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; margin: 2px 4px 2px 0; border-radius: 7px; font-size: 11.5px; background: var(--surface-3); color: var(--ink-2); }

/* ---------------------------------------------------------------- login */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--bg); }
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(800px 400px at 0% 0%, rgba(255, 255, 255, .18), transparent 60%), linear-gradient(145deg, #3730a3, #6d28d9 55%, #9333ea);
}
.auth-art h1 { color: #fff; font-size: 38px; line-height: 1.1; margin: 18px 0 12px; }
.auth-art p { opacity: .85; max-width: 440px; font-size: 15px; }
.auth-art .orb { position: absolute; border-radius: 50%; filter: blur(2px); background: rgba(255, 255, 255, .12); animation: float 9s ease-in-out infinite; }
.auth-feats { display: grid; gap: 12px; margin-top: 28px; }
.auth-feat { display: flex; gap: 12px; align-items: center; opacity: .95; }
.auth-feat .fi { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(255, 255, 255, .14); }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 26px; margin-bottom: 6px; }
.auth-card .field { margin-bottom: 16px; }
.auth-card input { height: 46px; }
.login-card { max-width: 420px; margin: 40px auto; }

/* ---------------------------------------------------------------- animations */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(3); opacity: 0; } }
@keyframes stripes { to { background-position: 18px 0; } }
@keyframes indet { 0% { left: -35%; } 100% { left: 100%; } }
@keyframes ripple { to { transform: scale(4); opacity: 0; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px) scale(.96); } }
@keyframes shrink { from { width: 100%; } to { width: 0; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes rowFlash { 0% { background: color-mix(in srgb, var(--green) 22%, transparent); } 100% { background: transparent; } }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.skeleton { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 8px; min-height: 14px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); animation: shimmer 1.3s infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) { .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); --side-w: 250px; width: 250px; }
  html.side-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .main { margin-left: 0 !important; }
  .topbar { padding: 0 16px; }
  .topbar .burger { display: inline-grid; }
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .page { padding: 18px 16px 50px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

/* ---------------------------------------------------------------- ограниченная версия */
.limit-modal { text-align: center; }
.limit-modal h2 { margin: 6px 0 6px; font-size: 21px; }
.limit-hero { width: 64px; height: 64px; margin: 4px auto 6px; border-radius: 20px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ef4444); box-shadow: 0 12px 30px -10px rgba(239, 68, 68, .6); animation: pop .35s var(--ease); }
.limit-hero .icon { width: 30px; height: 30px; }
.limit-text { color: var(--ink-2); margin: 0 0 14px; }
.limit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 12px; }
.limit-grid div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; }
.limit-grid b { font-size: 24px; }
.limit-grid span { font-size: 12px; color: var(--muted); }
.edition-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--amber-soft, #fef3c7); color: var(--amber-ink, #92400e); cursor: help; }
.limit-count { font-weight: 700; }
.limit-count.full { color: var(--red-ink, #b91c1c); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.struct-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; gap: 5px; }

.seg-wrap { flex-wrap: wrap; }
.seg button.dim { opacity: .45; }
.seg button.rec:not(.active) { box-shadow: inset 0 0 0 1.5px var(--primary); }
.struct-banner { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px;
  background: var(--primary-soft); color: var(--ink-2); font-size: 12.5px; }

.lang-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.lang-card { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border: 1.5px solid var(--line);
  border-radius: 14px; cursor: pointer; transition: all .18s var(--ease); background: var(--surface); font-weight: 650; margin: 0; }
.lang-card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.lang-card.active { border-color: var(--primary); background: var(--primary-soft); }
.lang-card input { display: none; }
.lang-card img { width: 46px; height: 31px; border-radius: 5px; box-shadow: 0 1px 4px rgba(0,0,0,.25); object-fit: cover; }
.flag-sm { width: 20px; height: 14px; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); object-fit: cover; vertical-align: -2px; }

.lang-menu { position: relative; }
.lang-menu .lang-btn img { width: 22px; height: 15px; }
.lang-menu .dropdown { right: 0; min-width: 170px; }
.lang-menu:hover .dropdown, .lang-menu:focus-within .dropdown { opacity: 1; transform: none; pointer-events: auto; }
.lang-menu::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.lang-menu .dropdown button.active { background: var(--primary-soft); font-weight: 700; }

/* журнал действий */
.audit-changes { display: flex; flex-direction: column; gap: 3px; }
.ach { font-size: 12px; line-height: 1.45; word-break: break-word; }
.ach code { font-size: 11.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; margin-right: 4px; }
.ach-old { color: var(--red-ink); text-decoration: line-through; opacity: .8; }
.ach-new { color: var(--green-ink); font-weight: 500; }

/* массовое создание маппингов */
.bulk-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 4px; margin-top: 10px; }
.bulk-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; margin: 0; font-weight: 400; }
.bulk-row:hover { background: var(--surface-2); }
.bulk-row.done { opacity: .55; cursor: default; }
.bulk-row input { flex: none; width: auto; }
.bulk-name { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.bulk-name small { color: var(--muted); font-size: 11.5px; }
.bulk-result { margin-top: 10px; max-height: 22vh; overflow: auto; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }

/* статистика */
.chart { position: relative; min-height: 220px; }
.chart svg { display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .base { stroke: var(--line-2); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; }
.chart .b-main { fill: var(--primary); }
.chart .b-ok { fill: var(--green); }
.chart .b-err { fill: var(--red); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: var(--ink); fill-opacity: .05; }
.chart-tip { position: fixed; z-index: 1000; display: none; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow-lg); }
.chart-legend { margin-left: auto; display: flex; gap: 14px; font-size: 12px; color: var(--ink-2); align-items: center; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-legend .lg-ok { background: var(--green); } .chart-legend .lg-err { background: var(--red); }
.hbar { position: relative; height: 22px; display: flex; align-items: center; }
.hbar span { position: absolute; left: 0; top: 4px; bottom: 4px; background: var(--primary-soft); border-radius: 0 4px 4px 0; border-left: 2px solid var(--primary); }
.hbar b { position: relative; padding-left: 8px; font-weight: 600; font-size: 12.5px; }
@media (max-width: 640px) { .card-head:has(.chart-legend) { flex-wrap: wrap; } .chart-legend { margin-left: 0; width: 100%; } }

/* предпросмотр и сверка */
.preview-wrap { max-height: 60vh; overflow: auto; }
.preview-table td, .preview-table th { white-space: nowrap; font-size: 12px; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.struct-banner.ok { background: var(--green-soft); color: var(--green-ink); }
.struct-banner.warn { background: var(--amber-soft); color: var(--amber-ink); }

/* связанные маппинги при изменении подключения */
.impact-list { display: flex; flex-wrap: wrap; gap: 6px; max-height: 180px; overflow: auto; }

/* окно «Структура 1С»: как получить файл */
.struct-howto { margin: 0 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2, rgba(99,102,241,.06)); border: 1px solid var(--line, rgba(0,0,0,.08)); font-size: 13.5px; }
.struct-howto ol { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.struct-dl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* окно результата (лицензия, пользователи) */
.result-modal { text-align: center; }
.result-modal h2 { margin: 6px 0 6px; font-size: 21px; }
.result-hero { width: 64px; height: 64px; margin: 4px auto 6px; border-radius: 20px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #10b981, #0d9488); box-shadow: 0 12px 28px -12px rgba(13, 148, 136, .7); }
.result-modal.error .result-hero { background: linear-gradient(135deg, #ef4444, #b91c1c); box-shadow: 0 12px 28px -12px rgba(185, 28, 28, .7); }
.result-modal.limit .result-hero { background: linear-gradient(135deg, #6366f1, #7c3aed); box-shadow: 0 12px 28px -12px rgba(99, 102, 241, .7); }
.result-hero .icon { width: 30px; height: 30px; }
.result-text { color: var(--ink-2, inherit); margin: 4px 0 10px; white-space: pre-line; }
.result-rows { display: grid; gap: 6px; margin: 10px 0 4px; text-align: left; }
.result-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2, #f4f5fa); }
.result-rows span { color: var(--muted); }
.upd-result { margin-top: 10px; }
.alert.info { background: var(--blue-soft, #e0f2fe); color: var(--blue-ink, #075985); }
.lock-card { text-align: center; padding: 28px; }
.lock-card h2 { margin: 6px 0; }
.lock-card .btn { margin-top: 6px; }
.ad-card { margin-bottom: 16px; }
.ad-card summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.ad-card summary::-webkit-details-marker { display: none; }
.ad-card[open] summary { margin-bottom: 10px; }
.ad-card .card-icon { width: 34px; height: 34px; }
.ad-combo .combo-list { position: static; margin-top: 6px; max-height: 240px; }
.ad-combo .combo-item.disabled { opacity: .5; cursor: default; background: none; }
.ad-combo .combo-item .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.switch.disabled { opacity: .55; cursor: not-allowed; }
