:root {
  --bg0: #11253d;
  --bg1: #1a3554;
  --cyan: #6fc8d3;
  --blue: #4d86b8;
  --purple: #566db0;
  --gold: #a88f45;
  --text: #f5f7ff;
  --muted: rgba(238, 245, 255, 0.8);
  --panel: rgba(18, 34, 56, 0.64);
  --stroke: rgba(255, 255, 255, 0.2);
  --shadow: 0 20px 58px rgba(5, 12, 22, 0.38);
  --ok: #35c86a;
  --warn: #d0841c;
  --danger: #de596f;
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 700px at 50% 36%, rgba(111, 200, 211, 0.2), transparent 60%),
    radial-gradient(900px 500px at 20% 70%, rgba(168, 143, 69, 0.12), transparent 60%),
    radial-gradient(900px 500px at 80% 75%, rgba(86, 109, 176, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  overflow-x: hidden;
}

a {
  color: inherit;
}

.bg,
.cover,
.vignette,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg {
  z-index: -4;
  background: url("/images/background.png") center/cover no-repeat;
  opacity: 0.45;
}

.cover {
  z-index: -3;
  background: url("/images/bg-cover.png") center/cover no-repeat;
  opacity: 0.58;
}

.vignette {
  z-index: -2;
  background:
    radial-gradient(900px 520px at 50% 48%, rgba(6, 14, 26, 0.02), rgba(8, 16, 28, 0.42) 70%),
    radial-gradient(1200px 900px at 50% 45%, rgba(0, 0, 0, 0) 35%, rgba(7, 13, 23, 0.44) 85%);
}

.grain {
  z-index: -1;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="180" height="180"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency=".9" numOctaves="3" stitchTiles="stitch"/></filter><rect width="180" height="180" filter="url(%23n)" opacity=".45"/></svg>');
  background-size: 180px 180px;
}

.simple-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--stroke);
  background: rgba(22, 40, 63, 0.62);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-logo {
  width: 128px;
  height: auto;
  display: block;
  filter: drop-shadow(0 6px 18px rgba(5, 12, 22, 0.34));
}

.brand-text {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 650;
  color: rgba(238, 245, 255, 0.84);
}

.topnav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(14, 24, 38, 0.26);
}

.nav-link:hover {
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.9);
}

.nav-link.active {
  border-color: rgba(111, 200, 211, 0.52);
  color: rgba(255, 255, 255, 0.95);
  background: rgba(111, 200, 211, 0.2);
}

.topbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions .btn,
.topbar-actions .sub-chip,
.topbar-actions .user-pill,
.topbar-actions .user-menu-toggle {
  height: 38px;
  min-height: 38px;
  border-radius: 12px;
}

.user-pill {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 5px 10px 5px 6px;
  font-size: 12px;
  color: rgba(245, 247, 255, 0.86);
  max-width: 320px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 10, 18, 0.42);
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.24);
  flex: 0 0 auto;
}

.user-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(180deg, rgba(31, 185, 196, 0.9), rgba(27, 58, 123, 0.92));
}

.user-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-menu-wrap {
  position: relative;
  z-index: 45;
}

.user-menu-toggle {
  border: 1px solid var(--stroke);
  background: rgba(8, 10, 18, 0.42);
  color: rgba(245, 247, 255, 0.9);
  padding: 4px 10px 4px 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.user-menu-name {
  max-width: 180px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12px;
}

.user-menu-caret {
  font-size: 11px;
  line-height: 1;
  opacity: 0.75;
}

.user-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 270px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  background: rgba(10, 14, 24, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  padding: 10px;
  display: grid;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 60;
}

.user-menu-wrap.open .user-menu-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.user-menu-head {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.user-menu-meta {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.user-menu-meta strong {
  font-size: 13px;
  line-height: 1.2;
}

.user-menu-meta span {
  font-size: 11px;
  color: rgba(245, 247, 255, 0.72);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-menu-link {
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 8px 10px;
  color: rgba(245, 247, 255, 0.92);
  background: rgba(255, 255, 255, 0.04);
  font-size: 13px;
}

.user-menu-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-menu-nav {
  display: none;
  gap: 6px;
}

.user-menu-nav-link.active {
  border-color: rgba(123, 201, 220, 0.5);
  background: rgba(111, 200, 211, 0.2);
}

.user-menu-signout {
  border-color: rgba(218, 98, 98, 0.4);
  color: #ffdede;
  background: rgba(180, 64, 64, 0.16);
}

.sub-chip {
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 0 11px;
  font-size: 12px;
  color: rgba(245, 247, 255, 0.86);
  background: rgba(8, 10, 18, 0.36);
  display: inline-flex;
  align-items: center;
}

.page-wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 20px 44px;
  display: grid;
  gap: 18px;
}

.panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(15, 30, 49, 0.74), rgba(15, 30, 49, 0.5));
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  padding: 24px;
}

.panel::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
    radial-gradient(600px 220px at 25% 0%, rgba(111, 200, 211, 0.2), transparent 55%),
    radial-gradient(520px 240px at 85% 25%, rgba(86, 109, 176, 0.18), transparent 58%),
    radial-gradient(700px 260px at 65% 120%, rgba(168, 143, 69, 0.12), transparent 60%);
}

.panel > * {
  position: relative;
  z-index: 1;
}

.panel h1,
.panel h2,
.panel h3 {
  margin: 0 0 10px;
}

.panel p {
  margin: 0;
  color: rgba(245, 247, 255, 0.86);
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

.text-ok {
  color: #b9f4d3;
}

.text-error {
  color: #ffd0d4;
}

.grid {
  display: grid;
  gap: 16px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stream-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.hero-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.btn {
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 650;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  color: #0f2c44;
  background: linear-gradient(180deg, #9edce3, #67c0cf);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #b3e5ea, #7acbd8);
}

.btn-secondary {
  color: rgba(245, 247, 255, 0.92);
  background: rgba(16, 30, 48, 0.44);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn-secondary:hover {
  background: rgba(16, 30, 48, 0.62);
}

.hero-logo {
  width: min(340px, 100%);
  height: auto;
  display: block;
  margin-bottom: 14px;
  filter: drop-shadow(0 10px 24px rgba(5, 12, 22, 0.34));
}

.actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.list {
  margin: 8px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  color: rgba(245, 247, 255, 0.86);
}

.stream-card {
  display: grid;
  gap: 12px;
}

.player-shell {
  display: grid;
  gap: 12px;
}

.stream-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: 14px;
  align-items: start;
}

.stream-sidebar {
  align-self: stretch;
  order: 2;
}

.stream-main {
  min-width: 0;
  order: 1;
}

.player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.player-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.channel-drawer-btn {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  background: rgba(8, 14, 24, 0.46);
  color: rgba(245, 247, 255, 0.94);
  min-height: 34px;
  padding: 6px 10px;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.03em;
}

.channel-drawer-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
}

.channel-drawer-btn.channel-drawer-btn-force {
  display: inline-flex;
}

.channel-drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(88vw, 360px);
  margin: 0;
  border-radius: 0;
  z-index: 70;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.2s ease;
}

.channel-drawer-panel.open {
  transform: translateX(0);
}

.channel-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 65;
  background: rgba(3, 7, 14, 0.58);
}

.player-meta {
  margin: 4px 0 0;
  font-size: 13px;
}

.player-wrap {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  min-height: 0;
}

.player-overlay-controls {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 4;
  display: inline-flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.player-wrap:hover .player-overlay-controls,
.player-wrap:focus-within .player-overlay-controls,
.player-wrap.player-controls-visible .player-overlay-controls {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.player-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(10, 15, 24, 0.6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.player-icon-btn:hover {
  background: rgba(10, 15, 24, 0.78);
}

.player-icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.player-sound-btn {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: rgba(10, 15, 24, 0.72);
  color: #fff;
  border-radius: 11px;
  padding: 9px 12px;
  font-size: 12px;
  letter-spacing: 0.03em;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.player-sound-btn:hover {
  background: rgba(10, 15, 24, 0.86);
}

.player-brand-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at center, rgba(8, 12, 20, 0.42), rgba(0, 0, 0, 0.64));
  pointer-events: none;
}

.player-brand-logo {
  width: min(260px, 58%);
  height: auto;
  opacity: 0.92;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.46));
}

.player-brand-spinner {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.22);
  border-top-color: rgba(255, 255, 255, 0.92);
  animation: qstv-spin 1s linear infinite;
}

.player-brand-overlay:not(.is-loading) .player-brand-spinner {
  display: none;
}

.embed-hover-info {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 6;
  padding: 14px 16px 18px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0));
  color: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.embed-hover-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.embed-hover-status {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

.player-wrap:hover .embed-hover-info,
.player-wrap:focus-within .embed-hover-info,
.player-wrap.player-controls-visible .embed-hover-info {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .player-wrap:hover .player-overlay-controls,
  .player-wrap:focus-within .player-overlay-controls {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
  }

  .player-wrap.player-controls-visible .player-overlay-controls {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .player-wrap:hover .embed-hover-info,
  .player-wrap:focus-within .embed-hover-info {
    opacity: 0;
  }

  .player-wrap.player-controls-visible .embed-hover-info {
    opacity: 1;
  }
}

#channelPlayer,
#channelSinglePlayer {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  display: block;
  background: #000;
  object-fit: contain;
}

.player-fallback {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.58));
}

.player-fallback img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.player-fallback-copy {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
}

.player-fallback-label {
  position: absolute;
  bottom: 14px;
  left: 14px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px;
  letter-spacing: 0.06em;
  font-weight: 800;
  color: #fff;
  background: rgba(208, 84, 84, 0.92);
}

.player-wrap.player-wrap-expanded {
  aspect-ratio: auto;
  height: calc(100dvh - 210px);
  max-height: calc(100dvh - 25px);
  min-height: 220px;
}

body.player-theater-mode .stream-layout {
  grid-template-columns: 1fr;
}

body.player-theater-mode .stream-sidebar {
  display: none;
}

@keyframes qstv-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.channel-list {
  display: grid;
  gap: 10px;
}

.channel-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(8, 10, 18, 0.5);
  color: rgba(245, 247, 255, 0.95);
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
}

.channel-btn:hover {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(8, 10, 18, 0.72);
}

.channel-btn-active {
  border-color: rgba(111, 200, 211, 0.75);
  box-shadow: 0 0 0 2px rgba(111, 200, 211, 0.22);
}

.stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stream-head h2 {
  margin: 0;
  font-size: 20px;
}

.pill {
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.02em;
  font-weight: 800;
  padding: 5px 10px;
  border: 1px solid;
}

.pill-live {
  color: #dbffe9;
  border-color: #3cc28a;
  background: rgba(53, 200, 106, 0.22);
}

.pill-offline {
  color: #ffe3c3;
  border-color: #cf8b34;
  background: rgba(208, 132, 28, 0.2);
}

.pill-open {
  color: #dff5ff;
  border-color: #3ba3db;
  background: rgba(34, 168, 255, 0.2);
}

.pill-locked {
  color: #ffdfe0;
  border-color: #d8666a;
  background: rgba(216, 102, 106, 0.22);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  text-align: left;
  padding: 10px 8px;
  vertical-align: middle;
}

.table th {
  color: rgba(245, 247, 255, 0.62);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table code,
.meta code,
.list code {
  background: rgba(5, 7, 12, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  color: rgba(245, 247, 255, 0.92);
  padding: 2px 6px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inline-form-wide {
  flex-wrap: wrap;
  margin-top: 10px;
}

.input,
.select {
  width: 100%;
  min-width: 220px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(8, 14, 24, 0.52);
  color: #f7fbff;
  padding: 9px 10px;
  font-size: 14px;
}

.input::placeholder {
  color: rgba(237, 244, 255, 0.52);
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(245, 247, 255, 0.9);
  font-size: 13px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(8, 14, 24, 0.6);
  color: rgba(245, 247, 255, 0.92);
  font-size: 12px;
  padding: 6px 10px;
}

.chip-remove {
  cursor: pointer;
}

.inline-chip-form {
  margin: 0;
}

.kv {
  display: grid;
  gap: 8px;
}

.kv div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  padding-bottom: 8px;
}

.kv div span {
  color: var(--muted);
}

.auth-panel {
  max-width: 620px;
  margin: 30px auto;
  text-align: center;
}

.auth-brand {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
  color: rgba(245, 247, 255, 0.75);
  font-weight: 700;
}

.auth-id-btn {
  background: #f8fbff;
  color: #163d74;
  border: 2px solid #2f66b0;
  font-weight: 700;
  min-height: 52px;
  padding: 10px 16px;
  gap: 10px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(6, 17, 31, 0.18);
}

.auth-id-btn:hover {
  background: #eef3fb;
  color: #103361;
  border-color: #275a9f;
}

.auth-id-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  display: block;
  border-radius: 999px;
}

.footer {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 12px;
}

.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 20px 22px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.empty-panel {
  max-width: 600px;
  text-align: center;
}

.mgmt-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.mgmt-sidebar {
  position: sticky;
  top: 92px;
  align-self: start;
  border: 1px solid #d9e2ec;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  display: grid;
  gap: 8px;
}

.mgmt-side-title {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #536a83;
  font-weight: 700;
  margin-bottom: 4px;
}

.mgmt-link {
  text-decoration: none;
  border-radius: 10px;
  padding: 9px 10px;
  color: #173553;
  border: 1px solid transparent;
  font-size: 14px;
}

.mgmt-link:hover {
  background: #f0f5fb;
  border-color: #d9e6f4;
}

.mgmt-link.active {
  background: #e5eef8;
  border-color: #bbd1e7;
  color: #13314e;
  font-weight: 700;
}

.mgmt-stats {
  margin-top: 10px;
  border-top: 1px solid #e2eaf3;
  padding-top: 10px;
  display: grid;
  gap: 8px;
}

.mgmt-stats div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #4a5f76;
}

.mgmt-stats strong {
  color: #173553;
}

.mgmt-content {
  display: grid;
  gap: 16px;
  align-content: start;
  align-items: start;
}

.status-grid {
  display: grid;
  gap: 10px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #294863;
}

.status-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.status-pill {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  column-gap: 8px;
  border: 1px solid #d3dfeb;
  border-radius: 999px;
  background: #f4f8fc;
  color: #244867;
  padding: 7px 12px;
  font-size: 13px;
  width: 250px;
  max-width: 250px;
  min-width: 250px;
}

.status-pill span:nth-child(2) {
  white-space: nowrap;
}

.status-pill strong {
  color: #153452;
  white-space: nowrap;
  text-align: right;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}

.dot-green {
  background: #1fba66;
}

.dot-yellow {
  background: #f1b436;
}

.dot-red {
  background: #de5a5a;
}

.dot-blue {
  background: #64b5ff;
}

.dot-gray {
  background: #98a8ba;
}

.status-table-wrap {
  margin-top: 12px;
}

.process-log-tail {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d3dfeb;
  border-radius: 10px;
  background: #f8fbff;
  color: #1a3652;
  font-family: Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.35;
  max-height: 170px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.status-detail-list {
  display: grid;
  gap: 6px;
}

.status-detail-list div {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.status-detail-list span {
  color: #5f7387;
  white-space: nowrap;
}

.status-detail-list strong {
  color: #234662;
  font-size: 13px;
}

body.route-manage {
  background: linear-gradient(180deg, #f8fbff, #eef3f9);
  color: #1b3550;
}

body.route-manage .bg,
body.route-manage .cover,
body.route-manage .vignette,
body.route-manage .grain {
  display: none;
}

body.route-manage .topbar {
  position: sticky;
  top: 0;
  overflow: visible;
  background: linear-gradient(180deg, #1a3657, #152e4a);
  border-bottom: 1px solid rgba(175, 201, 227, 0.35);
}

body.route-manage .topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("/images/background.png");
  background-repeat: no-repeat;
  background-position: center top;
  background-size: 100% auto;
  opacity: 0.58;
  pointer-events: none;
}

body.route-manage .topbar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(26, 54, 87, 0.56), rgba(21, 46, 74, 0.64));
  pointer-events: none;
}

body.route-manage .topbar-inner {
  position: relative;
  z-index: 1;
}

body.route-manage .nav-link {
  color: #274463;
  background: #f3f7fb;
}

body.route-manage .nav-link:hover {
  border-color: #c9d9e8;
  color: #153452;
}

body.route-manage .nav-link.active {
  background: #e5eef8;
  border-color: #bbd1e7;
  color: #173553;
}

body.route-manage .admin-chip,
body.route-manage .user-pill,
body.route-manage .sub-chip {
  background: #f2f7fc;
  color: #173553;
  border-color: #cbd9e7;
}

body.route-manage .user-menu-toggle {
  background: #f2f7fc;
  color: #173553;
  border-color: #cbd9e7;
}

body.route-manage .user-menu-panel {
  background: #fff;
  border-color: #d8e3ee;
  box-shadow: 0 16px 42px rgba(27, 53, 80, 0.16);
}

body.route-manage .user-menu-head {
  border-color: #d8e3ee;
  background: #f5f9fd;
}

body.route-manage .user-menu-meta span {
  color: #5f7387;
}

body.route-manage .user-menu-link {
  border-color: #c7d8e8;
  color: #173553;
  background: #eef4fb;
}

body.route-manage .user-menu-link:hover {
  background: #e3edf8;
}

body.route-manage .user-menu-nav-link.active {
  border-color: #bad0e4;
  background: #e2edf8;
}

body.route-manage .user-menu-signout {
  border-color: #efc0c0;
  color: #8a2b2b;
  background: #fff2f2;
}

body.route-manage .page-wrap {
  max-width: 1320px;
  padding-top: 16px;
}

body.route-manage .panel {
  background: #fff;
  border: 1px solid #d9e3ee;
  box-shadow: 0 10px 30px rgba(27, 53, 80, 0.08);
}

body.route-manage .panel h1,
body.route-manage .panel h2,
body.route-manage .panel h3,
body.route-manage .panel strong {
  color: #163a5c;
}

body.route-manage .panel::before {
  display: none;
}

body.route-manage .panel p,
body.route-manage .meta {
  color: #4d647c;
}

body.route-manage .status-pill {
  background: #edf3fa;
  border-color: #cfdeec;
  color: #30516f;
}

body.route-manage .status-pill strong {
  color: #173553;
}

body.route-manage .status-pill span:nth-child(2) {
  color: #335875;
}

body.route-manage .status-detail-list strong {
  color: #173553;
}

body.route-manage .table th,
body.route-manage .table td {
  border-bottom: 1px solid #e5ecf4;
}

body.route-manage .table th {
  color: #5f7387;
}

body.route-manage .pill-live {
  color: #1f6b4d;
  border-color: #7ec7a6;
  background: #e5f6ef;
}

body.route-manage .pill-offline {
  color: #8b5b1f;
  border-color: #e3b16f;
  background: #fff3e2;
}

body.route-manage .pill-open {
  color: #1d5070;
  border-color: #86b9d9;
  background: #e7f4fd;
}

body.route-manage .pill-locked {
  color: #7c2f35;
  border-color: #e7a6ab;
  background: #fdecee;
}

body.route-manage .table code,
body.route-manage .meta code,
body.route-manage .list code {
  background: #f0f4f9;
  border: 1px solid #d5e1ed;
  color: #1b3550;
}

body.route-manage .btn-secondary {
  background: linear-gradient(180deg, #e0eefb, #c9dff5);
  border-color: #aac8e4;
  color: #123a5d;
  font-weight: 700;
}

body.route-manage .btn-secondary:hover {
  background: linear-gradient(180deg, #edf6ff, #d6e8fa);
}

body.route-manage .inline-form.inline-form-wide {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d2e0ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fcff, #eef5fc);
}

body.route-manage .inline-form.inline-form-wide .input,
body.route-manage .inline-form.inline-form-wide .select {
  min-height: 44px;
}

body.route-manage .inline-form.inline-form-wide textarea.input {
  min-height: 44px;
  height: 44px;
  resize: vertical;
}

body.route-manage .inline-form.inline-form-wide .checkbox-line {
  min-height: 44px;
  border: 1px solid #b9cee3;
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.route-manage .channel-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d2e0ee;
  border-radius: 12px;
  background: linear-gradient(180deg, #f9fcff, #eef5fc);
}

body.route-manage .channel-form-field {
  display: grid;
  gap: 5px;
  align-content: start;
}

body.route-manage .channel-form-field-wide {
  grid-column: 1 / -1;
}

body.route-manage .field-label {
  font-size: 12px;
  font-weight: 700;
  color: #2d516f;
}

body.route-manage .field-help {
  font-size: 11px;
  color: #637c95;
  margin: 0;
}

body.route-manage .channel-form-checkbox {
  min-height: 44px;
  border: 1px solid #b9cee3;
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #214361;
  font-size: 13px;
}

body.route-manage .channel-form-actions {
  display: flex;
  align-items: flex-end;
}

body.route-manage .input,
body.route-manage .select {
  background: #fff;
  border-color: #b9cee3;
  color: #123a5d;
}

body.route-manage .input::placeholder {
  color: #6f87a0;
}

body.route-manage .input:focus,
body.route-manage .select:focus,
body.route-manage textarea.input:focus {
  outline: none;
  border-color: #4d86b8;
  box-shadow: 0 0 0 3px rgba(77, 134, 184, 0.18);
}

body.route-manage textarea.input {
  min-height: 72px;
  resize: vertical;
}

body.route-manage .checkbox-line {
  color: #204160;
}

body.route-manage .broadcaster-grid {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

body.route-manage .broadcaster-card {
  margin: 0;
  border: 1px solid #d2e0ee;
  border-radius: 14px;
  background: linear-gradient(180deg, #f9fcff, #eef5fc);
  padding: 12px;
  display: grid;
  gap: 10px;
}

body.route-manage .broadcaster-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

body.route-manage .broadcaster-card-title-wrap {
  min-width: 0;
  display: grid;
  gap: 4px;
}

body.route-manage .broadcaster-card-title {
  margin: 0;
  color: #163a5c;
  font-size: 17px;
}

body.route-manage .broadcaster-card-title-wrap .meta {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

body.route-manage .broadcaster-health-pill {
  min-width: 165px;
}

body.route-manage .broadcaster-health-detail {
  margin-top: -2px;
}

body.route-manage .broadcaster-row {
  display: grid;
  gap: 6px;
}

body.route-manage .broadcaster-inline {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

body.route-manage .broadcaster-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-content: start;
}

body.route-manage .mgmt-form-stack {
  display: grid;
  gap: 6px;
  align-content: start;
}

body.route-manage .input-compact,
body.route-manage .select.input-compact {
  min-width: 0;
  min-height: 38px;
  padding: 7px 9px;
  font-size: 13px;
}

body.route-manage .checkbox-compact {
  min-height: 36px;
  border: 1px solid #b9cee3;
  border-radius: 10px;
  background: #fff;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

body.route-manage .broadcaster-embed-row {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

body.route-manage .broadcaster-advanced {
  border: 1px solid #d0deec;
  border-radius: 12px;
  background: #fff;
  padding: 8px 10px;
}

body.route-manage .broadcaster-advanced summary {
  cursor: pointer;
  list-style: none;
  color: #234a6a;
  font-weight: 700;
  font-size: 13px;
}

body.route-manage .broadcaster-advanced summary::-webkit-details-marker {
  display: none;
}

body.route-manage .broadcaster-advanced summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 6px;
  color: #4d86b8;
}

body.route-manage .broadcaster-advanced[open] summary::before {
  content: "▾";
}

body.route-manage .broadcaster-advanced-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

body.route-manage .broadcaster-card-actions {
  border-top: 1px solid #d4e2ef;
  padding-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.route-stream .page-wrap,
.route-channel .page-wrap {
  padding-top: 10px;
}

.route-stream .player-shell,
.route-channel .player-shell {
  min-height: 0;
}

@media (max-width: 900px) {
  .two-col,
  .stream-grid {
    grid-template-columns: 1fr;
  }

  .topbar-inner {
    flex-wrap: nowrap;
    min-width: 0;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .topnav {
    display: none;
  }

  .topbar-actions {
    width: auto;
    justify-content: flex-end;
    margin-left: auto;
  }

  .sub-chip {
    display: none;
  }

  .user-menu-name,
  .user-menu-caret {
    display: none;
  }

  .user-menu-toggle {
    width: 46px;
    min-height: 46px;
    height: 46px;
    padding: 4px;
    justify-content: center;
  }

  .user-menu-toggle .user-avatar,
  .user-menu-toggle .user-avatar-fallback {
    width: 34px;
    height: 34px;
  }

  .user-menu-panel {
    right: 0;
    left: auto;
    min-width: min(92vw, 320px);
  }

  .user-menu-head .user-avatar,
  .user-menu-head .user-avatar-fallback {
    width: 42px;
    height: 42px;
  }

  .user-menu-nav {
    display: grid;
  }

  .stream-layout {
    grid-template-columns: 1fr;
  }

  .channel-drawer-btn {
    display: inline-flex;
  }

  .stream-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 360px);
    margin: 0;
    border-radius: 0;
    z-index: 70;
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.2s ease;
  }

  .stream-sidebar.open {
    transform: translateX(0);
  }

  .status-pill {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .mgmt-shell {
    grid-template-columns: 1fr;
  }

  .mgmt-sidebar {
    position: static;
  }
}

body.channel-drawer-open {
  overflow: hidden;
}

body.embed-mode .topbar,
body.embed-mode .footer {
  display: none;
}

body.embed-mode .bg,
body.embed-mode .cover,
body.embed-mode .vignette,
body.embed-mode .grain {
  display: none;
}

body.embed-mode {
  height: 100%;
  overflow: hidden;
}

body.embed-mode .page-wrap {
  max-width: none;
  padding: 0;
  margin: 0;
  gap: 0;
  min-height: 100vh;
  height: 100vh;
}

body.embed-mode .stream-layout {
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 100%;
  height: 100%;
}

body.embed-mode .stream-sidebar {
  display: none;
}

body.embed-mode {
  background: #000;
}

body.embed-mode .content-shell {
  background: #000;
}

body.embed-mode .stream-main.panel {
  border-radius: 0;
  border: 0;
  box-shadow: none;
  background: #000;
  padding: 0;
}

body.embed-mode .stream-main .player-head {
  display: none;
}

body.embed-mode .stream-main.player-shell {
  gap: 0;
}

body.embed-mode .stream-main .player-wrap {
  height: 100%;
  min-height: 100%;
  border-radius: 0;
  border: 0;
}

body.embed-mode .stream-main .player-overlay-controls {
  right: 14px;
  bottom: 14px;
}

body.embed-mode .stream-main #playerExpandBtn {
  display: none;
}

body.embed-mode .stream-main .embed-hover-info {
  opacity: 0;
}

body.embed-mode .stream-main .player-wrap:hover .embed-hover-info,
body.embed-mode .stream-main .player-wrap:focus-within .embed-hover-info,
body.embed-mode .stream-main .player-wrap.player-controls-visible .embed-hover-info {
  opacity: 1;
}
