/* RMMZit console — MaxZit brand: indigo #4f46e5 / #818cf8, dark sidebar #0f172a */
:root {
  --bg: #f4f6fb; --panel: #ffffff; --panel-2: #f8fafc; --text: #0f172a; --muted: #64748b; --line: #e5e9f2; --line-2: #d6dce8;
  --accent: #4f46e5; --accent-2: #6366f1; --accent-soft: #eef2ff; --on-accent: #ffffff;
  --side: #0f172a; --side-text: #cbd5e1; --side-muted: #64748b; --side-hover: #1e293b; --side-on: #312e81;
  --ok: #047857; --ok-bg: #d1fae5; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 8px rgba(15, 23, 42, .05);
  --radius: 12px; --radius-sm: 8px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --panel: #121829; --panel-2: #0f1524; --text: #e2e8f0; --muted: #8b97ad; --line: #1f2940; --line-2: #2b3755;
    --accent: #818cf8; --accent-2: #6366f1; --accent-soft: #1e1b4b; --on-accent: #0b1020;
    --side: #080c18; --side-text: #cbd5e1; --side-muted: #5b6886; --side-hover: #141b2e; --side-on: #24215a;
    --ok: #34d399; --ok-bg: #062f24; --warn: #fbbf24; --warn-bg: #33250a; --bad: #f87171; --bad-bg: #3a1214;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1020; --panel: #121829; --panel-2: #0f1524; --text: #e2e8f0; --muted: #8b97ad; --line: #1f2940; --line-2: #2b3755;
  --accent: #818cf8; --accent-2: #6366f1; --accent-soft: #1e1b4b; --on-accent: #0b1020;
  --side: #080c18; --side-text: #cbd5e1; --side-muted: #5b6886; --side-hover: #141b2e; --side-on: #24215a;
  --ok: #34d399; --ok-bg: #062f24; --warn: #fbbf24; --warn-bg: #33250a; --bad: #f87171; --bad-bg: #3a1214;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.55 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -4px; }
.logo { width: 30px; height: 30px; flex: none; }

/* ---- shell */
.side { position: fixed; inset: 0 auto 0 0; width: 240px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 18px 12px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand b, .guest-brand b { color: #a5b4fc; font-weight: 650; }
.side nav { display: grid; gap: 2px; }
.side nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: var(--side-text); font-weight: 500; }
.side nav a .ic { color: var(--side-muted); }
.side nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.side nav a.on { background: var(--side-on); color: #fff; }
.side nav a.on .ic { color: #a5b4fc; }
.navlabel { margin: 16px 12px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--side-muted); }
.side-foot { margin-top: auto; padding: 12px; font-size: 12px; color: var(--side-muted); line-height: 1.6; }
.side-foot .ic { width: 13px; height: 13px; vertical-align: -2px; }
.side-foot .support-link { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; padding: 8px 10px; border-radius: 8px; background: linear-gradient(135deg, #fcd34d, #f59e0b); color: #1c1203; font-size: 13px; font-weight: 650; box-shadow: 0 1px 0 rgba(255,255,255,.25) inset; }
.side-foot .support-link:hover { background: linear-gradient(135deg, #fde68a, #fbbf24); text-decoration: none; }
.side-foot .support-link .ic { width: 16px; height: 16px; color: #1c1203; }
.side-foot .bug-link { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; padding: 7px 10px; border-radius: 8px; color: var(--side-text); font-size: 13px; font-weight: 500; }
.side-foot .bug-link:hover { background: var(--side-hover); text-decoration: none; }
.side-foot .bug-link .ic { width: 16px; height: 16px; color: var(--side-muted); }
#clock { font-variant-numeric: tabular-nums; }
.scrim { display: none; }

.shell { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; height: 60px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.crumb { font-weight: 600; color: var(--muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user { display: flex; align-items: center; gap: 10px; margin: 0; }
.me { display: flex; align-items: center; gap: 10px; color: var(--text); }
.me:hover { text-decoration: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent-2), #a855f7); color: #fff; font-weight: 700; font-size: 13px; flex: none; }
.uname { display: grid; font-weight: 600; line-height: 1.2; }
.uname small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.iconbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; padding: 0; }
.iconbtn:hover { background: var(--panel); border-color: var(--line); color: var(--text); }
.iconbtn.menu { display: none; }
.langs { display: flex; gap: 2px; margin-right: 6px; }
.langs select { width: auto; min-width: 0; height: 36px; padding: 0 30px 0 12px; font-size: 13.5px; background-color: transparent; color: var(--text); border-color: var(--line); }
.topbar .user button.ghost { height: 36px; padding: 7px 10px; font-size: 13px; border-color: transparent; }
.topbar .user button.ghost:hover { background: var(--panel); color: var(--text); border-color: var(--line); }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px; flex: 1; }

/* ---- typography */
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 20px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
h2 { font-size: 15px; font-weight: 650; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
h2 .ic { color: var(--accent); }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 16px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.back { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--panel-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
code.wrap, pre { overflow-wrap: anywhere; word-break: break-all; }
pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; white-space: pre-wrap; margin: 0 0 12px; }
pre.token { font-size: 14px; font-weight: 600; color: var(--accent); }

/* ---- panels & stats */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; box-shadow: var(--shadow); }
.panel.accent { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: color-mix(in srgb, var(--accent-soft) 55%, var(--panel)); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 16px 70px; box-shadow: var(--shadow); min-height: 84px; display: flex; flex-direction: column; justify-content: center; color: var(--text); }
a.stat:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.stat .si { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.stat .si .ic { width: 20px; height: 20px; }
.stat b { display: block; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.stat > span:last-child { color: var(--muted); font-size: 13px; }
.stat.ok .si { background: var(--ok-bg); color: var(--ok); }
.empty { display: grid; justify-items: center; gap: 8px; padding: 26px 12px; color: var(--muted); text-align: center; }
.empty .ic { width: 28px; height: 28px; opacity: .7; }
.empty p { margin: 0; }
.empty h1 { margin: 0; justify-content: center; color: var(--text); }
.steps, .tips { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* ---- tables */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; background: var(--panel-2); }
thead th:first-child { border-top-left-radius: 8px; }
thead th:last-child { border-top-right-radius: 8px; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { text-align: right; width: 1%; white-space: nowrap; }
td.detail { min-width: 220px; overflow-wrap: anywhere; }
td.ellipsis { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- badges & flash */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.warn-text { color: var(--warn); }
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500; }
.flash .ic { margin-top: 1px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.err { background: var(--bad-bg); color: var(--bad); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.info { background: var(--accent-soft); color: var(--accent); }

/* ---- forms */
form.stack { display: grid; gap: 16px; max-width: 720px; }
form.stack.wide { max-width: none; gap: 0; margin-bottom: 20px; }
form.stack { grid-template-columns: minmax(0, 1fr); }
form.stack.wide .panel > * + * { margin-top: 14px; }
form.stack.wide .panel > h2 + p { margin-top: -4px; }
form.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
form.row > input { flex: 1 1 200px; width: auto; }
form.row label.inline input { width: 110px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { min-height: 84px; font-family: var(--mono); font-size: 13px; resize: vertical; }
input.mono { font-family: var(--mono); }
select.narrow { width: auto; min-width: 7em; display: block; }
input.narrow { width: 7em; display: block; }
input.code { font-family: var(--mono); font-size: 18px; letter-spacing: .2em; max-width: 220px; }
label.check { display: flex; gap: 10px; align-items: center; font-weight: 500; }
label.check input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; padding: 0; }
fieldset.box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; gap: 12px; margin: 0; background: var(--panel-2); min-width: 0; }
fieldset.box legend { font-weight: 650; font-size: 13px; padding: 0 6px; }
.checks { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.checks > span { grid-column: 1 / -1; }

/* ---- buttons */
button, .btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { text-decoration: none; }
.primary { background: var(--accent); color: var(--on-accent); }
.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.secondary { background: var(--panel); color: var(--text); border-color: var(--line-2); }
.secondary:hover { border-color: var(--accent); color: var(--accent); }
.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.danger:hover { background: var(--bad-bg); }
.ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.ghost:hover { color: var(--text); border-color: var(--line-2); }
.sm { padding: 4px 10px; font-size: 12.5px; }
button.link { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 500; }
button.link:hover { color: var(--accent); text-decoration: underline; }

/* ---- settings tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-weight: 600; font-size: 13px; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.tabs a.on { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- settings with side tabs */
.settings { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; }
.sidetabs { position: sticky; top: 80px; display: grid; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.sidetabs a { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 9px; color: var(--text); font-weight: 600; }
.sidetabs a .ic { margin-top: 2px; color: var(--muted); flex: none; }
.sidetabs a span { display: grid; gap: 1px; }
.sidetabs a small { font-weight: 400; font-size: 12px; color: var(--muted); }
.sidetabs a:hover { background: var(--panel-2); text-decoration: none; }
.sidetabs a.on { background: var(--accent-soft); color: var(--accent); }
.sidetabs a.on .ic { color: var(--accent); }
.settings-body { min-width: 0; }
.settings-body > :first-child { margin-top: 0; }
@media (max-width: 900px) { .settings { grid-template-columns: 1fr; } .sidetabs { position: static; grid-auto-flow: column; overflow-x: auto; } .sidetabs a small { display: none; } .sidetabs a { white-space: nowrap; } }

/* ---- guest pages (setup, sign-in) */
body.guest { min-height: 100vh; background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%), var(--bg); }
.guest-main { max-width: 460px; padding: 48px 16px; }
.guest-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 650; margin-bottom: 22px; letter-spacing: -.01em; }
.guest-brand b { color: var(--accent); }
.guest-brand .logo { width: 36px; height: 36px; }
.guest-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 10px 30px rgba(15, 23, 42, .08); }
.guest-card h1 { font-size: 21px; }
.guest-card form.stack button.primary { width: 100%; }
.guest-foot { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.enroll { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin: 4px 0 18px; }
.qr { width: 180px; height: 180px; border-radius: 8px; border: 1px solid var(--line); flex: none; }
code.secret { font-size: 13px; overflow-wrap: anywhere; word-break: break-all; }
.codes { list-style: none; padding: 0; margin: 0 0 14px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.codes code { display: block; text-align: center; font-size: 14px; padding: 6px; }

/* ---- small screens */
@media (max-width: 900px) {
  .side { transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  .side.open + .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .45); z-index: 25; }
  .shell { margin-left: 0; }
  .iconbtn.menu { display: inline-grid; }
  .topbar { padding: 0 12px; gap: 6px; }
  .uname, .user button span { display: none; }
  main { padding: 20px 16px; }
  .panel { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .hide-sm { display: none; }
  .langs { margin-right: 0; }
  .langs select { padding: 0 24px 0 8px; }
}
@media (max-width: 420px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px 12px 12px 58px; min-height: 72px; }
  .stat .si { left: 10px; width: 36px; height: 36px; }
  .stat b { font-size: 22px; }
  .guest-card { padding: 20px; }
  .codes { grid-template-columns: 1fr; }
}

/* ---- devices */
.stat b.sm { font-size: 15px; letter-spacing: 0; line-height: 1.3; overflow-wrap: anywhere; }
.cards2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 0 20px; }
.disk + .disk { margin-top: 14px; }
.disk-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; }
.disk-free { margin-left: auto; color: var(--muted); font-size: 12.5px; }
progress.meter { width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--panel-2); overflow: hidden; appearance: none; -webkit-appearance: none; }
progress.meter::-webkit-progress-bar { background: var(--line); border-radius: 99px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 99px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
progress.meter.warn::-webkit-progress-value { background: var(--warn); }
progress.meter.warn::-moz-progress-bar { background: var(--warn); }
progress.meter.bad::-webkit-progress-value { background: var(--bad); }
progress.meter.bad::-moz-progress-bar { background: var(--bad); }
.scroll-y { max-height: 480px; overflow-y: auto; }
.bad-text { color: var(--bad); }
.install pre { font-size: 12px; }
.install h3 { font-size: 13.5px; margin: 16px 0 8px; }
@media (max-width: 420px) { .cards2 { grid-template-columns: 1fr; } }

/* ---- file manager */
.h1-sub { font-size: 15px; font-weight: 500; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -6px 0 16px; font-weight: 500; }
.crumbs span { color: var(--muted); }
.crumbs .ic { width: 16px; height: 16px; margin-right: 4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
details.pop { position: relative; }
details.pop > summary { list-style: none; cursor: pointer; }
details.pop > summary::-webkit-details-marker { display: none; }
details.pop[open] > form, details.pop[open] > .pop-body { position: absolute; z-index: 15; top: calc(100% + 6px); left: 0; min-width: 300px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); }
details.pop.right[open] > .pop-body { left: auto; right: 0; }
.pop-body { display: grid; gap: 10px; text-align: left; }
.pop-body form.row > input { flex: 1 1 140px; }
table.files td.fname a { display: inline-flex; align-items: center; gap: 8px; color: var(--text); overflow-wrap: anywhere; }
table.files td.fname .ic { color: var(--accent); flex: none; }
tr.dim td { opacity: .6; }
a.drive { display: block; color: var(--text); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
a.drive + a.drive { margin-top: 10px; }
a.drive:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.drive-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.drive-head .ic { color: var(--accent); }
/* In tables the actions open inside the row (a floating box would be cut
   off by the scrolling table container). */
table.files details.pop[open] > .pop-body { position: static; box-shadow: none; min-width: 0; margin-top: 8px; }
.fline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.fline > a { flex: 1 1 auto; min-width: 0; }
.fline > details.pop { margin-left: auto; }
.fline > details.pop[open] { flex-basis: 100%; text-align: right; }
table.files td.fname { min-width: 180px; }

/* ---- remote desktop */
.rd { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; position: relative; }
.rd-kbd { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; pointer-events: none; }
.rd-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.rd-bar > b { display: inline-flex; gap: 8px; align-items: center; }
.rd-bar > b .ic { color: var(--accent); }
.rd-status { color: var(--muted); font-size: 13px; }
.rd-status.ok { color: var(--ok); }
.rd-status.err { color: var(--bad); }
.rd-tools { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rd-q { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.rd-q select { width: auto; padding: 4px 26px 4px 8px; font-size: 13px; }
.rd-screen { background: #000; display: grid; place-items: center; overflow: hidden; }
.rd-screen canvas { display: block; outline: none; cursor: default; } /* size set by rd.js to fit */
.rd:fullscreen, body.rdwin .rd { border-radius: 0; border: 0; margin: 0; display: flex; flex-direction: column; height: 100vh; }
.rd:fullscreen .rd-screen, body.rdwin .rd-screen { flex: 1; min-height: 0; }
body.rdwin { margin: 0; overflow: hidden; background: #000; }
.rd.closed .rd-screen canvas { opacity: .4; }
.side nav a .navcount { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 10px; background: #fbbf24; color: #1f1300; font-size: 12px; font-weight: 700; text-align: center; }
table.alerts td b { font-weight: 600; }
.stat.bad .si { background: var(--bad-bg); color: var(--bad); }
.stat.bad b { color: var(--bad); }
.loads { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 22px; }
.loads > div { display: grid; gap: 4px; }
.loads span { color: var(--muted); font-size: 12.5px; }
.loads b { font-weight: 600; }
.alert-panel { border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }

/* ---- device header with the main actions */
.actionbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.devhead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.devhead-title { min-width: 0; }
.devhead-title h1 { margin: 0; }
.devhead-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: stretch; }
.devhead-actions > form { display: flex; }
.devhead-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.devhead-name form { display: inline-flex; }
.power-btns { display: flex; gap: 10px; margin-left: 8px; }
details.power.restart > summary { color: var(--warn); }
details.power.shutdown > summary { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); }
details.power.shutdown > summary:hover { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--panel)); }
.tile-btn { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 10px; min-width: 210px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--text); box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.tile-btn:hover { text-decoration: none; border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); transform: translateY(-1px); }
.tile-btn .tb-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.tile-btn .tb-ic .ic { width: 20px; height: 20px; }
.tile-btn > span:last-child { display: grid; line-height: 1.25; }
.tile-btn b { font-weight: 650; }
.tile-btn small { color: var(--muted); font-size: 12px; }
.tile-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tile-btn.primary .tb-ic { background: rgba(255, 255, 255, .18); color: var(--on-accent); }
.tile-btn.primary small { color: color-mix(in srgb, var(--on-accent) 80%, transparent); }
.tile-btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.iconbtn.bordered { width: auto; height: auto; min-height: 42px; min-width: 46px; padding: 0 14px; border-color: var(--line); background: var(--panel); box-shadow: var(--shadow); }
.iconbtn.bordered:disabled { opacity: .5; cursor: default; }
@media (max-width: 600px) { .devhead-actions, .tile-btn { width: 100%; } .tile-btn { min-width: 0; } }

/* ---- device sections: services, processes, scripts */
.devtabs { margin: 4px 0 18px; }
.row.filter { align-items: center; }
.row.filter input[type=search] { flex: 1 1 220px; min-width: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; }
td.actions form.inline { display: inline-flex; gap: 6px; }
code.clip { display: inline-block; max-width: 42ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
textarea.mono { font-family: var(--mono); font-size: 13px; }
pre.output { max-height: 560px; overflow: auto; word-break: normal; overflow-wrap: anywhere; }
details.power .pop-body { min-width: 320px; }
details.power .pop-body form.stack { display: grid; gap: 10px; }
@media (max-width: 900px) { details.power.right[open] > .pop-body { left: 0; right: auto; min-width: min(320px, calc(100vw - 48px)); } }
form[data-busy].busy button { opacity: .6; pointer-events: none; }
.busy-note { margin-top: 8px; }
.update-note { align-items: center; flex-wrap: wrap; }
.update-note form { margin-left: auto; }
th.check-col, td.check-col { width: 32px; }
td.check-col input, th.check-col input { width: auto; }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
a.stat { color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--accent); }
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.pagehead h1 { margin-bottom: 0; }
.rd-mon { width: auto; padding: 4px 26px 4px 8px; font-size: 13px; }

/* ---- report (printable) */
body.report { max-width: 1000px; margin: 0 auto; padding: 24px 16px 40px; background: var(--bg); }
.report-tools { display: flex; gap: 8px; justify-content: space-between; margin-bottom: 16px; }
.report-head { margin-bottom: 16px; }
.report-head .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; margin-bottom: 10px; }
.report-head .brand .logo { width: 28px; height: 28px; }
.report-head .brand b { color: var(--accent); }
.report-head h1 { margin: 0 0 4px; }
.report-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.report-grid .stat { display: grid; gap: 2px; padding: 12px; }
.report-grid .stat b { font-size: 24px; }
.report .panel table { width: 100%; }
.report-foot { margin-top: 20px; text-align: center; }
@media (max-width: 700px) { .report-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media print {
  .noprint { display: none !important; }
  body.report { padding: 0; background: #fff; }
  .report .panel { box-shadow: none; break-inside: avoid; }
  .report-devices tr { break-inside: avoid; }
}
.report-head .brand span { color: var(--text); }
table.events details summary { cursor: pointer; overflow-wrap: anywhere; }
table.events details pre { margin-top: 6px; max-height: 320px; }

/* ---- script run */
.run-head { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; justify-content: space-between; border-left: 4px solid var(--line-2); }
.run-head.is-ok { border-left-color: var(--ok); }
.run-head.is-warn { border-left-color: var(--warn); }
.run-head.is-bad { border-left-color: var(--bad); }
.run-state { display: flex; gap: 12px; align-items: center; }
.run-state > .ic { width: 30px; height: 30px; }
.is-ok .run-state > .ic { color: var(--ok); }
.is-warn .run-state > .ic { color: var(--warn); }
.is-bad .run-state > .ic { color: var(--bad); }
.run-state b { display: block; font-size: 18px; }
.run-state span { color: var(--muted); }
.run-facts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; }
.run-facts div { display: grid; }
.run-facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.run-facts dd { margin: 0; font-weight: 600; }
pre.console { background: #0b1020; color: #d1d5db; border-color: #1f2a4a; max-height: 640px; overflow: auto; white-space: pre-wrap; }
pre.script { max-height: 360px; overflow: auto; }
table.runs code.clip { max-width: 52ch; }

/* Terminal */
.term-screen { position: relative; flex: 1; min-height: 360px; height: 70vh; overflow-y: auto; overflow-x: hidden; background: #111; color: #d0d0d0; padding: 6px 8px; border-radius: 0 0 8px 8px; font: 14px/1.25 ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace; cursor: text; }
.rd.term:fullscreen .term-screen, body.rdwin .term-screen { height: auto; border-radius: 0; }
.term-screen .trow, .term-screen .trow-probe { white-space: pre; height: 1.25em; }
.term-screen .trow-probe { position: absolute; visibility: hidden; }
.term.alt .term-sb { display: none; }
.term-sep { border-top: 1px dashed #555; height: 0; margin: 4px 0; }
.term-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }
.rd.term { position: relative; }
.tb { font-weight: 700; } .td { opacity: .6; } .ti { font-style: italic; } .tu { text-decoration: underline; } .ts { text-decoration: line-through; } .th { visibility: hidden; }
.tinvfg { color: #111; } .tinvbg { background: #d0d0d0; }
.tcur { background: #d0d0d0; color: #111; } .tcur-off { outline: 1px solid #d0d0d0; outline-offset: -1px; }
.rd.dropping .rd-screen { outline: 3px dashed var(--accent); outline-offset: -3px; }
pre.notes { white-space: pre-wrap; font-family: inherit; background: var(--panel-2); border-radius: var(--radius-sm); padding: 10px 12px; max-height: 320px; overflow: auto; }
pre.log { max-height: 520px; font-size: 12px; }
pre.log .lv-warn { color: #fbbf24; }
pre.log .lv-error { color: #f87171; }
.btn.wide { display: flex; justify-content: center; width: 100%; }
.center { text-align: center; }

/* ---- user guide */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.docnav { position: sticky; top: 80px; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.docnav-title { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 4px 8px 10px; }
.docnav-search { margin: 0 4px 8px; }
.docnav-search input { width: 100%; padding: 6px 10px; font-size: 13px; }
.docnav a { padding: 7px 10px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 13.5px; }
.docnav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.docnav a.on { background: var(--accent-soft); color: var(--accent); }
article.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 36px; box-shadow: var(--shadow); line-height: 1.7; font-size: 14.5px; max-width: 900px; min-width: 0; }
article.doc h1 { font-size: 28px; margin: 0 0 8px; }
article.doc .lead { font-size: 16px; color: var(--muted); margin-bottom: 24px; }
article.doc h2 { font-size: 19px; margin: 32px 0 10px; padding-top: 8px; border-top: 1px solid var(--line); }
article.doc h3 { font-size: 15.5px; margin: 22px 0 8px; }
article.doc ul, article.doc ol { padding-left: 22px; margin: 0 0 14px; }
article.doc li { margin-bottom: 5px; }
article.doc table { margin: 8px 0 16px; font-size: 13.5px; }
article.doc pre { margin: 6px 0 16px; }
.callout { border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 12px 16px; margin: 14px 0; }
.callout.warn { border-left-color: #f59e0b; background: var(--warn-bg); }
.callout.tip { border-left-color: #10b981; background: var(--ok-bg); }
.callout p:last-child { margin-bottom: 0; }
.docpager { display: flex; justify-content: space-between; gap: 12px; margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--line); }
.docsearch-big { display: flex; gap: 8px; margin: 8px 0 16px; }
.docsearch-big input { flex: 1; }
.search-hits { padding-left: 20px; }
.search-hits li { margin-bottom: 12px; }
kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--panel-2); }
@media (max-width: 900px) { .docs { grid-template-columns: 1fr; } .docnav { position: static; } article.doc { padding: 20px; } }
.search-hits mark { background: var(--warn-bg); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ---- device list: filters and actions on the chosen devices */
details.filters summary { cursor: pointer; color: var(--muted); }
th.check-col, td.check-col { width: 1%; }
.bulk-bar { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); }

/* ---- search */
.topsearch input { width: 240px; height: 36px; padding: 0 12px; font-size: 13.5px; background-color: transparent; border-color: var(--line); }
.topsearch input:focus { width: 300px; }
ul.hits { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
@media (max-width: 900px) { .topsearch { display: none; } }

/* History charts (SVG drawn on the server) */
.chart { margin: 0; }
.chart svg { width: 100%; height: 200px; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .ylab { text-anchor: end; dominant-baseline: middle; }
.chart .xlab { text-anchor: middle; }
.chart .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart .ln.s1 { stroke: var(--accent); }
.legend .s1 i { background: var(--accent); }
.chart .ln.s2 { stroke: var(--ok); }
.legend .s2 i { background: var(--ok); }
.chart .ln.s3 { stroke: var(--warn); }
.legend .s3 i { background: var(--warn); }
.chart .ln.s4 { stroke: var(--bad); }
.legend .s4 i { background: var(--bad); }
.chart .ln.s5 { stroke: #0891b2; }
.legend .s5 i { background: #0891b2; }
.chart .ln.s6 { stroke: #a21caf; }
.legend .s6 i { background: #a21caf; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.legend b { color: var(--text); font-weight: 600; }

/* Registry editor */
.reglist { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow: auto; }
.reglist li a { display: flex; align-items: center; gap: 8px; padding: 5px 4px; border-radius: 6px; word-break: break-all; }
.reglist li a:hover { background: var(--accent-soft); text-decoration: none; }
.regvals td.wrap { word-break: break-all; white-space: pre-wrap; max-width: 380px; }
.wrap { overflow-wrap: anywhere; }
.side-foot .src-link { color: inherit; }
.side-foot .src-link:hover { color: var(--accent); }
