:root {
  color-scheme: dark;
  --bg: #07090f;
  --bg-elev: #10141d;
  --bg-soft: #171d2a;
  --line: #2a3346;
  --text: #e8edf7;
  --muted: #93a0b8;
  --accent: #5b8cff;
  --accent-2: #7aa2ff;
  --ok: #3dd68c;
  --bad: #ff5d73;
  --warn: #ffcc66;
  --shadow: 0 20px 60px rgba(0, 0, 0, .35);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.guest-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 400px at 10% -10%, rgba(91, 140, 255, .25), transparent 50%),
    var(--bg);
}
.auth-card, .panel {
  width: min(440px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.brand { display: flex; justify-content: center; margin-bottom: 18px; }
.brand img { height: 52px; width: auto; }
h1, h2, h3 { margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 14px; }
input, select, textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  text-decoration: none;
}
.btn.block { width: 100%; margin-top: 18px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.warn { background: #3a2430; color: #ffd0d8; }
.btn.small { padding: 8px 10px; border-radius: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.alert { border-radius: 12px; padding: 12px 14px; margin: 12px 0; }
.alert-error { background: rgba(255, 93, 115, .12); color: #ffd0d8; }
.alert-success { background: rgba(61, 214, 140, .12); color: #d7ffe9; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.check input { width: auto; }

.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
  background: #0c1018;
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; }
.side-brand img { height: 36px; }
.nav-link {
  display: block;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.nav-link.active, .nav-link:hover { background: var(--bg-soft); color: var(--text); }
.workspace { padding: 24px; }
.topbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card strong { display: block; font-size: 28px; margin-top: 6px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--bg-elev); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
.badge { border-radius: 999px; padding: 4px 8px; font-size: 12px; }
.badge-ok { background: rgba(61, 214, 140, .15); color: var(--ok); }
.badge-bad { background: rgba(255, 93, 115, .15); color: var(--bad); }
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters input { max-width: 280px; }
.pager { display: flex; gap: 6px; margin-top: 14px; }
.pager a { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.pager a.active { background: var(--accent); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.logo-preview { height: 72px; background: var(--bg-soft); border-radius: 12px; padding: 8px; }
.stack { margin-top: 18px; }
.section-title { margin: 22px 0 10px; }
.mb { margin-bottom: 14px; }
.reveal {
  margin-top: 8px;
  padding: 10px;
  border-radius: 10px;
  background: #0b0e15;
  word-break: break-all;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}

.player-app { min-height: 100vh; display: flex; flex-direction: column; }
.player-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.player-top img { height: 42px; }
.search { flex: 1; }
.player-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(260px, 340px) 1fr;
}
.cats, .channels, .stage { min-height: 0; }
.cats, .channels { border-right: 1px solid var(--line); overflow: auto; }
.cat, .channel {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
}
.cat.active, .channel.active, .cat:hover, .channel.active, .channel:hover { background: var(--bg-soft); }
.channel img { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; background: #0b0e15; }
.stage { display: flex; flex-direction: column; background: #05070c; }
.video-wrap { position: relative; background: black; aspect-ratio: 16/9; }
video { width: 100%; height: 100%; background: black; }
.overlay {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, .45);
  text-align: center;
  padding: 20px;
}
.overlay.show { display: grid; }
.meta { padding: 14px 16px 8px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 0 16px 16px; }
.controls input[type="range"] { width: 120px; }
.epg { padding: 0 16px 18px; color: var(--muted); }
.epg article { padding: 8px 0; border-top: 1px solid var(--line); }
.star { margin-left: auto; background: transparent; border: 0; color: var(--warn); cursor: pointer; font-size: 18px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; }
  .player-grid { grid-template-columns: 1fr; }
  .stage { order: -1; }
  .cats { display: flex; overflow: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .cat { width: auto; white-space: nowrap; }
  .channels { max-height: 46vh; border-right: 0; }
  .player-top { flex-wrap: wrap; }
}
