/* DG RMM console.
   One idea carries the look: a dark rack-rail of client prefixes on the left (dg, apm, jmb), mirroring how
   the MSP names its gear, with status LEDs as the only saturated color. Everything else stays quiet. */

:root {
  --paper: #eef1f4;
  --panel: #ffffff;
  --ink: #18212c;
  --muted: #5b6775;
  --line: #d5dbe2;
  --line-soft: #e6eaee;
  --teal: #0e6b70;
  --teal-ink: #ffffff;
  --teal-soft: #e3f0f0;
  --amber: #b9741a;
  --red: #b8352d;
  --led-on: #22a35a;
  --led-off: #a3adb8;
  --rail: #1c2733;
  --rail-ink: #c9d3dc;
  --rail-dim: #7f8d9b;
  --rail-strong: #ffffff;
  --rail-hi: #2a3846;
  --code-bg: #0f1720;
  --code-ink: #dbe3ea;
  --radius: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", "DejaVu Sans Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121820;
    --panel: #1a222c;
    --ink: #e6ebf0;
    --muted: #93a0ae;
    --line: #2c3743;
    --line-soft: #232d38;
    --teal: #3fa9ae;
    --teal-ink: #0c1a1c;
    --teal-soft: #1b3236;
    --amber: #e3a54a;
    --red: #ec6b62;
    --rail: #0d131a;
    --rail-hi: #1c2733;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 1.02rem; font-weight: 650; }
code, pre, .data, .host { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
/* Headings receive focus after navigation for screen readers; no ring needed. */
h1:focus, h1:focus-visible { outline: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); }

/* ---------- buttons and inputs ---------- */

button, .button {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}
button:hover, .button:hover { border-color: var(--muted); }
button:disabled { opacity: 0.5; cursor: default; }
.primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.primary:hover { filter: brightness(1.08); border-color: var(--teal); }
.secondary { background: var(--panel); }
.link { border: none; background: none; padding: 0.2rem 0.3rem; color: var(--teal); font-weight: 600; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--red); }
.wide { width: 100%; justify-content: center; padding: 0.65rem; margin-top: 0.6rem; }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
label.check { flex-direction: row; align-items: center; gap: 0.5rem; font-weight: 500; }
.hint { font-weight: 400; color: var(--muted); }
.form-error { color: var(--red); margin: 0.4rem 0; }
.form-ok { color: var(--led-on); margin: 0.4rem 0; }
.validation-message { color: var(--red); font-size: 0.85rem; margin: -0.2rem 0 0.4rem; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--rail);
  color: var(--rail-ink);
  padding: 0.9rem 0.6rem 1.2rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  font-size: 0.92rem;
  border-right: 1px solid color-mix(in srgb, var(--rail) 88%, black);
}
.brand-logo { width: 26px; height: 26px; object-fit: contain; border-radius: 5px; flex: none; }
.brand-logo.large { width: 36px; height: 36px; }
.brand {
  display: flex; align-items: center; gap: 0.55rem;
  color: var(--rail-strong); text-decoration: none; font-weight: 700; font-size: 1.02rem;
  padding: 0.1rem 0.55rem 0.9rem;
}

.nav { display: flex; flex-direction: column; gap: 1px; padding-bottom: 0.9rem; border-bottom: 1px solid var(--rail-hi); }
.nav a {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--rail-ink); text-decoration: none;
  padding: 0.42rem 0.6rem; border-radius: var(--radius);
}
.nav a:hover { background: var(--rail-hi); color: var(--rail-strong); }
.nav a.active { background: var(--rail-hi); color: var(--rail-strong); box-shadow: inset 3px 0 0 var(--led-on); }

.tree-head {
  display: flex; flex-direction: column; gap: 0.45rem;
  padding: 0.9rem 0.6rem 0.35rem; color: var(--rail-dim); font-size: 0.82rem; font-weight: 600;
}
.tree-filter { background: var(--rail-hi); border-color: var(--rail-hi); color: var(--rail-strong); font-size: 0.86rem; padding: 0.3rem 0.5rem; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { margin-left: 1.15rem; border-left: 1px solid var(--rail-hi); padding-left: 0.2rem; }
.node {
  display: grid; grid-template-columns: 1.15rem 1fr auto; align-items: center; gap: 0.15rem;
  border-radius: var(--radius); padding: 0.1rem 0.45rem 0.1rem 0.15rem;
}
.node.leaf { grid-template-columns: 1fr auto; padding-left: 0.5rem; }
.node:hover { background: var(--rail-hi); }
.node.active { background: var(--rail-hi); box-shadow: inset 3px 0 0 var(--led-on); }
.node a { color: var(--rail-ink); text-decoration: none; padding: 0.3rem 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node.active a, .node a:hover { color: var(--rail-strong); }
.twisty {
  width: 1.15rem; height: 1.6rem; padding: 0; border: none; background: none; color: var(--rail-dim);
  display: grid; place-items: center; border-radius: 4px;
}
.twisty::before {
  content: ""; width: 0; height: 0;
  border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform 120ms ease;
}
.twisty.open::before { transform: rotate(90deg); }
.twisty:hover { color: var(--rail-strong); border: none; }
.twisty-space { width: 1.15rem; }
.sidebar .count { font-family: var(--mono); font-size: 0.76rem; color: var(--rail-dim); }
.sidebar .count.warn { color: #f2b84b; }
.tree-empty { color: var(--rail-dim); padding: 0.4rem 0.6rem; }
.tree-empty a { color: var(--rail-ink); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.55rem 1.6rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.topbar-spacer { flex: 1; }
.who { color: var(--ink); text-decoration: none; font-weight: 600; }
.topbar form { margin: 0; }
.global-search { width: min(420px, 50vw); }
.content { padding: 1.6rem; max-width: 1400px; width: 100%; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head .sub { display: flex; align-items: center; gap: 0.5rem; }

.crumbs { display: flex; flex-wrap: wrap; gap: 0.35rem; font-size: 0.88rem; color: var(--muted); margin-bottom: 0.35rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--teal); text-decoration: underline; }
.crumbs > * + *::before { content: "/"; margin-right: 0.35rem; color: var(--line); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.segmented { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.segmented button { border: none; border-radius: 0; font-weight: 600; color: var(--muted); padding: 0.4rem 0.85rem; background: none; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button span { font-family: var(--mono); font-size: 0.8rem; margin-left: 0.3rem; font-weight: 500; }
.segmented button.on { background: var(--teal-soft); color: var(--ink); box-shadow: inset 0 -2px 0 var(--teal); }

a.quiet { color: inherit; text-decoration: none; }
a.quiet:hover { color: var(--teal); text-decoration: underline; }
.under { display: block; font-size: 0.78rem; color: var(--muted); }
.hint { color: var(--muted); font-size: 0.86rem; margin: 0.5rem 0 0; }
.sub { margin: 0.25rem 0 0; color: var(--muted); }
.search { min-width: 280px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.2rem;
}
.panel h2 { margin-bottom: 0.8rem; }
.panel h2.spaced { margin-top: 1.4rem; }
.callout { border-color: var(--teal); box-shadow: inset 4px 0 0 var(--teal); }

.empty { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty h1, .empty h2 { color: var(--ink); margin-bottom: 0.5rem; }

/* ---------- tables ---------- */

.grid { width: 100%; border-collapse: collapse; background: var(--panel); }
.content > .grid { border: 1px solid var(--line); border-radius: var(--radius); }
.grid th {
  text-align: left; font-size: 0.8rem; font-weight: 650; color: var(--muted);
  padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.grid tr:last-child td { border-bottom: none; }
.grid .num { text-align: right; }
.grid td:first-child { white-space: nowrap; }
.grid .actions { text-align: right; white-space: nowrap; }
.grid .actions select { margin-right: 0.4rem; }
.grid .clip { max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.devices tbody tr { cursor: pointer; }
.devices tbody tr:hover { background: var(--teal-soft); }
.grid tr.dim td { color: var(--muted); }
.col-led { width: 28px; padding-right: 0 !important; }
.host { color: var(--ink); font-weight: 600; text-decoration: none; }
a.host:hover { color: var(--teal); }
.chip { font-family: var(--mono); font-size: 0.8rem; font-weight: 700; background: var(--line-soft); padding: 0.1rem 0.45rem; border-radius: 4px; }

/* ---------- status bits ---------- */

.led { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--led-off); flex: none; }
.led.on { background: var(--led-on); box-shadow: 0 0 0 3px color-mix(in srgb, var(--led-on) 22%, transparent); }

.meter { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--mono); font-size: 0.82rem; }
.meter-bar { width: 56px; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.meter-bar > span { display: block; height: 100%; background: var(--teal); }
.meter.warm .meter-bar > span { background: var(--amber); }
.meter.hot .meter-bar > span { background: var(--red); }
.meter-num { min-width: 2.6em; text-align: right; }

.status { font-size: 0.8rem; font-weight: 650; padding: 0.1rem 0.5rem; border-radius: 999px; white-space: nowrap; }
.status.ok { background: color-mix(in srgb, var(--led-on) 16%, transparent); color: var(--led-on); }
.status.bad { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.status.busy { background: color-mix(in srgb, var(--amber) 16%, transparent); color: var(--amber); }
.status.idle { background: var(--line-soft); color: var(--muted); }

/* ---------- device page ---------- */

.device-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.device-title { display: grid; grid-template-columns: auto 1fr; column-gap: 0.7rem; align-items: center; }
.device-title h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.device-title .where, .device-title .seen { grid-column: 2; color: var(--muted); }
.device-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.device-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.device-grid .panel { margin-bottom: 0; }
.device-grid + .panel { margin-top: 1.2rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 0.45rem 1.2rem; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.disk { display: grid; grid-template-columns: minmax(80px, 1fr) auto minmax(140px, auto); gap: 0.8rem; align-items: center; padding: 0.3rem 0; }

.chart svg { width: 100%; height: 120px; display: block; background: var(--paper); border-radius: 4px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 4; }
.chart .line { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .line.cpu { stroke: var(--teal); }
.chart .line.mem { stroke: var(--amber); }
.chart figcaption { display: flex; gap: 1.2rem; margin-top: 0.5rem; font-size: 0.85rem; flex-wrap: wrap; }
.chart { margin: 0; }
.key::before { content: ""; display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 0.4rem; vertical-align: middle; }
.key.cpu::before { background: var(--teal); }
.key.mem::before { background: var(--amber); }

.script-form { display: flex; flex-direction: column; gap: 0.7rem; }
.script-opts { display: flex; gap: 1rem; flex-wrap: wrap; }
.script-run { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
textarea.code, .output {
  font-family: var(--mono);
  font-size: 0.86rem;
  background: var(--code-bg);
  color: var(--code-ink);
  border: 1px solid var(--code-bg);
  border-radius: var(--radius);
}
textarea.code { width: 100%; padding: 0.8rem; resize: vertical; }
.output { padding: 0.8rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 480px; overflow: auto; margin: 0.5rem 0; }
.copyable { user-select: all; }

.jobs { display: grid; grid-template-columns: minmax(260px, 2fr) 3fr; gap: 1rem; }
.job-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); max-height: 560px; overflow: auto; }
.job-list li { display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.6rem; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.job-list li:hover { background: var(--teal-soft); }
.job-list li.selected { background: var(--teal-soft); box-shadow: inset 3px 0 0 var(--teal); }
.job-list .job-first { font-family: var(--mono); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-list .muted { grid-column: 2; font-size: 0.8rem; }
.job-meta { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
details summary { cursor: pointer; color: var(--muted); margin-top: 0.4rem; }

/* ---------- clients ---------- */

.inline-form { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; margin-top: 0.8rem; }
.inline-form input.short, .client-edit input.short { width: 7rem; }
.client { scroll-margin-top: 1rem; }
.client-head { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.client-title { display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap; }
.client-title h2 { margin: 0; font-size: 1.15rem; }
.client-actions { display: flex; gap: 0.5rem; }
.client-edit { display: flex; gap: 0.8rem; align-items: flex-end; flex-wrap: wrap; }
.consent { margin: 0.6rem 0 0.2rem; }
.grid.locations { margin-top: 0.8rem; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.rename { display: inline-flex; gap: 0.4rem; align-items: center; }
.rename input { padding: 0.3rem 0.5rem; }
.callout.install { margin-top: 1rem; padding: 0.9rem 1rem; border: 1px solid var(--teal); border-radius: var(--radius); }
.callout.install h3 { margin: 0 0 0.4rem; font-size: 1rem; }

/* ---------- settings ---------- */

.banner { padding: 0.6rem 0.9rem; background: color-mix(in srgb, var(--led-on) 12%, var(--panel)); border-radius: var(--radius); }
.settings h3.spaced { margin: 1.4rem 0 0.6rem; font-size: 1rem; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 2rem; align-items: start; }
.settings-fields { display: flex; flex-direction: column; gap: 1.1rem; max-width: 560px; }
.settings-fields.addresses { max-width: 760px; }
.settings-fields .hint { font-weight: 400; margin: 0; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-weight: 600; font-size: 0.9rem; }
.with-button { display: flex; gap: 0.5rem; }
.with-button input { flex: 1; }
.logo-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.logo-preview { width: 48px; height: 48px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--paper); }
.file-button { position: relative; overflow: hidden; }
.file-button input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.color-fields { display: flex; flex-direction: column; gap: 1.1rem; }
.color-row { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.color-row input[type=color] { width: 42px; height: 34px; padding: 2px; cursor: pointer; }
.color-row input.hex { width: 6.5rem; font-family: var(--mono); }
.swatch { width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
.preview { display: grid; grid-template-columns: 130px 1fr; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-height: 190px; position: sticky; top: 1rem; }
.preview-side { padding: 0.7rem 0.45rem; font-size: 0.8rem; display: flex; flex-direction: column; gap: 2px; }
.preview-brand { display: flex; align-items: center; gap: 0.35rem; font-weight: 700; padding: 0 0.3rem 0.6rem; overflow: hidden; white-space: nowrap; }
.preview-brand img { width: 18px; height: 18px; object-fit: contain; }
.preview-item { padding: 0.3rem 0.4rem; border-radius: 4px; }
.preview-main { background: var(--paper); padding: 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; align-items: flex-start; font-size: 0.85rem; }
.preview-title { font-weight: 700; font-size: 1rem; }
.preview-link { font-family: var(--mono); font-weight: 600; text-decoration: underline; }
.preview-button { padding: 0.35rem 0.7rem; border-radius: var(--radius); font-weight: 600; }
.save-bar { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-bottom: 2rem; }

/* ---------- dialogs ---------- */

.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 18, 26, 0.55); z-index: 900; }
.modal {
  position: fixed; z-index: 901; left: 50%; top: 14vh; transform: translateX(-50%);
  width: min(540px, calc(100vw - 2rem)); max-height: 76vh; overflow: auto;
  background: var(--panel); border-radius: 10px; padding: 1.3rem 1.4rem 1.1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.modal.danger { border-top: 4px solid var(--red); }
.modal h2 { font-size: 1.2rem; margin-bottom: 0.7rem; }
.modal-body p { margin: 0 0 0.7rem; }
.warning-line { font-weight: 600; color: var(--red); }
.device-list { columns: 2; margin: 0 0 0.8rem; padding: 0.6rem 0.8rem 0.6rem 1.8rem; background: var(--paper); border-radius: var(--radius); font-size: 0.88rem; }
.type-confirm { display: block; margin: 0.4rem 0 0.2rem; font-weight: 500; }
.type-confirm input { display: block; width: 100%; margin-top: 0.4rem; }
.type-confirm code { font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
button.danger:not(.link) { background: var(--red); border-color: var(--red); color: #fff; }
button.danger:not(.link):hover { filter: brightness(1.08); border-color: var(--red); }
.danger-text { color: var(--red); }
.danger-text:hover { border-color: var(--red); }

/* ---------- account pages ---------- */

.account-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; background: var(--rail); }
.account-card {
  width: 100%; max-width: 440px;
  background: var(--panel); border-radius: 10px; padding: 2rem 2rem 1.6rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.account-card h1 { font-size: 1.4rem; }
.account-card h2 { margin-top: 1rem; }
.account-card form { display: flex; flex-direction: column; gap: 0.7rem; margin: 0; }
.account-brand { display: flex; align-items: center; gap: 0.6rem; font-weight: 700; font-size: 1.1rem; margin-bottom: 0.6rem; }
.lede { margin: 0; color: var(--muted); }
.aside { margin: 0.4rem 0 0; text-align: center; font-size: 0.9rem; }
.qr { align-self: center; background: #fff; padding: 8px; border-radius: 6px; line-height: 0; }
.qr svg { width: 220px; height: 220px; }
.secret { font-size: 0.9rem; color: var(--muted); margin: 0; }
.secret code { color: var(--ink); font-size: 0.95rem; }
.codes { columns: 2; list-style: none; padding: 0.8rem 1rem; margin: 0; background: var(--paper); border-radius: var(--radius); }
.codes li { padding: 0.15rem 0; }

/* ---------- remote sessions ---------- */

.remote-shell { height: 100vh; display: flex; flex-direction: column; background: var(--code-bg); color: var(--code-ink); }
.remote-head {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.5rem 1rem; background: var(--rail); border-bottom: 1px solid #263342; flex: none;
}
.remote-head .back { color: var(--rail-ink); font-size: 0.9rem; }
.remote-kind { font-weight: 700; color: var(--rail-strong); }
.remote-head .host { color: var(--rail-strong); font-size: 1.05rem; }
.remote-status { margin-left: auto; font-size: 0.88rem; color: var(--rail-ink); }
.remote-status:empty::before { content: attr(data-initial); }
.remote-status[data-kind="ok"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--led-on); margin-right: 0.45rem; }
.remote-status[data-kind="wait"] { color: #f2b84b; }
.remote-status[data-kind="error"] { color: #ff8a80; }
.remote-status[data-kind="ended"] { color: var(--rail-dim); }
.remote-error { padding: 0.6rem 1rem; margin: 0; color: #ff8a80; }

.term { flex: 1; min-height: 0; padding: 0.4rem 0 0 0.6rem; }

.file-manager { flex: 1; min-height: 0; overflow: auto; background: var(--paper); color: var(--ink); padding: 1rem; }
.file-bar { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.8rem; flex-wrap: wrap; }
.file-bar .path { flex: 1; min-width: 240px; font-family: var(--mono); }
.grid.files { border: 1px solid var(--line); border-radius: var(--radius); }
.files a.dir { font-weight: 600; color: var(--ink); }
.files a.dir::before { content: "▸ "; color: var(--teal); }
.transfers { font-size: 0.88rem; color: var(--muted); margin-bottom: 0.6rem; }

.desktop { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.desktop { position: relative; }
.desk-bar { display: flex; gap: 0.35rem; align-items: center; padding: 0.4rem 0.75rem; background: #17222d; flex-wrap: wrap; border-bottom: 1px solid #22303d; }
.desk-group { position: relative; display: inline-flex; }
.desk-btn { display: inline-flex; align-items: center; gap: 0.35rem; height: 2rem; padding: 0 0.55rem; background: transparent; color: var(--code-ink);
  border: 1px solid transparent; border-radius: 6px; font-weight: 500; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.desk-btn:hover, .desk-btn.open { background: #22303d; border-color: #2f3f4e; }
.desk-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.desk-btn.text { padding: 0 0.7rem; }
.desk-btn .ico { display: inline-flex; width: 1.15rem; height: 1.15rem; }
.desk-btn .ico svg { width: 100%; height: 100%; }
.desk-btn .ico:last-child:not(:first-child) { width: 0.9rem; height: 0.9rem; opacity: 0.75; }
.desk-group.split { border: 1px solid #2f3f4e; border-radius: 6px; }
.desk-group.split .desk-btn { border: 0; border-radius: 0; }
.desk-group.split .desk-btn:first-child { border-radius: 5px 0 0 5px; }
.desk-group.split .desk-btn.more { border-left: 1px solid #2f3f4e; border-radius: 0 5px 5px 0; padding: 0 0.3rem; }
.desk-group.split .desk-btn.more .ico { width: 0.9rem; height: 0.9rem; opacity: 0.75; }
.desk-sep { width: 1px; height: 1.4rem; background: #2f3f4e; margin: 0 0.25rem; }
.desk-spacer { flex: 1; }
.desk-bar.view-only .desk-group.split .desk-btn:first-child { opacity: 0.55; }
.desk-menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; min-width: 14rem; padding: 0.3rem; background: #1d2a36; border: 1px solid #2f3f4e;
  border-radius: 8px; box-shadow: 0 10px 28px rgb(0 0 0 / 0.4); }
.desk-menu button { display: flex; align-items: center; gap: 0.5rem; width: 100%; padding: 0.45rem 0.6rem; background: transparent; color: var(--code-ink);
  border: 0; border-radius: 5px; text-align: left; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.desk-menu button:hover:not([disabled]), .desk-menu button:focus-visible { background: #2a3a48; outline: none; }
.desk-menu button[disabled] { opacity: 0.45; cursor: default; }
.desk-menu .mark { display: inline-flex; width: 1rem; height: 1rem; flex: none; }
.desk-menu .mark .ico, .desk-menu .mark svg { width: 1rem; height: 1rem; }
.desk-menu .label { flex: 1; }
.desk-menu.plain .mark { display: none; }
.desk-menu .sep { height: 1px; margin: 0.3rem 0.2rem; background: #2f3f4e; }
.keys { display: inline-flex; gap: 0.2rem; margin-left: 1.25rem; }
.clip-pop .keys { margin: 0 0.1rem; vertical-align: middle; }
.keys kbd { font: inherit; font-size: 0.75rem; padding: 0.05rem 0.35rem; border-radius: 4px; background: #2f3f4e; color: var(--code-ink); }
.clip-pop { position: absolute; top: 3.2rem; left: 50%; transform: translateX(-50%); z-index: 31; width: min(28rem, calc(100% - 2rem));
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.8rem; background: #1d2a36; color: var(--code-ink); border: 1px solid #2f3f4e;
  border-radius: 8px; box-shadow: 0 10px 28px rgb(0 0 0 / 0.45); }
.clip-pop[hidden], .desk-menu[hidden] { display: none; }
.clip-pop p { margin: 0; }
.clip-pop textarea { background: #0f1720; color: var(--code-ink); border: 1px solid #2f3f4e; border-radius: 6px; font: inherit; padding: 0.4rem; }
.clip-pop .link { align-self: flex-end; color: var(--code-ink); }
.stage { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: flex-start; justify-content: center; }
.stage.fit { overflow: hidden; align-items: center; }
.stage.fit .screen { max-width: 100%; max-height: 100%; }
.screen { display: block; cursor: default; outline: none; image-rendering: auto; }
.screen:focus-visible { outline: 2px solid var(--teal); }

/* ---------- connection lost banner ---------- */

#blazor-error-ui {
  display: none; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--amber); color: #1b1300; padding: 0.6rem 1.2rem; z-index: 1000; font-weight: 600;
}
#blazor-error-ui a { color: inherit; }

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; max-height: 45vh; }
  .global-search { width: 100%; }
  .content { padding: 1rem; }
  .device-grid, .jobs, .settings-grid { grid-template-columns: 1fr; }
  .devices th:nth-child(n+4), .devices td:nth-child(n+4) { display: none; }
  .search { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
