:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0ea5e9;
  --accent-soft: #e0f2fe;
  --ok: #10b981;
  --danger: #ef4444;
  --font: "Manrope", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(800px 400px at 90% -10%, #dbeafe, transparent 55%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.hidden { display: none !important; }
.center { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.card {
  width: min(380px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
  display: grid;
  gap: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}
label { font-size: .85rem; color: var(--muted); font-weight: 600; }
input, button { font: inherit; border-radius: 12px; border: 1px solid var(--line); padding: 11px 12px; }
input { background: #fff; color: var(--text); width: 100%; }
button {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
  color: #fff; border: 0; font-weight: 700; cursor: pointer;
}
button.ghost { background: #fff; border: 1px solid var(--line); color: var(--text); }
.muted, .hint { color: var(--muted); font-size: .85rem; margin: 0; }
.error { color: var(--danger); min-height: 1.2em; }
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: 100vh; }
aside {
  background: rgba(255,255,255,.9);
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}
.aside-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
main { padding: 16px; display: grid; grid-template-rows: auto auto 1fr; gap: 12px; }
.player-wrap {
  background: #0b1220; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); position: relative;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}
video { width: 100%; aspect-ratio: 16/9; background: #0b1220; display: block; }
.player-screen-art {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  background: #0b1220;
}
.player-screen-art.hidden { display: none; }
.player-screen-art img,
.player-screen-art video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}
.player-screen-art.show-img img { display: block; }
.player-screen-art.show-vid video { display: block; }
.player-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(37, 99, 235, 0.35), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #111827 55%, #0f172a 100%);
  color: #f8fafc;
  pointer-events: none;
}
.player-loading.hidden { display: none; }
.player-brand {
  width: min(220px, 70%);
  height: auto;
  filter: drop-shadow(0 8px 24px rgba(37, 99, 235, 0.45));
  animation: brand-pulse 2.2s ease-in-out infinite;
}
.player-loading-spin {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(125, 211, 252, 0.25);
  border-top-color: #38bdf8;
  animation: spin 0.85s linear infinite;
}
.player-loading-title {
  margin: 4px 0 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.player-loading-sub {
  margin: 0;
  max-width: 28rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #94a3b8;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes brand-pulse {
  0%, 100% { opacity: 0.88; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.03); }
}
.now {
  position: absolute; left: 12px; bottom: 12px; z-index: 5;
  background: rgba(15,23,42,.7); color: #fff; padding: 6px 10px; border-radius: 8px; font-size: .9rem;
}
.toolbar { display: flex; justify-content: space-between; align-items: center; }
.toolbar h2 { margin: 0; font-size: 1.1rem; }
.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 8px; border-radius: 12px; border: 1px solid transparent;
  margin-bottom: 6px; cursor: pointer; background: #fff;
}
.cat-item:hover, .cat-item.active { border-color: #7dd3fc; background: var(--accent-soft); }
.cat-item .meta { display: flex; flex-direction: column; gap: 2px; }
.cat-item .name { font-weight: 700; }
.switch {
  width: 42px; height: 24px; border-radius: 999px; border: 0; position: relative;
  background: #cbd5e1; flex-shrink: 0;
}
.switch.on { background: var(--ok); }
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: left .15s;
}
.switch.on::after { left: 21px; }
.channels {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-content: start;
  overflow: auto;
  max-width: 720px;
}
.ch {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(15,23,42,.04);
}
.ch .logo {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 10px;
  object-fit: contain;
  background: #f1f5f9;
  border: 1px solid var(--line);
  padding: 4px;
}
.ch .logo-fallback {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #e2e8f0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
}
.ch .meta { min-width: 0; display: grid; gap: 2px; }
.ch:hover, .ch.playing { border-color: #7dd3fc; background: var(--accent-soft); }
.ch .t {
  font-weight: 700;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ch .s { color: var(--muted); font-size: .8rem; }
.side-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 14px; }
.side-tabs button {
  background: #fff; border: 1px solid var(--line); color: var(--muted);
  padding: 8px 6px; font-size: .8rem; border-radius: 10px;
}
.side-tabs button.active { background: var(--accent-soft); color: #0369a1; border-color: #7dd3fc; }
.info-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  box-shadow: 0 6px 16px rgba(15,23,42,.04);
}
.stat-card .label { display: block; color: var(--muted); font-size: .78rem; font-weight: 600; margin-bottom: 4px; }
.stat-card strong { font-size: 1.15rem; }
.panel-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 6px 16px rgba(15,23,42,.04);
}
.panel-card h3 { margin: 0 0 10px; }
.kv { display: grid; gap: 8px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.kv span { color: var(--muted); }
.form-grid { display: grid; gap: 8px; }
.form-grid select { font: inherit; border-radius: 12px; border: 1px solid var(--line); padding: 11px 12px; background: #fff; }
.pkg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.pkg {
  border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; background: #f8fafc; text-align: left;
}
.pkg.active, .pkg:hover { border-color: #7dd3fc; background: var(--accent-soft); }
.pkg strong { display: block; margin-bottom: 4px; }
.list-soft { display: grid; gap: 8px; }
.list-soft .row-item {
  display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; font-size: .88rem;
}
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge.pending { background: #fef3c7; color: #b45309; }
.badge.approved { background: #d1fae5; color: #047857; }
.badge.rejected { background: #fee2e2; color: #b91c1c; }
#view-profile, #view-credit { display: grid; gap: 4px; align-content: start; overflow: auto; }
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  aside {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 42vh;
  }
  main { padding: 12px; }
  .player-wrap { border-radius: 12px; }
  video { max-height: 40vh; }
  .channels { max-width: none; padding-bottom: 24px; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
  .ch { padding: 8px 10px; gap: 10px; }
  .ch .logo, .ch .logo-fallback {
    width: 40px;
    height: 40px;
    border-radius: 8px;
  }
  .ch .t { font-size: 0.92rem; }
  #now-playing { font-size: 0.8rem; max-width: 80%; }
}
