/* ===== Routa — дизайн-токены. Тёмная тема по умолчанию, светлая — по системе или переключателю ===== */
:root {
  --sans: 'Geist', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --bg: #0a0b0d;
  --side: #0e1013;
  --panel: #121418;
  --panel-2: #181b20;
  --panel-sunk: #0d0f12;
  --hover: #191c22;
  --field: #0c0e11;
  --float: #16191e;
  --line: #1f2329;
  --line-2: #2a2f37;
  --line-3: #3a404a;
  --text: #eef0f3;
  --text-2: #b7bcc6;
  --muted: #7f8693;
  --muted-2: #565c67;
  --knob: #d5d9e0;

  --accent: #c8f135;        /* фирменный лайм — заливки, кнопки, логотип */
  --accent-2: #8fe36a;
  --accent-ink: #0a0b0d;    /* текст и иконки на лайме */
  --accent-text: #c8f135;   /* лайм как цвет текста/иконок на фоне */
  --info: #5cc8ff;
  --ok: #3ddc97;
  --warn: #ffb547;
  --danger: #ff6b6b;
  --do: var(--do);

  --shadow: #000;
  --scrim: rgba(5, 6, 8, .66);
  --glow: color-mix(in srgb, var(--accent) 9%, transparent);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --violet: var(--accent-text);  /* старые имена — алиасы */
  --cyan: var(--info);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6f8;
  --side: #ffffff;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --panel-sunk: #f7f8fa;
  --hover: #f3f5f8;
  --field: #ffffff;
  --float: #ffffff;
  --line: #e7e9ed;
  --line-2: #d9dde3;
  --line-3: #c2c7cf;
  --text: #0e1116;
  --text-2: #3a414c;
  --muted: #6b7280;
  --muted-2: #9aa1ac;
  --knob: #ffffff;
  --accent: #c8f135;
  --accent-2: #a6e84a;
  --accent-ink: #0e1116;
  --accent-text: #4d7c0f;
  --info: #0a7fc4;
  --ok: #0f9d63;
  --warn: #b86e00;
  --danger: #d93d42;
  --do: #1f6fe0;
  --shadow: #1b2230;
  --scrim: rgba(15, 18, 24, .32);
  --glow: color-mix(in srgb, var(--accent) 22%, transparent);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12px; background: var(--panel-2); padding: 1px 6px; border-radius: 6px; border: 1px solid var(--line-2); white-space: nowrap; }
kbd { font-family: var(--mono); font-size: 11px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); line-height: 18px; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
p { margin: 0; }

/* ---------- каркас ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 18px 14px; background: var(--side); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px; font-weight: 700; letter-spacing: -0.01em; font-size: 15px; }
.logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--grad); color: var(--accent-ink); box-shadow: 0 6px 20px -6px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.35); }
.logo svg { width: 18px; height: 18px; stroke-width: 2.6; }
.logo.lg { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 4px; }
.logo.lg svg { width: 28px; height: 28px; }

.add-btn { width: 100%; justify-content: flex-start; }
.add-btn span { flex: 1; text-align: left; }
.add-btn kbd { border-color: color-mix(in srgb, var(--shadow) 20%, transparent); color: rgba(7,7,13,.6); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text-2); font-weight: 500; text-align: left; transition: background .15s, color .15s;
}
.nav button span { flex: 1; }
.nav button b { font-weight: 500; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav button:hover { background: var(--hover); color: var(--text); }
.nav button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.nav button.on svg { color: var(--accent-text); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.account {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--panel); text-align: left; transition: .15s;
}
.account:hover { border-color: var(--line-2); background: var(--panel-2); }
.account > svg { color: var(--muted); }
.account .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex-shrink: 0; }
.account.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 15%, transparent); }
.account-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.account-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-sub { font-size: 11.5px; color: var(--muted); }
.link-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 6px 10px; border-radius: 8px; }
.link-btn:hover { color: var(--text); background: var(--hover); }

.main { min-width: 0; padding: 26px 32px 120px; background: radial-gradient(900px 320px at 75% -140px, var(--glow), transparent 70%); }
.view { width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.025em; font-weight: 700; }
.head-actions { display: flex; align-items: center; gap: 8px; }

.kpis { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.kpis span { display: inline-flex; align-items: center; gap: 6px; }
.kpis b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpis i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* ---------- контролы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 500; font-size: 13px;
  transition: background .15s, border-color .15s, filter .15s; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--line-3); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.icon { width: 34px; padding: 0; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.primary { background: var(--grad); border: 0; color: var(--accent-ink); font-weight: 600; box-shadow: 0 6px 22px -8px color-mix(in srgb, var(--accent) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.4); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.lg { height: 42px; padding: 0 18px; font-size: 14px; border-radius: 11px; }
.btn.danger { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.btn.loading .btn-label::after { content: ''; display: inline-block; width: 11px; height: 11px; margin-left: 9px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -1px; }
.btn.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--field); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: color-mix(in srgb, var(--accent) 65%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.input::placeholder { color: var(--muted-2); }
textarea.input { height: auto; min-height: 180px; padding: 12px; line-height: 1.7; font-size: 13px; resize: vertical; }
select.input { appearance: none; }
.input-wrap { position: relative; }
.input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-wrap .input { padding-left: 36px; }
.label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 4px 0 -4px; }
.help { font-size: 12px; color: var(--muted); }
.pill { font-size: 11.5px; padding: 0 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); font-weight: 500; line-height: 18px; }
.pill.on { background: color-mix(in srgb, var(--accent) 15%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--accent-text); }
.pill.bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

.search { position: relative; width: 320px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; height: 34px; padding: 0 34px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--panel); outline: none; font-size: 13px; }
.search input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }

.tabs { display: flex; gap: 2px; margin-bottom: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 12px; color: var(--muted); font-weight: 500; font-size: 13px; position: relative; white-space: nowrap; }
.tabs button b { font-weight: 500; margin-left: 4px; padding: 0 6px; border-radius: 6px; background: var(--panel-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--grad); }

/* ---------- таблица ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.thead, .row {
  display: grid; grid-template-columns: 44px minmax(200px, 1fr) minmax(280px, 1.5fr) minmax(220px, .9fr) 92px;
  align-items: center; gap: 12px; padding: 0 12px 0 4px;
}
.thead { height: 38px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); background: var(--panel-sunk); }
.thead .hint { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted-2); }
.row { min-height: 56px; border-bottom: 1px solid var(--line); transition: background .12s; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row.selected { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.row.flash { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: color-mix(in srgb, var(--ok) 14%, transparent); } }

.cb { display: grid; place-items: center; height: 100%; cursor: pointer; position: relative; }
.cb input { position: absolute; opacity: 0; pointer-events: none; }
.cb span { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--muted-2); display: grid; place-items: center; transition: .12s; }
.cb:hover span { border-color: var(--muted); }
.cb input:checked + span { background: var(--accent-text); border-color: var(--accent-text); }
.cb input:checked + span::after { content: ''; width: 8px; height: 4px; border: 2px solid var(--field); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.cb input:indeterminate + span { border-color: var(--accent-text); }
.cb input:indeterminate + span::after { content: ''; width: 8px; height: 2px; background: var(--accent-text); border-radius: 1px; }

.dom { min-width: 0; display: flex; align-items: center; gap: 10px; }
.favicon { width: 26px; height: 26px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; flex-shrink: 0; }
.dom-text { min-width: 0; }
.dom-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); }
.dom-name:hover { color: var(--info); text-decoration: none; }
.dom-sub { font-size: 11.5px; color: var(--muted); }

.dest-cell { min-width: 0; }
.dest {
  min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 10px; margin-left: -10px; border-radius: 9px;
  border: 1px solid transparent; background: none; text-align: left; width: calc(100% + 10px); transition: .12s;
}
.dest:hover { border-color: var(--line-2); background: var(--field); }
.dest:hover .dest-edit { opacity: 1; }
.dest .arr { color: var(--accent-text); }
.dest-body { min-width: 0; flex: 1; }
.dest-url { font-family: var(--mono); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.dest-tags { display: flex; gap: 4px; margin-top: 2px; }
.tag { font-size: 10.5px; padding: 0 6px; line-height: 16px; border-radius: 5px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line-2); font-weight: 600; }
.tag.code { color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); background: color-mix(in srgb, var(--info) 6%, transparent); }
.tag.off { color: var(--danger); }
.dest-edit { opacity: 0; color: var(--muted); transition: opacity .12s; }
.dest.none { color: var(--muted); }
.dest.none .arr { color: var(--muted-2); }
.dest.none .set { color: var(--accent-text); font-weight: 500; font-size: 13px; }

.inline-edit { display: flex; gap: 6px; align-items: center; width: 100%; }
.inline-edit .input { height: 34px; font-family: var(--mono); font-size: 12.5px; }
.inline-edit .btn { height: 34px; }

.status { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge.active { color: var(--ok); }
.badge.pending, .badge.initializing { color: var(--warn); }
.badge.pending::before { animation: pulse 1.6s infinite; }
.badge.moved, .badge.deactivated, .badge.read-only, .badge.error { color: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }
.ns-line { display: flex; gap: 4px; flex-wrap: wrap; }
.ns-chip { font-family: var(--mono); font-size: 11px; color: var(--muted); border: 0; background: none; padding: 0 4px; margin-left: -4px; border-radius: 5px; }
.ns-chip:hover { color: var(--text); background: var(--panel-2); }

.actions { display: flex; justify-content: flex-end; gap: 2px; }
.actions .btn { width: 30px; height: 30px; color: var(--muted); }
.actions .btn:hover { color: var(--text); }

.skeleton { padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.skeleton div { height: 46px; border-radius: 9px; background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- пустое состояние / онбординг ---------- */
.empty { padding: 56px 24px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.empty h3 { margin: 6px 0 0; font-size: 17px; }
.empty .muted { max-width: 440px; }
.empty .btn { margin-top: 10px; }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--panel-2); border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--accent-text); }
.empty-ico svg { width: 26px; height: 26px; }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 820px; margin-top: 18px; text-align: left; }
.stp { padding: 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-sunk); }
.stp-n { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--panel-2); border: 1px solid var(--line-2); margin-bottom: 10px; }
.stp.done .stp-n { background: var(--ok); color: var(--accent-ink); border-color: var(--ok); }
.stp.cur { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.stp.cur .stp-n { background: var(--grad); border: 0; color: var(--accent-ink); }
.stp b { display: block; font-size: 13.5px; margin-bottom: 3px; }
.stp span { font-size: 12.5px; color: var(--muted); }

/* ---------- направления ---------- */
.targets { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.tcard { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.tcard-head { display: flex; align-items: flex-start; gap: 12px; }
.tcard-ico { width: 34px; height: 34px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent-text); display: grid; place-items: center; flex-shrink: 0; }
.tcard-ico.none { background: var(--panel-2); color: var(--muted); }
.tcard-title { min-width: 0; flex: 1; }
.tcard-url { font-family: var(--mono); font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--text); }
.tcard-meta { font-size: 12px; color: var(--muted); }
.tcard-doms { display: flex; flex-wrap: wrap; gap: 5px; max-height: 92px; overflow: hidden; }
.tcard-doms span { font-family: var(--mono); font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); color: var(--text-2); }
.tcard-actions { display: flex; gap: 6px; margin-top: auto; }
.tcard-actions .btn { flex: 1; }
.targets .empty { grid-column: 1 / -1; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }

/* ---------- история ---------- */
.timeline { list-style: none; margin: 0; padding: 4px 0; }
.timeline li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 10px 16px; align-items: start; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline li:last-child { border-bottom: 0; }
.timeline .tdot { width: 8px; height: 8px; border-radius: 50%; margin: 6px 0 0 6px; background: var(--accent-text); }
.timeline .add .tdot { background: var(--ok); }
.timeline .delete .tdot, .timeline .error .tdot { background: var(--danger); }
.timeline .unredirect .tdot { background: var(--warn); }
.timeline .tl-dom { font-family: var(--mono); font-weight: 500; }
.timeline .tl-msg { color: var(--muted); word-break: break-word; }
.timeline time { color: var(--muted-2); font-size: 12px; white-space: nowrap; }
.timeline .empty-li { display: block; color: var(--muted); text-align: center; padding: 40px; border: 0; }

/* ---------- массовая панель ---------- */
.bulk {
  position: fixed; left: calc(50% + 124px); bottom: 22px; transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 14px;
  background: var(--float); backdrop-filter: blur(14px); border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -12px color-mix(in srgb, var(--shadow) 85%, transparent); animation: up .2s ease-out; max-width: calc(100vw - 32px); overflow-x: auto;
}
@keyframes up { from { opacity: 0; transform: translate(-50%, 10px); } }
.bulk-count { padding: 0 10px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.bulk-count b { color: var(--text); }
.bulk .sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 4px; flex-shrink: 0; }
.bulk button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px; border: 0; border-radius: 9px; background: none; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.bulk button:hover { background: var(--hover); color: var(--text); }
.bulk button.danger { color: var(--danger); }
.bulk button.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.bulk button.icon { width: 34px; padding: 0; justify-content: center; }

/* ---------- выезжающая панель ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); backdrop-filter: blur(3px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 51; width: min(620px, 100vw);
  background: var(--side); border-left: 1px solid var(--line-2); display: flex; flex-direction: column;
  transform: translateX(100%); visibility: hidden; transition: transform .28s cubic-bezier(.2,.9,.3,1), visibility 0s .28s;
  box-shadow: -30px 0 80px -20px color-mix(in srgb, var(--shadow) 80%, transparent);
}
.sheet.open { transform: none; visibility: visible; transition: transform .28s cubic-bezier(.2,.9,.3,1); }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { margin: 0 0 2px; font-size: 18px; letter-spacing: -0.015em; }
.sheet-body { flex: 1; overflow: auto; padding: 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--side); }

.recent { display: flex; flex-wrap: wrap; gap: 6px; }
.recent:empty { display: none; }
.recent button { font-family: var(--mono); font-size: 11.5px; padding: 3px 9px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent button:hover { border-color: color-mix(in srgb, var(--accent) 50%, transparent); color: var(--text); }
.recent .recent-label { font-size: 11.5px; color: var(--muted-2); align-self: center; }

.opts-box { border: 1px solid var(--line-2); border-radius: 11px; background: var(--panel); margin-top: 6px; }
.opts-box summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 11px 13px; cursor: pointer; font-size: 13px; font-weight: 500; }
.opts-box summary::-webkit-details-marker { display: none; }
.opts-box summary svg { transition: transform .2s; color: var(--muted); }
.opts-box[open] summary svg { transform: rotate(180deg); }
.opts-summary { flex: 1; text-align: right; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.opts-box .opts { padding: 0 13px 13px; }

.opts { display: flex; flex-direction: column; gap: 12px; }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px; gap: 3px; border-radius: 10px; background: var(--field); border: 1px solid var(--line-2); }
.seg button { border: 0; background: transparent; padding: 6px 4px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 13px; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.seg button small { font-size: 10.5px; font-weight: 400; opacity: .8; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; user-select: none; position: relative; }
.switch small { color: var(--muted-2); font-family: var(--mono); font-size: 11px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { width: 32px; height: 18px; border-radius: 999px; background: var(--line-2); position: relative; transition: .18s; flex-shrink: 0; }
.switch i::after { content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--knob); top: 2px; left: 2px; transition: .18s; }
.switch input:checked + i { background: var(--accent-text); }
.switch input:checked + i::after { left: 16px; background: #fff; }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.check-row { display: flex; gap: 9px; align-items: center; font-size: 13px; color: var(--text-2); cursor: pointer; }

.preview { border: 1px solid var(--line-2); border-radius: 11px; background: var(--panel); overflow: hidden; margin-top: 6px; }
.preview-head { display: flex; justify-content: space-between; gap: 10px; padding: 10px 13px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--line); }
.preview-list { list-style: none; margin: 0; padding: 4px 0; max-height: 360px; overflow: auto; }
.preview-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1.2fr); gap: 10px; align-items: center; padding: 6px 13px; font-size: 12.5px; }
.preview-list .pd { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-list .pt { font-family: var(--mono); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.preview-list .pt.own { color: var(--info); }
.preview-list li.bad .pd { color: var(--danger); text-decoration: line-through; }
.preview-list li.err .pt { color: var(--danger); white-space: normal; }
.preview-list li.done .pt { color: var(--ok); }
.preview-list .exists { font-size: 10.5px; color: var(--warn); margin-left: 6px; font-family: var(--sans); }
.st { width: 14px; height: 14px; border-radius: 50%; display: grid; place-items: center; }
.st.idle { border: 1.5px solid var(--line-2); }
.st.bad { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.st.run { border: 2px solid var(--accent-text); border-right-color: transparent; animation: spin .7s linear infinite; }
.st.ok { background: var(--ok); }
.st.err { background: var(--danger); }
.st svg { width: 9px; height: 9px; stroke: var(--accent-ink); stroke-width: 4; }
.progress-bar { height: 3px; background: var(--line); }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }

/* ---------- меню ---------- */
.menu {
  position: fixed; z-index: 70; min-width: 230px; padding: 5px; border-radius: 12px; background: var(--float);
  border: 1px solid var(--line-2); box-shadow: 0 20px 50px -10px color-mix(in srgb, var(--shadow) 85%, transparent); animation: fade .12s;
}
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font-size: 13px; color: var(--text-2); text-align: left; }
.menu button:hover, .menu a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.menu .danger { color: var(--danger); }
.menu .danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.menu hr { border: 0; height: 1px; background: var(--line-2); margin: 5px 0; }

/* ---------- модалки ---------- */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
.modal.wide { width: min(720px, calc(100vw - 32px)); }
.modal::backdrop { background: var(--scrim); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.modal-body { background: var(--side); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 40px 100px -20px color-mix(in srgb, var(--shadow) 90%, transparent); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 2px; }
.modal-head h3 { margin: 0 0 2px; font-size: 16px; overflow-wrap: anywhere; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.howto { margin: 0; padding: 12px 12px 12px 30px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--text-2); }
.howto code { display: inline-block; margin: 2px 2px 0 0; }

.ns-groups { display: flex; flex-direction: column; gap: 10px; }
.ns-group { border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel); overflow: hidden; }
.ns-group-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.ns-pair { font-family: var(--mono); font-size: 13px; line-height: 1.7; }
.ns-group-body { padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 5px; max-height: 160px; overflow: auto; }
.ns-group-body span { font-family: var(--mono); font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--panel-2); color: var(--text-2); }

.test-results { display: flex; flex-direction: column; gap: 8px; }
.test-row { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; padding: 11px 13px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2); font-family: var(--mono); font-size: 12.5px; }
.test-row .tu { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.test-row .ts { font-weight: 600; }
.test-row .ts.ok { color: var(--ok); }
.test-row .ts.warn { color: var(--warn); }
.test-row .ts.bad { color: var(--danger); }
.test-row .tl { grid-column: 1 / -1; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- логин ---------- */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.login-card { width: min(360px, 100%); padding: 30px 26px; border-radius: 18px; text-align: center; display: flex; flex-direction: column; gap: 12px; background: var(--side); border: 1px solid var(--line-2); box-shadow: 0 40px 100px -20px color-mix(in srgb, var(--shadow) 90%, transparent); }
.login-card h2 { margin: 4px 0 0; font-size: 20px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ---------- тосты ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px; max-width: 420px; font-size: 13px; background: var(--float); border: 1px solid var(--line-2); box-shadow: 0 16px 40px -10px color-mix(in srgb, var(--shadow) 80%, transparent); animation: pop .22s ease-out; transition: .22s; }
.toast.out { opacity: 0; transform: translateX(14px); }
.toast i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-text); flex-shrink: 0; }
.toast.ok i { background: var(--ok); }
.toast.err i { background: var(--danger); }


/* ---------- режим назначения и серверы ---------- */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-switch button {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 11px; text-align: left;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--text-2); transition: .15s;
}
.mode-switch button svg { width: 18px; height: 18px; color: var(--muted); }
.mode-switch button span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.mode-switch button b { font-weight: 600; font-size: 13px; color: var(--text); }
.mode-switch button small { font-size: 11.5px; color: var(--muted); }
.mode-switch button:hover { border-color: var(--line-3); }
.mode-switch button.on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.mode-switch button.on svg { color: var(--accent-text); }
.mode-switch.compact button { padding: 9px 12px; }
[data-pane] { display: flex; flex-direction: column; gap: 8px; }

.server-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.server-pick:empty { display: none; }
.server-pick button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 11px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel); text-align: left; min-width: 0; transition: .15s;
}
.server-pick button b { font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.server-pick button span { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.server-pick button:hover { border-color: var(--line-3); }
.server-pick button.on { border-color: color-mix(in srgb, var(--info) 60%, transparent); background: color-mix(in srgb, var(--info) 6%, transparent); }
.server-pick button.on span { color: var(--info); }
.server-pick .pick-empty {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: 10px; border: 1px dashed var(--line-2); background: var(--panel);
}
.pick-empty-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--info) 10%, transparent); color: var(--info); flex-shrink: 0; }
.pick-empty-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.pick-empty-text b { color: var(--text); font-weight: 600; font-size: 13px; }
.pick-empty .btn { flex-shrink: 0; cursor: pointer; }
@media (max-width: 560px) { .server-pick .pick-empty { flex-wrap: wrap; } .pick-empty .btn { width: 100%; } }

.dest.srv .arr { color: var(--info); }
.tag.ssl { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); background: color-mix(in srgb, var(--ok) 6%, transparent); }
.tcard-ico.srv { background: color-mix(in srgb, var(--info) 10%, transparent); color: var(--info); }

.server-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; margin-bottom: 14px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.server-add .btn { height: 40px; }
.src-badge { font-size: 10.5px; padding: 0 6px; line-height: 16px; border-radius: 5px; border: 1px solid var(--line-2); color: var(--muted); margin-left: 6px; font-weight: 600; vertical-align: 1px; }
.src-badge.do { color: var(--do); border-color: color-mix(in srgb, var(--do) 30%, transparent); }
.tcard-name { background: none; border: 0; padding: 0; font-weight: 600; font-size: 14px; color: var(--text); text-align: left; cursor: text; }
.tcard-name:hover { color: var(--accent-text); }
.tcard-actions .btn.icon { flex: 0 0 34px; }
@media (max-width: 900px) { .server-add { grid-template-columns: 1fr; } .mode-switch { grid-template-columns: 1fr; } }


/* ---------- подсказки в панели добавления ---------- */
.mode-help { font-size: 12.5px; line-height: 1.55; color: var(--text-2); padding: 11px 13px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 6%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.mode-help b { color: var(--text); }
.mode-help u { text-decoration: none; color: var(--accent-text); font-weight: 600; }
.mode-help .mh-note { display: block; margin-top: 5px; color: var(--muted); }
.opt-block { display: flex; flex-direction: column; gap: 8px; }
.opt-title { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.opt-desc { font-size: 12.5px; line-height: 1.55; color: var(--text-2); padding: 9px 11px; border-radius: 9px; background: var(--field); border: 1px solid var(--line); }
.opt-desc:empty { display: none; }
.opt-desc b { color: var(--text); }
.seg button { position: relative; }
.rec { font-style: normal; font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); border-radius: 5px; padding: 0 5px; line-height: 15px; }
.seg-top { display: inline-flex; align-items: center; gap: 6px; }
.seg button .rec { line-height: 14px; font-size: 9px; padding: 0 4px; }
.switch.opt-row { align-items: flex-start; }
.switch.opt-row i { margin-top: 2px; }
.switch.opt-row span { display: flex; flex-direction: column; gap: 2px; }
.switch.opt-row b { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.switch.opt-row small { font-family: var(--sans); font-size: 12px; color: var(--muted); line-height: 1.45; }
.opts-box .opts { gap: 16px; padding-top: 4px; }
.next-steps { padding: 12px 14px; border-radius: 11px; border: 1px dashed var(--line-2); margin-top: 6px; }
.next-steps .ns-title { font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.next-steps ol { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.next-steps b { color: var(--text-2); font-weight: 600; }

/* ---------- бренд Routa: уточнения ---------- */
::selection { background: color-mix(in srgb, var(--accent) 40%, transparent); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 6px; }
.input:focus, .search input:focus { border-color: var(--accent-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.brand { gap: 10px; }
.brand .wordmark { font-weight: 700; font-size: 19px; letter-spacing: -0.045em; line-height: 1; }
.brand .wordmark i { font-style: normal; color: var(--accent-text); }
.brand-tag { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 3px; }
.logo { box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 70%, transparent), inset 0 1px 0 rgba(255,255,255,.45); }
.logo svg { stroke-width: 2.4; }
.btn.primary { color: var(--accent-ink); box-shadow: 0 6px 20px -10px color-mix(in srgb, var(--accent) 90%, transparent), inset 0 1px 0 rgba(255,255,255,.45); }
.btn.primary:hover { filter: brightness(1.04) saturate(1.05); }
.add-btn kbd { border-color: color-mix(in srgb, var(--accent-ink) 25%, transparent); color: color-mix(in srgb, var(--accent-ink) 65%, transparent); }
.cb input:checked + span { background: var(--accent); border-color: var(--accent); }
.cb input:checked + span::after { border-color: var(--accent-ink); }
.cb input:indeterminate + span { border-color: var(--accent-text); }
.cb input:indeterminate + span::after { background: var(--accent-text); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { background: var(--accent-ink); }
.tabs button.on::after { background: var(--accent); height: 2px; }
.nav button.on { background: var(--panel-2); }
.nav button.on svg { color: var(--accent-text); }
.row.selected { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.dest .arr { color: var(--accent-text); }
.stp.cur .stp-n { color: var(--accent-ink); }
.menu, .toast, .bulk { box-shadow: 0 18px 50px -12px color-mix(in srgb, var(--shadow) 55%, transparent), 0 0 0 1px var(--line-2); border-color: transparent; }
.modal-body, .login-card, .sheet { box-shadow: 0 40px 100px -24px color-mix(in srgb, var(--shadow) 60%, transparent); }
.panel, .tcard, .server-add { box-shadow: 0 1px 0 color-mix(in srgb, var(--shadow) 4%, transparent); }
.login { background: radial-gradient(700px 380px at 50% -10%, var(--glow), transparent 70%), var(--bg); }
.login-card .wordmark { font-size: 28px; font-weight: 700; letter-spacing: -0.05em; margin: 6px 0 0; }
.login-card .wordmark i { font-style: normal; color: var(--accent-text); }
.theme-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; color: var(--muted); font-size: 12.5px; padding: 6px 10px; border-radius: 8px; }
.theme-btn:hover { color: var(--text); background: var(--hover); }
.theme-btn .t-dark, :root[data-theme="light"] .theme-btn .t-light { display: none; }
:root[data-theme="light"] .theme-btn .t-dark { display: inline; }
.side-links { display: flex; justify-content: space-between; }

/* ---------- адаптив ---------- */
@media (max-width: 1180px) {
  .thead, .row { grid-template-columns: 44px minmax(170px, 1fr) minmax(220px, 1.3fr) minmax(130px, .7fr) 72px; }
  .status .ns-line { display: none; }
  .search { width: 240px; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand .brand-text, .add-btn span, .add-btn kbd, .nav button span, .nav button b, .account-text, .account > svg, .link-btn, .theme-btn span { display: none; }
  .add-btn { width: auto; order: 5; padding: 0 10px; }
  .nav { flex-direction: row; margin-left: auto; }
  .side-foot { margin: 0; flex-direction: row; }
  .account { padding: 11px; }
  :root[data-theme] .side .theme-btn span { display: none; }
  .side-links { gap: 2px; }
  .main { padding: 20px 16px 120px; }
  .head { align-items: stretch; flex-direction: column; }
  .head-actions { flex-wrap: wrap; }
  .search { flex: 1 1 100%; width: auto; }
  .search kbd { display: none; }
  .thead { display: none; }
  .row { grid-template-columns: 36px minmax(0, 1fr) auto; grid-template-areas: 'cb dom act' 'cb dest dest' 'cb st st'; gap: 4px 8px; padding: 10px 10px 10px 0; }
  .row > .cb { grid-area: cb; align-self: start; height: 26px; }
  .row > .dom { grid-area: dom; }
  .row > .dest-cell { grid-area: dest; padding-left: 36px; }
  .row > .status { grid-area: st; padding-left: 36px; }
  .row > .actions { grid-area: act; }
  .bulk { left: 50%; }
  .steps { grid-template-columns: 1fr; }
  .targets { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
