:root {
  /* Refined Neutral Obsidian Palette (Linear / Apple-inspired) */
  --bg: #09090b;
  --bg-elevated: #0e0e11;
  --surface: #121215;
  --surface-2: #18181c;
  --card: #131316;
  --card-hover: #19191e;
  --input: #0d0d10;

  --border: rgba(255, 255, 255, 0.068);
  --border-strong: rgba(255, 255, 255, 0.13);
  --border-subtle: rgba(255, 255, 255, 0.04);

  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;

  /* Restrained, Tasteful Accents */
  --accent: #e5484d;
  --accent-hover: #ec5d5e;
  --accent-soft: rgba(229, 72, 77, 0.12);
  --accent-border: rgba(229, 72, 77, 0.28);

  --amber: #e5a00d;
  --amber-soft: rgba(229, 160, 13, 0.12);

  --violet: #8e7cf6;
  --violet-soft: rgba(142, 124, 246, 0.12);

  --emerald: #30a46c;
  --emerald-soft: rgba(48, 164, 108, 0.13);

  --sidebar-w: 274px;
  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 14px;
  --radius-xl: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

h1, h2, h3, h4, .brand-title {
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, sans-serif;
  letter-spacing: -0.02em;
}

button, input, select { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* Subtle Custom Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.09); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }

/* App Shell — Clean, Calm Background */
.app-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 12px 10px;
  z-index: 40;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 14px;
}

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

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.brand-title {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
}

.brand-sub {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
}

.engine-dot {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: var(--text-3);
}

.engine-dot.api {
  background: var(--emerald);
}

.sidebar-top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn-accent {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn-accent:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Primary Navigation */
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 12px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7.5px 9px;
  border-radius: 9px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.13s ease, color 0.13s ease, border-color 0.13s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.nav-item.active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-icon-box {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon-red { background: var(--accent-soft); color: #f27477; }
.nav-icon-amber { background: var(--amber-soft); color: #f0b429; }
.nav-icon-violet { background: var(--violet-soft); color: #a899fa; }

.nav-label { flex: 1; }

.unread-badge {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: #ff9497;
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.unread-badge-amber {
  background: var(--amber-soft);
  border-color: rgba(229, 160, 13, 0.28);
  color: #f5c249;
}

.unread-badge-violet {
  background: var(--violet-soft);
  border-color: rgba(142, 124, 246, 0.28);
  color: #c2b6fc;
}

/* Sidebar Search & Category Filter */
.sidebar-filter-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.sidebar-search, .mini-search { position: relative; }

.sidebar-search input,
.mini-search input {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px 7px 30px;
  font-size: 12.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.sidebar-search input::placeholder,
.mini-search input::placeholder {
  color: var(--text-3);
}

.sidebar-search input:focus,
.mini-search input:focus {
  border-color: var(--border-strong);
  background: var(--surface);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}

.cat-pills-row {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.cat-pills-row::-webkit-scrollbar { display: none; }

.cat-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 7px;
  padding: 3.5px 8.5px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.13s ease;
}

.cat-pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
}

.cat-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}

/* Scrollable Channels */
.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 2px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 8px 5px;
}

.section-count {
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  margin-bottom: 6px;
}

.channel-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.channel-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.channel-row.active {
  background: var(--surface-2);
  border-color: var(--border);
}

.ch-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-2);
}

.ch-avatar img { width: 100%; height: 100%; object-fit: cover; }

.ch-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ch-name {
  font-size: 12.8px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.ch-cat {
  font-size: 10.8px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.25;
}

.ch-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5.5px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.row-icon-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}

.channel-row:hover .row-icon-btn,
.row-icon-btn.is-fav { opacity: 1; }
.row-icon-btn.is-fav { color: var(--amber); }
.row-icon-btn:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.row-icon-btn.del:hover { color: #f27477; }

/* Auto-Sync Footer */
.sidebar-footer {
  margin-top: 6px;
  padding: 9px 6px 2px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sync-status-left { display: flex; align-items: center; gap: 7px; min-width: 0; }

.sync-pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  flex-shrink: 0;
}

.sync-pulse-dot.syncing {
  background: var(--amber);
  animation: pulseDot 1s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.sync-status-text {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-now-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  padding: 3.5px 8.5px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.13s ease;
}

.sync-now-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

/* =========================================================
   MAIN WORKSPACE & TOPBAR
   ========================================================= */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  flex-shrink: 0;
}

.header-avatar img { width: 100%; height: 100%; object-fit: cover; }

.header-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.header-title {
  font-size: 17.5px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.header-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 1px;
}

.category-chip-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 99px;
  padding: 2.5px 9px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s ease;
}

.category-chip-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.star-icon-btn, .ext-icon-link {
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: 15px;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  transition: all 0.13s ease;
}

.star-icon-btn:hover, .ext-icon-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}
.star-icon-btn.active { color: var(--amber); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 2.5px;
  gap: 2px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 6.5px;
  cursor: pointer;
  transition: background-color 0.13s ease, color 0.13s ease;
}

.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 1px 2px rgba(0, 0, 0, 0.25);
}

.date-picker-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 5px 10px;
  color: var(--text-2);
  transition: border-color 0.13s ease;
}

.date-picker-pill:hover { border-color: var(--border-strong); }

.date-picker-pill.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.date-picker-pill input[type="date"] {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  outline: none;
  color-scheme: dark;
  cursor: pointer;
}

/* =========================================================
   BODY CONTENT & TOOLBAR
   ========================================================= */
.content {
  padding: 22px 28px 56px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.type-segmented {
  flex-shrink: 0;
}

.seg-count {
  font-size: 10.5px;
  opacity: 0.62;
  margin-left: 3px;
  font-variant-numeric: tabular-nums;
}

.video-cat-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.vcat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s ease;
}

.vcat-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.vcat-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
  font-weight: 600;
}

.vcat-pill.short-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.vcat-count {
  opacity: 0.6;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-left: 3px;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 5.5px 11px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s ease;
}

.toggle-chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.toggle-chip.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: #ff9fa2;
  font-weight: 600;
}

.toggle-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}

.toggle-chip.active .toggle-dot { background: var(--accent); }

.toggle-count {
  min-width: 18px;
  height: 17px;
  padding: 0 5.5px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-2);
  font-size: 10.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.toggle-chip.active .toggle-count {
  background: rgba(229, 72, 77, 0.24);
  color: #ffc2c4;
}

.mini-search { width: 180px; }
.mini-search input { padding-top: 5.5px; padding-bottom: 5.5px; font-size: 12px; }

.minimal-select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5.5px 10px;
  font-size: 12px;
  color: var(--text-2);
  outline: none;
  cursor: pointer;
  transition: border-color 0.13s ease;
}

.minimal-select:hover, .minimal-select:focus {
  border-color: var(--border-strong);
  color: var(--text);
}

/* Dates Strip */
.dates-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -10px;
}

.dates-strip-label {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
}

.dates-strip-list {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dates-strip-list::-webkit-scrollbar { display: none; }

.date-link-pill {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 500;
  padding: 3.5px 9px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s ease;
}

.date-link-pill:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.date-link-pill.active {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: #ffb3b5;
}

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7.5px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease, opacity 0.14s ease;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sm { padding: 5.5px 11px; font-size: 12px; border-radius: 7.5px; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.btn-primary:hover:not(:disabled) {
  background: #ffffff;
}

.btn-subtle {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
}

.btn-subtle:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-wl.saved {
  background: var(--violet-soft);
  border-color: rgba(142, 124, 246, 0.35);
  color: #c9bffd;
}

.btn-watched.is-watched {
  background: var(--emerald-soft);
  border-color: rgba(48, 164, 108, 0.35);
  color: #8ee0b5;
}

.text-link {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.22);
  transition: color 0.13s ease, text-decoration-color 0.13s ease;
}

.text-link:hover {
  color: var(--text);
  text-decoration-color: rgba(255, 255, 255, 0.55);
}

/* =========================================================
   CINEMA STAGE + SIDE UP-NEXT QUEUE
   ========================================================= */
.stage-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 344px;
  gap: 16px;
  align-items: stretch;
}

.player-section.theatre .stage-grid { grid-template-columns: 1fr; }
.player-section.theatre .upnext-panel { display: none; }

.player-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.36);
}

.player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

.player-bar {
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.player-info { flex: 1; min-width: 240px; }

.player-title {
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.02em;
  color: var(--text);
}

.player-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-2);
}

.player-channel-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--text);
}

.tiny-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.tiny-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sep { opacity: 0.35; }

.tag-pill {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 6px;
}

.player-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.player-desc-box { border-top: 1px solid var(--border); padding: 10px 20px 14px; }
.desc-btn { background: none; border: none; color: var(--text-3); font-size: 12px; font-weight: 500; cursor: pointer; }
.desc-btn:hover { color: var(--text); }
.player-desc { margin-top: 8px; font-size: 12.5px; line-height: 1.62; color: var(--text-2); white-space: pre-wrap; }

/* Side Up-Next Queue */
.upnext-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 560px;
}

.upnext-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.upnext-title { font-size: 13px; font-weight: 600; color: var(--text); }

.upnext-count {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.upnext-list {
  flex: 1;
  overflow-y: auto;
  padding: 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.upnext-item {
  display: flex;
  gap: 10px;
  padding: 7px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease, opacity 0.12s ease;
}

.upnext-item:hover { background: rgba(255, 255, 255, 0.045); }
.upnext-item.playing {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.upnext-item.watched { opacity: 0.52; }
.upnext-item.watched:hover, .upnext-item.watched.playing { opacity: 1; }

.upnext-thumb {
  position: relative;
  width: 108px;
  aspect-ratio: 16 / 9;
  border-radius: 7px;
  overflow: hidden;
  background: #09090b;
  flex-shrink: 0;
}

.upnext-thumb img { width: 100%; height: 100%; object-fit: cover; }

.upnext-dur {
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: rgba(9, 9, 11, 0.86);
  color: #f4f4f5;
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 1px 4.5px;
  border-radius: 4px;
}

.upnext-watched-mark {
  position: absolute;
  left: 4px;
  top: 4px;
  background: rgba(48, 164, 108, 0.92);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4.5px;
  border-radius: 4px;
}

.upnext-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }

.upnext-name {
  font-size: 12.2px;
  font-weight: 500;
  line-height: 1.34;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.upnext-meta { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =========================================================
   VIDEO GRID & EDITORIAL CARDS
   ========================================================= */
.grid-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}

.grid-header h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.muted-count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 18px;
}

.video-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.16s ease, background-color 0.16s ease, opacity 0.16s ease;
}

.video-card:hover {
  border-color: var(--border-strong);
  background: var(--card-hover);
}

.video-card.playing {
  border-color: rgba(255, 255, 255, 0.28);
  background: var(--card-hover);
}

.video-card.watched { opacity: 0.56; }
.video-card.watched:hover, .video-card.watched.playing { opacity: 1; }

.thumb-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0c0c0f;
  overflow: hidden;
}

.thumb-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.24s ease;
}

.video-card:hover .thumb-box img { transform: scale(1.02); }

.thumb-hover-play {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.26);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.video-card:hover .thumb-hover-play { opacity: 1; }

.play-bubble {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dur-pill {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(9, 9, 11, 0.84);
  color: #f4f4f5;
  font-size: 10.8px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  padding: 2px 6.5px;
  border-radius: 5px;
}

.short-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(9, 9, 11, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f4f5;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6.5px;
  border-radius: 5px;
}

.watched-pill {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(9, 9, 11, 0.82);
  border: 1px solid rgba(48, 164, 108, 0.45);
  color: #8ee0b5;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
}

.card-body {
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.card-title {
  font-size: 13.6px;
  font-weight: 600;
  line-height: 1.42;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-cat-row { display: flex; align-items: center; gap: 6px; }

.card-cat-tag {
  font-size: 10.8px;
  font-weight: 500;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 1.5px 7.5px;
  border-radius: 5px;
}

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
}

.card-ch { display: flex; align-items: center; gap: 8px; min-width: 0; }

.card-ch-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-2);
}

.card-ch-avatar img { width: 100%; height: 100%; object-fit: cover; }

.card-ch-meta { display: flex; flex-direction: column; min-width: 0; }
.card-ch-name { font-size: 12px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.card-date { font-size: 11px; color: var(--text-3); line-height: 1.25; font-variant-numeric: tabular-nums; }

.card-actions { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }

.card-act-btn {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.13s ease;
}

.card-act-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--border);
  color: var(--text);
}

.card-act-btn.saved {
  background: var(--violet-soft);
  border-color: rgba(142, 124, 246, 0.35);
  color: #c9bffd;
}

.card-act-btn.watched-on {
  background: var(--emerald-soft);
  border-color: rgba(48, 164, 108, 0.35);
  color: #8ee0b5;
}

/* =========================================================
   CENTER / EMPTY STATES
   ========================================================= */
.center-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 52px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.center-state h2 { font-size: 16px; font-weight: 700; }
.center-state p { font-size: 13px; color: var(--text-2); max-width: 440px; }
.quick-dates-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin: 4px 0; }
.empty-actions { display: flex; gap: 8px; margin-top: 6px; }

.spinner {
  width: 26px;
  height: 26px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.spinner-sm { width: 15px; height: 15px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   MODALS
   ========================================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 500px;
  max-height: 86vh;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.modal-sm { max-width: 420px; }

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 { font-size: 15px; font-weight: 700; }
.modal-header p { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.modal-tabs { display: flex; padding: 0 20px; border-bottom: 1px solid var(--border); gap: 12px; }

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 2px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.13s ease, border-color 0.13s ease;
}

.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

.modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inline-form { display: flex; gap: 8px; }

.inline-form input, .field input {
  flex: 1;
  width: 100%;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8.5px 12px;
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.inline-form input::placeholder, .field input::placeholder { color: var(--text-3); }
.inline-form input:focus, .field input:focus {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12px; color: var(--text-3); }
.helper-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); }
.inline-spinner { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; font-size: 12.5px; color: var(--text-2); }
.results-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }

.sr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sr-info { flex: 1; min-width: 0; }
.sr-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-sub { font-size: 11.2px; color: var(--text-3); }

.cat-choices-grid { display: flex; flex-wrap: wrap; gap: 6px; }

.cat-choice-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-2);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.13s ease;
}

.cat-choice-btn:hover { border-color: var(--border-strong); color: var(--text); }
.cat-choice-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 600; }

.divider { height: 1px; background: var(--border); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

.feedback-box { padding: 10px 12px; border-radius: 9px; font-size: 12.2px; line-height: 1.5; }
.feedback-box.success { background: var(--emerald-soft); border: 1px solid rgba(48, 164, 108, 0.32); color: #a7f3d0; }
.feedback-box.error { background: var(--accent-soft); border: 1px solid var(--accent-border); color: #fecaca; }

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
  background: var(--bg-elevated);
  transition: border-color 0.14s ease, background-color 0.14s ease;
}

.dropzone.dragover { border-color: var(--text); background: var(--surface-2); }
.dropzone-compact { padding: 16px 14px; gap: 7px; }

/* =========================================================
   WATCH LATER AUTO-SYNC PANEL (CLEAN & RESTRAINED)
   ========================================================= */
.wl-sync-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wl-connected-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.wl-connected-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.wl-connected-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wl-connected-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.wl-playlist-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.2px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 6px;
  transition: border-color 0.13s ease, background-color 0.13s ease;
}

.wl-playlist-badge:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.08);
}

.wl-connected-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.wl-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wl-setup-head h3 {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 3px;
}

.wl-setup-helpers {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wl-discovered-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 2px;
}

.wl-playlist-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.13s ease, background-color 0.13s ease;
}

.wl-playlist-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.wl-playlist-chip-count {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.wl-quick-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 10px;
}

.wl-quick-add-row input {
  flex: 1;
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7.5px 11px;
  font-size: 12.5px;
  outline: none;
  transition: border-color 0.13s ease;
}

.wl-quick-add-row input:focus { border-color: var(--border-strong); }

.wl-settings-connected {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  background: var(--emerald-soft);
  border: 1px solid rgba(48, 164, 108, 0.28);
  border-radius: 10px;
  flex-wrap: wrap;
}

.wl-settings-connected-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* =========================================================
   TOASTS
   ========================================================= */
.toast-container {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.48);
}

.toast.success { border-color: rgba(48, 164, 108, 0.45); }
.toast.error { border-color: var(--accent-border); }

/* =========================================================
   RESPONSIVE
   ========================================================= */
.mobile-only { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.65); z-index: 35; }

@media (max-width: 1180px) {
  .stage-grid { grid-template-columns: 1fr; }
  .upnext-panel { max-height: 270px; }
}

@media (max-width: 900px) {
  .mobile-only { display: inline-flex; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .mini-search { width: 145px; }
}
