:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --line: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --ok: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
h1, h2, h3 { margin: 0 0 0.5rem; }
.muted { color: var(--muted); }
a { color: var(--accent); }
.top {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #0b1220;
}
.top nav { display: flex; gap: 0.5rem; flex: 1; }
main { padding: 1.25rem; }
.card, .login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem;
}
.login-card { width: min(360px, 92vw); }
label { display: block; margin: 0.75rem 0; color: var(--muted); font-size: 0.9rem; }
input, button, select, pre {
  font: inherit;
}
input, select {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: var(--text);
}
button {
  background: #1b4f72;
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  cursor: pointer;
}
button.ghost { background: transparent; border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button.nav { background: transparent; color: var(--muted); }
button.nav.active { color: var(--accent); background: #0f172a; }
.row { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.75rem; }
.row.wrap { flex-wrap: wrap; }
.row.wrap label { min-width: 140px; flex: 1; }
.split { display: grid; grid-template-columns: 320px 1fr; gap: 1rem; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.list { display: flex; flex-direction: column; gap: 0.5rem; }
.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  cursor: pointer;
}
.item.active { border-color: var(--accent); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.4rem; background: var(--muted); }
.dot.on { background: var(--ok); }
.empty-card { min-height: 240px; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 0.35rem 0.75rem; font-size: 0.95rem; }
.kv span { color: var(--muted); }
pre {
  background: #0b1220;
  padding: 0.9rem;
  border-radius: 8px;
  overflow: auto;
  color: #cbd5e1;
  font-size: 0.85rem;
}
.token-box { margin: 1rem 0; padding: 1rem; background: #0b1220; border-radius: 8px; }
.token-box img { background: white; padding: 8px; border-radius: 8px; max-width: 220px; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal[hidden],
[hidden] {
  display: none !important;
}
.remote-panel {
  width: min(920px, 100%);
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
}
#remoteStage {
  background: #000;
  min-height: 360px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  overflow: hidden;
}
#remoteViewport {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}
#remoteFrame {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
#remoteHit {
  position: absolute;
  inset: 0;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}
.remote-toolbar { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.75rem; }
.toolbar-sep { width: 1px; height: 1.4rem; background: #475569; margin: 0 0.25rem; }
.hidden { display: none !important; }
.apk-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; cursor: default; }
.apk-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
}
.apk-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.profile-wide { grid-column: 1 / -1; }
.inline-check { display: flex; align-items: center; gap: 0.45rem; color: var(--text); margin: 0.5rem 0; }
.inline-check input { width: auto; margin: 0; }
.app-picker { max-height: 320px; }
.app-picker label { align-items: flex-start; }
.app-picker .app-meta { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 900px) { .profile-grid { grid-template-columns: 1fr; } }
.profile-block { background: #0b1220; border: 1px solid var(--line); border-radius: 10px; padding: 0.9rem; }
.profile-block h3 { margin-top: 0; }
.profile-block textarea { width: 100%; min-height: 96px; margin-top: 0.35rem; padding: 0.65rem; border-radius: 8px; border: 1px solid var(--line); background: #0f172a; color: var(--text); }
.check-list { display: flex; flex-direction: column; gap: 0.35rem; max-height: 180px; overflow: auto; }
.check-list label { display: flex; align-items: center; gap: 0.5rem; margin: 0; color: var(--text); }
.check-list input { width: auto; margin: 0; }
.wifi-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.5rem; align-items: end; margin-bottom: 0.5rem; }
.range-row { display: grid; grid-template-columns: 110px 1fr 48px; gap: 0.5rem; align-items: center; margin: 0.4rem 0; }
.range-row input[type="range"] { width: 100%; margin: 0; }
.toggle-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.toggle-row label { display: flex; align-items: center; gap: 0.4rem; margin: 0; color: var(--text); }
.toggle-row input { width: auto; margin: 0; }
