/* =========================================================
   Cometa Gate — дизайн-система Cometa Wiki
   ========================================================= */

:root {
  --topbar-h: 64px;
  --sidebar-w: 272px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);

  --brand-1: #c13cff;
  --brand-2: #5b5cff;
  --brand-3: #38bdf8;
  --grad: linear-gradient(120deg, var(--brand-1) 0%, var(--brand-2) 48%, var(--brand-3) 100%);

  color-scheme: dark;
  --bg: #070a12;
  --bg-elev: #0b0f1a;
  --surface: #0f1421;
  --surface-2: #141a2a;
  --surface-3: #1a2134;
  --overlay: rgba(7, 10, 18, .72);
  --border: rgba(160, 175, 215, .10);
  --border-strong: rgba(160, 175, 215, .20);
  --text: #eef1fb;
  --text-2: #a5aec4;
  --text-3: #6f7891;
  --accent: #7c8bff;
  --accent-strong: #9aa6ff;
  --accent-soft: rgba(124, 139, 255, .12);
  --accent-line: rgba(124, 139, 255, .35);
  --danger: #ff7a8a;
  --danger-soft: rgba(255, 92, 115, .10);
  --danger-line: rgba(255, 110, 130, .28);
  --info: #5cc8ff;
  --info-soft: rgba(56, 189, 248, .09);
  --info-line: rgba(56, 189, 248, .26);
  --success: #3ee0a1;
  --warn: #fcd968;
  --warn-soft: rgba(250, 204, 21, .08);
  --warn-line: rgba(250, 204, 21, .3);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 30px 80px -20px rgba(0, 0, 0, .7);
  --glow-a: rgba(124, 60, 255, .22);
  --glow-b: rgba(56, 189, 248, .14);
  /* chart series (validated on --surface) */
  --down: #1d9fd6;
  --up: #8f6bff;
}

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; }
.hidden, [hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--topbar-h) + 20px); -webkit-text-size-adjust: 100%; }
body {
  min-width: 320px; margin: 0;
  background: var(--bg); color: var(--text);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 380px at 12% -6%, var(--glow-a), transparent 70%),
    radial-gradient(700px 420px at 92% -10%, var(--glow-b), transparent 70%);
}
h1, h2, h3, h4 { margin: 0; color: var(--text); font-weight: 700; letter-spacing: -.022em; line-height: 1.2; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; transition: color .15s ease; }
a:hover { color: var(--accent-strong); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(124, 139, 255, .35); }
kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2);
  color: var(--text-3); font: 600 11px/1 var(--font);
}
.mono { font-family: var(--mono); }
.muted { color: var(--text-3); }
.dim { color: var(--text-2); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Верхняя панель ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 100; height: var(--topbar-h);
  border-bottom: 1px solid var(--border); background: var(--overlay);
  -webkit-backdrop-filter: saturate(160%) blur(16px); backdrop-filter: saturate(160%) blur(16px);
}
.top-inner { max-width: 1320px; height: 100%; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; text-decoration: none !important; }
.logo img { display: block; width: auto; height: 22px; }
.chip-brand {
  padding: 2px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em; line-height: 1.5;
}
.search {
  flex: 0 1 340px; min-width: 0; height: 38px; margin-left: 32px;
  display: flex; align-items: center; gap: 10px; padding: 0 8px 0 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-3);
  transition: border-color .15s ease, background .15s ease;
}
.search:hover { border-color: var(--border-strong); }
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; color: var(--text); font-size: .9rem; }
.search input::placeholder { color: var(--text-3); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px; background: none;
  color: var(--text-3); font-size: .78rem; font-weight: 600; cursor: pointer;
}
.pill-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn {
  width: 38px; height: 38px; flex: 0 0 38px; display: inline-grid; place-items: center; padding: 0;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text-2); cursor: pointer;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-2); }
.burger { display: none; }

/* ---------- Каркас ---------- */
.shell {
  max-width: 1320px; margin: 0 auto; padding: var(--topbar-h) 24px 0;
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); gap: 56px;
}
.main { min-width: 0; padding: 36px 0 120px; }
.page { max-width: 980px; }
.page.wide { max-width: none; }
.with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 48px; align-items: start; }

/* ---------- Боковое меню ---------- */
.side {
  position: sticky; top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h));
  padding: 28px 8px 40px 0; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px;
  min-height: 38px; padding: 7px 10px; border-radius: 10px;
  color: var(--text-2); font-size: .93rem; font-weight: 500; line-height: 1.3;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-item.active::before { content: ""; position: absolute; left: -1px; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--grad); }
.nav-sec { margin-top: 22px; }
.nav-sec-h {
  width: 100%; display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 4px 10px;
  color: var(--text-3); font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  cursor: pointer; user-select: none;
}
.nav-sec-h:hover { color: var(--text-2); }
.nav-sec-h svg:first-child { opacity: .8; }
.nav-sec-h .chev { margin-left: auto; display: inline-flex; transition: transform .2s var(--ease); }
.nav-sec.closed .chev { transform: rotate(-90deg); }
.nav-sec.closed .nav-list { display: none; }
.nav-list { display: grid; gap: 2px; padding-left: 12px; margin-left: 9px; border-left: 1px solid var(--border); }
.nav-list .nav-item.active::before { left: -13px; }
.nav-srv { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nav-srv span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-add { color: var(--accent); }
.nav-add:hover { color: var(--accent-strong); }
.nav-foot { margin-top: 28px; padding: 16px 10px 0; border-top: 1px solid var(--border); color: var(--text-3); font-size: .8rem; }

/* ---------- Оглавление ---------- */
.toc { position: sticky; top: calc(var(--topbar-h) + 32px); padding-top: 4px; }
.toc-h { margin-bottom: 10px; color: var(--text-3); font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.toc-list { border-left: 1px solid var(--border); }
.toc a {
  display: block; margin-left: -1px; padding: 5px 0 5px 14px; border-left: 2px solid transparent;
  color: var(--text-3); font-size: .86rem; line-height: 1.4;
}
.toc a:hover { color: var(--text); }
.toc a.on { border-left-color: var(--accent); color: var(--text); font-weight: 500; }

/* ---------- Типографика ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 18px; font-size: .85rem; color: var(--text-3); }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); }
.crumbs b { color: var(--text-2); font-weight: 500; }
.crumbs svg { width: 12px; height: 12px; transform: rotate(-90deg); opacity: .6; }
h1 { margin: 0 0 12px; font-size: clamp(2rem, 4.2vw, 2.6rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; }
h2 {
  margin: 44px 0 14px; padding-top: 4px; font-size: 1.45rem; font-weight: 700;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  scroll-margin-top: calc(var(--topbar-h) + 20px);
}
h3 { font-size: 1.02rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.lead { max-width: 680px; margin: 0 0 28px; font-size: 1.08rem; line-height: 1.7; color: var(--text-2); }
code, .code {
  padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface-2); color: #e7d7ff; font: 500 .86em/1.4 var(--mono); word-break: break-word;
}
.head-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head-row h1 { flex: 1 1 auto; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }

/* ---------- Карточки ---------- */
.card {
  position: relative; padding: 18px 20px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.card.feature {
  border-color: var(--accent-line);
  background: linear-gradient(120deg, rgba(193, 60, 255, .08), rgba(56, 189, 248, .05)), var(--surface);
}
.card-h { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.card-h .sub { color: var(--text-3); font-size: .85rem; line-height: 1.5; margin-top: 2px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cq { container-type: inline-size; }
@container (max-width: 860px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 420px) { .g4 { grid-template-columns: 1fr; } }
.gauto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.stat { padding: 16px 18px; }
.stat .k { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-weight: 600; font-size: .88rem; }
.stat .k svg { color: var(--accent); }
.stat .k .tag { margin-left: auto; font: 500 .76rem var(--mono); color: var(--text-3); }
.stat .v { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 12px; font: 700 1.75rem/1.1 var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .v small { font: 500 .78rem var(--mono); color: var(--text-3); letter-spacing: 0; }
.stat .foot { margin-top: 10px; color: var(--text-3); font-size: .8rem; line-height: 1.45; }

.bar { height: 8px; margin-top: 12px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; width: 0; height: 100%; border-radius: 99px; background: var(--grad); transition: width .6s var(--ease); }
.bar.thin { height: 5px; margin-top: 0; }
.bar.warm > i { background: linear-gradient(90deg, #f5b84a, #fcd968); }
.bar.hot > i { background: linear-gradient(90deg, #ff5c73, #ff8a5c); }

/* Серверы на обзоре */
.srv-card { display: block; padding: 18px 20px 16px; color: var(--text); transition: transform .2s var(--ease), border-color .2s ease, box-shadow .2s ease; }
.srv-card:hover { transform: translateY(-2px); border-color: var(--accent-line); box-shadow: var(--shadow); color: var(--text); }
.srv-card .t { display: flex; align-items: flex-start; gap: 12px; }
.srv-card .name { font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.srv-card .host { margin-top: 2px; font: 500 .8rem var(--mono); color: var(--text-3); }
.srv-card .go { margin-left: auto; color: var(--text-3); transition: transform .2s var(--ease), color .2s ease; }
.srv-card:hover .go { transform: translate(2px, -2px); color: var(--text); }
.srv-card .row { display: flex; align-items: center; gap: 8px; margin-top: 18px; color: var(--text-2); font-size: .9rem; }
.srv-card .row svg { color: var(--accent); }
.srv-card .row .val { margin-left: auto; font: 600 .85rem var(--mono); color: var(--text); font-variant-numeric: tabular-nums; }
.srv-card .row .val .of { color: var(--text-3); font-weight: 500; }
.srv-card .ft { display: flex; align-items: center; gap: 8px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border); font: 500 .78rem var(--mono); color: var(--text-3); }
.srv-card .ft .r { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--text-3); }
.dot.ok { background: var(--success); box-shadow: 0 0 0 4px rgba(62, 224, 161, .15); }
.dot.err { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 4px var(--warn-soft); }
.dot.busy { background: var(--accent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-2);
  color: var(--text-2); font: 600 .74rem/1 var(--font); white-space: nowrap;
}
.badge.acc { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-strong); }
.badge.ok { border-color: rgba(62, 224, 161, .3); background: rgba(62, 224, 161, .09); color: #6ff0bd; }
.badge.warn { border-color: var(--warn-line); background: var(--warn-soft); color: var(--warn); }
.badge.err { border-color: var(--danger-line); background: var(--danger-soft); color: var(--danger); }
.badge.info { border-color: var(--info-line); background: var(--info-soft); color: var(--info); }
a.badge:hover { filter: brightness(1.15); }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface);
  color: var(--text-2); font-weight: 600; font-size: .9rem; line-height: 1.2; white-space: nowrap;
  text-decoration: none !important; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s ease, background .2s ease, color .15s ease, filter .2s ease, border-color .15s ease;
}
.btn:hover { color: var(--text); background: var(--surface-2); }
.btn.primary {
  border-color: transparent; background: var(--grad); color: #fff !important;
  box-shadow: 0 8px 24px -8px rgba(91, 92, 255, .65), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.danger { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.btn.danger:hover { color: #ffb3bd; background: rgba(255, 92, 115, .16); }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: .82rem; border-radius: 10px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none !important; filter: none !important; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- Поля ---------- */
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > span:first-child { color: var(--text-2); font-size: .85rem; font-weight: 600; }
.field > span em { font-style: normal; font-weight: 500; color: var(--text-3); }
.field .hint { color: var(--text-3); font-size: .78rem; line-height: 1.45; }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-elev);
  color: var(--text); font: 500 .9rem var(--mono); outline: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select.input { appearance: none; padding-right: 38px; background: var(--bg-elev) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238790a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right 12px center / 14px no-repeat; }
textarea.input { height: auto; min-height: 150px; padding: 12px 14px; resize: vertical; line-height: 1.55; font-size: .82rem; }
.input::placeholder { color: var(--text-3); opacity: .8; }
.input:focus { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.sans { font-family: var(--font); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box {
  flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 7px;
  display: grid; place-items: center; color: transparent;
  background: var(--bg-elev); box-shadow: inset 0 0 0 1px var(--border-strong);
  transition: background .15s ease;
}
.check input:checked + .box { background: var(--grad); box-shadow: none; color: #fff; }
.check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.check b { display: block; color: var(--text); font-weight: 600; font-size: .95rem; }
.check small { color: var(--text-3); font-size: .82rem; line-height: 1.45; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; color: var(--text-2); font-size: .85rem; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .tr { position: relative; flex: none; width: 42px; height: 24px; border-radius: 999px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border-strong); transition: background .2s ease; }
.switch .tr::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); transition: transform .2s var(--ease); }
.switch input:checked + .tr { background: linear-gradient(120deg, #ff8a3d, #ffc53d); box-shadow: none; }
.switch input:checked + .tr::after { transform: translateX(18px); }
.switch.acc input:checked + .tr { background: var(--grad); }
.switch input:focus-visible + .tr { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Режимы (как выбор «бот / сайт» в wiki) */
.modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mode {
  position: relative; display: flex; gap: 12px; padding: 14px 44px 14px 16px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
  color: var(--text); text-align: left; cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.mode::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--border-strong); transition: box-shadow .2s ease, background .2s ease;
}
.mode:hover { border-color: var(--border-strong); background: var(--surface-3); }
.mode svg { flex: none; margin-top: 2px; color: var(--text-3); }
.mode b { display: block; font-weight: 600; font-size: .98rem; line-height: 1.35; }
.mode small { display: block; margin-top: 2px; color: var(--text-3); font-size: .82rem; line-height: 1.4; }
.mode.on { border-color: var(--accent-line); background: var(--accent-soft); }
.mode.on::after { background: var(--grad); box-shadow: inset 0 0 0 4px var(--surface); }
.mode.on svg { color: var(--accent); }
.mode[disabled] { opacity: .4; cursor: not-allowed; }

/* ---------- Пути ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar .input { height: 40px; font-family: var(--font); }
.routes-box { container-type: inline-size; }
.routes { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; box-shadow: var(--shadow-sm); }
.route, .routes-head {
  display: grid; grid-template-columns: minmax(0, 1fr) 170px 64px 92px 84px 116px;
  align-items: center; gap: 14px; padding: 13px 16px;
}
.route { border-top: 1px solid var(--border); transition: background .15s ease; }
.route:first-of-type { border-top: 0; }
.route:hover { background: rgba(255, 255, 255, .015); }
.route.off { opacity: .55; }
.route.muted-reserve .r-main { opacity: .55; }
.routes-head { padding-top: 11px; padding-bottom: 11px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.routes-head > :nth-child(n+3) { text-align: right; }
.r-main { min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.r-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.path-chip {
  max-width: 100%; padding: 3px 9px; border: 1px solid var(--accent-line); border-radius: 8px;
  background: var(--accent-soft); color: #c9cfff; font: 500 .82rem/1.4 var(--mono);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: copy;
  transition: border-color .15s ease, background .15s ease;
}
.path-chip:hover { border-color: var(--accent); background: rgba(124, 139, 255, .2); }
.r-be { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--text); font: 500 .84rem var(--mono); }
.r-be .port { color: var(--text-3); }
.r-be svg { flex: none; color: var(--text-3); }
.r-note { color: var(--text-3); font: 400 .8rem var(--font); }
.r-live { display: flex; flex-direction: column; gap: 7px; font: 500 .8rem var(--mono); font-variant-numeric: tabular-nums; }
.r-live .nums { display: flex; gap: 10px; white-space: nowrap; }
.arr-d { color: var(--down); font-weight: 700; margin-right: 2px; }
.arr-u { color: var(--up); font-weight: 700; margin-right: 2px; }
.r-col { color: var(--text-2); font: 500 .8rem var(--mono); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-col.big { color: var(--text); font-weight: 700; font-size: .84rem; }
.r-col .lbl { display: none; }
.r-act { display: flex; justify-content: flex-end; gap: 2px; }
.mini-btn {
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text-3); cursor: pointer;
  transition: color .15s ease, background .15s ease, border-color .15s ease;
}
.mini-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }
.mini-btn.on { color: var(--success); }
.empty { padding: 40px 24px; text-align: center; color: var(--text-3); font-size: .92rem; }
.empty b { display: block; margin-bottom: 4px; color: var(--text); font-size: 1.02rem; }

/* ---------- Таблицы ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; font-size: .9rem; }
.tbl th { padding: 10px 14px; background: var(--surface-2); color: var(--text-3); font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-align: left; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-top: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); font-size: .82rem; white-space: nowrap; }
.tbl tr:hover td { background: rgba(255, 255, 255, .015); }

/* ---------- Журнал ---------- */
.events { display: flex; flex-direction: column; }
.ev { display: grid; grid-template-columns: 112px 14px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 10px 0; border-top: 1px solid var(--border); color: var(--text-2); font-size: .9rem; }
.ev:first-child { border-top: 0; padding-top: 2px; }
.ev time { color: var(--text-3); font: 500 .78rem var(--mono); }
.ev .dot { width: 7px; height: 7px; box-shadow: none; transform: translateY(-1px); }
.ev .srv { color: var(--accent); font-weight: 600; }

/* ---------- Графики ---------- */
.chart-card { padding: 16px 18px 12px; }
.chart-wrap { position: relative; height: 240px; margin-top: 8px; }
.chart-wrap.sm { height: 170px; }
.chart-wrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; color: var(--text-2); font-size: .8rem; }
.legend i { display: inline-block; width: 12px; height: 3px; margin-right: 7px; border-radius: 2px; vertical-align: middle; }
.tip {
  position: absolute; z-index: 5; pointer-events: none; transform: translate(-50%, -110%);
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-elev);
  color: var(--text-2); font-size: .8rem; white-space: nowrap; box-shadow: var(--shadow-lg);
}
.tip b { color: var(--text); font: 600 .8rem var(--mono); }
.tabs { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tabs button { padding: 5px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text-3); font-size: .82rem; font-weight: 600; cursor: pointer; transition: color .15s ease, background .15s ease; }
.tabs button:hover { color: var(--text); }
.tabs button.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.top-list { display: flex; flex-direction: column; gap: 12px; }
.top-item .l { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: .84rem; }
.top-item .l .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Модальные окна, меню, уведомления ---------- */
.modal-bg {
  position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 8, 15, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: fade .2s ease;
}
.modal {
  position: relative; width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  padding: 24px; border: 1px solid var(--border-strong); border-radius: 24px;
  background: var(--surface); box-shadow: var(--shadow-lg); animation: pop .22s var(--ease);
}
.modal::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: radial-gradient(420px 200px at 100% 0%, var(--glow-a), transparent 70%); }
.modal > * { position: relative; }
.modal.wide { width: min(920px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; }
.modal .sub { margin: 0 0 20px; color: var(--text-3); font-size: .9rem; line-height: 1.55; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.98); } }

.toasts { position: fixed; left: 50%; bottom: 24px; z-index: 500; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: flex-start; gap: 10px; max-width: 460px; padding: 10px 16px;
  border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-elev);
  color: var(--text); font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg);
  animation: slide .2s var(--ease);
}
.toast > span { display: inline-flex; margin-top: 2px; }
.toast.ok { border-color: rgba(62, 224, 161, .35); }
.toast.ok > span { color: var(--success); }
.toast.err { border-color: var(--danger); background: #1c0d12; color: #ffb3bd; }
.toast a { color: var(--accent-strong); cursor: pointer; font-weight: 600; }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } }

.log {
  max-height: 380px; overflow: auto; padding: 14px 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: #05070d;
  color: #dfe5f5; font: 400 .8rem/1.65 var(--mono); white-space: pre-wrap; word-break: break-word;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.log .e { color: #ff9aa8; }
.log .s { color: #9fe0b6; }

.callout {
  position: relative; display: flex; gap: 12px; padding: 14px 16px;
  border: 1px solid var(--warn-line); border-radius: var(--radius); background: var(--warn-soft);
  color: var(--text-2); font-size: .92rem; line-height: 1.6;
}
.callout > svg { flex: none; margin-top: 3px; color: var(--warn); }
.callout b { color: var(--text); font-weight: 600; }
.callout.err { border-color: var(--danger-line); background: var(--danger-soft); }
.callout.err > svg { color: var(--danger); }
.callout.info { border-color: var(--info-line); background: var(--info-soft); }
.callout.info > svg { color: var(--info); }

.menu {
  position: fixed; z-index: 400; min-width: 240px; padding: 6px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg-elev);
  box-shadow: var(--shadow-lg); animation: pop .15s var(--ease);
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2);
  font-size: .88rem; font-weight: 500; text-align: left; cursor: pointer;
}
.menu button svg { color: var(--text-3); }
.menu button:hover { background: var(--accent-soft); color: var(--text); }
.menu button:hover svg { color: var(--accent); }
.menu button.danger, .menu button.danger svg { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-soft); }
.menu hr { margin: 5px 4px; border: 0; border-top: 1px solid var(--border); }

/* ---------- Вход ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login {
  position: relative; overflow: hidden; width: 100%; max-width: 400px; padding: 32px 28px 28px;
  border: 1px solid var(--border-strong); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.login::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(420px 200px at 100% 0%, var(--glow-a), transparent 70%); }
.login > * { position: relative; }
.login .logo { margin-bottom: 26px; }
.login .logo img { height: 24px; }
.login h1 { margin: 0 0 6px; font-size: 1.75rem; }
.login-sub { margin: 0 0 22px; color: var(--text-3); }
.login form { display: grid; gap: 14px; }
.login .input { height: 48px; font-family: var(--font); font-size: 1rem; }
.login-error { padding: 11px 14px; border: 1px solid var(--danger-line); border-radius: 12px; background: var(--danger-soft); color: #ffb3bd; font-size: .9rem; }

/* ---------- Выбор серверов ---------- */
.srv-pick { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.srv-pick label {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  transition: border-color .15s ease, background .15s ease;
}
.srv-pick label:hover { border-color: var(--border-strong); }
.srv-pick label:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.srv-pick input { width: 17px; height: 17px; accent-color: #7c8bff; }
.srv-pick .host { margin-left: auto; color: var(--text-3); font: 500 .78rem var(--mono); }

/* Ключ — значение */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); margin: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.kv dt, .kv dd { margin: 0; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.kv dt { color: var(--text-3); font-size: .84rem; font-weight: 600; background: var(--surface-2); border-right: 1px solid var(--border); }
.kv dd { color: var(--text); font: 500 .84rem var(--mono); word-break: break-all; }
.kv dt:last-of-type, .kv dd:last-of-type { border-bottom: 0; }

.mt { margin-top: 14px; }
.mt2 { margin-top: 24px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row .push { margin-left: auto; }

/* Список путей подстраивается под ширину своего блока */
@container (max-width: 940px) {
  .routes-head { display: none; }
  .route { grid-template-columns: minmax(150px, 1fr) auto auto auto auto; gap: 10px 18px; padding: 14px 16px; }
  .route .r-main { grid-column: 1 / -1; }
  .route .r-col { text-align: left; }
  .route .r-col .lbl { display: inline; margin-right: 5px; color: var(--text-3); font-weight: 500; }
}
@container (max-width: 560px) {
  .route { grid-template-columns: 1fr auto; }
  .route .r-live { grid-column: 1 / -1; }
  .route .r-sess { display: none; }
  .route .r-act { grid-column: 1 / -1; justify-content: flex-start; padding-top: 8px; border-top: 1px solid var(--border); }
}

/* ---------- Адаптив ---------- */
@media (max-width: 1280px) {
  .with-toc { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 1180px) {
}
@media (max-width: 1100px) {
  .shell { gap: 36px; --sidebar-w: 240px; }
}
@media (max-width: 900px) {
  :root { --topbar-h: 58px; }
  .top-inner { padding: 0 12px; gap: 10px; }
  .burger { display: inline-grid; }
  .search { margin-left: 0; flex: 1 1 auto; }
  .logo img { height: 20px; }
  .pill-btn { display: none; }
  .shell { display: block; padding: var(--topbar-h) 16px 0; }
  .side {
    position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 95; height: auto;
    width: min(320px, 86vw); padding: 16px 12px 40px;
    border-right: 1px solid var(--border); background: var(--bg-elev); box-shadow: var(--shadow-lg);
    transform: translateX(-102%); transition: transform .3s var(--ease);
  }
  body.nav-open .side { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: var(--topbar-h) 0 0; z-index: 94; background: rgba(5, 8, 15, .5); backdrop-filter: blur(3px); }
  .main { padding: 22px 0 90px; }
  .g3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .chip-brand { display: none; }
  .search kbd { display: none; }
  .g2, .modes, .form-grid { grid-template-columns: 1fr; }
  .stat .v { font-size: 1.5rem; }
  .modal { padding: 20px 16px; border-radius: 20px; }
  .ev { grid-template-columns: 1fr; gap: 2px; }
  .ev .dot { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { border-right: 0; border-bottom: 0; padding-bottom: 2px; background: none; font-size: .78rem; }
  .kv dd { padding-top: 2px; }
  h2 { font-size: 1.3rem; margin-top: 36px; }
  .lead { font-size: 1rem; }
  .toasts { bottom: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
