/* ───────── темы: тёмная (по умолчанию), светлая, красная ───────── */
:root, html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b14;
  --bg-2: #0e1120;
  --surface: #151a31;
  --surface-2: #10142a;
  --ink: #ffffff;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --panel-solid: #12162a;
  --border: rgba(255, 255, 255, 0.08);
  --border-2: rgba(255, 255, 255, 0.14);
  --text: #e9ebf8;
  --muted: #8a90b2;
  --dim: #5d6386;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-text: #c9bcff;
  --accent-2-text: #a5f3fc;
  --accent-soft: rgba(124, 92, 255, 0.16);
  --grad: linear-gradient(135deg, #7c5cff 0%, #4f7bff 50%, #22d3ee 100%);
  --success: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --danger-text: #fecaca;
  --ok-text: #a7f3d0;
  --gold-text: #fde68a;
  --glow-1: rgba(124, 92, 255, 0.16);
  --glow-2: rgba(34, 211, 238, 0.10);
}
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f4fa;
  --bg-2: #e9ebf5;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --ink: #0b1020;
  --panel: rgba(255, 255, 255, 0.75);
  --panel-2: rgba(11, 16, 32, 0.05);
  --panel-solid: #ffffff;
  --border: rgba(11, 16, 32, 0.09);
  --border-2: rgba(11, 16, 32, 0.16);
  --text: #171a2c;
  --muted: #5a607e;
  --dim: #868ba6;
  --accent: #6a46ff;
  --accent-2: #0891b2;
  --accent-text: #5232d8;
  --accent-2-text: #0e7490;
  --accent-soft: rgba(106, 70, 255, 0.12);
  --grad: linear-gradient(135deg, #6a46ff 0%, #3f6cf5 50%, #0aa5c8 100%);
  --success: #059669;
  --danger: #dc2626;
  --warn: #d97706;
  --danger-text: #b91c1c;
  --ok-text: #047857;
  --gold-text: #a16207;
  --glow-1: rgba(106, 70, 255, 0.10);
  --glow-2: rgba(8, 145, 178, 0.08);
  --shadow: 0 20px 50px -24px rgba(23, 26, 44, 0.35);
}
html[data-theme="red"] {
  color-scheme: dark;
  --bg: #0f0708;
  --bg-2: #170b0d;
  --surface: #1f0e11;
  --surface-2: #180a0c;
  --ink: #ffffff;
  --panel: rgba(255, 235, 235, 0.035);
  --panel-2: rgba(255, 235, 235, 0.065);
  --panel-solid: #1c0d10;
  --border: rgba(255, 220, 220, 0.09);
  --border-2: rgba(255, 220, 220, 0.16);
  --text: #f8e9ea;
  --muted: #b08a8f;
  --dim: #7a5a5f;
  --accent: #ef4444;
  --accent-2: #fb923c;
  --accent-text: #fecaca;
  --accent-2-text: #fed7aa;
  --accent-soft: rgba(239, 68, 68, 0.17);
  --grad: linear-gradient(135deg, #dc2626 0%, #ef4444 45%, #fb923c 100%);
  --success: #4ade80;
  --danger: #f87171;
  --warn: #fbbf24;
  --danger-text: #fecaca;
  --ok-text: #bbf7d0;
  --gold-text: #fde68a;
  --glow-1: rgba(239, 68, 68, 0.18);
  --glow-2: rgba(251, 146, 60, 0.10);
}
:root {
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);
  --font: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(900px 600px at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
    radial-gradient(800px 600px at 100% 100%, color-mix(in srgb, var(--accent-2) 10%, transparent), transparent 60%),
    radial-gradient(600px 400px at 70% 10%, rgba(79, 123, 255, 0.08), transparent 60%);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12px; }
.center { text-align: center; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
svg.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
i[data-icon] { display: inline-flex; font-style: normal; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in srgb, var(--ink) 16%, transparent); }

/* ───────── buttons & inputs ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--panel-2);
  font-weight: 550; transition: .15s ease; white-space: nowrap;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); border-color: color-mix(in srgb, var(--ink) 22%, transparent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: white; box-shadow: 0 8px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .35); color: var(--danger-text); }
.btn.danger:hover { background: rgba(248, 113, 113, .22); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; font-size: 15px; }
.btn.block { width: 100%; }
.icon-btn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; flex: none;
  border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--muted); transition: .15s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.icon-btn.active { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.sm svg.ic { width: 15px; height: 15px; }

.input, .field input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25); border: 1px solid var(--border-2); outline: none; transition: .15s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; font-family: var(--mono); font-size: 13px; }
.input:focus, .field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
select.input option { background: var(--panel-solid); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > i { position: absolute; left: 12px; color: var(--dim); pointer-events: none; }
.input-wrap input { padding-left: 40px; height: 46px; }
.input-wrap .eye { position: absolute; right: 6px; background: none; border: 0; color: var(--dim); padding: 8px; }
.input-wrap .eye:hover { color: var(--text); }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: rgba(0, 0, 0, .3); border: 1px solid var(--border); border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; color: var(--muted); font-weight: 600; display: inline-flex; gap: 7px; align-items: center; }
.seg button.active { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 6%, transparent) inset, 0 4px 12px rgba(0, 0, 0, .3); }
.seg button:hover:not(.active) { color: var(--text); }

/* toggle switch */
.switch { position: relative; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: color-mix(in srgb, var(--ink) 12%, transparent); transition: .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: white; transition: .2s; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(17px); }
.switch input:disabled + span { opacity: .4; cursor: not-allowed; }

.check { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; transition: .15s; }
.check:hover { border-color: var(--border-2); }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.check.on { border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }

/* ───────── auth ───────── */
.auth { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr 1fr; height: 100vh; }
.auth-hero { padding: 56px 64px; display: flex; flex-direction: column; justify-content: center; position: relative; overflow: hidden; }
.auth-hero h1 { font-size: 46px; line-height: 1.1; letter-spacing: -0.02em; margin: 34px 0 16px; font-weight: 750; }
.auth-hero p { color: var(--muted); font-size: 16px; max-width: 520px; margin: 0; }
.auth-panel { display: grid; place-items: center; padding: 32px; background: linear-gradient(180deg, color-mix(in srgb, var(--ink) 2%, transparent), color-mix(in srgb, var(--ink) 0%, transparent)); border-left: 1px solid var(--border); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; margin: 26px 0 4px; letter-spacing: -0.01em; }
.auth-card > p.muted { margin: 0 0 24px; }
.form-error { background: rgba(248, 113, 113, .1); border: 1px solid rgba(248, 113, 113, .3); color: var(--danger-text); padding: 10px 12px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; }
.auth-card .btn.primary { margin-top: 6px; }
.auth-card #authSwitch { margin-top: 18px; }

.orbit { position: relative; height: 300px; margin-top: 40px; max-width: 560px; }
.orbit svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.orbit .node { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: float 6s ease-in-out infinite; }
.orbit .node svg.ic { width: 24px; height: 24px; color: var(--accent-text); }
.orbit .node.hub { width: 84px; height: 84px; border-radius: 24px; background: var(--grad); border: 0; box-shadow: 0 20px 60px -10px color-mix(in srgb, var(--accent) 60%, transparent); animation: none; }
.orbit .node.hub svg.ic { color: white; width: 34px; height: 34px; }
@keyframes float { 0%, 100% { margin-top: 0; } 50% { margin-top: -8px; } }

/* ───────── brand ───────── */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 18px; letter-spacing: -0.01em; }
.brand.big { font-size: 22px; }
.logo { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); position: relative; box-shadow: 0 6px 20px -4px color-mix(in srgb, var(--accent) 70%, transparent); flex: none; }
.logo::before { content: ""; position: absolute; inset: 6px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 19h11a4.5 4.5 0 0 0 .6-8.96A6 6 0 0 0 6.6 11.1 4 4 0 0 0 6.5 19z' fill='white'/%3E%3C/svg%3E") center / contain no-repeat; }

/* ───────── layout ───────── */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 290px 1fr; height: 100vh; }
.sidebar { display: flex; flex-direction: column; padding: 20px 14px 14px; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(16px); min-height: 0; }
.sidebar .brand { padding: 2px 8px 18px; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; }
.nav button { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 560; text-align: left; transition: .15s; }
.nav button:hover { background: var(--panel-2); color: var(--text); }
.nav button.active { background: var(--accent-soft); color: var(--accent-text); }
.side-title { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 8px; font-size: 11.5px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .08em; }
.device-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; margin: 0 -4px; padding: 0 4px; min-height: 0; }
.dev-item { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 12px; border: 1px solid transparent; background: transparent; text-align: left; transition: .15s; position: relative; width: 100%; }
.dev-item:hover { background: var(--panel-2); }
.dev-item.active { background: var(--panel-2); border-color: var(--border-2); }
.dev-item.drop { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 15%, transparent); }
.dev-item.locked { opacity: .5; cursor: not-allowed; }
.dev-item .dev-body { flex: 1; min-width: 0; }
.dev-item .dev-name { font-weight: 600; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-item .dev-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; position: relative; }
.dev-ico svg.ic { width: 19px; height: 19px; }
.dev-ico.lg { width: 48px; height: 48px; border-radius: 14px; }
.dev-ico.lg svg.ic { width: 24px; height: 24px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.dot.on { background: var(--success); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.dot.off { background: var(--danger); }
.dev-ico .dot { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--bg); width: 11px; height: 11px; box-shadow: none; }
.crown { color: var(--warn); display: inline-flex; }
.crown svg.ic { width: 14px; height: 14px; }

.t-server { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); }
.t-pc { background: rgba(79, 123, 255, .16); color: #9bb5ff; }
.t-laptop { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2-text); }
.t-nas { background: rgba(52, 211, 153, .14); color: #7fe9c0; }
.t-phone { background: rgba(251, 191, 36, .14); color: #fcd57a; }
.t-tablet { background: rgba(244, 114, 182, .14); color: #f9a8d4; }
.t-usb { background: rgba(248, 113, 113, .14); color: var(--danger-text); }
.t-tv { background: rgba(167, 139, 250, .14); color: var(--accent-text); }

.server-card { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), color-mix(in srgb, var(--accent-2) 6%, transparent)); text-align: left; transition: .15s; }
.server-card:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); transform: translateY(-1px); }
.server-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--grad); color: white; flex: none; }
.server-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.server-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-card .chev { color: var(--muted); }

.user-card { display: flex; align-items: center; gap: 11px; margin-top: 10px; padding: 10px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-meta strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: white; flex: none; font-size: 14px; text-transform: uppercase; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.role-badge { align-self: flex-start; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 6px; }
.role-root { background: rgba(248, 113, 113, .15); color: var(--danger-text); border: 1px solid rgba(248, 113, 113, .3); }
.role-admin { background: rgba(251, 191, 36, .13); color: var(--gold-text); border: 1px solid rgba(251, 191, 36, .3); }
.role-user { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 14px; padding: 16px 28px; border-bottom: 1px solid var(--border); min-height: 72px; background: color-mix(in srgb, var(--bg) 35%, transparent); backdrop-filter: blur(12px); }
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.view { flex: 1; overflow-y: auto; padding: 26px 28px 40px; position: relative; min-height: 0; }

.crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.crumbs button { border: 0; background: transparent; padding: 6px 9px; border-radius: 8px; color: var(--muted); font-weight: 600; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.crumbs button:hover { background: var(--panel-2); color: var(--text); }
.crumbs button:last-child { color: var(--text); }
.crumbs .sep { color: var(--dim); }
.crumbs .dev-ico { width: 26px; height: 26px; border-radius: 8px; }
.crumbs .dev-ico svg.ic { width: 15px; height: 15px; }
.search { position: relative; width: 240px; }
.search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.search input { padding-left: 36px; height: 38px; }

/* ───────── cards & overview ───────── */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat { padding: 18px; display: flex; gap: 14px; align-items: center; }
.stat .stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.stat .v { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; }
.stat .l { color: var(--muted); font-size: 12.5px; }

.ov-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; margin-bottom: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 14px; }
.section-head h2, .section-head h3 { margin: 0; font-size: 16px; }
.topo { padding: 18px; }
.topo-canvas { position: relative; height: 360px; }
.topo-canvas svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.topo-node { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; padding: 0; transition: .2s; }
.topo-node:hover .dev-ico { transform: scale(1.08); }
.topo-node .dev-ico { width: 54px; height: 54px; border-radius: 16px; border: 1px solid var(--border-2); transition: .2s; backdrop-filter: blur(10px); }
.topo-node .dev-ico svg.ic { width: 24px; height: 24px; }
.topo-node.server .dev-ico { width: 78px; height: 78px; border-radius: 22px; background: var(--grad); color: white; border: 0; box-shadow: 0 16px 50px -10px color-mix(in srgb, var(--accent) 70%, transparent); }
.topo-node.server .dev-ico svg.ic { width: 32px; height: 32px; }
.topo-node .lbl { font-size: 12.5px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.topo-node.locked { opacity: .45; }
.topo-node.offline .dev-ico { filter: grayscale(1); opacity: .6; }
.flow { stroke-dasharray: 5 7; animation: flow 1.4s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -24; } }

.activity { padding: 18px; display: flex; flex-direction: column; min-height: 0; }
.act-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; max-height: 340px; }
.act { display: flex; gap: 11px; padding: 9px 6px; border-radius: 10px; align-items: flex-start; }
.act:hover { background: var(--panel); }
.act .act-body { flex: 1; min-width: 0; font-size: 13px; }
.act .act-body .d { color: var(--muted); font-size: 12px; word-break: break-word; }
.act time { color: var(--dim); font-size: 11.5px; white-space: nowrap; }

.dev-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.dev-card { padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: .2s; cursor: pointer; position: relative; overflow: hidden; }
.dev-card:hover { border-color: var(--border-2); transform: translateY(-2px); background: var(--panel-2); }
.dev-card.locked { cursor: not-allowed; opacity: .55; }
.dev-card.locked:hover { transform: none; }
.dev-card .top { display: flex; gap: 12px; align-items: center; }
.dev-card .top strong { font-size: 15px; display: flex; gap: 6px; align-items: center; }
.bar { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--ink) 7%, transparent); overflow: hidden; }
.bar > div { height: 100%; border-radius: 99px; background: var(--grad); }
.dev-card .meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.pill.ok { color: var(--ok-text); background: rgba(52, 211, 153, .1); border-color: rgba(52, 211, 153, .25); }
.pill.bad { color: var(--danger-text); background: rgba(248, 113, 113, .1); border-color: rgba(248, 113, 113, .25); }
.pill.gold { color: var(--gold-text); background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .25); }
.pill.violet { color: var(--accent-text); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }

/* ───────── files ───────── */
.files-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.files-toolbar .info { color: var(--muted); font-size: 13px; }
.selbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); animation: pop .15s ease; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.file { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px 10px 14px; border-radius: var(--radius); border: 1px solid transparent; background: var(--panel); text-align: center; user-select: none; transition: .12s; cursor: default; }
.file:hover { background: var(--panel-2); border-color: var(--border); }
.file.sel { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.file.drop { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent); }
.file .f-ico { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; cursor: pointer; transition: transform .15s, box-shadow .15s; }
.file .f-ico:hover, .file-table .nm .f-ico:hover { transform: scale(1.08); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 18%, transparent); }
.file-table .nm .f-ico { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.file .f-ico svg.ic { width: 28px; height: 28px; }
.file .f-name { font-weight: 560; font-size: 13px; width: 100%; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.file .f-sub { font-size: 11.5px; color: var(--muted); }
.file .more { position: absolute; top: 6px; right: 6px; opacity: 0; }
.file:hover .more, .file.sel .more { opacity: 1; }
.f-dir { background: rgba(251, 191, 36, .13); color: var(--gold-text); }
.f-img { background: rgba(244, 114, 182, .13); color: #f9a8d4; }
.f-code { background: color-mix(in srgb, var(--accent-2) 13%, transparent); color: #67e8f9; }
.f-text { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-text); }
.f-media { background: rgba(52, 211, 153, .13); color: #6ee7b7; }
.f-arch { background: rgba(248, 113, 113, .13); color: var(--danger-text); }
.f-other { background: color-mix(in srgb, var(--ink) 7%, transparent); color: #cbd5e1; }

.file-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; }
.file-table th { text-align: left; font-size: 12px; color: var(--dim); font-weight: 600; padding: 4px 14px; text-transform: uppercase; letter-spacing: .05em; }
.file-table td { padding: 9px 14px; background: var(--panel); border-top: 1px solid transparent; border-bottom: 1px solid transparent; }
.file-table td:first-child { border-radius: 10px 0 0 10px; border-left: 1px solid transparent; }
.file-table td:last-child { border-radius: 0 10px 10px 0; border-right: 1px solid transparent; width: 1%; }
.file-table tr.file-row { user-select: none; }
.file-table tr.file-row:hover td { background: var(--panel-2); }
.file-table tr.sel td { background: var(--accent-soft) !important; border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.file-table tr.drop td { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 10%, transparent); }
.file-table .nm { display: flex; align-items: center; gap: 12px; font-weight: 560; }
.file-table .nm .f-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }

.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 70px 20px; color: var(--muted); gap: 10px; }
.empty .e-ico { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); margin-bottom: 6px; }
.empty .e-ico svg.ic { width: 32px; height: 32px; }
.empty h3 { color: var(--text); margin: 0; }

.dropzone { position: absolute; inset: 14px; border: 2px dashed var(--accent-2); border-radius: 20px; background: color-mix(in srgb, var(--accent-2) 6%, transparent); display: grid; place-items: center; z-index: 5; pointer-events: none; backdrop-filter: blur(2px); }
.dropzone div { text-align: center; color: var(--accent-2-text); font-weight: 650; font-size: 16px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.dropzone svg.ic { width: 40px; height: 40px; }

/* ───────── context menu ───────── */
.ctx { position: fixed; z-index: 100; min-width: 220px; padding: 6px; border-radius: 12px; background: color-mix(in srgb, var(--surface) 96%, transparent); border: 1px solid var(--border-2); box-shadow: var(--shadow); backdrop-filter: blur(16px); animation: pop .12s ease; }
.ctx button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 0; background: none; text-align: left; font-size: 13.5px; }
.ctx button:hover { background: var(--panel-2); }
.ctx button.danger { color: var(--danger-text); }
.ctx button:disabled { opacity: .4; cursor: not-allowed; background: none; }
.ctx hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }

/* ───────── modal ───────── */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(4, 6, 14, .66); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 24px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: linear-gradient(180deg, var(--surface), var(--surface-2)); border: 1px solid var(--border-2); border-radius: 20px; box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .8); animation: rise .2s cubic-bezier(.2, .9, .3, 1.2); }
.modal.wide { max-width: 820px; }
.modal.xl { max-width: 1100px; height: calc(100vh - 48px); }
@keyframes rise { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head .sub { color: var(--muted); font-size: 13px; }
.modal-head .grow { flex: 1; min-width: 0; }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding: 14px 22px 18px; border-top: 1px solid var(--border); }
.modal-foot .grow { flex: 1; }
.label { font-size: 12px; font-weight: 700; color: var(--dim); text-transform: uppercase; letter-spacing: .07em; margin: 4px 0 10px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* server picker */
.srv-list { display: flex; flex-direction: column; gap: 10px; }
.srv-opt { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--panel); text-align: left; transition: .15s; width: 100%; }
.srv-opt:hover:not(:disabled) { border-color: var(--border-2); background: var(--panel-2); }
.srv-opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); }
.srv-opt:disabled { opacity: .5; cursor: not-allowed; }
.srv-opt .grow { flex: 1; min-width: 0; }
.srv-opt .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-2); flex: none; display: grid; place-items: center; }
.srv-opt.on .radio { border-color: var(--accent); }
.srv-opt.on .radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent-2) 7%, transparent); border: 1px solid color-mix(in srgb, var(--accent-2) 22%, transparent); color: var(--accent-2-text); font-size: 13px; margin-bottom: 16px; }
.note.warn { background: rgba(251, 191, 36, .07); border-color: rgba(251, 191, 36, .25); color: var(--gold-text); }

/* transfer */
.tr-src { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); margin-bottom: 18px; }
.tr-src .grow { flex: 1; min-width: 0; }
.tr-src strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tr-devs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 18px; }
.tr-dev { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); text-align: left; transition: .15s; }
.tr-dev:hover:not(:disabled) { border-color: var(--border-2); }
.tr-dev.on { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 8%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 12%, transparent); }
.tr-dev:disabled { opacity: .4; cursor: not-allowed; }
.tr-dev .dev-ico { width: 32px; height: 32px; }
.tr-dev span { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-box { border: 1px solid var(--border); border-radius: 12px; background: rgba(0, 0, 0, .2); overflow: hidden; }
.folder-box .fb-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--panel); }
.folder-box .fb-list { max-height: 220px; overflow-y: auto; padding: 6px; }
.fb-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; text-align: left; }
.fb-item:hover { background: var(--panel-2); }
.fb-item .f-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.fb-item .f-ico svg.ic { width: 15px; height: 15px; }

/* editor */
.editor-wrap { display: flex; flex-direction: column; height: 100%; }
.editor { flex: 1; width: 100%; resize: none; border: 0; outline: none; background: rgba(0, 0, 0, .28); color: var(--text); font-family: var(--mono); font-size: 13.5px; line-height: 1.6; padding: 18px 22px; tab-size: 4; }
.modal.xl .modal-body { padding: 0; display: flex; }
.preview { flex: 1; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .28); overflow: auto; }
.preview img, .preview video { max-width: 100%; max-height: 100%; border-radius: 12px; }
.preview iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; background: white; }
.sync { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.sync .dot { animation: none; }
.sync.saving .dot { background: var(--warn); animation: blink 1s infinite; }
.sync.saved .dot { background: var(--success); }
.sync.remote .dot { background: var(--accent-2); }
.sync.error .dot { background: var(--danger); }
@keyframes blink { 50% { opacity: .3; } }
.editors { display: flex; }
.editors .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.flash { animation: flash 1s ease; }
@keyframes flash { 0% { box-shadow: inset 0 0 0 2px var(--accent-2); } 100% { box-shadow: inset 0 0 0 2px transparent; } }

/* admin */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.tabs button { border: 0; background: none; padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--panel-2); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; color: var(--dim); font-weight: 700; padding: 12px 16px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: color-mix(in srgb, var(--ink) 2%, transparent); }
.table .u { display: flex; align-items: center; gap: 12px; }
.table .u strong { display: flex; align-items: center; gap: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.actions { display: flex; gap: 4px; justify-content: flex-end; }
.perm-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); }
.perm-row .grow { flex: 1; }
.perm-row .grow strong { display: block; font-size: 13.5px; }
.perm-row .grow span { font-size: 12px; color: var(--muted); }
.perm-row .p-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); }
.root-zone { border: 1px solid rgba(248, 113, 113, .3); background: rgba(248, 113, 113, .05); border-radius: 14px; padding: 16px; margin-top: 18px; }
.root-zone .label { color: var(--danger-text); display: flex; align-items: center; gap: 8px; }
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.type-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); font-size: 12px; font-weight: 600; }
.type-opt.on { border-color: var(--accent); background: var(--accent-soft); }
.drive-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.drive-chips button { border: 1px solid var(--border-2); background: var(--panel); border-radius: 8px; padding: 4px 10px; font-family: var(--mono); font-size: 12px; }
.drive-chips button:hover { border-color: var(--accent); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: color-mix(in srgb, var(--ink) 6%, transparent); padding: 2px 6px; border-radius: 6px; }

/* toasts */
#toasts { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; min-width: 280px; max-width: 420px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--surface) 97%, transparent); border: 1px solid var(--border-2); box-shadow: var(--shadow); animation: slide .25s cubic-bezier(.2, .9, .3, 1.2); backdrop-filter: blur(12px); font-size: 13.5px; }
.toast.out { animation: slideOut .2s ease forwards; }
.toast .t-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.toast.ok .t-ico { background: rgba(52, 211, 153, .15); color: var(--success); }
.toast.err .t-ico { background: rgba(248, 113, 113, .15); color: var(--danger); }
.toast.info .t-ico { background: color-mix(in srgb, var(--accent-2) 15%, transparent); color: var(--accent-2); }
.toast .grow { flex: 1; min-width: 0; word-break: break-word; }
.toast .bar { margin-top: 6px; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@keyframes slideOut { to { transform: translateX(30px); opacity: 0; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--ink) 15%, transparent); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }

/* ───────── Wi-Fi доступ ───────── */
.nav-badge { margin-left: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(52, 211, 153, .15); color: var(--ok-text); }
.nav-badge:empty { display: none; }
.wifi-hero { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 16px; margin-bottom: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 12%, transparent), color-mix(in srgb, var(--accent) 10%, transparent)); border: 1px solid color-mix(in srgb, var(--accent-2) 25%, transparent); }
.wifi-hero .big-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: white; flex: none; }
.wifi-hero .big-ico svg.ic { width: 26px; height: 26px; }
.wifi-hero p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 20px; }
.qr-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 16px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); text-align: center; }
.qr-card.main { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 10%, transparent); }
.qr-card img { width: 170px; height: 170px; border-radius: 12px; background: white; padding: 6px; image-rendering: pixelated; }
.qr-card .url { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.qr-card .iface { font-size: 12px; color: var(--muted); }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent-text); }
.cmd { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .35); border: 1px solid var(--border); font-family: var(--mono); font-size: 12.5px; margin-bottom: 8px; }
.cmd span { flex: 1; overflow-x: auto; white-space: nowrap; }
.client-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border); }
.client-row .grow { flex: 1; min-width: 0; }
.client-row .grow strong { display: block; font-size: 13.5px; }
.nav-wifi.live { color: var(--accent-2-text); }
.nav-wifi.live::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(52, 211, 153, .2); margin-left: 6px; animation: blink 2s infinite; }
@media (max-width: 900px) { .tunnel-on, .tunnel-off { flex-direction: column; align-items: stretch; } .tunnel-on img { align-self: center; } }
.tunnel-on, .tunnel-off, .tunnel-wait { display: flex; gap: 16px; align-items: center; padding: 16px; border-radius: 16px; border: 1px solid var(--border); background: var(--panel); }
.tunnel-on { border-color: rgba(52, 211, 153, .4); background: linear-gradient(135deg, rgba(52, 211, 153, .08), color-mix(in srgb, var(--accent-2) 6%, transparent)); align-items: flex-start; }
.tunnel-on img { width: 150px; height: 150px; border-radius: 12px; background: white; padding: 6px; flex: none; }
.tunnel-on .grow, .tunnel-off .grow, .tunnel-wait .grow { flex: 1; min-width: 0; }
.tunnel-url { font-family: var(--mono); font-size: 15px; font-weight: 600; margin: 10px 0 6px; word-break: break-all; color: var(--accent-2-text); }
.tunnel-off .big-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--panel-2); color: var(--muted); flex: none; }
.tunnel-off strong, .tunnel-wait strong { display: block; margin-bottom: 3px; }
.offline-bar { position: fixed; z-index: 300; top: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; align-items: center; max-width: min(620px, calc(100vw - 24px)); padding: 12px 18px; border-radius: 14px; background: color-mix(in srgb, var(--danger) 22%, var(--surface)); border: 1px solid rgba(248, 113, 113, .45); box-shadow: var(--shadow); backdrop-filter: blur(12px); animation: pop .2s ease; }
.offline-bar .spinner { border-top-color: var(--danger); flex: none; }
.offline-bar b { display: block; color: var(--danger-text); }
.offline-bar span { font-size: 12.5px; color: var(--danger-text); }
.menu-btn { display: none; }
.nav-backdrop { display: none; }

@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ov-grid { grid-template-columns: 1fr; }
}

/* ───────── мобильная версия (телефоны и планшеты по Wi-Fi) ───────── */
@media (max-width: 900px) {
  body { font-size: 15px; }
  .auth { grid-template-columns: 1fr; height: 100dvh; }
  .auth-hero { display: none; }
  .auth-panel { border-left: 0; padding: 24px 18px; }
  .app { grid-template-columns: 1fr; height: 100dvh; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .25s cubic-bezier(.2, .9, .3, 1);
    background: color-mix(in srgb, var(--surface) 97%, transparent); padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .app.nav-open .sidebar { transform: none; box-shadow: 30px 0 80px rgba(0, 0, 0, .6); }
  .nav-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(4, 6, 14, .6); backdrop-filter: blur(3px); }
  .app.nav-open .nav-backdrop { display: block; }
  .menu-btn { display: inline-grid; color: var(--text); }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 60px; }
  .topbar h1 { font-size: 17px; }
  .topbar .muted.small { display: none; }
  .topbar .crumbs { flex: 1; order: 1; }
  .topbar .menu-btn { order: 0; }
  .topbar .spacer { display: none; }
  .topbar .search { order: 5; width: 100%; }
  .topbar .seg { order: 2; }
  .topbar .btn { order: 3; padding: 0 11px; }
  .topbar .btn .lbl-long { display: none; }
  .view { padding: 14px 12px calc(30px + env(safe-area-inset-bottom)); }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat .stat-ico { width: 36px; height: 36px; }
  .stat .v { font-size: 18px; }
  .topo-canvas { height: 280px; }
  .topo-node .dev-ico { width: 44px; height: 44px; }
  .topo-node.server .dev-ico { width: 62px; height: 62px; }
  .topo-node .lbl { font-size: 11px; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
  .file { padding: 14px 6px 10px; }
  .file .f-ico { width: 46px; height: 46px; }
  .files-toolbar .muted.small { display: none; }
  .selbar { flex-wrap: wrap; width: 100%; }
  .card:has(> .table) { overflow-x: auto; }
  .table { min-width: 760px; }
  .tabs { overflow-x: auto; }
  .overlay { padding: 0; align-items: end; }
  .modal, .modal.wide { max-width: none; max-height: 92dvh; border-radius: 20px 20px 0 0; }
  .modal.xl { height: 100dvh; max-height: none; border-radius: 0; }
  .modal-foot { flex-wrap: wrap; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .grid2, .type-grid { grid-template-columns: 1fr 1fr; }
  .search { width: 100%; }
  #toasts { left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
  .ctx { min-width: 240px; }
  .ctx button { padding: 12px 12px; font-size: 15px; }
}
@media (hover: none) {
  .file .more { opacity: 1; }
  .icon-btn.sm { width: 32px; height: 32px; }
}

/* ───────── подстройка светлой темы ───────── */
html[data-theme="light"] .dev-ico svg.ic, html[data-theme="light"] .f-ico svg.ic, html[data-theme="light"] .stat-ico svg.ic { filter: brightness(.55) saturate(1.6); }
html[data-theme="light"] .topo-node.server .dev-ico svg.ic, html[data-theme="light"] .server-icon svg.ic { filter: none; }
html[data-theme="light"] .card, html[data-theme="light"] .file, html[data-theme="light"] .perm-row, html[data-theme="light"] .srv-opt,
html[data-theme="light"] .tr-dev, html[data-theme="light"] .check, html[data-theme="light"] .qr-card { box-shadow: 0 1px 2px rgba(23, 26, 44, .06); }
html[data-theme="light"] .input, html[data-theme="light"] .field input, html[data-theme="light"] .seg, html[data-theme="light"] .cmd, html[data-theme="light"] .folder-box { background: #fff; }
html[data-theme="light"] .editor, html[data-theme="light"] .preview { background: #fbfbfe; }
html[data-theme="light"] .switch span::after { box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
html[data-theme="light"] .overlay { background: rgba(30, 34, 60, .35); }

/* ───────── переключатель тем ───────── */
.theme-pick { display: flex; gap: 6px; }
.theme-pick button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border-2); padding: 0; transition: .15s; }
.theme-pick button:hover { transform: scale(1.12); }
.theme-pick button.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.theme-pick [data-theme-set="dark"] { background: linear-gradient(135deg, #090b14 50%, #7c5cff 50%); }
.theme-pick [data-theme-set="light"] { background: linear-gradient(135deg, #f3f4fa 50%, #6a46ff 50%); }
.theme-pick [data-theme-set="red"] { background: linear-gradient(135deg, #0f0708 50%, #ef4444 50%); }
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px 2px; font-size: 12px; color: var(--muted); }
.auth-theme { position: absolute; top: 20px; right: 24px; z-index: 5; }
/* ───────── удаление устройства одним нажатием ───────── */
.dev-del { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: .15s; flex: none; }
.dev-del svg.ic { width: 14px; height: 14px; }
.dev-item:hover .dev-del, .dev-item:focus-visible .dev-del { opacity: 1; }
.dev-del:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger-text); }
@media (hover: none) { .dev-del { opacity: .7; } }
.form-error.ok { background: color-mix(in srgb, var(--success) 12%, transparent); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--ok-text); }

/* ───────── подключение по QR ───────── */
.pair-box { display: flex; gap: 22px; align-items: flex-start; }
.pair-qr { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: none; }
.pair-qr img { width: 210px; height: 210px; background: white; padding: 8px; border-radius: 16px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.pair-box .grow { flex: 1; min-width: 0; }
.pair-box .pill { cursor: pointer; }
.perm-details { margin-top: 18px; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--panel); }
.perm-details summary { cursor: pointer; font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
.perm-details summary::-webkit-details-marker { display: none; }

/* ───────── страница устройства (телефон, подключённый по QR) ───────── */
.devpage { position: relative; z-index: 1; min-height: 100dvh; display: flex; justify-content: center; padding: max(24px, env(safe-area-inset-top)) 16px 40px; overflow-y: auto; height: 100dvh; }
.devpage-card { width: 100%; max-width: 560px; }
.devpage .client-row { width: 100%; text-align: left; color: inherit; text-decoration: none; }
.devpage .client-row .f-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.devpage .client-row:hover { border-color: var(--border-2); text-decoration: none; }
@media (max-width: 900px) { .pair-box { flex-direction: column; align-items: center; } }
