/* PushAuth — интерфейс портала.
   Палитры: «Графит» (по умолчанию) и «Кобальт» (data-palette="cobalt" на <html>).
   Тема: светлая / тёмная / как в системе (data-theme="light|dark" или без атрибута).
   Компоненты — ниже, в порядке: каркас, кнопки, поля, панели, таблицы, метки, правила, диалоги. */

@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/onest-cyrillic-ext.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/jetbrainsmono-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("fonts/jetbrainsmono-cyrillic.woff2") format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }

/* ---------- токены: Графит, светлая ---------- */
:root {
  color-scheme: light;
  --paper: #F5F6F8; --surface: #FFFFFF; --sunk: #EEF0F3;
  --ink: #1B2230; --ink-2: #4A5468; --ink-3: #7B8496;
  --line: #DDE1E7; --line-2: #EBEEF2;
  --side: #1B2230; --side-ink: #B9C0CC; --side-ink-hi: #FFFFFF; --side-hi: #2A3345; --side-line: #2A3345;
  --accent: #E9A23B; --accent-ink: #1B2230; --accent-soft: #FCEFD9; --accent-text: #8F5A0E;
  --ok: #2E8B62; --ok-soft: #DFF1E8;
  --bad: #C9433F; --bad-soft: #F8E1E0;
  --warn: #8F5A0E; --warn-soft: #FCEFD9; --warn-bar: #E9A23B;
  --focus: #E9A23B;
  --shadow: 0 10px 30px rgba(20, 26, 38, .16);
  --scrim: rgba(20, 26, 38, .38);
  --r-s: 7px; --r-m: 10px; --r-l: 14px;
}
/* Кобальт, светлая */
:root[data-palette="cobalt"] {
  --paper: #F2F4FA; --surface: #FFFFFF; --sunk: #EAEEF7;
  --ink: #101A3A; --ink-2: #47507A; --ink-3: #7D85A6;
  --line: #DCE1EF; --line-2: #EAEEF7;
  --side: #FFFFFF; --side-ink: #47507A; --side-ink-hi: #2D4FD6; --side-hi: #E8EDFF; --side-line: #DCE1EF;
  --accent: #2D4FD6; --accent-ink: #FFFFFF; --accent-soft: #E8EDFF; --accent-text: #2D4FD6;
  --ok: #1F8A5B; --ok-soft: #DCF2E7; --bad: #C8403C; --bad-soft: #F9E2E1;
  --focus: #2D4FD6;
  --r-s: 8px; --r-m: 12px; --r-l: 16px;
}
/* Тёмная: по системе (если тема не выбрана) или выбрана явно */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #11151C; --surface: #181D26; --sunk: #141920;
    --ink: #E6E9EF; --ink-2: #AEB5C2; --ink-3: #7D8594;
    --line: #2C3340; --line-2: #232A35;
    --side: #0C0F15; --side-ink: #9AA2B1; --side-ink-hi: #FFFFFF; --side-hi: #1F2531; --side-line: #1F2531;
    --accent: #F0B04F; --accent-ink: #1B2230; --accent-soft: #3A2E1A; --accent-text: #F0B04F;
    --ok: #55B98C; --ok-soft: #16302A; --bad: #E8645F; --bad-soft: #3B1F1F;
    --warn: #F0B04F; --warn-soft: #3A2E1A; --warn-bar: #F0B04F;
    --focus: #F0B04F; --shadow: 0 12px 34px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .55);
  }
  :root[data-palette="cobalt"]:not([data-theme="light"]) {
    --paper: #0E1326; --surface: #151B33; --sunk: #11172C;
    --ink: #E4E8F7; --ink-2: #A9B1D3; --ink-3: #7880A3;
    --line: #262E4D; --line-2: #1D2442;
    --side: #0B1020; --side-ink: #A9B1D3; --side-ink-hi: #FFFFFF; --side-hi: #1C2547; --side-line: #1C2547;
    --accent: #6F8BFF; --accent-ink: #0B1020; --accent-soft: #1F2A57; --accent-text: #93A8FF;
    --ok: #4FBF8A; --ok-soft: #13302A; --bad: #EF6A64; --bad-soft: #3A1E24; --focus: #93A8FF;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #11151C; --surface: #181D26; --sunk: #141920;
  --ink: #E6E9EF; --ink-2: #AEB5C2; --ink-3: #7D8594;
  --line: #2C3340; --line-2: #232A35;
  --side: #0C0F15; --side-ink: #9AA2B1; --side-ink-hi: #FFFFFF; --side-hi: #1F2531; --side-line: #1F2531;
  --accent: #F0B04F; --accent-ink: #1B2230; --accent-soft: #3A2E1A; --accent-text: #F0B04F;
  --ok: #55B98C; --ok-soft: #16302A; --bad: #E8645F; --bad-soft: #3B1F1F;
  --warn: #F0B04F; --warn-soft: #3A2E1A; --warn-bar: #F0B04F;
  --focus: #F0B04F; --shadow: 0 12px 34px rgba(0, 0, 0, .5); --scrim: rgba(0, 0, 0, .55);
}
:root[data-theme="dark"][data-palette="cobalt"] {
  --paper: #0E1326; --surface: #151B33; --sunk: #11172C;
  --ink: #E4E8F7; --ink-2: #A9B1D3; --ink-3: #7880A3;
  --line: #262E4D; --line-2: #1D2442;
  --side: #0B1020; --side-ink: #A9B1D3; --side-ink-hi: #FFFFFF; --side-hi: #1C2547; --side-line: #1C2547;
  --accent: #6F8BFF; --accent-ink: #0B1020; --accent-soft: #1F2A57; --accent-text: #93A8FF;
  --ok: #4FBF8A; --ok-soft: #13302A; --bad: #EF6A64; --bad-soft: #3A1E24; --focus: #93A8FF;
}

/* ---------- основа ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 "Onest", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent-text); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono, kbd { font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; }
code { background: var(--sunk); border-radius: 5px; padding: 1px 5px; overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16.5px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i-sm { width: 15px; height: 15px; }
.app-ref { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.app-ref svg.i { color: var(--ink-3); }

/* ---------- каркас ---------- */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--side); color: var(--side-ink); border-right: 1px solid var(--side-line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--side-ink-hi); text-decoration: none; }
:root[data-palette="cobalt"] .brand { color: var(--ink); }
.brand-mark { width: 32px; height: 32px; border-radius: var(--r-s); background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-weight: 700; font-size: 16px; line-height: 1.2; overflow-wrap: anywhere; }
.brand-name small { display: block; font-weight: 500; font-size: 12px; color: var(--side-ink); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-s); color: var(--side-ink); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--side-ink-hi); background: color-mix(in srgb, var(--side-hi) 60%, transparent); }
.nav a[aria-current="page"] { background: var(--side-hi); color: var(--side-ink-hi); }
.nav-sep { height: 12px; }
.side-foot { margin-top: auto; padding: 12px 10px 4px; font-size: 12.5px; color: var(--side-ink); opacity: .8; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 28px; min-height: 56px;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--ink-3); font-size: 14px; min-width: 0; }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.top-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.btn.nav-toggle { display: none; }

.page { width: 100%; max-width: 1180px; padding: 26px 28px 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; margin-bottom: 22px; min-height: 36px; }
.page-head .sub { margin-top: 6px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cols-wide { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 10px 16px; border-radius: var(--r-m);
  background: var(--warn-soft); color: var(--ink); margin-bottom: 18px; }

/* ---------- кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 36px; padding: 7px 14px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--sunk); color: var(--ink); }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 6px; min-width: 36px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
form.is-sending .btn[type="submit"] { opacity: .65; pointer-events: none; }
.inline { display: inline; margin: 0; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }

/* ---------- поля ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form .form-sep { margin: 8px 0 -4px; font-size: 15px; font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], input[type="url"], input:not([type]), select, textarea {
  width: 100%; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-s); background: var(--surface); color: var(--ink); }
input:hover, select:hover, textarea:hover { border-color: var(--ink-3); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
input[readonly] { background: var(--sunk); }
input.mono { font-size: 14px; }
input[type="number"] { max-width: 140px; }
textarea { min-height: 72px; resize: vertical; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--ink-3); font-weight: 400; font-size: 13px; }
.checks { display: flex; flex-direction: column; gap: 10px; }
.checks.inline-list { flex-direction: row; flex-wrap: wrap; gap: 8px 18px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.access-tree { display: flex; flex-direction: column; gap: 8px; }
.tree-group { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.tree-servers { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 2px 27px; }
.check input:disabled + span { color: var(--ink-3); }
p.hint { font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; }
.add-row { margin-top: 12px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--r-s); overflow: hidden; background: var(--surface); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg span { display: block; padding: 7px 14px; font-weight: 500; font-size: 14px; border-right: 1px solid var(--line-2); }
.seg label:last-child span { border-right: 0; }
.seg input:checked + span { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.filters .search { flex: 1 1 240px; }
.filters select { width: auto; min-width: 150px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 34px; background: var(--sunk); border-color: transparent; }

/* ---------- панели ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 15px 18px 0; }
.panel-head h2 .count { color: var(--ink-3); font-weight: 500; margin-left: 6px; }
.panel-body { padding: 14px 18px 18px; }
.panel-body > * + * { margin-top: 12px; }
.panel > .table-wrap, .panel > table { margin-top: 10px; }
.panel.flush .panel-body { padding: 0; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.danger-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.danger-row + .danger-row { padding-top: 12px; border-top: 1px solid var(--line-2); }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--ink-3); font-size: 14px; }
dl.facts dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* ---------- таблицы ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 13px; padding: 9px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 18px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.off td { opacity: .55; }
.table td.title a, .table a.title { color: var(--ink); font-weight: 600; text-decoration: none; }
.table td.title a:hover, .table a.title:hover { text-decoration: underline; }
.table td a { color: var(--ink); text-decoration-color: var(--line); }
.table td a:hover { text-decoration-color: currentColor; }
.table .sub { display: block; color: var(--ink-3); font-size: 13px; font-weight: 400; }
.table td.act { text-align: right; white-space: nowrap; width: 1%; }
.sort-link { color: inherit; font: inherit; background: none; border: 0; padding: 0; display: inline-flex; gap: 4px; align-items: center; cursor: pointer; }
.sort-link:hover { color: var(--ink); }
.sort-link::after { content: attr(data-arrow); font-size: 10px; }
.datatable-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; font-size: 13px; color: var(--ink-3); }
.datatable-bar label { display: inline-flex; align-items: center; gap: 8px; }
.datatable-bar select { width: auto; min-height: 30px; padding: 4px 8px; }
.datatable-search { max-width: 260px; min-height: 32px !important; }
.datatable-info { margin: 0; padding: 8px 18px 0; font-size: 13px; color: var(--ink-3); }
.datatable-info:empty { display: none; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 18px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--ink-3); }
.pager a, .pager span { display: inline-flex; min-width: 30px; height: 30px; align-items: center; justify-content: center; padding: 0 8px; border-radius: var(--r-s); color: var(--ink-2); text-decoration: none; }
.pager a:hover { background: var(--sunk); }
.pager .page-current { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.pager .is-off { opacity: .4; pointer-events: none; }
.pager-info { margin-right: auto; }

/* ---------- метки ---------- */
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--sunk); color: var(--ink-2); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.tag.accent { background: var(--accent); color: var(--accent-ink); }
.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.dot.off { background: var(--ink-3); }
.dot.bad { background: var(--bad); }
.ev-allow { color: var(--ok); font-weight: 600; }
.ev-deny { color: var(--bad); font-weight: 600; }
.ev-offline { color: var(--warn); font-weight: 600; }
.ev-pending { color: var(--warn); font-weight: 600; }
details.sig { margin-top: 4px; }
details.sig > summary { cursor: pointer; color: var(--ink-3); font-size: .85em; }
.mono.wrap { word-break: break-all; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

/* ---------- связи: команды, участники ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-weight: 500; font-size: 14px; background: var(--surface); }
.chip a { color: var(--ink); text-decoration: none; }
.chip a:hover { text-decoration: underline; }
.chip .x { width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; padding: 0; }
.chip .x:hover { background: var(--bad-soft); color: var(--bad); }
.chip.plain { padding-right: 12px; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.add-row select { width: auto; min-width: 200px; flex: 1 1 200px; max-width: 320px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.list > li:last-child { border-bottom: 0; }
.list .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.list .who b { font-weight: 600; }
.list .meta { color: var(--ink-3); font-size: 13px; }

/* ---------- правила входа: цепочка ---------- */
.chain { display: inline-flex; flex-wrap: wrap; align-items: stretch; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); overflow: hidden; max-width: 100%; }
.chain .link { display: flex; align-items: center; gap: 8px; padding: 8px 13px; font-size: 14px; font-weight: 500; border-right: 1px solid var(--line-2); }
.chain .link svg { color: var(--ink-2); }
.chain .link.off { color: var(--ink-3); }
.chain .link.off span { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.chain .link.off svg { color: var(--ink-3); }
.chain .meter { border-right: 0; }
.chain.sm .link { padding: 5px 10px; font-size: 13px; }
.table .chain { flex-wrap: nowrap; }
.list .chain { flex-wrap: nowrap; }
.meter { display: flex; align-items: center; gap: 10px; padding: 8px 13px; background: var(--sunk); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.bars { display: inline-flex; gap: 3px; }
.bars i { width: 6px; height: 15px; border-radius: 2px; background: var(--line); }
.bars[data-level="1"] i:nth-child(-n+1), .bars[data-level="2"] i:nth-child(-n+2) { background: var(--bad); }
.bars[data-level="3"] i:nth-child(-n+3) { background: var(--warn-bar); }
.bars[data-level="4"] i:nth-child(-n+4), .bars[data-level="5"] i:nth-child(-n+5) { background: var(--ok); }
.rules-summary { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.list > li > .rules-summary { flex-basis: 100%; }
.rules-summary .bars i { height: 12px; width: 5px; }

/* редактор правил */
.rules { display: flex; flex-direction: column; gap: 18px; }
.rules .sub-rules { display: flex; flex-direction: column; gap: 10px; padding-left: 27px; }
.rules .note { font-size: 13px; color: var(--ink-3); }
.alert { padding: 10px 14px; border-radius: var(--r-s); background: var(--bad-soft); color: var(--bad); font-size: 14px; }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
/* ---------- тариф: сколько из скольких ---------- */
.plan-grid input[type="number"] { max-width: none; }
.panel-body > .alert + .usage, .panel-body > p + .usage { margin-top: 14px; }
.usage { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.usage li { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px 12px; }
.usage-label { font-weight: 500; }
.usage-num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-bar { grid-column: 1 / -1; appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 999px; background: var(--sunk); overflow: hidden; }
.usage-bar::-webkit-progress-bar { background: var(--sunk); border-radius: 999px; }
.usage-bar::-webkit-progress-value { background: var(--ok); border-radius: 999px; }
.usage-bar::-moz-progress-bar { background: var(--ok); border-radius: 999px; }
.usage li.over .usage-bar::-webkit-progress-value, .usage li.full .usage-bar::-webkit-progress-value { background: var(--warn-bar); }
.usage li.over .usage-bar::-moz-progress-bar, .usage li.full .usage-bar::-moz-progress-bar { background: var(--warn-bar); }
.usage-note { grid-column: 1 / -1; color: var(--warn); font-size: 13px; }
.alert.info { background: var(--sunk); color: var(--ink-2); }
.strength-line { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-s); background: var(--sunk); font-size: 13.5px; color: var(--ink-2); }

/* ---------- диалоги ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(12, 16, 24, .45); }
dialog.modal { width: min(440px, calc(100vw - 32px)); border-radius: var(--r-l); }
dialog.sheet { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(480px, 100vw); border-radius: 0; }
dialog.sheet[open] { display: flex; flex-direction: column; animation: sheet-in .16s ease-out; }
@keyframes sheet-in { from { transform: translateX(28px); } }
@media (prefers-reduced-motion: reduce) { dialog.sheet[open] { animation: none; } }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dlg-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; flex: 1; }
.dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }
dialog.sheet form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
dialog.modal .dlg-body { padding-bottom: 6px; }
dialog.modal .dlg-foot { border-top: 0; }

/* ---------- секрет, показанный один раз ---------- */
.secret { border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); }
.copy { display: flex; gap: 8px; align-items: stretch; }
.copy input, .copy textarea { flex: 1; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; background: var(--surface); }
.copy textarea { min-height: 60px; }

/* ---------- пустое состояние ---------- */
.empty { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; padding: 22px 18px; }
.empty .illus { width: 132px; height: auto; flex: none; }
.empty h3 { font-size: 16px; margin-bottom: 4px; }
.empty p { color: var(--ink-2); margin-bottom: 12px; }
.empty-line { color: var(--ink-3); padding: 4px 0; }
.illus .fill-a { fill: var(--accent); } .illus .fill-s { fill: var(--accent-soft); } .illus .fill-p { fill: var(--surface); stroke: var(--ink-2); stroke-width: 2; }
.illus .stroke { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.illus .tick { fill: none; stroke: var(--accent-ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- обзор ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--ink); text-decoration: none; }
.stat:hover { border-color: var(--ink-3); }
.stat b { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat span { color: var(--ink-3); font-size: 13.5px; }
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.todo li:last-child { border-bottom: 0; }
.todo .n { min-width: 30px; height: 30px; border-radius: var(--r-s); display: grid; place-items: center; font-weight: 700; background: var(--warn-soft); color: var(--warn); }
.todo .n.bad { background: var(--bad-soft); color: var(--bad); }
.todo .what { flex: 1 1 260px; }
.todo .what small { display: block; color: var(--ink-3); }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }

/* ---------- вкладки ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 8px 12px; color: var(--ink-2); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------- меню (пользователь, тема) ---------- */
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--r-s); }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { background: var(--sunk); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: var(--shadow); padding: 6px; z-index: 20; }
.menu-pop .who { padding: 10px 10px 12px; border-bottom: 1px solid var(--line-2); margin-bottom: 6px; }
.menu-pop .who small { display: block; color: var(--ink-3); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-s); background: transparent; color: var(--ink); text-decoration: none; font-size: 14px; cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--sunk); }
.menu-item.danger { color: var(--bad); }
.who-name { font-size: 14px; font-weight: 600; line-height: 1.2; text-align: left; }
.who-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; }
.look { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--sunk); gap: 2px; }
.look button { width: 30px; height: 28px; border: 0; border-radius: 999px; background: transparent; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; padding: 0; }
.look button:hover { color: var(--ink); }
.look button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

/* ---------- сообщение ---------- */
.toast { position: fixed; z-index: 50; right: 20px; bottom: 20px; max-width: min(440px, calc(100vw - 40px)); display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 12px 12px 16px; border-radius: var(--r-m); background: var(--ink); color: var(--paper); box-shadow: var(--shadow); transition: opacity .25s, transform .25s; }
.toast.error { background: var(--bad); color: #fff; }
.toast.is-hidden { opacity: 0; transform: translateY(8px); }
.toast button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 4px; font-size: 18px; line-height: 1; opacity: .8; }

/* ---------- вход, приглашение ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-art { background: var(--side); color: var(--side-ink-hi); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
:root[data-palette="cobalt"] .auth-art { background: var(--accent); }
.auth-art .brand { padding: 0; color: inherit; }
.auth-art .brand-mark { background: var(--accent); }
:root[data-palette="cobalt"] .auth-art .brand-mark { background: #fff; color: var(--accent); }
.auth-art .art { width: min(360px, 90%); align-self: center; }
.auth-art .art .a { fill: var(--accent); } :root[data-palette="cobalt"] .auth-art .art .a { fill: #fff; }
.auth-art .art .l { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.auth-art .art .f { fill: currentColor; opacity: .08; }
.auth-art .art .t { fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
:root[data-palette="cobalt"] .auth-art .art .t { stroke: var(--accent); }
.auth-art p { opacity: .75; font-size: 14px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-box h1 { font-size: 24px; }
.auth-box .lead { color: var(--ink-2); }
.auth-box .site { display: flex; align-items: center; gap: 8px; margin-top: -10px; color: var(--ink-2); overflow-wrap: anywhere; }
.auth-foot { font-size: 13.5px; color: var(--ink-3); }
.number-input { font-size: 28px !important; letter-spacing: .3em; text-align: center; max-width: 160px; font-family: "JetBrains Mono", monospace; }
.wait { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r-m); background: var(--sunk); }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.8); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.qr { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.qr img { width: 220px; height: 220px; border-radius: var(--r-m); background: #fff; padding: 8px; border: 1px solid var(--line); }
.fp { font-family: "JetBrains Mono", monospace; letter-spacing: .04em; }
ol.howto { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- узкий экран ---------- */
@media (max-width: 980px) {
  .cols, .cols-wide { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 264px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; }
  .btn.nav-toggle { display: inline-flex; }
  .top { padding: 8px 16px; }
  .page { padding: 18px 16px 40px; }
  h1 { font-size: 22px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .who-name { display: none; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 20px 24px; }
  .auth-art .art, .auth-art p { display: none; }
  /* таблицы → карточки */
  .table.cards thead { display: none; }
  .table.cards tr { display: block; padding: 10px 16px; border-bottom: 1px solid var(--line-2); }
  .table.cards td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  .table.cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; text-align: left; }
  .table.cards td.title { display: block; text-align: left; font-size: 15px; padding-bottom: 4px; }
  .table.cards td.title::before { display: none; }
  .table.cards td.act { width: auto; justify-content: flex-end; }
  .table.cards td.act::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* блок команд (RouterOS и т. п.) */
pre.code { margin: 0; padding: 10px 12px; background: var(--sunk); border-radius: 8px; overflow-x: auto; white-space: pre; line-height: 1.5; }
.pre { white-space: pre-line; }

/* подключение компании и вход через Google/Apple */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.fed { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.page-head .actions select { width: auto; }
