/* NanoRMM console. Tokens first; dark is the default, light follows the OS or the toggle. */
:root {
  --bg: #0b0f14; --surface: #121821; --surface-2: #18202b; --surface-3: #202a37; --line: #263140; --line-2: #33404f;
  --tx: #e8edf4; --tx-2: #a7b3c2; --tx-3: #6f7d8f;
  --acc: #4c9dff; --acc-2: #2f7fe6; --acc-soft: rgba(76,157,255,.14); --on-acc: #04121f;
  --ok: #34c77b; --ok-soft: rgba(52,199,123,.14); --warn: #f2b23e; --warn-soft: rgba(242,178,62,.15);
  --bad: #ff6464; --bad-soft: rgba(255,100,100,.13);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.28); --shadow-lg: 0 24px 64px rgba(0,0,0,.55);
  --r: 10px; --r-sm: 7px; --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) { :root:not([data-theme=dark]) {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f6f8fb; --surface-3: #eceff4; --line: #e1e6ed; --line-2: #cdd5df;
  --tx: #131a24; --tx-2: #4d5a6b; --tx-3: #7b8797;
  --acc: #1f6fe0; --acc-2: #175bbd; --acc-soft: rgba(31,111,224,.10); --on-acc: #ffffff;
  --ok: #128a4c; --ok-soft: rgba(18,138,76,.11); --warn: #a86a00; --warn-soft: rgba(200,130,0,.13);
  --bad: #cf3030; --bad-soft: rgba(207,48,48,.09);
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.07); --shadow-lg: 0 24px 64px rgba(16,24,40,.22);
  color-scheme: light;
} }
:root[data-theme=light] {
  --bg: #f4f6f9; --surface: #ffffff; --surface-2: #f6f8fb; --surface-3: #eceff4; --line: #e1e6ed; --line-2: #cdd5df;
  --tx: #131a24; --tx-2: #4d5a6b; --tx-3: #7b8797;
  --acc: #1f6fe0; --acc-2: #175bbd; --acc-soft: rgba(31,111,224,.10); --on-acc: #ffffff;
  --ok: #128a4c; --ok-soft: rgba(18,138,76,.11); --warn: #a86a00; --warn-soft: rgba(200,130,0,.13);
  --bad: #cf3030; --bad-soft: rgba(207,48,48,.09);
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.07); --shadow-lg: 0 24px 64px rgba(16,24,40,.22);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
#app { min-height: 100vh; }
body { background: var(--bg); color: var(--tx); font: 14px/1.5 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; font-weight: 600; }
a { color: var(--acc); text-decoration: none; } a:hover { text-decoration: underline; }
svg.ic { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mut { color: var(--tx-2); } .dim { color: var(--tx-3); } .small { font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .end { justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }

/* ---- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--tx); font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: background .14s var(--ease), border-color .14s var(--ease), color .14s var(--ease), transform .08s var(--ease), box-shadow .14s var(--ease); user-select: none; }
.btn:hover { background: var(--surface-3); border-color: var(--tx-3); text-decoration: none; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { background: var(--acc); border-color: var(--acc); color: var(--on-acc); box-shadow: 0 1px 0 rgba(255,255,255,.14) inset, 0 2px 8px var(--acc-soft); }
.btn.primary:hover { background: var(--acc-2); border-color: var(--acc-2); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: transparent; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--tx-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--tx); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 32px; height: 32px; padding: 0; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn[aria-busy=true] { pointer-events: none; color: transparent !important; position: relative; }
.btn[aria-busy=true]::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--tx-2); border-top-color: transparent; animation: spin .6s linear infinite; }
.btn.primary[aria-busy=true]::after { border-color: var(--on-acc); border-top-color: transparent; }

/* ---- forms */
label.f { display: block; font-size: 12.5px; font-weight: 550; color: var(--tx-2); margin: 0 0 6px; }
.field { margin-bottom: 14px; }
input.in, select.in { width: 100%; height: 36px; padding: 0 11px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
  transition: border-color .14s, box-shadow .14s, background .14s; }
input.in:hover, select.in:hover { border-color: var(--tx-3); }
input.in:focus, select.in:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); background: var(--surface); }
input.in::placeholder { color: var(--tx-3); }
input.code-in { font: 600 20px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .3em; text-align: center; height: 46px; }
.search { position: relative; width: 260px; max-width: 100%; }
.search svg { position: absolute; left: 11px; top: 10px; color: var(--tx-3); }
.search input { padding-left: 34px; }
.err { color: var(--bad); font-size: 13px; min-height: 20px; margin-top: 8px; }
.switch { appearance: none; width: 36px; height: 20px; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; transition: background .18s var(--ease); margin: 0; vertical-align: middle; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .18s var(--ease); }
.switch:checked { background: var(--acc); } .switch:checked::after { transform: translateX(16px); }
.seg { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; }
.seg button { border: 0; background: none; height: 28px; padding: 0 14px; border-radius: 7px; color: var(--tx-2); font-weight: 550; font-size: 13px; cursor: pointer; transition: background .15s, color .15s; }
.seg button.on { background: var(--surface); color: var(--tx); box-shadow: var(--shadow); }

/* ---- shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, #5fb0ff, #2a6fe0 60%, #1b49b8); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; box-shadow: 0 4px 12px rgba(42,111,224,.4); flex: none; }
.logo.big { width: 44px; height: 44px; border-radius: 13px; font-size: 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 11px; border: 0; background: none; border-radius: 8px; color: var(--tx-2); font-weight: 550; cursor: pointer; text-align: left; position: relative;
  transition: background .14s var(--ease), color .14s var(--ease); }
.nav button:hover { background: var(--surface-3); color: var(--tx); }
.nav button.on { background: var(--acc-soft); color: var(--acc); }
.nav button.on::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--acc); }
.nav .count { margin-left: auto; background: var(--warn); color: #1a1200; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 99px; line-height: 18px; }
.side-foot .btn { justify-content: flex-start; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--acc-soft); color: var(--acc); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; text-transform: uppercase; }
.who b { display: block; line-height: 1.2; } .who span { font-size: 12px; color: var(--tx-3); text-transform: capitalize; }
.content { padding: 28px 32px 48px; max-width: 1280px; width: 100%; margin: 0 auto; min-width: 0; }
.view { animation: rise .26s var(--ease) both; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--tx-2); margin-top: 3px; }

/* ---- surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-body { padding: 18px; }
.card.pad { padding: 18px; }
.card.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 15px 17px; display: flex; align-items: center; gap: 13px; transition: transform .16s var(--ease), border-color .16s; }
.stat:hover { transform: translateY(-2px); border-color: var(--line-2); }
.stat .tile { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--acc-soft); color: var(--acc); flex: none; }
.stat .tile.ok { background: var(--ok-soft); color: var(--ok); } .stat .tile.warn { background: var(--warn-soft); color: var(--warn); } .stat .tile.off { background: var(--surface-3); color: var(--tx-3); }
.stat .tile svg { width: 19px; height: 19px; }
.stat b { font-size: 22px; font-weight: 680; line-height: 1.1; display: block; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--tx-2); }
.grid-form { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.grid-form.three { grid-template-columns: 1fr 1fr 1fr; }

/* ---- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--tx-3); padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; } tbody tr:hover { background: var(--surface-2); } tbody tr:last-child td { border-bottom: 0; }
td.actions { text-align: right; white-space: nowrap; } td.actions .btn { margin-left: 6px; }
td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell .tile { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--tx-2); flex: none; }
.cell.on .tile { background: var(--ok-soft); color: var(--ok); } .cell.busy .tile { background: var(--warn-soft); color: var(--warn); }
.cell b { display: block; font-weight: 600; } .cell span { font-size: 12.5px; color: var(--tx-3); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--tx-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--ok-soft); color: var(--ok); } .badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); } .badge.acc { background: var(--acc-soft); color: var(--acc); }
.badge.ok.live::before { animation: pulse 2s infinite; }
.empty { padding: 44px 20px; text-align: center; color: var(--tx-2); }
.empty .tile { width: 52px; height: 52px; border-radius: 14px; background: var(--surface-3); color: var(--tx-3); display: grid; place-items: center; margin: 0 auto 14px; }
.empty .tile svg { width: 24px; height: 24px; } .empty b { display: block; color: var(--tx); font-size: 15px; margin-bottom: 4px; } .empty p { max-width: 440px; margin: 0 auto; }
.skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--line) 37%, var(--surface-3) 63%); background-size: 400% 100%; animation: shimmer 1.3s infinite; margin: 14px 18px; }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.cmd { position: relative; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 12px 14px; word-break: break-all; line-height: 1.6; user-select: all; max-height: 150px; overflow: auto; }
.notice { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--r-sm); background: var(--acc-soft); color: var(--tx); font-size: 13px; align-items: flex-start; }
.notice svg { color: var(--acc); margin-top: 2px; } .notice.ok { background: var(--ok-soft); } .notice.ok svg { color: var(--ok); } .notice.bad { background: var(--bad-soft); } .notice.bad svg { color: var(--bad); }
.bigcode { font: 700 34px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .12em; text-align: center; padding: 18px 10px; background: var(--surface-2); border: 1px dashed var(--acc); border-radius: var(--r); margin: 16px 0; color: var(--acc); }
.qr { display: block; margin: 14px auto; background: #fff; padding: 8px; border-radius: 10px; }

/* ---- auth screens */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(900px 500px at 50% -10%, var(--acc-soft), transparent 70%), var(--bg); }
.auth .card { width: 100%; max-width: 400px; padding: 30px 28px; animation: pop .3s var(--ease) both; }
.auth .head { text-align: center; margin-bottom: 22px; } .auth .head .logo { margin: 0 auto 14px; } .auth .head p { color: var(--tx-2); margin-top: 4px; }
.auth .btn { width: 100%; }
.steps { margin: 16px 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); width: 24px; height: 24px; border-radius: 50%; background: var(--acc-soft); color: var(--acc); font-weight: 700; font-size: 12.5px; display: grid; place-items: center; flex: none; }

/* ---- overlays */
.modal { position: fixed; inset: 0; background: rgba(4,8,14,.6); backdrop-filter: blur(5px); display: grid; place-items: center; padding: 20px; z-index: 50; animation: fade .16s ease both; }
.modal .card { width: 100%; max-width: 440px; padding: 24px; box-shadow: var(--shadow-lg); animation: pop .22s var(--ease) both; max-height: calc(100vh - 40px); overflow: auto; }
.modal h2 { font-size: 17px; margin-bottom: 6px; } .modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal.closing { animation: fade .14s ease reverse both; }
#toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 99; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 420px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line-2); border-left: 3px solid var(--acc); border-radius: var(--r-sm); box-shadow: var(--shadow-lg); animation: slidein .24s var(--ease) both; font-size: 13.5px; }
.toast.ok { border-left-color: var(--ok); } .toast.ok svg { color: var(--ok); } .toast.err { border-left-color: var(--bad); } .toast.err svg { color: var(--bad); } .toast svg { color: var(--acc); }
.toast.out { animation: slideout .2s var(--ease) both; }

/* ---- remote viewer */
.viewer { position: fixed; inset: 0; display: flex; flex-direction: column; background: #05070a; z-index: 40; animation: fade .2s ease both; color: #e8edf4; color-scheme: dark; }
.vbar { display: flex; gap: 6px; align-items: center; padding: 7px 12px; background: #121821; border-bottom: 1px solid #263140; flex-wrap: wrap; }
.vbar .title { display: flex; align-items: center; gap: 10px; margin-right: 6px; font-weight: 650; }
.vbar .sep { width: 1px; height: 20px; background: #263140; margin: 0 4px; }
.vbar .btn { background: transparent; border-color: transparent; color: #a7b3c2; height: 30px; padding: 0 9px; font-size: 13px; }
.vbar .btn:hover { background: #202a37; color: #e8edf4; }
.vbar .btn.danger { color: #ff6464; border-color: rgba(255,100,100,.4); } .vbar .btn.danger:hover { background: rgba(255,100,100,.13); }
.vbar select { height: 30px; background: #18202b; border: 1px solid #33404f; border-radius: 7px; padding: 0 8px; color: #e8edf4; font-size: 13px; }
.vbar .timer { font-variant-numeric: tabular-nums; color: #6f7d8f; font-size: 12.5px; }
.vstage { flex: 1; position: relative; overflow: hidden; display: grid; place-items: center; min-height: 0; }
.vstage canvas { max-width: 100%; max-height: 100%; background: #000; outline: none; box-shadow: 0 0 0 1px #263140, 0 20px 60px rgba(0,0,0,.6); }
.vmsg { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 16px; align-items: center; justify-content: center; color: #a7b3c2; font-size: 15px; text-align: center; padding: 2rem; pointer-events: none; }
.spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid #263140; border-top-color: #4c9dff; animation: spin .8s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes slidein { from { opacity: 0; transform: translateX(24px); } }
@keyframes slideout { to { opacity: 0; transform: translateX(24px); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); } 60% { box-shadow: 0 0 0 5px transparent; } }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; gap: 8px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand { padding: 0 6px 0 0; } .brand span { display: none; }
  .nav { flex-direction: row; } .nav button.on::before { display: none; } .nav button span { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; } .who div { display: none; }
  .content { padding: 18px 14px 40px; } .stats { grid-template-columns: repeat(2, 1fr); } .grid-form, .grid-form.three { grid-template-columns: 1fr; }
  .vbar .lbl { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
