/* Remote Console — design tokens, components, layout.
   Visual language of the Morvax dashboard (morvax.morvi.ru, public/assets/css/dashboard/style.css):
   the same palette, sidebar + cards, 12px buttons, 16px cards, 20px dialogs, orange #e45c01.
   Dark is the default; light follows the system unless the user picked a theme (html[data-theme]).
   Where a Morvax colour fails WCAG AA for text it is shifted just enough (noted next to the token). */

:root {
  /* surfaces (Morvax --bg / --sidebar / --card / --hover / --border) */
  --bg: #121212;
  --sidebar: #1a1a1a;
  --surface: #1e1e1e;
  --surface-2: #252525;
  --surface-3: #2d2d2d;
  --input-bg: rgba(255, 255, 255, .07);
  --border: #333333;
  --border-strong: #474747;
  --overlay: rgba(0, 0, 0, .78);
  --scroll-thumb: rgba(255, 255, 255, .15);
  /* text (Morvax --text; --muted made opaque and AA on every surface) */
  --text: #e0e0e0;
  --text-2: #b5b5b5;
  --text-3: #959595;
  /* brand: DeployHUB modern tech blue */
  --primary: #3b82f6;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;
  --accent-text: #60a5fa;
  --accent-soft: rgba(59, 130, 246, .16);
  --accent-border: rgba(59, 130, 246, .38);
  --ring: #3b82f6;
  /* status (Morvax --success / --danger; text variants lifted for AA on dark) */
  --ok: #32b45a;
  --warn: #f5b83d;
  --danger: #f26b6b;
  --danger-fill: #cf3838;
  --danger-soft: rgba(207, 56, 56, .16);
  /* type tint (SSH / VNC / RDP / Hyper-V) */
  --t-ssh: #34d399;
  --t-vnc: #fbbf24;
  --t-rdp: #60a5fa;
  --t-hyperv: #c084fc;
  --t-agent: #2dd4bf;
  /* scale (Morvax: inputs 10px, buttons/nav 12px, cards 16px, dialogs 20px) */
  --r-sm: 8px;
  --r-input: 10px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 5px 15px rgba(0, 0, 0, .3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  --ease: cubic-bezier(.2, .7, .2, 1);
  /* Morvax: 'Inter', 'Segoe UI', sans-serif. No web font is shipped (the CSP allows fonts only from
     this origin): Inter when installed, otherwise the system UI font. */
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f6f8; --sidebar: #ffffff; --surface: #ffffff; --surface-2: #f8f9fa; --surface-3: #e9ecef;
    --input-bg: #f1f3f5; --border: #dee2e6; --border-strong: #ced4da; --overlay: rgba(33, 37, 41, .55);
    --scroll-thumb: rgba(0, 0, 0, .2);
    --text: #212529; --text-2: #495057; --text-3: #636b74;
    --accent-text: #1d4ed8; --accent-soft: rgba(37, 99, 235, .12); --accent-border: rgba(37, 99, 235, .32); --ring: #2563eb;
    --ok: #1e7e34; --warn: #9a6100; --danger: #c82333; --danger-soft: rgba(207, 56, 56, .10);
    --t-ssh: #0f8a5f; --t-vnc: #a16207; --t-rdp: #1d5fd0; --t-hyperv: #7e3fd0; --t-agent: #0d8f80;
    --shadow-sm: 0 1px 2px rgba(33, 37, 41, .08);
    --shadow-md: 0 5px 15px rgba(33, 37, 41, .08);
    --shadow-lg: 0 20px 50px rgba(33, 37, 41, .18);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f6f8; --sidebar: #ffffff; --surface: #ffffff; --surface-2: #f8f9fa; --surface-3: #e9ecef;
  --input-bg: #f1f3f5; --border: #dee2e6; --border-strong: #ced4da; --overlay: rgba(33, 37, 41, .55);
  --scroll-thumb: rgba(0, 0, 0, .2);
  --text: #212529; --text-2: #495057; --text-3: #636b74;
  --accent-text: #1d4ed8; --accent-soft: rgba(37, 99, 235, .12); --accent-border: rgba(37, 99, 235, .32); --ring: #2563eb;
  --ok: #1e7e34; --warn: #9a6100; --danger: #c82333; --danger-soft: rgba(207, 56, 56, .10);
  --t-ssh: #0f8a5f; --t-vnc: #a16207; --t-rdp: #1d5fd0; --t-hyperv: #7e3fd0; --t-agent: #0d8f80;
  --shadow-sm: 0 1px 2px rgba(33, 37, 41, .08);
  --shadow-md: 0 5px 15px rgba(33, 37, 41, .08);
  --shadow-lg: 0 20px 50px rgba(33, 37, 41, .18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a.btn { text-decoration: none; color: var(--text); }
a.btn-primary { color: var(--accent-ink); }
::selection { background: var(--accent-soft); }
/* thin scrollbars, orange on hover (Morvax) */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.ico {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.grow { flex: 1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 16px; border-radius: var(--r-md);
  border: 1px solid var(--border); background: transparent; color: var(--text);
  font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn-primary:hover:not(:disabled), .btn-danger:hover:not(:disabled) { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: var(--accent); border-color: transparent; color: var(--accent-ink);
  box-shadow: 0 4px 12px rgba(228, 92, 1, .22);
}
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--text); }
.btn-icon { width: 38px; padding: 0; }
.btn-lg { min-height: 46px; font-size: 15px; border-radius: var(--r-md); }
.btn-block { width: 100%; }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.btn:focus-visible, .input:focus-visible { outline-offset: 1px; }

/* tooltips for toolbar buttons */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; z-index: 30; top: calc(100% + 8px); right: 0;
  padding: 6px 10px; border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
  font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none;
  opacity: 0; transform: translateY(-3px); transition: opacity .12s var(--ease) .25s, transform .12s var(--ease) .25s;
}
[data-tip][data-tip-pos="top"]::after { top: auto; bottom: calc(100% + 8px); right: auto; left: 0; transform: translateY(3px); }
@media (hover: hover) {
  [data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: none; }
}

/* ---------- form ---------- */
label { display: block; margin: 0 0 6px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.input {
  width: 100%; min-height: 42px; padding: 9px 12px; font: inherit; color: var(--text);
  background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--r-input);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.input::placeholder { color: var(--text-3); }
.input:hover { border-color: var(--border-strong); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input option { background: var(--surface); color: var(--text); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.5; }
.field { position: relative; }
.field .input { padding-left: 38px; padding-right: 42px; min-height: 46px; }
.field-ico { position: absolute; left: 13px; top: 14px; color: var(--text-3); pointer-events: none; }
.field-btn { position: absolute; right: 4px; top: 4px; width: 38px; min-height: 38px; }
.form-error {
  min-height: 20px; margin: 10px 0 14px; color: var(--danger); font-size: 13px;
}

/* ---------- brand mark ---------- */
.logo {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-lg); color: #fff;
  background: var(--primary); box-shadow: 0 6px 18px rgba(228, 92, 1, .28);
}
.logo .ico { width: 26px; height: 26px; }
.logo-sm { width: 34px; height: 34px; border-radius: 10px; box-shadow: none; }
.logo-sm .ico { width: 17px; height: 17px; }

/* ---------- login ---------- */
#login { position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 20px; overflow: hidden; }
.login-fox, .login-brand-logo { display: block; width: 88px; height: 88px; margin: 0 auto 16px; }
.brand-fox, .brand-logo { flex: none; display: block; width: 34px; height: 34px; }
.login-card {
  position: relative; width: 100%; max-width: 410px; padding: 36px 32px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
  animation: rise .35s var(--ease) both;
}
.login-card .logo { margin-bottom: 20px; }
.login-card h1 { text-align: center; margin-bottom: 22px; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.login-card .lead { margin: 6px 0 26px; color: var(--text-2); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.shake { animation: shake .35s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------- layout ---------- */
#app { height: 100%; display: grid; grid-template-columns: 280px minmax(0, 1fr); }
#sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--sidebar); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 20px 14px 16px 20px; }
.brand-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-weight: 700; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { color: var(--text-3); font-size: 12px; font-weight: 500; }
.brand .btn-icon { flex: none; border-radius: 50%; }
.brand [data-tip]::after { right: auto; left: 50%; transform: translate(-50%, -3px); }
@media (hover: hover) {
  .brand [data-tip]:hover::after, .brand [data-tip]:focus-visible::after { transform: translate(-50%, 0); }
}

.search { position: relative; padding: 0 16px 10px; }
.search .input { padding-left: 38px; padding-right: 12px; min-height: 40px; }
.search-ico { position: absolute; left: 29px; top: 11px; color: var(--text-3); pointer-events: none; }

#machines { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 14px; }
.group-title {
  margin: 16px 12px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
}
.group-title:first-child { margin-top: 6px; }
.empty-note { margin: 16px 12px; color: var(--text-3); font-size: 13px; line-height: 1.5; }
.empty-note.error { color: var(--danger); }

.m-icon {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
  color: var(--tint, var(--text-2));
  background: color-mix(in srgb, var(--tint, var(--text-2)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint, var(--text-2)) 22%, transparent);
}
[data-type="ssh"] { --tint: var(--t-ssh); }
[data-type="vnc"] { --tint: var(--t-vnc); }
[data-type="rdp"] { --tint: var(--t-rdp); }
[data-type="hyperv"] { --tint: var(--t-hyperv); }
[data-type="agent"] { --tint: var(--t-agent); }

.machine {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%; margin: 2px 0; padding: 7px 10px 7px 8px;
  text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--r-md); cursor: pointer;
  transition: background .15s var(--ease);
}
.machine:hover { background: var(--surface-3); }
/* Morvax active nav item: the hover fill, plus an orange marker */
.machine.active { background: var(--surface-3); }
.machine.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.machine.active .name { font-weight: 650; }
.machine .m-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.machine .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine .sub { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.machine .sub.busy { color: var(--warn); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.dot[data-state="connecting"] { background: var(--warn); animation: pulse 1.2s ease-in-out infinite; }
.dot[data-state="busy"], .dot[data-state="waiting_takeover"] { background: var(--warn); }
.dot[data-state="connected"] { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.dot[data-state="error"], .dot[data-state="closed"] { background: var(--danger); }
.dot[data-state="ended"] { background: var(--text-3); }
.dot[data-online="on"] { background: var(--ok); }
.dot[data-online="off"] { background: var(--text-3); opacity: .55; }
.machine.offline .m-icon, .machine.offline .name { opacity: .5; }
@keyframes pulse { 50% { opacity: .35; } }

.sidebar-foot { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
.sidebar-foot .btn-ghost.grow { justify-content: flex-start; }

main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#topbar {
  display: flex; align-items: center; gap: 8px; min-height: 56px; padding: 8px 14px;
  background: var(--sidebar); border-bottom: 1px solid var(--border);
}
#menu { display: none; }
@media (min-width: 761px) {
  body.sidebar-collapsed #app { grid-template-columns: minmax(0, 1fr); }
  body.sidebar-collapsed #sidebar { display: none; }
  body.sidebar-collapsed #menu { display: inline-flex; }
}
#tabs { flex: 1; display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
#tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 6px 0 12px; max-width: 220px;
  border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--text-2);
  font-weight: 500; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.tab:hover { background: var(--surface-3); color: var(--text); }
.tab.active { background: var(--surface-3); border-color: var(--border); color: var(--text); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--primary); }
.tab .tab-name { overflow: hidden; text-overflow: ellipsis; }
.tab .x {
  display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-3); cursor: pointer;
}
.tab .x .ico { width: 14px; height: 14px; }
.tab .x:hover { background: var(--danger-soft); color: var(--danger); }
#tools { display: flex; align-items: center; gap: 2px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--border); }
.power-tools { display: inline-flex; align-items: center; gap: 2px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--border); }
.power-tools .pw-one { display: none; }
.power-tools [data-action="shutdown"]:hover, .power-tools [data-action="reboot"]:hover { color: var(--danger); background: var(--danger-soft); }

/* ---------- stage / home ---------- */
#stage { position: relative; flex: 1; min-height: 0; background: #000; }
#home { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: var(--bg); }
/* empty state as a Morvax card */
.home-empty {
  display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(420px, 100%); padding: 32px 28px; text-align: center;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.home-ico { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; color: var(--accent-text); background: var(--accent-soft); }
.home-ico .ico { width: 26px; height: 26px; }
#home-lead { font-size: 15px; line-height: 1.55; }
#home-open { display: none; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  color: var(--tint, var(--text-2)); background: color-mix(in srgb, var(--tint, var(--text-2)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--tint, var(--text-2)) 30%, transparent);
}
.skeleton { height: 138px; border-radius: var(--r-lg); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- views ---------- */
.view { position: absolute; inset: 0; display: none; background: #000; }
.view.active { display: block; }
.holder { position: absolute; inset: 0; }

.term { position: absolute; inset: 0; padding: 10px 6px 6px 12px; background: #0b0d11; }
.term .xterm { height: 100%; }
.term .xterm-viewport { background-color: #0b0d11 !important; }

.vnc { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; outline: none; }
.vnc.actual { display: block; overflow: auto; }
.vnc-viewport {
  position: relative;
  overflow: hidden;
  display: block;
}
.vnc-canvas {
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}
.vnc.bell { box-shadow: inset 0 0 0 3px var(--accent-text); }

.badge-mini {
  position: absolute;
  top: 1px;
  right: 1px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  pointer-events: none;
}
.option-selected {
  border-color: var(--accent-border) !important;
  background: var(--accent-soft) !important;
}
.row-wake-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  opacity: .75;
  transition: opacity .15s, color .15s;
}
.row-wake-btn:hover {
  opacity: 1;
  color: var(--accent);
}

/* ---------- file transfer (docs/protocol-files.md) ---------- */
.drop-zone {
  position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; padding: 20px; pointer-events: none;
  background: rgba(0, 0, 0, .55); animation: fade .12s var(--ease) both;
}
.drop-zone .drop-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(440px, 100%); padding: 34px 26px; text-align: center;
  color: var(--text); background: var(--surface); border: 2px dashed var(--accent-border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.drop-zone .drop-ico { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: var(--accent-text); background: var(--accent-soft); }
.drop-zone .drop-ico .ico { width: 26px; height: 26px; }
.drop-zone .drop-title { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.drop-zone .drop-hint { color: var(--text-2); font-size: 13px; line-height: 1.5; }
.drop-zone.blocked .drop-card { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.drop-zone.blocked .drop-ico { color: var(--danger); background: var(--danger-soft); }

.xfer {
  position: absolute; right: 16px; bottom: 16px; z-index: 4; width: min(380px, calc(100% - 32px)); max-height: min(60%, 420px);
  display: flex; flex-direction: column; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-lg); overflow: hidden; animation: fade .15s var(--ease) both;
}
.xfer-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; border-bottom: 1px solid var(--border); }
.xfer-head .xfer-title { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xfer-list { overflow-y: auto; padding: 4px 0; }
.xfer-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 2px 10px; align-items: center; padding: 8px 8px 8px 14px; }
.xfer-row + .xfer-row { border-top: 1px solid var(--border); }
.xfer-row > .ico { width: 18px; height: 18px; color: var(--text-3); grid-row: span 2; }
.xfer-row[data-state="done"] > .ico { color: var(--ok); }
.xfer-row[data-state="error"] > .ico, .xfer-row[data-state="cancelled"] > .ico { color: var(--danger); }
.xfer-name { min-width: 0; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xfer-meta { grid-column: 2; min-width: 0; color: var(--text-2); font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.xfer-row[data-state="error"] .xfer-meta { color: var(--danger); }
.xfer-row[data-state="done"] .xfer-meta { color: var(--ok); }
.xfer-bar { grid-column: 2; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; }
.xfer-bar > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s linear; }
.xfer-row[data-state="waiting"] .xfer-bar > span, .xfer-row[data-state="verifying"] .xfer-bar > span { opacity: .55; }
.xfer-row .x { grid-row: span 2; }
#btn-upload.is-disabled { opacity: .45; }

/* ---------- connection status ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 20px;
  background: rgba(0, 0, 0, .74); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  animation: fade .18s var(--ease) both;
}
.overlay .msg {
  display: flex; flex-direction: column; align-items: center; gap: 4px; width: min(420px, 100%); padding: 28px 28px 24px; text-align: center;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-lg);
}
.status-ico {
  position: relative; display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 12px; border-radius: 50%;
  color: var(--danger); background: var(--danger-soft);
}
.status-ico .ico { width: 24px; height: 24px; }
.overlay[data-state="connecting"] .status-ico { background: var(--accent-soft); color: var(--accent-text); }
.overlay[data-state="closed"] .status-ico { background: var(--surface-3); color: var(--text-2); }
.overlay[data-state="busy"] .status-ico,
.overlay[data-state="waiting_takeover"] .status-ico { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.spinner {
  width: 24px; height: 24px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--accent-text) 25%, transparent);
  border-top-color: var(--accent-text); animation: spin .8s linear infinite;
}
.overlay .title { font-size: 17px; font-weight: 600; }
.overlay .detail { color: var(--text-2); font-size: 13.5px; line-height: 1.55; overflow-wrap: anywhere; }
.overlay .machine-name { color: var(--text-3); font-size: 12.5px; }
.overlay .actions { display: flex; gap: 8px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.overlay.bar {
  inset: auto 0 0 0; display: flex; align-items: center; justify-content: center; padding: 10px 14px;
  background: var(--surface); border-top: 1px solid var(--border); backdrop-filter: none; animation: none;
}
.overlay.bar .msg { flex-direction: row; gap: 14px; width: auto; padding: 0; border: 0; box-shadow: none; background: transparent; }
.overlay.bar .status-ico, .overlay.bar .detail, .overlay.bar .machine-name { display: none; }
.overlay.bar .actions { margin: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- dialog / toast ---------- */
#clip-panel {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: var(--overlay); animation: fade .15s var(--ease) both;
}
.dialog {
  width: 100%; max-width: 540px; padding: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); animation: rise .2s var(--ease) both;
}
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.dialog-head h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }

#toasts { position: fixed; z-index: 50; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: min(460px, calc(100vw - 32px)); padding: 12px 16px; border-radius: var(--r-md);
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--primary);
  font-weight: 500; box-shadow: var(--shadow-lg); animation: rise .2s var(--ease) both;
}
.toast .ico { width: 18px; height: 18px; color: var(--ok); }

#scrim { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  #tools .lbl { display: none; }
  #tools .btn { width: 38px; padding: 0; }
}
@media (max-width: 760px) {
  #home-open { display: inline-flex; }
  #app { grid-template-columns: minmax(0, 1fr); }
  #sidebar {
    position: fixed; z-index: 20; inset: 0 auto 0 0; width: min(86vw, 320px);
    padding-top: env(safe-area-inset-top); transform: translateX(-102%); transition: transform .22s var(--ease);
  }
  body.menu-open #sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.menu-open #scrim { display: block; position: fixed; inset: 0; z-index: 15; background: var(--overlay); }
  #menu { display: inline-flex; }
  #topbar { padding-left: 8px; padding-right: 8px; }
  .btn { min-height: 40px; }
  .btn-icon, #tools .btn { width: 40px; }
  .tab { height: 40px; }
  .brand { padding-top: 16px; }
  .login-card { padding: 28px 22px 22px; }
  /* one «Питание» button instead of four: the strip is narrow */
  .power-tools .pw-each { display: none; }
  .power-tools .pw-one { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
}

/* =====================================================================
   Accounts, security, admin — built on the tokens and components above.
   ===================================================================== */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint { margin: 6px 0 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; }
.form-hint { margin: 8px 0 0; color: var(--text-3); font-size: 12.5px; line-height: 1.5; text-align: center; }
.form-hint:empty, .form-error:empty { margin: 0; min-height: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.fld label { margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-end { justify-content: flex-end; }
.btn-sm { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-input); }
.btn-sm .ico { width: 15px; height: 15px; }
.input-sm { min-height: 34px; padding: 4px 10px; width: auto; }
.btn-danger { background: var(--danger-fill); border-color: transparent; color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger-fill) 85%, black); border-color: transparent; }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 2px; border: 0; background: none;
  color: var(--accent-text); font-weight: 500; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: transparent;
  transition: text-decoration-color .15s var(--ease);
}
.btn-link:hover { text-decoration-color: currentColor; }
.btn-link .ico { width: 15px; height: 15px; }
a.btn { text-decoration: none; }
.input-code { font: 500 20px/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .25em; text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* checkbox / switch */
.check { display: inline-flex; align-items: center; gap: 9px; margin: 0; color: var(--text); font-size: 14px; font-weight: 450; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; color: var(--text); font-size: 14px; font-weight: 450; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px; background: var(--border-strong); transition: background .15s var(--ease); }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s var(--ease); }
.switch input:checked + .switch-ui { background: var(--primary); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--ring); outline-offset: 2px; }
.switch input:disabled + .switch-ui { opacity: .5; }

/* password strength */
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.strength span { height: 4px; border-radius: 2px; background: var(--border); transition: background .2s var(--ease); }
.strength[data-score="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-score="2"] span:nth-child(-n+2) { background: var(--warn); }
.strength[data-score="3"] span:nth-child(-n+3) { background: var(--ok); }
.strength[data-score="4"] span { background: var(--ok); }

/* badges & pills */
.badge-ok { --tint: var(--ok); }
.badge-warn { --tint: var(--warn); }
.badge-danger { --tint: var(--danger); }
.badge-admin { --tint: var(--t-hyperv); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }
.pill .ico { width: 15px; height: 15px; }

/* ---------- login & limited ---------- */
.login-card-wide { max-width: 520px; }
.login-step { text-align: left; }
.login-form { margin-top: 2px; }
.login-form label { margin-top: 12px; }
.login-form .btn-block { margin-top: 18px; }
.login-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.step-count { margin-bottom: 4px; color: var(--accent-text); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.login-card .options { margin-top: 20px; }
.login-card .stack { margin-top: 20px; text-align: left; }

/* ---------- option cards (MFA chooser) ---------- */
.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 14px; width: 100%; padding: 14px 16px; text-align: left; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); color: var(--text);
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.option:hover { border-color: var(--accent-border); background: var(--surface-3); }
.option:disabled { opacity: .55; cursor: not-allowed; }
.option-primary { border-color: var(--accent-border); background: var(--accent-soft); }
.option-ico { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: var(--r-md); color: var(--accent-text); background: var(--accent-soft); }
.option-ico .ico { width: 20px; height: 20px; }
.option-sm { align-items: center; padding: 10px 14px; }
.option-sm .option-ico { width: 34px; height: 34px; border-radius: 10px; }
.option-danger .option-ico { color: var(--danger); background: var(--danger-soft); }
.option-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.option-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.option-sub { color: var(--text-2); font-size: 13px; line-height: 1.5; }
.option-radio { align-items: flex-start; }
.option-radio input { width: 18px; height: 18px; margin: 11px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.option-radio:has(input:checked) { border-color: var(--accent-border); background: var(--accent-soft); }
.option-radio:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
/* admin → Компьютеры: the gateway card above the PC table */
.gw-card { padding: 14px 16px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; gap: 12px; }
.gw-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gw-head .list-title, .gw-head .list-sub { display: block; }
.gw-head .badge { margin-left: auto; }
.gw-card .facts code { font-size: 12.5px; overflow-wrap: anywhere; }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.fp { display: block; font-size: 12px; letter-spacing: .04em; }
.check-sm { font-size: 12.5px; }

/* ---------- modal dialogs ---------- */
.modal {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; overflow-y: auto;
  background: var(--overlay); animation: fade .15s var(--ease) both;
}
.modal .dialog { max-height: calc(100dvh - 32px); min-width: 0; display: flex; flex-direction: column; outline: none; }
.dialog-sm { max-width: 440px; }
.dialog-md { max-width: 560px; }
.dialog-lg { max-width: 760px; }
.dialog-page { max-width: 1100px; width: 100%; height: calc(100dvh - 32px); }
.dialog-body { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: 2px; margin: -2px; }
.dialog-text { color: var(--text-2); line-height: 1.55; margin-bottom: 4px; }
.dialog .form-error { margin: 0; }
.dialog .row { margin-top: 10px; }
.dialog .row + .check { margin-top: 14px; }
body.has-dialog { overflow: hidden; }

/* in-page Morvi ID confirmation (stepup.js): title, key mark or code field, a link and «Отмена» */
.dialog.stepup { max-width: 340px; }
.stepup .dialog-head { margin-bottom: 12px; }
.stepup-key { display: grid; place-items: center; width: 56px; height: 56px; margin: 4px auto 6px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); }
.stepup-key .ico { width: 26px; height: 26px; }
.stepup .input-code { font-size: 24px; letter-spacing: .35em; padding-left: .35em; }
.stepup .form-error:not(:empty) { margin-top: 8px; }
.stepup-actions { justify-content: space-between; align-items: center; }
.stepup-actions .btn { margin-left: auto; }
.stepup .input-code::placeholder { color: var(--text-3); opacity: .55; }

/* ---------- sections, profile, lists ---------- */
.sect { padding: 16px 0; border-top: 1px solid var(--border); }
.sect:first-child { padding-top: 4px; border-top: 0; }
.sect h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.sect-lead { margin: 0 0 12px; color: var(--text-2); font-size: 13.5px; line-height: 1.55; }
.sect .switch { margin-top: 4px; }
.profile { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.avatar {
  position: relative; overflow: hidden;
  display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
/* Morvi ID profile picture over the initials (they stay underneath as the fallback). */
.avatar-img {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  object-fit: cover; border-radius: inherit; user-select: none; -webkit-user-drag: none;
}
.avatar.has-pic { color: transparent; background: var(--surface-3); }
.avatar-lg { width: 52px; height: 52px; font-size: 18px; }
.profile-name { font-size: 18px; font-weight: 600; }
.profile-sub { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-3); font-size: 13px; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); font-size: 13.5px; }
.facts li { display: flex; align-items: flex-start; gap: 8px; }
.facts .ico { width: 16px; height: 16px; margin-top: 2px; color: var(--text-3); }
.list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.list-ico { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; color: var(--accent-text); background: var(--accent-soft); }
.list-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; }
.list-sub { color: var(--text-3); font-size: 12.5px; }
.list-actions { display: flex; gap: 2px; flex: none; }
.list-empty { padding: 12px; color: var(--text-3); font-size: 13px; line-height: 1.5; border: 1px dashed var(--border-strong); border-radius: var(--r-md); }

/* secrets, codes */
.secret-box { padding: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.secret-box.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 7%, var(--surface-2)); }
.secret-box .row { margin-top: 10px; }
.secret { display: block; padding: 10px 12px; font: 500 15px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; overflow-wrap: anywhere; user-select: all; background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--r-input); }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; margin: 0 0 12px; padding: 14px 14px 14px 36px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.codes li { padding-left: 4px; color: var(--text-3); font-size: 12px; }
.codes code { display: block; padding: 2px 0; color: var(--text); font: 500 15px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; user-select: all; }
.steps { margin: 0; padding-left: 20px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.steps li + li { margin-top: 4px; }

/* ---------- user menu (sidebar footer) ---------- */
.sidebar-foot { position: relative; padding: 8px; }
.user-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-md); cursor: pointer; transition: background .12s var(--ease);
}
.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface-3); }
.user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .chev { color: var(--text-3); transform: rotate(180deg); transition: transform .15s var(--ease); }
.user-btn[aria-expanded="true"] .chev { transform: none; }
.menu {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% - 2px); z-index: 25; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); animation: rise .15s var(--ease) both;
}
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px; text-align: left;
  background: transparent; border: 0; border-radius: var(--r-input); color: var(--text); cursor: pointer; font-weight: 500;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-3); outline: none; }
.menu-item .ico { color: var(--text-2); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }

/* revoked state */
.overlay[data-state="revoked"] .status-ico { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.toast-alert { border-left-color: var(--danger-fill); }
.toast-alert .ico { color: var(--danger); }

/* ---------- admin console ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tab-btn {
  position: relative; padding: 8px 14px 10px; background: transparent; border: 0; color: var(--text-2); font-weight: 550; cursor: pointer; white-space: nowrap;
}
.tab-btn::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: transparent; }
.tab-btn:hover { color: var(--text); }
.tab-btn:focus-visible { outline-offset: -2px; border-radius: var(--r-sm); } /* .tabs scrolls: an outer ring would be clipped */
.tab-btn.active { color: var(--text); }
.tab-btn.active::after { background: var(--primary); }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .hint { margin: 0 0 0 auto; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { padding: 12px 14px; text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); background: transparent; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.muted td { opacity: .6; }
.table tbody tr:hover td { background: var(--surface-2); }
.td-actions { text-align: right; white-space: nowrap; }
.td-actions .btn-icon.btn-sm { width: 30px; }
.cell-main { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.cell-main .list-title, .cell-main .list-sub { display: block; }
.secret.cmd { letter-spacing: 0; font-size: 12.5px; user-select: text; }
.secret-box .hint { margin-top: 10px; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
.user-cell .list-title { display: block; }
.user-cell .list-sub { display: block; }
.mfa { display: inline-flex; gap: 8px; }
.mfa-ico { display: inline-flex; align-items: center; gap: 3px; color: var(--text-3); font-size: 12px; font-weight: 600; opacity: .5; }
.mfa-ico.on { color: var(--ok); opacity: 1; }
.mfa-ico .ico { width: 16px; height: 16px; }

/* grants editor */
.grants { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.grant-row { display: grid; grid-template-columns: 150px minmax(160px, 1fr) 150px auto 38px; gap: 8px; align-items: end; padding: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
.grant-cell { min-width: 0; }
.grant-cell .input { min-height: 38px; padding: 6px 10px; }
.cell-label { display: block; margin-bottom: 4px; color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.grant-row .check { min-height: 38px; }
.grant-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; }
.grant-checks .check { min-height: 30px; }
.grants-editor .hint strong { color: var(--text-2); }

/* audit */
.audit { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.audit-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.audit-row:last-child { border-bottom: 0; }
.audit-dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.audit-row.failed .audit-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.audit-row.failed { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.audit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.audit-type { font-weight: 600; }
.audit-row.failed .audit-type { color: var(--danger); }
.audit-detail { color: var(--text-2); font-size: 12.5px; overflow-wrap: anywhere; }
.audit-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; color: var(--text-3); font-size: 12px; text-align: right; }
.audit-meta code { font-size: 11.5px; }
.audit-abs { font-size: 11px; }
.skeleton-sm { height: 80px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .modal { padding: 0; place-items: stretch; }
  .modal .dialog { max-width: none; max-height: none; height: 100dvh; border-radius: 0; border: 0; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top)); }
  .modal:has(> .dialog.stepup) { padding: 16px; place-items: center; }
  .modal .dialog.stepup { height: auto; max-width: 340px; border-radius: var(--r-xl); border: 1px solid var(--border); padding: 20px; }
  .grid-2 { grid-template-columns: 1fr; }
  .codes { grid-template-columns: 1fr; }
  .list-item { flex-wrap: wrap; }
  .list-actions { width: 100%; justify-content: flex-end; }
  .list-actions .lbl { display: none; }
  .grant-row { grid-template-columns: 1fr 1fr; }
  .grant-target, .grant-checks { grid-column: 1 / -1; }
  .audit-row { flex-wrap: wrap; }
  .audit-meta { width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .audit-abs { display: none; }
  /* tables collapse to cards; headers come from data-th */
  .table-wrap { border: 0; border-radius: 0; background: transparent; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { margin-bottom: 10px; padding: 6px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); }
  .table td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
  .table td:last-child { border-bottom: 0; }
  .table td[data-th]::before { content: attr(data-th); flex: none; color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
  .table tbody tr:hover td { background: transparent; }
  .td-actions { justify-content: flex-end; }
  .toolbar .hint { margin-left: 0; width: 100%; }
}
.login-card .lead:empty { display: none; }
.badges { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* RDP session through the agent: a second, indented entry under the PC (docs/rdp-via-agent.md) */
.machine.machine-mode { padding-left: 28px; }
.machine.machine-mode .name { font-weight: 500; }
.btn-icon.btn-on { color: var(--accent-text); }

/* Sign-in error as a callout: it must stay visible in both themes, e.g. the Morvi ID not_linked
   message right under the «Войти через Morvi ID» button. */
.login-card .form-error:not(:empty) {
  margin: 14px 0 0; padding: 10px 12px; min-height: 0;
  color: var(--danger); background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger-fill) 42%, transparent); border-left-width: 4px; border-radius: var(--r-input);
  font-size: 13.5px; font-weight: 500; line-height: 1.5;
}
