* { box-sizing: border-box }
:root { color-scheme: dark; font: 14px 'Segoe UI', system-ui, sans-serif; color: #e4e6e8; background: #232527 }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; border: 2px solid #555 }
header { background: linear-gradient(#353535,#1b1b1b); border-bottom: 1px solid #777; padding: 8px 14px; display: flex; align-items: center; gap: 12px }
.brand { letter-spacing: .18em; color: #eeeeef; font-weight: bold }
.muted { color: #c5c8cd }
nav { background: linear-gradient(#555a5eaa,#292d31bb); border-bottom: 1px solid #8d92964d; padding: 5px 14px 0; display: flex; gap: 2px }
button, .tab, input { font: inherit; color: inherit; border: 1px solid #a6a9ad4d; background: #25282bbc; padding: 7px 10px }
button, .tab { cursor: pointer; background: linear-gradient(#45494ca8,#25282bc9); text-decoration: none }
button:hover, .tab:hover, .tab[aria-current] { background: linear-gradient(#676e73bc,#3b4247db); color: #ffffff }
.tab { padding-inline: 17px }
:focus-visible { outline: 2px solid #b9c8d6; outline-offset: 2px }
main { flex: 1; padding: 20px; background: linear-gradient(#18140f65,#18140f86), url('/default.jpg') center / cover fixed; }
main.custom { background: linear-gradient(#18140f65,#18140f86), url('/background') center/cover no-repeat }
.panel { background: linear-gradient(#0b0e1166,#0b0e1180), url('/portrait.jpg') 68% center / cover fixed }
.panel.custom { background: linear-gradient(rgba(8,10,14,.18),rgba(8,10,14,.30)), url('/background') center/cover no-repeat }
.users-view { padding: 0 }
.users-view th, .users-view td { padding: 8px 12px; border-right: 0 }
.dashboard .users-view th { text-transform: uppercase; letter-spacing: .08em; font-size: 10.5px; font-weight: 600; color: #b9c3d6 }
.dashboard .users-view tbody tr { border-bottom: 1px solid rgba(255,255,255,.06) }
.dashboard .users-view tbody tr:last-child { border-bottom: 0 }
.dashboard .users-view tbody tr:hover td { background: rgba(255,255,255,.05) }
.dashboard .users-view td.pc { padding-left: 12px }
.users-view th { background: #3e4449b5 }
.users-view td { background: #23272ab0 }
.users-view table { min-width: 0 }
.dashboard .users-view th:nth-child(1) { width: 196px }
.dashboard .users-view th:nth-child(2) { width: 146px }
.dashboard .users-view th:nth-child(3) { width: 84px }
.dashboard .users-view th:nth-child(4) { width: 128px }
.dashboard .users-view th:nth-child(5) { width: 118px }
.dashboard .users-view td.pc { overflow: hidden; text-overflow: ellipsis }
.dashboard .users-view td:nth-child(4), .dashboard .users-view td:nth-child(5) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }

.users-view td a { color: inherit }
.users-view tr[data-user-link]:hover td { background: #343b3fbf }
.users-view tr[data-user-link] { cursor: pointer }
#user-menu { position: fixed; inset: auto; margin: 0; min-width: 176px; padding: 4px; border: 1px solid #667075; background: #22272a; color: #e4e6e8; z-index: 1000; display: none; }
#user-menu a { display: block; padding: 7px 12px; color: inherit; text-decoration: none; cursor: pointer; }
#user-menu a:hover, #user-menu a:focus-visible { background: #414a50 }
#user-menu a[data-priority='danger'] { color: #ff8a75 }
.panel-users-box { margin-bottom: 12px }
body[data-role="worker"] [data-action="uninstall"], body[data-role="worker"] [data-action="wipewin"] { display: none }
body[data-role="boss"] [data-action="wipewin"] { display: none }
.note-btn { background: transparent !important; border: 0 !important; box-shadow: none !important; outline: 0; padding: 0 !important; margin: 0; min-height: 0; line-height: inherit; cursor: pointer; color: #ffffff; font: inherit; text-align: left }
.note-btn.has { color: #ff5a5a; font-weight: 600 }
.note-btn:hover { color: #ffffff; background: transparent !important }
.users-view img.shot { width: 68px; height: 40px; object-fit: cover; border-radius: 3px; background: #0e0f12; display: inline-block; vertical-align: middle; margin-right: 10px }
.dashboard .users-view td.pc { white-space: nowrap }
.dashboard .users-view td.mid { text-align: center }
.dashboard .users-view th:nth-child(2), .dashboard .users-view th:nth-child(3), .dashboard .users-view th:nth-child(4) { text-align: center }
.dashboard .users-view td:nth-child(2), .dashboard .users-view td:nth-child(3), .dashboard .users-view td:nth-child(4) { text-align: center }
.panel-users-box table { min-width: 560px }
body:has(.panel) header { padding: 4px 12px }
.panel-nav, .panel-status { justify-content: space-between; align-items: stretch; flex-wrap: wrap; gap: 3px 12px }
.panel-nav { padding: 4px 10px 1px; background: linear-gradient(#505659,#2b3033); border-color: #777f83 }
.bar-group { display: flex; flex-wrap: wrap; align-items: stretch }
.panel-nav .bar-group { gap: 2px }
.panel-nav .tab {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 27px; padding: 3px 15px; border-color: #81898d66;
  background: linear-gradient(#383e41,#202426); color: #f2f3f4; font-size: 13px;
}
.panel-nav .tab[aria-current], .panel-nav a.tab:hover { background: linear-gradient(#596268,#333a3e) }
.panel-nav button:disabled { color: #ccd0d2; cursor: default }
.panel-status { padding: 0; border-top: 2px solid #727a7e; background: linear-gradient(#41474a,#1b1e20) }
.panel-status .bar-group { align-items: center }
.panel-status .bar-group:last-child { margin-left: auto }
.panel-status span, .refresh { display: inline-flex; align-items: center; min-height: 25px; padding: 2px 8px }
.panel-status .bar-group:first-child span { border-right: 1px solid #a4aaad44 }
.panel-status .signal { align-items: end; gap: 2px }
.signal i { width: 4px; height: 5px; background: #55bf72 }
.signal i:nth-child(2) { height: 9px }
.signal i:nth-child(3) { height: 13px }
.signal i:nth-child(4) { height: 17px }
.refresh { color: inherit; text-decoration: none; font: 21px/1 Arial, sans-serif }
.refresh:hover { background: #ffffff20 }
main.gate { display: grid; place-items: center; min-height: 420px }
.box { border: 1px solid #a5a9ae55; background: #282b2e88; margin: 0 auto 14px; max-width: 1040px; box-shadow: 0 2px 14px #0007 }
.gate .box { width: min(100%, 390px); margin: 0 }
h1, h2 { margin: 0; padding: 9px 13px; background: linear-gradient(#62676b78,#3c414583); border-bottom: 1px solid #a5a9ae55; font-size: 15px }
.content { padding: 14px; overflow-wrap: anywhere }
p { margin: 0 0 12px; line-height: 1.45 }
p:last-child { margin-bottom: 0 }
form.stack { display: grid; gap: 11px; max-width: 370px; margin: 0 }
label { display: grid; gap: 5px }
input { min-width: 0; width: 100% }
.actions { display: flex; flex-wrap: wrap; align-items: end; gap: 10px }
.actions form { margin: 0 }
.scroll { overflow-x: auto }
table { border-collapse: collapse; width: 100%; text-align: left }
th, td { padding: 8px 12px; border-bottom: 1px solid #a3a7aa42; }
th { background: #565b607a }
.active { color: #a8e3a9 }
.error { color: #ffbcab }
footer { display: flex; flex-wrap: wrap; gap: 12px; background: linear-gradient(#555a5eac,#272a2cd9); border-top: 2px solid #949ba45e; padding: 7px 12px; font-size: 12px }
footer .end { margin-left: auto }

.login-page { border: 0; background: #101113 url('/background') center/cover no-repeat; color: #fff; font: 14px 'Segoe UI', system-ui, sans-serif; color-scheme: light }
.login-screen { display: grid; place-items: center; background: linear-gradient(90deg,#090a0cec,#090a0c61), url("/portrait.jpg") 68% center / cover no-repeat; padding: 24px }
.login-form { width: min(100%, 330px); margin: 0; padding: 27px 30px; border: 1px solid #ffffff33; border-radius: 9px; background: #25282bc9; box-shadow: 0 18px 65px #0008; backdrop-filter: blur(10px) }
.login-form h1 { padding: 0; margin: 0 0 24px; border: 0; background: none; text-align: center; font-size: 24px; line-height: 28px; text-shadow: 0 2px 1px #151515 }
.login-fields { border: 1px solid #bdbdbd; border-radius: 4px; overflow: hidden; background: #ededed }
.login-fields input { display: block; height: 39px; border: 0; padding: 0 9px; background: transparent; color: #252525 }
.login-fields input::placeholder { color: #626c76; opacity: 1 }
.login-fields input:focus-visible, .password-toggle:focus-visible { outline: 2px solid #4c4c4c; outline-offset: -2px }
.password-field { position: relative; border-top: 1px solid #c5c5c5 }
.password-field input { padding-right: 42px }
.password-toggle { position: absolute; inset: 0 0 0 auto; width: 35px; padding: 0; border: 0; background: transparent; color: #777e84 }
.password-toggle:hover, .password-toggle[aria-pressed="true"] { color: #343b41; background: #dadada }
.password-toggle svg { display: block; margin: auto }
.login-submit { margin-top: 14px; width: 100%; height: 47px; border: 1px solid #f5f5f5; border-radius: 5px; background: #f5f5f5; color: #141414; font-size: 16px; font-weight: bold }
.login-submit:hover { background: #dedede; color: #141414 }
.login-error { margin: 10px 0 0; color: #ffbcab }
.login-submit:disabled { opacity: .65; cursor: wait }

.dashboard { --glass-edge: #ffffff29; --glass-button: linear-gradient(180deg,#292929,#151515); --control-hover-edge: #ffffff6b; --primary-button: #f5f5f5; border: 0; font: 14px/1.45 'Bahnschrift','DIN Alternate','Segoe UI',Tahoma,sans-serif; letter-spacing: .012em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; background: linear-gradient(90deg,#06070d8c,#06070d24), url('/portrait.jpg') 70% center / cover fixed }
.dashboard:has(.panel.custom) { background: linear-gradient(90deg,#06070d5c,#06070d10), url('/background') center/cover no-repeat }
.dashboard .panel-nav { gap: 3px 12px; padding: 5px 10px 3px; background: rgba(10,9,11,.62); border-bottom: 1px solid rgba(255,255,255,.08); -webkit-backdrop-filter: blur(18px) saturate(130%); backdrop-filter: blur(18px) saturate(130%) }
.dashboard .panel-nav .tab, .dashboard main button, .dashboard .refresh, .dashboard input::file-selector-button { min-height: 24px; padding: 3px 13px; border: 1px solid var(--glass-edge); border-radius: 5px; background: var(--glass-button); color: #f2eeee; box-shadow: inset 0 1px #ffffff0d; transition: border-color .15s ease, background-color .15s ease }
.dashboard .panel-nav .tab { border-color: transparent; border-radius: 0; background: transparent; box-shadow: none }
.dashboard .panel-nav .tab[aria-current] { border-bottom-color: #ededed; color: #fff }
.dashboard .panel-nav a.tab:hover, .dashboard main button:hover, .dashboard .refresh:hover, .dashboard input::file-selector-button:hover { border-color: var(--control-hover-edge); background: #333333 }
.dashboard .panel-nav button:disabled { color: #a6a0a3 }
.dashboard form[action="/issue"] button, .dashboard form[action="/background"] button, .dashboard form[action="/revoke"] button { background: var(--primary-button); border-color: var(--primary-button); color: #141414; font-weight: 600 }
.dashboard form[action="/issue"] button:hover, .dashboard form[action="/background"] button:hover, .dashboard form[action="/revoke"] button:hover { background: #dedede; border-color: #dedede }
.dashboard input::file-selector-button { margin-right: 10px; font: inherit; cursor: pointer }
.dashboard .panel, .dashboard .panel.custom { padding: 14px }
.dashboard .users-view { padding: 0 }
.dashboard .users-view table { min-width: 0; width: auto; table-layout: fixed; background: rgba(11,9,11,.42); -webkit-backdrop-filter: blur(14px) saturate(130%); backdrop-filter: blur(14px) saturate(130%); border-radius: 10px }
.dashboard .users-view th, .dashboard .users-view td { padding: 3px 7px; border-color: var(--glass-edge); font-size: 12px }
.dashboard .users-view th { background: #ffffff0b; color: #e5eaf6 }
.dashboard .users-view th:first-child { width: 28% }
.dashboard .users-view th:last-child { width: 30% }
.dashboard .users-view .empty-devices { color: #c3cadb; background: transparent }
.dashboard .box { border: 1px solid rgba(255,255,255,.10); border-radius: 10px; overflow: hidden; background: rgba(13,12,14,.52); -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%); box-shadow: 0 10px 34px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.06) }
.dashboard .box h1 { padding: 9px 12px; background: #ffffff08; border-color: var(--glass-edge); font-size: 14px }
.dashboard .box h1::before { content: ''; display: inline-block; width: 2px; height: .9em; margin-right: 8px; background: #ededed; vertical-align: -.05em }
.dashboard .box th { background: #ffffff0b }
.dashboard input { background: #151315; border-color: var(--glass-edge); border-radius: 4px }
.dashboard :focus-visible { outline-color: #ededed }
.dashboard .refresh { padding: 1px 8px; font-size: 18px }
.dashboard .panel-status { padding: 0 4px; border-top: 1px solid var(--glass-edge); background: #0a090be0; color: #d9dfec; backdrop-filter: blur(12px) }

.dashboard .settings-layout { width: min(100%, 470px); margin: clamp(8px,3vh,32px) 0 0 clamp(0px,4vw,64px); color: #f0eded }
.dashboard .settings-layout .box { margin: 0 0 8px; border-radius: 10px; background: #0d0b0ded }
.dashboard .settings-layout .box h1 { padding: 14px 16px 0; border: 0; background: transparent; font-size: 19px; line-height: 1.2 }
.dashboard .issue-form { display: grid; gap: 10px }
.dashboard .settings-layout .box:has(.issue-form) { background: #101011eb; border-color: #ffffff34 }
.dashboard .settings-layout .box:has(.issue-form) h1::before { display: none }
.dashboard .issue-form input { min-height: 34px; padding: 6px 9px; background: #171718; border-color: #ffffff38 }
.dashboard .issue-form button { min-height: 36px; margin-top: 4px; border-radius: 6px }
.dashboard .settings-group summary { padding: 10px 14px; color: #d7cfd2; cursor: pointer }
.dashboard .settings-group summary:hover { background: #ffffff08; color: #fff }
.dashboard .settings-group[open] summary { border-bottom: 1px solid var(--glass-edge) }

.tools-clients { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px }
.tools-actions input { flex: 0 1 260px; width: auto }
.tools-buttons { display: flex; flex-wrap: wrap; align-items: stretch; gap: 10px; margin-top: 10px }
.tools-output { margin: 12px 0 0; padding: 10px; max-height: 320px; overflow: auto; font: 12px/1.5 Consolas, monospace; color: #d9dfec; background: #0f0e10d9; border: 1px solid #ffffff29; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere }
.tools-image { display: block; margin-top: 12px; max-width: 100%; border: 1px solid #ffffff29; border-radius: 6px }

/* вкладка Loader: строка VAC с датчиком и тумблером */
.vac-line { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 6px }
.vac-led { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #e04141; box-shadow: 0 0 7px #e04141cc }
.vac-led.on { background: #3ed15e; box-shadow: 0 0 9px #3ed15ecc; animation: vac-blink 1s infinite }
@keyframes vac-blink { 50% { opacity: .25 } }
.vac-switch { position: relative; flex: 0 0 auto; display: inline-block; width: 46px; height: 24px; margin: 0 }
.vac-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1 }
.vac-slider { position: absolute; inset: 0; border-radius: 24px; border: 1px solid #ffffff33; background: #3a3a3a; transition: background .2s }
.vac-slider::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #dedede; transition: transform .2s }
.vac-switch input:checked + .vac-slider { background: #2f7d3a }
.vac-switch input:checked + .vac-slider::after { transform: translateX(22px) }
.vac-switch input:focus-visible + .vac-slider { outline: 2px solid #ededed; outline-offset: 2px }
.vac-text { flex: 1 1 240px; margin: 0 }
.vac-select { flex: 0 1 320px; min-width: 180px }
.vac-chat { margin-top: 16px; border: 1px solid #ffffff1f; border-radius: 8px; background: #0f0e1099 }
#vac-links { display: inline-flex; gap: 12px; margin-left: 12px; font-size: 12px }
#vac-links a { color: #67c1f5; text-decoration: none }
#vac-links a:hover { text-decoration: underline }
.vac-chat-head { display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #ffffff14; color: #9aa4b8; font-size: 12px }
.vac-chat-log { min-height: 190px; max-height: 320px; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px }
.vac-msg { max-width: 78%; padding: 7px 10px; border-radius: 8px; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere }
.vac-msg.user { align-self: flex-start; background: #23303f; color: #dfe7f2; border: 1px solid #ffffff12 }
.vac-msg.agent { align-self: flex-end; background: #26465d; color: #eaf3fb; border: 1px solid #ffffff18 }
.vac-msg time { display: block; margin-top: 4px; color: #8fa1b6; font-size: 10px }
.vac-shot { display: block; max-width: 240px; max-height: 180px; margin-bottom: 6px; border-radius: 4px }
.vac-chat-empty { color: #7b8496; font-size: 12px; margin: auto 0; text-align: center }
.vac-chat-row { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #ffffff14 }
.vac-chat-row input { flex: 1 1 auto }
.vac-chat-row textarea { flex: 1 1 auto; min-height: 38px; max-height: 140px; resize: vertical; font: inherit }
.vac-actions { display: flex; gap: 10px; margin: 10px 0 4px }
.troll-box { margin-top: 14px; border: 1px solid #ffffff1f; border-radius: 8px; padding: 10px 12px }
.troll-title { font-size: 12px; color: #9aa4b8; margin-bottom: 8px }
.troll-row { display: flex; gap: 8px; margin-bottom: 8px }
.troll-row input { flex: 1 1 auto }

/* окно просмотра экрана/камеры: тянуть за шапку, растягивать за угол */
.rat-viewer { position: fixed; right: 18px; bottom: 18px; z-index: 1200; width: min(44vw, 680px); min-width: 280px; min-height: 200px; resize: both; overflow: hidden; border: 1px solid #ffffff38; border-radius: 9px; background: #0d0c0ef2; box-shadow: 0 12px 45px #000b; display: flex; flex-direction: column }
.rat-viewer-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; background: #ffffff0f; color: #eceff1; font-size: 13px; cursor: move; user-select: none }
.rat-viewer-close { font: inherit; color: inherit; background: transparent; border: 0; cursor: pointer; padding: 2px 7px }
.rat-viewer-close:hover { color: #fff; background: #ffffff1c }
.rat-viewer-body { flex: 1; overflow: hidden; display: flex; align-items: center; justify-content: center; background: #000 }
.rat-viewer img { display: block; max-width: 100%; max-height: 100%; object-fit: contain }

/* модальные окна */
.rat-specs { position: fixed; inset: 0; z-index: 1300; display: grid; place-items: center; background: #000000a6 }
.rat-specs-box { width: min(94vw, 640px); max-height: 84vh; display: flex; flex-direction: column; border: 1px solid #ffffff38; border-radius: 9px; background: #101113f5; box-shadow: 0 12px 45px #000b }
.rat-specs-head { padding: 10px 14px; border-bottom: 1px solid #ffffff29; color: #eceff1; font-weight: 600 }
.rat-specs-box pre { margin: 0; padding: 12px 14px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.55 Consolas, monospace; color: #d9dfec }
.rat-closebtn { margin: 10px 14px 12px auto; padding: 6px 16px; font: inherit; color: #f2eeee; background: linear-gradient(#292929,#151515); border: 1px solid #ffffff38; border-radius: 5px; cursor: pointer }
.rat-closebtn:hover { background: #333333 }
.rat-ctl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 14px }
.rat-ctl-grid button { min-height: 42px }
.rat-ctl-cmd { display: flex; gap: 8px; padding: 0 14px 14px }
.rat-ctl-cmd input { flex: 1 }

/* файловый менеджер */
.rat-files-box { width: min(94vw, 720px) }
.rat-files-path { display: flex; gap: 8px; padding: 10px 14px }
.rat-files-path input { flex: 1 }
.rat-files-table { width: 100% }
.rat-files-table td { cursor: pointer }
.rat-files-table tr:hover td { background: #343b3fbf }
.rat-files-stat { color: #ff8a75 }

.rat-minilog { position: fixed; left: 18px; bottom: 18px; z-index: 1150; width: min(42vw, 540px); max-height: 240px; overflow: auto; padding: 10px 12px; font: 12px/1.5 Consolas, monospace; color: #d9dfec; background: #0f0e10ee; border: 1px solid #ffffff2b; border-radius: 7px; white-space: pre-wrap; overflow-wrap: anywhere }
