:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --accent: #4f8cff;
  --text: #e6e8ec;
  --muted: #8a909b;
  --danger: #ff5c5c;
  --ok: #38d39f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---- Login ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-card {
  background: var(--panel);
  padding: 32px;
  border-radius: 14px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.4);
}
.login-card h1 { margin: 0; font-size: 26px; text-align: center; }
.subtitle { margin: 0 0 8px; color: var(--muted); text-align: center; font-size: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2b2f3a;
  background: #12141a;
  color: var(--text);
  font-size: 15px;
}
.login-card button, .toolbar button {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 10px 14px;
  font-size: 15px;
}
.login-card button:hover { filter: brightness(1.1); }
.error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0; text-align: center; }

/* ---- App ---- */
.app-page { display: flex; flex-direction: column; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid #262a33;
}
.brand { font-weight: 700; }
.spacer { flex: 1; }
.status { font-size: 13px; padding: 3px 10px; border-radius: 20px; }
.status.online { background: rgba(56,211,159,.15); color: var(--ok); }
.status.offline { background: rgba(255,92,92,.12); color: var(--danger); }
.focus-status { font-size: 12px; color: var(--muted); }
.focus-status.active { color: #ffd166; font-weight: 600; }
.control-toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.quality-control { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.quality-control select { background: #12141a; color: var(--text); border: 1px solid #363b48; border-radius: 5px; padding: 3px 5px; }
.quality-control select:disabled { opacity: .55; }
.quality-status { font-size: 11px; color: var(--ok); min-width: 120px; }
.toolbar button { background: #2b2f3a; padding: 6px 12px; font-size: 14px; }
.toolbar button:hover { background: #363b48; }

.screen-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
}
#screen {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: crosshair;
  outline: none;
}
#screen.remote-focused {
  outline: 3px solid #ffd166;
  outline-offset: -3px;
  cursor: crosshair;
}
#screen.remote-focused { cursor: none; }
.overlay {
  position: absolute;
  color: var(--muted);
  font-size: 15px;
  pointer-events: none;
}
.overlay.hidden { display: none; }
