/* TV-first media app aesthetic. Designed for couch viewing on a TV browser,
   responsive down to mobile. Cinematic dark palette, big typography,
   horizontal-scrolling rows, visible focus rings for remote/D-pad nav. */

:root {
  --bg: #07080c;
  --bg-1: #0d0f14;
  --bg-2: #14171f;
  --bg-3: #1d2230;
  --bg-4: #2a2f40;
  --fg: #f3f5fb;
  --fg-dim: #aab1c4;
  --fg-mute: #6a728a;
  --accent: #ff2d55;          /* punchy red — reads on TV from across a room */
  --accent-2: #ff4d70;
  --accent-soft: rgba(255, 45, 85, 0.18);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --info: #60a5fa;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 18px;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.55);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;

  /* Couch-readable typography */
  --fs-body: 16px;
  --fs-h1: clamp(28px, 4.5vw, 56px);
  --fs-h2: clamp(20px, 2.4vw, 28px);
  --fs-hero: clamp(32px, 5.5vw, 72px);
}
@media (min-width: 1400px) {
  :root { --fs-body: 17px; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--fg); text-decoration: none; }

/* TV-friendly visible focus ring on every interactive thing */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
  z-index: 5;
}

/* ====== Loader ====== */
.boot {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ====== App layout ====== */
.app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ====== Top nav (TV-style) ====== */
.topnav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  height: var(--nav-h);
  background: linear-gradient(to bottom, rgba(7, 8, 12, 0.96), rgba(7, 8, 12, 0.78));
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topnav .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.2px;
  color: var(--fg);
}
.topnav .brand .logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b91c5c);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 0 24px var(--accent-soft);
}
/* Image variant of the brand mark (admin-uploaded). */
.topnav .brand img.logo-img,
.auth-card .logo-wrap img.logo-img {
  background: transparent;
  box-shadow: none;
  object-fit: contain;
  border-radius: 8px;
}
.auth-card .logo-wrap img.logo-img { width: 96px; height: 96px; border-radius: 22px; padding: 6px; background: rgba(255, 255, 255, 0.04); }
.topnav .brand img.logo-img { width: 32px; height: 32px; }
.topnav .nav-tabs {
  display: flex; gap: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav .nav-tabs::-webkit-scrollbar { display: none; }
.topnav .nav-tabs a {
  display: inline-flex; align-items: center;
  padding: 0 16px;
  height: var(--nav-h);
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}
@media (hover: hover) {
  .topnav .nav-tabs a:hover { color: var(--fg); }
}
.topnav .nav-tabs a { -webkit-tap-highlight-color: transparent; }
.topnav .nav-tabs a:active { color: var(--fg); }
.topnav .nav-tabs a.active {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.topnav .nav-tabs a {
  position: relative;
  gap: 8px;
}
/* Pending-request badge (red pill with count). */
.nav-badge {
  display: inline-flex;
  align-items: center; justify-content: center;
  min-width: 20px; height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 11px; font-weight: 800;
  line-height: 1;
  box-shadow: 0 0 0 2px var(--bg);
  animation: badge-pop 0.25s ease;
}
@keyframes badge-pop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.topnav .who { position: relative; }
.topnav .who .trigger {
  appearance: none;
  display: inline-flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--accent), #b91c5c);
  border: 0;
  color: white;
  font-size: 14px; font-weight: 700;
  padding: 4px 14px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  min-height: 40px;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 4px 14px rgba(255, 45, 85, 0.32);
}
@media (hover: hover) {
  .topnav .who .trigger:hover { filter: brightness(1.08); box-shadow: 0 6px 18px rgba(255, 45, 85, 0.42); }
}
.topnav .who .trigger:active { transform: translateY(1px) scale(0.98); }
.topnav .who .trigger.open { filter: brightness(0.92); box-shadow: 0 2px 8px rgba(255, 45, 85, 0.5); }
.topnav .who .name { font-weight: 700; }
.topnav .who .caret {
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid white;
  opacity: 0.85;
  margin-left: 2px;
  transition: transform 0.15s;
}
.topnav .who .trigger.open .caret { transform: rotate(180deg); }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  color: white;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  text-transform: uppercase;
  flex-shrink: 0;
  letter-spacing: 0.3px;
  border: 2px solid rgba(255, 255, 255, 0.18);
}
.avatar.lg { width: 44px; height: 44px; font-size: 17px; }
.avatar.solid {
  background: linear-gradient(135deg, var(--accent), #b91c5c);
  border-color: transparent;
}

.user-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--bg-1);
  border: 1px solid var(--line-2);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 100;
  animation: menu-pop 0.12s ease;
  overflow: hidden;
}
.user-menu .profile {
  display: flex; gap: 12px; align-items: center;
  padding: 14px 14px 14px;
  margin: -6px -6px 6px;
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.08), transparent 70%);
  border-bottom: 1px solid var(--line);
}
.user-menu .profile .who-name { font-weight: 700; font-size: 15px; color: var(--fg); }
.user-menu .profile .who-role {
  font-size: 11px; color: var(--fg-dim);
  margin-top: 2px;
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}
.user-menu .profile .who-role.admin { color: var(--accent); }
@keyframes menu-pop {
  from { transform: translateY(-4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.user-menu .item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  appearance: none; border: 0; background: transparent;
  color: var(--fg); text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
}
@media (hover: hover) {
  .user-menu .item:hover { background: rgba(255, 255, 255, 0.06); }
}
.user-menu .item:active { background: rgba(255, 255, 255, 0.1); }
.user-menu .item.active { background: rgba(124, 92, 255, 0.0); color: var(--accent); }
.user-menu .item.danger { color: var(--bad); }
.user-menu .item .icon { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }
.user-menu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.user-menu .header {
  padding: 10px 12px 6px;
  font-size: 11px; color: var(--fg-mute);
  text-transform: uppercase; letter-spacing: 1px; font-weight: 600;
}

@media (max-width: 700px) {
  .topnav { padding: 0 14px; gap: 10px; }
  .topnav .brand { font-size: 17px; }
  .topnav .brand .logo { width: 28px; height: 28px; font-size: 14px; }
  .topnav .who .name { display: none; }
  .topnav .nav-tabs a { font-size: 14px; padding: 0 12px; }
}

main {
  flex: 1;
  width: 100%;
  margin: 0 auto;
  max-width: 100%;
}

/* ====== Hero banner (Discover) ====== */
.hero-banner {
  position: relative;
  min-height: 56vh;
  display: flex; align-items: flex-end;
  padding: 56px 48px 64px;
  overflow: hidden;
  margin-bottom: 24px;
}
.hero-banner .bg {
  position: absolute; inset: 0;
  background: var(--bg-1) center/cover no-repeat;
  z-index: 0;
}
.hero-banner .bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(to right, rgba(7, 8, 12, 0.95) 0%, rgba(7, 8, 12, 0.55) 60%, rgba(7, 8, 12, 0.2) 100%),
    linear-gradient(to top, var(--bg) 0%, transparent 60%);
}
.hero-banner.clickable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hero-banner .content {
  position: relative; z-index: 1;
  max-width: 720px;
}
.hero-dots {
  position: absolute;
  right: 24px; bottom: 18px;
  z-index: 2;
  display: flex; gap: 6px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.hero-dots .dot {
  appearance: none;
  width: 8px; height: 8px;
  background: rgba(255, 255, 255, 0.35);
  border: 0; border-radius: 999px;
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s, width 0.2s;
}
.hero-dots .dot:hover { background: rgba(255, 255, 255, 0.6); }
.hero-dots .dot.active { background: var(--accent); width: 22px; }
@media (max-width: 700px) {
  .hero-dots { right: 14px; bottom: 12px; }
}
.hero-banner .kicker {
  text-transform: uppercase; letter-spacing: 2px; font-size: 12px;
  color: var(--accent); font-weight: 700; margin-bottom: 12px;
}
.hero-banner h1 {
  margin: 0 0 12px;
  font-size: var(--fs-hero);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 800;
}
.hero-banner .meta-row {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  margin: 8px 0 16px;
  color: var(--fg-dim);
  font-size: 14px; font-weight: 600;
}
.hero-banner .meta-row .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--fg-mute); }
.hero-banner p {
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--fg-dim);
  max-width: 60ch;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
  margin: 0 0 22px;
}

/* Hero overview that auto-scrolls when content overflows the visible 5-line
   window. The .scrolling class is added by JS only when measurement detects
   overflow; otherwise the text just renders normally. The animation is a
   single cycle (no `infinite`) timed to fit inside the 9s hero rotation —
   pause-top → slow scroll → hold-bottom → smooth return to top. */
.hero-banner .overview-clip {
  position: relative;
  max-width: 60ch;
  max-height: 7.5em; /* ~5 lines at 1.5 line-height */
  overflow: hidden;
  margin: 0 0 22px;
}
.hero-banner .overview-clip .overview-inner {
  font-size: clamp(15px, 1.4vw, 18px);
  color: var(--fg-dim);
  line-height: 1.5;
  margin: 0;
  white-space: normal;
  will-change: transform;
}
.hero-banner .overview-clip.scrolling .overview-inner {
  animation: overview-scroll 9s ease-in-out;
  animation-fill-mode: forwards;
}
@keyframes overview-scroll {
  0%, 11% { transform: translateY(0); }
  66%, 85% { transform: translateY(var(--overview-scroll-end, 0)); }
  100% { transform: translateY(0); }
}
/* Subtle gradient hint that there's more text below — only shows when
   overflowing. Doesn't block clicks on the banner. */
.hero-banner .overview-clip.scrolling::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2em;
  background: linear-gradient(to bottom, transparent, var(--bg) 95%);
  pointer-events: none;
  opacity: 0.7;
}

@media (max-width: 700px) {
  .hero-banner { min-height: 70vh; padding: 24px 18px 28px; align-items: flex-end; }
  .hero-banner .bg::after {
    background:
      linear-gradient(to top, rgba(7, 8, 12, 0.98) 0%, rgba(7, 8, 12, 0.7) 40%, rgba(7, 8, 12, 0.25) 100%);
  }
}

/* ====== Page padding ====== */
.page { padding: 28px 48px 80px; }
.page > .hero-title { margin: 0 0 24px; font-size: var(--fs-h1); font-weight: 800; letter-spacing: -0.01em; }
@media (max-width: 700px) {
  .page { padding: 18px 16px 80px; }
}

/* ====== Buttons & inputs ====== */
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg);
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.15s, transform 0.08s ease-out, border-color 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
/* Hover only on devices that actually have hover — avoids sticky :hover on iOS */
@media (hover: hover) {
  .btn:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--line-2); }
  .btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
  .btn.danger:hover { background: rgba(248, 113, 113, 0.12); }
  .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }
}
/* Tap / press feedback — must be visible on touch */
.btn:active {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(1px) scale(0.98);
}
.btn.primary:active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  box-shadow: 0 2px 8px rgba(255, 45, 85, 0.4);
  transform: translateY(1px) scale(0.98);
}
.btn.danger:active { background: rgba(248, 113, 113, 0.22); transform: translateY(1px) scale(0.98); }
.btn.ghost:active { background: rgba(255, 255, 255, 0.14); transform: translateY(1px) scale(0.98); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: white;
  box-shadow: 0 6px 20px rgba(255, 45, 85, 0.35);
}
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(248, 113, 113, 0.4); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.lg { padding: 14px 28px; font-size: 16px; min-height: 50px; }
.btn.sm { padding: 6px 12px; min-height: 32px; font-size: 13px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.input, select.input, textarea.input {
  width: 100%;
  appearance: none;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  color: var(--fg);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 16px;
  min-height: 48px;
  transition: border-color 0.15s, background 0.15s;
}
.input:focus, .input:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-3);
}
label.field { display: block; margin-bottom: 14px; }
label.field > .lbl { display: block; font-size: 11px; color: var(--fg-dim); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }
.row { display: grid; gap: 14px; }
@media (min-width: 600px) { .row.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ====== Card (admin) ====== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 18px;
}
.card h3 { margin: 0 0 18px; font-size: 19px; font-weight: 700; }
.card .sub { color: var(--fg-dim); font-size: 14px; }

.logo-row { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; }
.logo-preview {
  width: 96px; height: 96px;
  border-radius: 18px;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  overflow: hidden;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo-preview .logo-fallback {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #b91c5c);
  color: white; font-size: 44px; font-weight: 800;
}
.logo-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.inline-success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.32);
  color: var(--good);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  animation: slideUp 0.2s ease;
}

/* ====== Search bar ====== */
.search-bar {
  position: relative;
  display: flex; gap: 10px; align-items: center;
  max-width: 760px;
  margin: 0 auto 18px;
}
.search-bar .input { padding-left: 48px; padding-right: 80px; font-size: 18px; min-height: 56px; border-radius: 14px; }
/* Suppress the browser's built-in clear-X on type="search" inputs — we render
   our own Clear button. Without this WebKit/Chromium show both, overlapping. */
.search-bar input[type="search"]::-webkit-search-cancel-button,
.search-bar input[type="search"]::-webkit-search-decoration,
.search-bar input[type="search"]::-webkit-search-results-button,
.search-bar input[type="search"]::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
  display: none;
}
.search-bar .icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--fg-mute); pointer-events: none;
}
.search-bar .icon svg { width: 22px; height: 22px; }

/* ====== Horizontal-scroll row (Plex/Netflix style) ====== */
.row-section { margin: 0 0 36px; padding: 0; }
.row-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 48px;
  margin-bottom: 14px;
}
.row-head h2 {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -0.01em;
}
/* Segmented pill control — used on Discover, Search, etc. */
.seg {
  display: inline-flex; gap: 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 4px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.seg button {
  appearance: none; border: 0; background: transparent;
  color: var(--fg-dim);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s;
}
@media (hover: hover) {
  .seg button:hover { color: var(--fg); }
}
.seg button.active { background: var(--accent); color: white; }
.seg button:active { transform: translateY(1px) scale(0.98); }
.freshness {
  font-size: 11px;
  color: var(--fg-mute);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.h-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-left: 48px;
  padding: 4px 48px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--bg-3) transparent;
}
.h-row::-webkit-scrollbar { height: 8px; }
.h-row::-webkit-scrollbar-track { background: transparent; }
.h-row::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: 999px; }
@media (max-width: 700px) {
  .row-head { padding: 0 16px; }
  .h-row { padding: 4px 16px 14px; gap: 10px; scroll-padding-left: 16px; }
}

/* ====== Posters ====== */
.poster {
  position: relative;
  flex: 0 0 auto;
  scroll-snap-align: start;
  width: 180px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
@media (min-width: 1100px) { .poster { width: 200px; } }
@media (min-width: 1500px) { .poster { width: 220px; } }
@media (max-width: 700px) { .poster { width: 140px; } }
@media (max-width: 380px) { .poster { width: 120px; } }

@media (hover: hover) {
  .poster:hover {
    transform: scale(1.04) translateY(-3px);
    border-color: var(--line-2);
    box-shadow: var(--shadow-lg);
    z-index: 4;
  }
}
.poster:focus-visible {
  transform: scale(1.04) translateY(-3px);
  border-color: var(--line-2);
  box-shadow: var(--shadow-lg);
  z-index: 4;
}
.poster:active { transform: scale(0.98); transition: transform 0.08s; }
.poster { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster .ph {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: var(--fg-mute); font-size: 12px; padding: 14px; text-align: center;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-3));
}
.poster .meta {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 10px 10px;
  background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 50%, transparent 100%);
  font-size: 12px;
}
.poster .meta .t {
  font-weight: 700; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.poster .meta .y { color: var(--fg-dim); font-size: 11px; margin-top: 2px; }
.poster .badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 10px; padding: 3px 7px;
  background: rgba(0,0,0,0.7); border-radius: 4px;
  text-transform: uppercase; letter-spacing: 0.6px;
  font-weight: 700;
  backdrop-filter: blur(8px);
}
.poster .badge.tv { background: rgba(96, 165, 250, 0.92); color: black; }
.poster .badge.movie { background: rgba(255, 45, 85, 0.92); color: white; }
.poster .badge.have {
  top: auto; bottom: 8px; right: 8px; left: auto;
  background: var(--good); color: black;
}

/* ====== Search grid (vs h-row): 2D wrap when there are many results ====== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 4px 0 20px;
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
@media (min-width: 1200px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; } }
.grid .poster { width: auto; }

/* ====== Request rows ====== */
.req-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
@media (hover: hover) {
  .req-row:hover { border-color: var(--line-2); }
}
.req-row .thumb { width: 64px; height: 96px; border-radius: 6px; overflow: hidden; background: var(--bg-2); }
.req-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.req-row .info .t { font-weight: 700; font-size: 16px; }
.req-row .info .s { font-size: 13px; color: var(--fg-dim); margin-top: 4px; }
.status-pill {
  font-size: 10px; padding: 3px 9px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.7px; font-weight: 800;
  display: inline-block; margin-left: 4px;
}
.status-pending { background: rgba(251, 191, 36, 0.16); color: var(--warn); }
.status-approved { background: rgba(96, 165, 250, 0.16); color: var(--info); }
.status-added { background: rgba(52, 211, 153, 0.16); color: var(--good); }
.status-denied { background: rgba(248, 113, 113, 0.16); color: var(--bad); }
.status-failed { background: rgba(248, 113, 113, 0.16); color: var(--bad); }

@media (max-width: 600px) {
  .req-row { grid-template-columns: 56px 1fr; }
  .req-row .btn-row { grid-column: 1 / -1; padding-top: 4px; }
}

/* ====== Modal ====== */
.modal-bg {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.78);
  display: grid; place-items: center;
  padding: 0;
  animation: fadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 920px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 92dvh; overflow-y: auto;
  animation: slideUp 0.25s ease;
  margin: 18px;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } }
@media (max-width: 700px) {
  .modal-bg { place-items: end center; }
  .modal { margin: 0; max-height: 94dvh; border-radius: 18px 18px 0 0; }
}
.modal-header {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px;
  background: rgba(13, 15, 20, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.modal-header h3 { margin: 0; flex: 1; font-size: 16px; }
.modal-body { padding: 0; }

.detail-hero {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  overflow: hidden;
}
.detail-hero img { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.detail-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg-1) 0%, rgba(13, 15, 20, 0.4) 60%, transparent 100%);
}
.detail-content { padding: 0 28px 28px; margin-top: -120px; position: relative; z-index: 1; }
@media (max-width: 700px) { .detail-content { padding: 0 18px 24px; margin-top: -80px; } }

.detail-meta { display: grid; grid-template-columns: 140px 1fr; gap: 22px; align-items: end; margin-bottom: 20px; }
@media (max-width: 700px) { .detail-meta { grid-template-columns: 110px 1fr; gap: 14px; } }
.detail-meta .pcol { aspect-ratio: 2/3; border-radius: 10px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: var(--shadow); }
.detail-meta .pcol img { width: 100%; height: 100%; object-fit: cover; }
.detail-meta h2 { margin: 0 0 6px; font-size: clamp(22px, 3vw, 34px); font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; }
.detail-meta .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.detail-meta .detail-titleblock .btn-row { margin-top: 16px; }
@media (max-width: 700px) {
  .detail-meta .detail-titleblock .btn-row { margin-top: 12px; }
}
.chip {
  font-size: 11px; padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.08); color: var(--fg-dim);
  font-weight: 600; letter-spacing: 0.3px;
}
.detail-overview { color: var(--fg-dim); font-size: 15px; line-height: 1.6; max-width: 70ch; margin-bottom: 20px; }

/* ====== Empty state ====== */
.empty {
  text-align: center; padding: 60px 20px; color: var(--fg-dim);
}
.empty h3 { color: var(--fg); margin-bottom: 8px; font-size: 20px; }

/* ====== Toast ====== */
.toast {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(20px + var(--safe-bottom));
  background: rgba(13, 15, 20, 0.96);
  border: 1px solid var(--line-2);
  color: var(--fg);
  padding: 12px 22px; border-radius: 999px;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 600;
  animation: slideUp 0.2s ease;
  max-width: 90%;
  backdrop-filter: blur(10px);
}
.toast.error { background: var(--bad); color: white; border-color: var(--bad); }
.toast.success { background: var(--good); color: black; border-color: var(--good); }

/* ====== Auth ====== */
.auth-screen {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at top, rgba(255, 45, 85, 0.12), transparent 60%),
    radial-gradient(ellipse at bottom, rgba(96, 165, 250, 0.08), transparent 50%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-card .logo-wrap { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-card .logo-wrap .logo { width: 96px; height: 96px; border-radius: 22px; background: linear-gradient(135deg, var(--accent), #b91c5c); display: grid; place-items: center; color: #fff; font-size: 44px; font-weight: 800; box-shadow: 0 0 40px var(--accent-soft); }
.auth-card h1 { margin: 0 0 6px; font-size: 28px; text-align: center; font-weight: 800; }
.auth-card .sub { color: var(--fg-dim); margin-bottom: 26px; text-align: center; }

/* ====== Admin tabs ====== */
.tabs-h {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tabs-h button {
  appearance: none; border: 0; background: transparent; color: var(--fg-dim);
  padding: 14px 20px; cursor: pointer; font-weight: 700; font-size: 14px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tabs-h button.active { color: var(--fg); border-bottom-color: var(--accent); }

/* ====== Table ====== */
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.tbl th { color: var(--fg-dim); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 1.2px; }
.tbl tr:last-child td { border-bottom: 0; }

@media (max-width: 700px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
  .tbl td { border: 0; padding: 6px 0; }
  .tbl td::before { content: attr(data-l); display: block; font-size: 10px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px; font-weight: 600; }
}

/* ====== Auth-mode hides chrome ====== */
.app[data-mode="auth"] .topnav { display: none; }
