:root {
  --bg: #0f1720;
  --panel: #17212c;
  --panel-2: #1e2b39;
  --line: #2a3a4b;
  --text: #e8eef5;
  --muted: #8da0b3;
  --accent: #2b86e8;
  --accent-2: #1b6fd1;
  --ok: #3ecf8e;
  --bad: #ff6b6b;
  --warn: #f2b84b;
  --radius: 14px;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior: none; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 6px; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }
.muted { color: var(--muted); margin: 0 0 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.error { color: var(--bad); margin: 0 0 10px; }
.warn { color: var(--warn); font-size: 13px; margin-top: 24px; }
.grow { flex: 1; }

main { min-height: 100%; }
.center { display: grid; place-items: center; padding: 20px; min-height: 100vh; }
.page { max-width: 880px; margin: 0 auto; padding: 28px 18px 60px; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
.logo { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent-2); }
.logo svg { width: 20px; height: 20px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.narrow { width: min(420px, 100%); }
.card.empty { text-align: center; padding: 38px 22px; }
.big svg { width: 54px; height: 54px; color: var(--muted); }

label { display: block; margin: 0 0 14px; font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 14px; }
input:not([type=checkbox]), textarea, select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); border-color: transparent; }

button { font: inherit; color: var(--text); cursor: pointer; border: 0; border-radius: 10px; padding: 11px 16px; background: var(--panel-2); }
button:active { transform: translateY(1px); }
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #3c93f0; }
button.ghost { background: transparent; border: 1px solid var(--line); }
form .primary:only-child, #login-form .primary { width: 100%; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.computer { display: flex; flex-direction: column; gap: 10px; }
.computer .head { display: flex; align-items: center; gap: 12px; }
.computer .screenicon { width: 46px; height: 46px; border-radius: 12px; background: var(--panel-2); display: grid; place-items: center; }
.computer .screenicon svg { width: 26px; height: 26px; color: var(--accent); }
.computer .name { font-weight: 650; font-size: 17px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ok); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.meta { font-size: 13px; color: var(--muted); word-break: break-all; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.center-row { justify-content: center; }

dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 100%; }
dialog::backdrop { background: rgba(5, 10, 16, .72); }
dialog .card { margin: auto; }
textarea { resize: vertical; font-family: ui-monospace, Menlo, monospace; }

/* session */
#view-session { position: fixed; inset: 0; background: #05090e; overflow: hidden; }
#screen { position: absolute; inset: 0; overflow: auto; background: #05090e; }
.toolbar {
  position: absolute; z-index: 5; top: max(8px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100% - 16px)); display: flex; align-items: center; gap: 2px; padding: 5px 6px;
  background: rgba(23, 33, 44, .92); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
.toolbar .title { font-weight: 600; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
button.icon { width: 42px; height: 42px; padding: 0; display: grid; place-items: center; background: transparent; flex: none; }
button.icon:hover, button.icon.on { background: var(--panel-2); }
button.icon.on { color: var(--accent); }
button.icon svg { width: 22px; height: 22px; }
.pill { position: absolute; z-index: 5; top: 8px; left: 50%; transform: translateX(-50%); width: 56px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 0 0 14px 14px; background: rgba(23, 33, 44, .85); top: 0; }
.pill svg { width: 18px; height: 18px; }

.panel {
  position: absolute; z-index: 4; top: calc(max(8px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translateX(-50%);
  width: min(720px, calc(100% - 16px)); padding: 12px; background: rgba(23, 33, 44, .96); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 12px 34px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 8px;
}
.panel .row { gap: 6px; }
.key { padding: 10px 12px; min-width: 46px; flex: 1 1 auto; text-align: center; font-size: 14px; }
.key.wide { flex: 1; }
.key.on { background: var(--accent); color: #fff; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 4px 0; color: var(--text); font-size: 14px; }
.line select { width: auto; margin: 0; min-width: 170px; }
.line.check { justify-content: flex-start; }

.overlay { position: absolute; inset: 0; z-index: 8; display: grid; place-items: center; background: rgba(5, 9, 14, .86); padding: 20px; text-align: center; }
.spinner { width: 34px; height: 34px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: absolute; z-index: 9; bottom: max(18px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 10px 16px; border-radius: 12px; box-shadow: 0 8px 26px rgba(0,0,0,.5); max-width: calc(100% - 24px); }

/* off-screen but focusable, so phones show their keyboard */
input#kbd { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; margin: 0; font-size: 16px; }
