:root {
  --bg: #f4f6fa; --panel: #ffffff; --text: #16202c; --muted: #5b6776; --line: #dde3ea;
  --green: #0f9d58; --green-bg: #e3f5eb; --red: #d93025; --red-bg: #fce8e6;
  --amber: #b26a00; --amber-bg: #fff3dc; --accent: #1a56db;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f141a; --panel: #18202a; --text: #e8edf3; --muted: #9aa6b4; --line: #2a3441;
    --green: #34c07a; --green-bg: #11321f; --red: #ff6b5f; --red-bg: #3a1714; --amber: #ffb74d; --amber-bg: #3a2a0f; --accent: #6b9bff; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.hidden { display: none !important; }
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 1.6rem; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card h2 { margin: 0 0 12px; font-size: 1.1rem; }
label { display: block; font-weight: 600; margin: 10px 0 6px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 10px 12px; font-size: 1rem; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); padding: 10px 16px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.big { width: 100%; padding: 26px 16px; font-size: 1.5rem; font-weight: 800; letter-spacing: .5px; border: 0; color: #fff; }
.big.start { background: var(--green); }
.big.stop { background: var(--red); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 220px; }
.checks label { display: inline-flex; gap: 6px; font-weight: 400; margin-right: 16px; }
.err { color: var(--red); min-height: 1.2em; margin-top: 8px; }
.meter { height: 22px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--green) 0%, var(--green) 70%, var(--amber) 85%, var(--red) 100%); transition: width 60ms linear; }
.status { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 10px; font-size: 1.25rem; font-weight: 700; }
.status.on { background: var(--red-bg); color: var(--red); }
.status.off { background: var(--bg); color: var(--muted); }
.dot { width: 14px; height: 14px; border-radius: 50%; background: currentColor; flex: none; }
.status.on .dot { animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.stats { display: flex; gap: 12px; margin-top: 12px; }
.stat { flex: 1; background: var(--bg); border-radius: 10px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 2rem; }
.stat span { color: var(--muted); font-size: .9rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .9rem; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .85rem; }
.badge.online { background: var(--green-bg); color: var(--green); }
.badge.offline { background: var(--red-bg); color: var(--red); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.muted { color: var(--muted); }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; font-size: .85rem; }

/* ---------- odbiornik (ekran TV) ---------- */
body.rx { background: #0b1220; color: #fff; overflow: hidden; }
.rx-main { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3vh 4vw; gap: 3vh; }
.rx-title { font-size: 4.2vw; font-weight: 900; letter-spacing: .15vw; margin: 0; }
.rx-room { font-size: 2.6vw; color: #9fb3d1; margin: 0; }
.rx-conn { font-size: 2.4vw; font-weight: 700; }
.rx-msg { font-size: 5vw; font-weight: 800; padding: 3vh 5vw; border-radius: 2vw; background: #16233a; color: #cfd9e8; }
.rx-msg.active { background: #b3261e; color: #fff; animation: rxpulse 1.6s ease-in-out infinite; }
@keyframes rxpulse { 50% { box-shadow: 0 0 0 2vw rgba(179,38,30,.25); } }
.rx-foot { position: fixed; bottom: 1.5vh; left: 0; right: 0; display: flex; justify-content: center; gap: 2vw; color: #6f84a3; font-size: 1.1vw; }
.rx-foot button { background: #16233a; color: #cfd9e8; border-color: #2a3a55; font-size: 1.1vw; padding: .5vw 1.2vw; }
.rx-unlock { position: fixed; inset: 0; background: rgba(5,10,20,.92); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3vh; cursor: pointer; z-index: 10; text-align: center; padding: 4vw; }
.rx-unlock b { font-size: 4vw; }
.rx-unlock span { font-size: 2vw; color: #9fb3d1; max-width: 70vw; }
.rx-error { font-size: 1.8vw; color: #ffb4ab; }
.row > .shrink { flex: 0 0 auto; }
.mt { margin-top: 12px; }
