/* =========================================================
   CSS Variables
   ========================================================= */
:root {
  --bg: #0e1117;
  --bg-2: #161b27;
  --bg-3: #1e2435;
  --border: #2a3149;
  --border-2: #3a4263;
  --primary: #6366f1;
  --primary-hover: #4f51cc;
  --primary-light: rgba(99,102,241,0.12);
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --success: #22c55e;
  --success-light: rgba(34,197,94,0.12);
  --error: #ef4444;
  --error-light: rgba(239,68,68,0.12);
  --warning: #f59e0b;
  --warning-light: rgba(245,158,11,0.12);
  --info-light: rgba(99,102,241,0.10);
  /* Chart palette — chart-1 always tracks the theme accent color */
  --chart-1: var(--primary);
  --chart-2: #22c55e;
  --chart-3: #f59e0b;
  --chart-4: #ec4899;
  --chart-5: #14b8a6;
  --chart-6: #f97316;
  --chart-7: #8b5cf6;
  --chart-8: #06b6d4;
  --sidebar-width: 220px;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --transition: 150ms ease;
}

/* =========================================================
   Z-index scale
   =========================================================
   200  — Dropdowns / tooltips / tz-dropdown
   300  — Sidebar overlay (mobile backdrop)
   400  — Sidebar (mobile slide-in)
   500  — Player bar
   600  — Toasts
   700  — Modal overlay
   800  — Modal
   900  — Setup / login overlays
   950  — Search overlay
   ========================================================= */

/* =========================================================
   Reset & Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; }
input, select, textarea { font: inherit; }
img { display: block; }

/* =========================================================
   Layout
   ========================================================= */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.logo {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
}

.logo-img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
}

.logo-name {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.logo-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.1;
  background: linear-gradient(120deg, var(--primary) 0%, var(--chart-2, var(--primary)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tagline {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-3);
  line-height: 1;
}

#nav {
  flex: 1;
  padding: 10px 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text-2);
  transition: background var(--transition), color var(--transition);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); }

#app-status {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg-3);
  margin: 0 8px 6px;
  border-radius: var(--radius);
}

#status-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.status-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--text-2);
  line-height: 1.35;
}

.status-item-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.status-item-main {
  font-size: 11.5px;
  font-weight: 600;
}

.status-item-sub {
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 400;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
  margin-top: 3px;
}
.status-dot.ok     { background: var(--success); }
.status-dot.warn   { background: #f59e0b; }
.status-dot.error  { background: var(--error); }
.status-dot.active {
  background: var(--primary);
  animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(0.75); }
}

#sidebar-footer {
  padding: 4px 18px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
}

#sidebar-footer a {
  color: var(--text-3);
  opacity: 0.7;
  transition: opacity var(--transition);
}

#sidebar-footer a:hover {
  opacity: 1;
  color: var(--primary);
}

/* Main content */
#content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* =========================================================
   Page scaffolding
   ========================================================= */
.page {
  padding: 28px 32px;
  max-width: 1200px;
  animation: page-enter 0.16s ease-out;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: none;
  transition: background var(--transition), opacity var(--transition);
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }

.btn-danger { background: var(--error-light); color: var(--error); border: 1px solid var(--error-light); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px; border-radius: var(--radius-sm); }

.btn:disabled { opacity: 0.45; pointer-events: none; }

/* =========================================================
   Cards
   ========================================================= */
.card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.card-body { padding: 20px; }

/* =========================================================
   Stats row
   ========================================================= */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.15s, background 0.15s;
}
.stat-card:hover {
  border-color: var(--primary);
  background: var(--bg-3);
  transform: translateY(-1px);
}

.stat-label {
  font-size: 12px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text);
}

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

/* =========================================================
   Feed grid
   ========================================================= */
.feeds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.feed-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.feed-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.art-paused-overlay {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.feed-card-art {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: var(--bg-3);
  overflow: hidden;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.feed-card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feed-card-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--text-3);
}

.feed-card-title {
  font-weight: 600;
  font-size: 14px;
  line-height: 1.35;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-card-author {
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-card-overlay {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.feed-card:hover .feed-card-overlay {
  opacity: 1;
  pointer-events: auto;
}

.feed-card-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-3);
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.feed-card-action:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.feed-card-action-delete:hover {
  background: var(--error-light);
  color: var(--error);
}

.feed-card-action:disabled {
  opacity: 0.5;
  cursor: default;
}

.feed-card-activity {
  display: flex;
  gap: 5px;
  margin-top: 8px;
}

.feed-card-pip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--primary);
  cursor: pointer;
}

.feed-card-pip:hover {
  background: var(--primary-light);
}

.feed-card-pip.pip-downloading svg {
  animation: pip-dl 1.4s ease-in-out infinite;
}

.feed-card-pip.pip-syncing svg {
  animation: pip-spin 1.6s linear infinite;
}

@keyframes pip-dl {
  0%, 100% { transform: translateY(-1px); opacity: 0.7; }
  50%       { transform: translateY(1px);  opacity: 1; }
}

@keyframes pip-spin {
  to { transform: rotate(360deg); }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-default { background: var(--bg-3); color: var(--text-2); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-error { background: var(--error-light); color: var(--error); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-info { background: var(--info-light); color: var(--primary); }
.badge-imported { background: var(--bg-3); color: var(--text-3); }

/* =========================================================
   Feed detail
   ========================================================= */
.feed-header {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.feed-header-art {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-3);
  flex-shrink: 0;
}

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

.feed-header-info { flex: 1; min-width: 0; }

.feed-header-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.feed-header-author {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
}

.feed-last-checked {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.feed-header-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.feed-stat-sep { color: var(--text-3); }

.feed-header-desc {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  border-radius: 4px;
  transition: background var(--transition);
}
.feed-header-desc[data-expandable] { cursor: pointer; }
.feed-header-desc[data-expandable]:hover { background: var(--bg-3); }
.feed-header-desc[data-expanded] {
  display: block;
  overflow: visible;
}

.feed-header-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* =========================================================
   Episodes list
   ========================================================= */
.episode-list { display: flex; flex-direction: column; gap: 0; }

.episode-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.ep-notes-panel {
  flex: 1 1 100%;
  max-height: 0;
  overflow: hidden;
  padding: 0 12px 0 58px;
  transition: max-height 0.28s ease, padding-bottom 0.28s ease;
}
.episode-item[data-notes-open] .ep-notes-panel { max-height: min(800px, 60vh); padding-bottom: 12px; }

.ep-notes-inner {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-2);
}
.ep-notes-inner a { color: var(--primary); }
.ep-notes-inner p  { margin: 0 0 8px; }
.ep-notes-inner p:last-child { margin-bottom: 0; }
.ep-notes-inner ul, .ep-notes-inner ol { margin: 0 0 8px; padding-left: 20px; }
.ep-notes-inner li { margin-bottom: 2px; }
.ep-notes-inner h1, .ep-notes-inner h2, .ep-notes-inner h3 {
  font-size: 13px; font-weight: 600; margin: 0 0 6px; color: var(--text);
}
.episode-item.has-notes { cursor: pointer; }
.episode-item.has-notes .btn { cursor: pointer; } /* restore default for buttons inside */

.episode-item:last-child { border-bottom: none; }
.episode-item:hover { background: var(--bg-3); }

.episode-art {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-3);
  flex-shrink: 0;
}

.episode-art img { width: 100%; height: 100%; object-fit: cover; }
.episode-art-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-3);
}

.episode-info { flex: 1; min-width: 0; }

.episode-title {
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 3px;
}

.episode-meta {
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.meta-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-3);
  margin-right: 2px;
}

.episode-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

@keyframes row-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.episode-item.entering {
  animation: row-enter 0.2s ease-out;
}

.progress-bar {
  width: 80px;
  height: 4px;
  background: var(--bg-3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Animate width quickly to the polled value so the bar catches up before the
   next update, keeping visual lag small and the final jump to 100% short. */
.episode-item[data-status="downloading"] .progress-fill {
  transition: width 0.8s ease-out;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.episode-item[data-status="queued"] .progress-fill {
  width: 100% !important;
  background: var(--border-2);
  animation: progress-pulse 1.6s ease-in-out infinite;
}

/* =========================================================
   Forms
   ========================================================= */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 12px;
}
.form-hint {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 4px;
  line-height: 1.5;
}

.form-control {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 13.5px;
  transition: border-color var(--transition);
  outline: none;
}

.form-control:focus { border-color: var(--primary); }
.form-control::placeholder { color: var(--text-3); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2364748b'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.form-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.form-check-label { font-size: 13.5px; }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 22px;
  transition: .2s;
  cursor: pointer;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text-2);
  border-radius: 50%;
  transition: .2s;
}

.toggle input:checked + .toggle-slider { background: var(--primary); border-color: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); background: #fff; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ID3 mapping table */
.id3-table { width: 100%; border-collapse: collapse; }
.id3-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.id3-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}
.id3-table tr:last-child td { border-bottom: none; }
.id3-table select { width: 100%; }

/* =========================================================
   Section headers
   ========================================================= */
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-3);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Collapsible panel */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  flex-wrap: wrap;
  gap: 6px;
}

.panel-header:hover { background: var(--bg-3); }

.panel-header-title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-chevron {
  width: 18px;
  height: 18px;
  color: var(--text-3);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.panel.open .panel-chevron { transform: rotate(180deg); }

.panel-body {
  padding: 18px;
  border-top: 1px solid var(--border);
  display: none;
}

.panel.open .panel-body { display: block; }

/* =========================================================
   Modal
   ========================================================= */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 700;
  padding: 12px;
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity 0.15s ease;
}

/* Use opacity+pointer-events instead of display:none so the transition plays */
#modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

#modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 24px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transform: scale(1);
  transition: transform 0.15s ease, max-width 0.15s ease;
}

#modal.modal-wide {
  max-width: min(92vw, 960px);
}

#modal-overlay.hidden #modal {
  transform: scale(0.96);
}

#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#modal-title { font-size: 15px; font-weight: 700; }

#modal-close {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--transition);
  flex-shrink: 0;
}
#modal-close:hover { color: var(--text); }

#modal-body {
  padding: 18px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Wizard option cards (used in Add Podcast modal) */
.wizard-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  white-space: normal;
  word-break: break-word;
  transition: border-color 0.15s, background 0.15s;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
}
.wizard-card:hover {
  border-color: var(--primary);
  background: var(--bg-2);
}
.wizard-card-icon { flex-shrink: 0; color: var(--primary); margin-top: 1px; }
.wizard-card-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.wizard-card-desc { font-size: 12px; color: var(--text-3); line-height: 1.5; }

.wiz-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
  user-select: none;
}
.wiz-check:last-child { margin-bottom: 0; }
.wiz-check input[type="checkbox"] { width: 14px; height: 14px; flex-shrink: 0; cursor: pointer; }

.wiz-info-box {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.wiz-indent { padding-left: 22px; }

.wiz-rename-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  user-select: none;
}
.wiz-rename-label input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

.wiz-safe-note {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  font-size: 12px;
  color: var(--text-3);
  margin: 8px 0 0;
}
.wiz-safe-note svg { flex-shrink: 0; margin-top: 1px; color: var(--success); }

.wiz-dir-hint {
  font-size: 12px;
  line-height: 1.4;
  margin-top: 5px;
  min-height: 1em;
}

/* =========================================================
   Toast notifications
   ========================================================= */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.2s ease;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--primary); }

@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; transform: translateY(4px); }
}

.toast.removing { animation: fadeOut 0.2s ease forwards; }

/* =========================================================
   Loading
   ========================================================= */
.loading-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes suggest-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes suggest-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.suggest-fade-out { animation: suggest-fade-out 0.25s ease forwards; }
.suggest-fade-in  { animation: suggest-fade-in  0.4s  ease forwards; }

/* =========================================================
   Empty states
   ========================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
}

.empty-state-icon { font-size: 48px; margin-bottom: 14px; }
.empty-state-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state-desc { font-size: 13px; max-width: 300px; line-height: 1.5; }
.empty-state .btn { margin-top: 18px; }

/* =========================================================
   Dividers / helpers
   ========================================================= */
.divider { height: 1px; background: var(--border); margin: 20px 0; }

.text-muted { color: var(--text-2); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }

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

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* =========================================================
   Tabs
   ========================================================= */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* =========================================================
   Search / filter bar
   ========================================================= */
.search-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-input-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-3);
  pointer-events: none;
}

.search-input-wrap input {
  width: 100%;
  padding: 8px 12px 8px 32px;
}

/* =========================================================
   Back button
   ========================================================= */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 20px;
  transition: color var(--transition);
}

.back-btn:hover { color: var(--text); }
.back-btn svg { width: 16px; height: 16px; }

/* =========================================================
   Activity feed (dashboard)
   ========================================================= */
.activity-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.activity-item:last-child { border-bottom: none; }

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.activity-info { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; truncate: true; }
.activity-sub { font-size: 11.5px; color: var(--text-3); }
/* Feed title links that show underline on hover */
.feed-link {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.12s;
}
.feed-link:hover { text-decoration-color: currentColor; }

/* =========================================================
   Mobile header bar
   ========================================================= */
#mobile-header {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 52px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mobile-header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-header-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

#hamburger {
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0;
  flex-shrink: 0;
}

#hamburger span {
  display: block;
  width: 17px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
}

#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
}

/* =========================================================
   Responsive tweaks
   ========================================================= */
@media (max-width: 700px) {
  #mobile-header { display: flex; }

  #app { flex-direction: column; }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

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

  #sidebar-overlay.open { display: block; }

  .page { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .feeds-grid { grid-template-columns: 1fr; }

  /* Episodes quick actions: stacked, right-aligned, Download first */
  #episodes-quick-actions {
    flex-direction: column-reverse;
    align-items: flex-end;
  }
}

/* =========================================================
   Dashboard 2x2 grid
   ========================================================= */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 700px) {
  .dash-grid { grid-template-columns: 1fr; }
  .log-entry { grid-template-columns: 70px 1fr; }
  .log-entry .log-ts, .log-entry .log-logger { display: none; }
}

/* =========================================================
   Stats table
   ========================================================= */
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.stats-table thead th,
.stats-th {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.stats-th:hover { color: var(--text); }

.stats-focus-btn.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-light);
}

.stats-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.stats-table tbody tr:last-child { border-bottom: none; }
.stats-table tbody tr:hover { background: var(--bg-3); }

.stats-table td {
  padding: 9px 10px;
  vertical-align: middle;
}

/* =========================================================
   Log viewer
   ========================================================= */
.log-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.log-level-btn,
.ep-filter-pill {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.log-level-btn:hover,
.ep-filter-pill:hover  { background: var(--bg-2); color: var(--text); }
.log-level-btn.active,
.ep-filter-pill.active { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.ep-filter-row {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 8px; flex-wrap: wrap;
}

.log-container {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 12px;
}
.log-raw {
  margin: 0;
  padding: 12px 16px;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text-2);
  line-height: 1.6;
}

.log-entry {
  display: grid;
  grid-template-columns: 160px 70px 140px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 4px 14px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.log-entry:last-child { border-bottom: none; }
.log-entry:hover { background: var(--bg-3); }

.log-ts    { color: var(--text-3); white-space: nowrap; }
.log-logger { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.log-msg   { color: var(--text); word-break: break-word; }

.log-level-tag {
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 3px;
  text-align: center;
}

.log-debug  .log-level-tag { color: var(--text-3); background: var(--bg-3); }
.log-info   .log-level-tag { color: var(--primary); background: var(--primary-light); }
.log-warn   .log-level-tag { color: var(--warning); background: var(--warning-light); }
.log-error  .log-level-tag { color: var(--error);   background: var(--error-light); }

.log-debug .log-msg { color: var(--text-3); }
.log-warn  .log-msg { color: var(--warning); }

/* =========================================================
   Audio Player Bar
   ========================================================= */
/* ── Player: container ─────────────────────────────────────── */
#player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.5);
}
#player-bar.hidden { display: none; }
body.has-player #content { padding-bottom: 72px; }

/* ── Player: mini bar ──────────────────────────────────────── */
#player-mini {
  cursor: pointer;
}
#player-mini-seek {
  height: 3px;
  background: var(--border);
}
#player-mini-progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.5s linear;
}
#player-mini-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  height: 64px;
}
#player-mini-art {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
#player-mini-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#player-mini-info {
  flex: 1;
  min-width: 0;
}
#player-mini-title {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#player-mini-feed {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#player-mini-play {
  width: 44px;
  height: 44px;
  background: var(--primary);
  border: none;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.1s ease;
}
#player-mini-play:active { transform: scale(0.9); }
.player-art-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-3);
}

/* ── Player: full overlay ──────────────────────────────────── */
#player-full {
  position: fixed;
  inset: 0;
  z-index: 510;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms ease, opacity 200ms ease;
}
#player-full-top {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px 0;
}
#player-full-bottom {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
  width: 100%;
}
#player-full.open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
body.player-expanded { overflow: hidden; }

/* Full overlay — header */
#player-full-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px 0 12px;
  flex-shrink: 0;
}
#player-full-collapse-btn {
  position: absolute;
  left: 0;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
}
#player-full-collapse-btn:hover { color: var(--text); background: var(--bg-3); }
#player-full-header-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

/* Full overlay — artwork */
#player-full-art {
  width: min(300px, 65vw);
  height: min(300px, 65vw);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 8px 0 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  flex-shrink: 0;
}
#player-full-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Full overlay — info */
#player-full-info {
  text-align: center;
  max-width: 400px;
  margin-bottom: 0;
  padding-bottom: 16px;
  flex-shrink: 0;
}
#player-full-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
#player-full-feed {
  font-size: 14px;
  color: var(--text-3);
}

/* Full overlay — seek bar */
#player-full-seek-wrap {
  width: 100%;
  max-width: 400px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
#player-full-seek {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: height 0.1s ease;
}
#player-full-seek:hover { height: 8px; }
#player-full-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.5s linear;
  pointer-events: none;
}
#player-full-seek-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  pointer-events: none;
  transition: width 0.12s ease, height 0.12s ease, box-shadow 0.12s ease;
}
#player-full-seek:hover #player-full-seek-thumb,
#player-full-seek.seeking #player-full-seek-thumb {
  width: 18px;
  height: 18px;
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb, 99 102 241) / 0.25);
}
#player-full-seek.seeking {
  cursor: grabbing;
}
#player-full-seek.seeking #player-full-progress-fill {
  transition: none;
}
#player-full-seek.seeking #player-full-seek-thumb {
  transition: none;
}
#player-full-times {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 6px;
}

/* Full overlay — transport controls */
#player-full-controls {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: 28px;
  flex-shrink: 0;
}
#player-full-controls button {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
#player-full-controls button:hover { color: var(--primary); }
#player-full-play-btn {
  width: 56px;
  height: 56px;
  background: var(--primary) !important;
  border-radius: 50% !important;
  color: white !important;
  transition: transform 0.1s ease;
}
#player-full-play-btn:active { transform: scale(0.9); }
#player-full-back-btn,
#player-full-fwd-btn {
  width: 48px;
  height: 48px;
}

/* Full overlay — secondary controls */
#player-full-secondary {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-shrink: 0;
  margin-bottom: 16px;
}
.player-ctrl-btn {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  cursor: pointer;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 68px;
  transition: background 0.12s ease, color 0.12s ease;
}
.player-ctrl-btn:hover {
  background: var(--bg-4, var(--bg-3));
  color: var(--text);
}
.player-ctrl-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.player-ctrl-icon-text {
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

/* Full overlay — volume row */
#player-full-volume-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 400px;
  color: var(--text-3);
  flex-shrink: 0;
}
#player-full-volume {
  flex: 1;
  accent-color: var(--primary);
}

@media (max-width: 600px) {
  #player-full-volume-row { display: none; }
  #player-full-art {
    width: 70vw;
    height: 70vw;
  }
}

.btn-ghost-small {
  background: none;
  border: none;
  color: var(--text-3);
  padding: 4px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-ghost-small:hover { color: var(--text); background: var(--bg-3); }

/* Played indicator */
.ep-played-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
}

/* Episode listen progress bar */
.ep-listen-bar-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
}
.ep-listen-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-3);
  overflow: hidden;
  max-width: 200px;
}
.ep-listen-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--primary);
  opacity: 0.7;
}
.ep-listen-label {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap;
  flex-shrink: 0;
}
.ep-listen-label.ep-listen-complete {
  color: var(--primary);
  opacity: 0.9;
}
.ep-listen-bar-wrap.ep-complete .ep-listen-fill {
  opacity: 1;
}

/* Episode highlight — softer, more natural emphasis */
@keyframes ep-pulse {
  0% {
    box-shadow: 0 0 0px 0px rgba(99,102,241,0.0);
    background: transparent;
    transform: translateY(0);
  }

  15% {
    box-shadow: 0 6px 18px 4px rgba(99,102,241,0.18);
    background: rgba(99,102,241,0.08);
    transform: translateY(-1px);
  }

  40% {
    box-shadow: 0 8px 22px 6px rgba(99,102,241,0.14);
    background: rgba(99,102,241,0.06);
  }

  100% {
    box-shadow: 0 0 0px 0px rgba(99,102,241,0.0);
    background: transparent;
    transform: translateY(0);
  }
}

.ep-highlight {
  animation: ep-pulse 4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  border-radius: 10px;
  transition: border-radius 0.2s ease;
}

/* Episode checkboxes — hidden until bulk mode is active */
.ep-checkbox { display: none; }
.bulk-mode .ep-checkbox { display: block; }

/* Quick actions row (Mark all played + Download) */
#episodes-quick-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
}

/* Select bar — single flex row of buttons */
#select-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

#select-bar .hidden { display: none; }
#bulk-apply-wrap.hidden { display: none; }

#btn-bulk-select.btn-cancel-select {
  background: var(--error-light);
  color: var(--error);
  border: 1px solid var(--error-light);
}
#btn-bulk-select.btn-cancel-select:hover {
  background: rgba(239,68,68,0.2);
}

#bulk-count {
  font-size: 12px;
  color: var(--text-3);
  margin-right: 4px;
  white-space: nowrap;
}

.bulk-check {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.log-error .log-msg { color: var(--error); }

/* Split download button */
.btn-split-main {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
}
.btn-split-caret {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  padding-left: 7px !important;
  padding-right: 7px !important;
}
.btn.btn-primary.btn-split-caret {
  border-left: 1px solid rgba(255,255,255,0.22) !important;
}
.btn.btn-ghost.btn-split-caret {
  border-left: 1px solid var(--border) !important;
}

/* Episode row "..." overflow menu */
.ep-more-wrap {
  position: relative;
  display: inline-flex;
}
.ep-more-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 200;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 170px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}
.ep-more-wrap[data-open] .ep-more-dropdown {
  display: block;
}
.ep-more-dropdown button,
.ep-more-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--text-1);
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}
.ep-more-dropdown button:hover,
.ep-more-dropdown a:hover { background: var(--bg-2); }
.ep-more-dropdown a { color: var(--text); text-decoration: none; }

/* Import banner */
.import-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  position: relative;
}
.import-banner-running { background: var(--bg-2); color: var(--text-1); }
.import-banner-done    { background: color-mix(in srgb, var(--success) 10%, var(--bg-1)); color: var(--text-1); }
.import-banner-error   { background: color-mix(in srgb, var(--error) 10%, var(--bg-1)); color: var(--error); }
.import-banner-msg { display: flex; align-items: center; gap: 6px; flex: 1; }
.import-banner-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  flex: 1;
  min-width: 80px;
}
.import-banner-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.4s ease;
}
.import-banner-close {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
}
.import-banner-close:hover { color: var(--text-1); }
.import-banner-rename {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid color-mix(in srgb, var(--text-3) 20%, transparent);
  font-size: 13px;
  color: var(--text-2);
}
.import-banner-rename .btn { flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }

/* ── Search overlay ─────────────────────────────────────────────────────── */
#search-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 950;
  background: rgba(0,0,0,0.55);
  align-items: flex-start; justify-content: center;
  padding: 80px 16px 40px;
}
#search-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.5);
  width: 100%; max-width: 580px;
  overflow: hidden;
}
#search-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
#search-input {
  flex: 1; background: none; border: none; outline: none;
  font-size: 16px; color: var(--text);
}
#search-input::placeholder { color: var(--text-3); }
#search-esc-hint {
  font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 6px; font-family: inherit;
}
#search-results { max-height: 420px; overflow-y: auto; }
.search-result {
  display: block; padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result:hover,
.search-result.search-focused { background: var(--bg-3); }
.search-result-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.search-result-meta  { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-result-feed  { font-size: 12px; color: var(--primary); font-weight: 500; }
.search-result-date  { font-size: 12px; color: var(--text-3); }
.search-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--text-3); }

/* ── Login overlay ──────────────────────────────────────────────────────── */
#login-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px;
  width: 100%; max-width: 380px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}
.login-logo {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 28px;
}

/* ── Setup wizard (full-page) ───────────────────────────────────────────── */
#setup-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: var(--bg);
  overflow-y: auto;
  display: none;
}
.wiz-page {
  width: 100%; max-width: 560px;
  margin: 0 auto;
  padding: 48px 24px 60px;
  box-sizing: border-box;
}
@media (max-width: 600px) {
  .wiz-page { padding: 32px 16px 48px; }
}

/* Header */
.wiz-header {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 32px;
}
.wiz-logo-img { width: 44px; height: 44px; flex-shrink: 0; }
.wiz-logo-name { font-size: 20px; font-weight: 700; color: var(--text); line-height: 1.2; }
.wiz-logo-sub  { font-size: 13px; color: var(--text-3); margin-top: 2px; }

/* Step dots */
.wiz-dots {
  display: flex; align-items: center;
  margin-bottom: 32px;
}
.wiz-dot {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--bg-3); color: var(--text-3);
  border: 2px solid var(--border);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.wiz-dot-active {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--primary); color: #fff; border: 2px solid var(--primary);
}
.wiz-dot-done {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--success); color: #fff; border: 2px solid var(--success);
}
.wiz-line {
  flex: 1; height: 2px; background: var(--border); min-width: 16px; margin: 0 6px;
}

/* Body content */
.wiz-title { font-size: 22px; font-weight: 700; color: var(--text); margin: 0 0 10px; }
.wiz-desc  { font-size: 14px; color: var(--text-2); margin: 0 0 20px; line-height: 1.6; }

.wiz-check-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: var(--text); cursor: pointer;
  user-select: none; margin-bottom: 16px;
}
.wiz-check-row input[type="checkbox"] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }

/* Theme picker */
.theme-pick-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 4px;
}
.theme-pick-btn {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 8px; border-radius: 10px;
  border: 2px solid transparent;
  cursor: pointer; transition: border-color 0.15s, transform 0.1s;
  /* Fixed width so the last item in a row never stretches */
  flex: 0 0 80px; width: 80px; box-sizing: border-box;
}
.theme-pick-btn span {
  white-space: normal; text-align: center;
  line-height: 1.3; word-break: break-word;
}
.theme-pick-btn:hover { transform: translateY(-1px); }

/* Footer */
.wiz-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 32px; gap: 10px;
}

/* Error banner */
.wiz-error {
  margin-top: 14px; padding: 10px 14px;
  background: color-mix(in srgb, var(--error) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 40%, transparent);
  border-radius: 8px;
  font-size: 13px; color: var(--error);
}

/* ── Directory browser ──────────────────────────────────────────────────── */
.wizard-dir-browser {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 200px; overflow-y: auto;
  margin-top: 8px;
  background: var(--bg);
}
.dir-browser-path {
  font-size: 11px; font-family: monospace; color: var(--text-3);
  padding: 6px 10px; background: var(--bg-3);
  border-bottom: 1px solid var(--border);
  border-radius: 7px 7px 0 0;
}
.dir-entry {
  padding: 7px 12px; font-size: 13px; color: var(--text-2);
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background 0.1s;
}
.dir-entry:hover { background: var(--bg-3); color: var(--text); }
.dir-icon { font-size: 14px; flex-shrink: 0; }
.dir-up { color: var(--text-3); font-style: italic; }
.import-dir-browser {
  border: 1px solid var(--border);
  border-radius: 8px;
  max-height: 240px; overflow-y: auto;
  margin-top: 8px;
  background: var(--bg);
}

/* ── Import wizard ─────────────────────────────────────────────────────── */
.import-analysis-banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.import-analysis-banner.banner-castcharm { background: rgba(var(--success-rgb,60,180,100),0.12); color: var(--success); }
.import-analysis-banner.banner-year { background: rgba(var(--primary-rgb,80,130,220),0.12); color: var(--primary); }
.import-analysis-banner.banner-season { background: rgba(var(--warning-rgb,200,150,50),0.12); color: var(--warning); }
.import-stat-cards {
  display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap;
}
.import-stat-card {
  flex: 1; min-width: 100px;
  text-align: center; padding: 14px 10px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2);
}
.import-stat-card .stat-num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.import-stat-card .stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.import-filter-tabs {
  display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap;
}
.import-filter-tab {
  padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: 500;
  cursor: pointer; border: 1px solid var(--border); background: var(--bg);
  color: var(--text-2); transition: all 0.15s;
}
.import-filter-tab:hover { background: var(--bg-3); }
.import-filter-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.import-source-tag {
  display: inline-block; font-size: 10px; padding: 1px 5px;
  border-radius: 3px; font-weight: 500; margin-left: 4px;
  vertical-align: middle;
}
.import-source-tag.src-sidecar { background: rgba(var(--success-rgb,60,180,100),0.15); color: var(--success); }
.import-source-tag.src-id3 { background: rgba(var(--primary-rgb,80,130,220),0.15); color: var(--primary); }
.import-source-tag.src-filename { background: rgba(128,128,128,0.15); color: var(--text-3); }
.import-source-tag.src-folder { background: rgba(160,100,220,0.15); color: rgb(160,100,220); }

/* Filename format tokens & preview */
.import-fn-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.import-fn-token {
  display: inline-block;
  font-family: monospace;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.import-fn-token:hover { background: var(--primary); color: var(--bg-1); }
.import-fn-preview {
  margin-top: 8px;
  font-size: 12px;
  max-height: 150px;
  overflow-y: auto;
}
.import-fn-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.import-fn-preview-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-3);
  padding: 3px 6px;
  border-bottom: 1px solid var(--border);
}
.import-fn-preview-table td {
  padding: 3px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  vertical-align: top;
}
.import-renumber-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(var(--warning-rgb,200,150,50),0.10);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
}
.import-renumber-note svg { flex-shrink: 0; color: var(--warning); margin-top: 1px; }
.import-fn-field {
  display: inline-block;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(var(--primary-rgb,80,130,220),0.12);
  color: var(--primary);
  margin: 1px 2px;
}

/* ── Timezone combobox ───────────────────────────────────────────────────── */
.tz-combo { position: relative; }

.tz-dropdown {
  display: none;
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 3px);
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}
.tz-dropdown.open { display: block; }

.tz-option {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.08s;
}
.tz-option:hover,
.tz-option.tz-highlighted {
  background: var(--primary-light);
  color: var(--primary);
}

/* ── XML import collision review modal ──────────────────────────────────────── */
.xml-rev-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.xml-rev-progress-text {
  font-size: 12px;
  color: var(--text-3);
  white-space: nowrap;
}
.xml-rev-pips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.xml-rev-pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}
.xml-rev-pip--active {
  background: var(--primary);
}
.xml-rev-pip--done {
  background: var(--success);
}
.xml-rev-ep-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 4px;
  line-height: 1.4;
}
.xml-rev-subhead {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 0 14px;
}
.xml-rev-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.xml-rev-card {
  background: var(--bg-3);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.1s ease;
  outline: none;
  overflow: hidden;
}
.xml-rev-card:hover,
.xml-rev-card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  transform: translateY(-1px);
}
.xml-rev-card--chosen {
  border-color: var(--success) !important;
  box-shadow: 0 0 0 3px rgba(var(--success-rgb, 50 190 90) / 0.2) !important;
}
.xml-rev-card-hdr {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.xml-rev-fields {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.xml-rev-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.xml-rev-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.xml-rev-value {
  font-size: 13px;
  color: var(--text-1);
}
.xml-rev-mono {
  font-family: monospace;
  font-size: 11px;
  color: var(--text-2);
  word-break: break-all;
}
.xml-rev-field.xml-rev-differs .xml-rev-value {
  background: rgba(240, 170, 0, 0.12);
  border-radius: 3px;
  padding: 1px 4px;
  border-left: 2px solid rgba(240, 170, 0, 0.5);
}
.xml-rev-card-footer {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  text-align: center;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  transition: color 0.1s, background 0.1s;
}
.xml-rev-card:hover .xml-rev-card-footer,
.xml-rev-card:focus-visible .xml-rev-card-footer {
  color: var(--primary);
  background: var(--primary-light);
}
/* Description diff */
.xml-rev-desc-section {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 10px;
}
.xml-rev-desc-hdr {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 8px;
}
.xml-rev-desc-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.xml-rev-desc-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.xml-rev-desc-side-hdr {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
}
.xml-rev-desc-text {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-2);
  max-height: 110px;
  overflow-y: auto;
}
mark.xml-diff-del {
  background: rgba(220, 60, 60, 0.15);
  color: var(--error);
  text-decoration: line-through;
  border-radius: 2px;
}
mark.xml-diff-add {
  background: rgba(50, 190, 80, 0.15);
  color: var(--success);
  border-radius: 2px;
}
/* Keep both + bulk actions */
.xml-rev-both-row {
  margin-bottom: 8px;
}
.xml-rev-both-row .btn {
  width: 100%;
  justify-content: center;
}
.xml-rev-bulk-row {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.xml-rev-bulk-row .btn {
  flex: 1;
  justify-content: center;
}
/* Stack cards vertically on mobile */
@media (max-width: 600px) {
  .xml-rev-cards {
    grid-template-columns: 1fr;
  }
  .xml-rev-bulk-row {
    flex-direction: column;
  }
  .xml-rev-bulk-row .btn {
    width: 100%;
  }
}
/* OPML import progress modal */
.opml-prog-status {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-1);
  margin-bottom: 10px;
}
.opml-prog-log {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.opml-entry {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.opml-entry-icon {
  font-size: 12px;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.opml-entry-label {
  flex: 1;
  color: var(--text-1);
  word-break: break-word;
}
.opml-entry-note {
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
}
.opml-entry-ok   .opml-entry-icon  { color: var(--success); }
.opml-entry-skip .opml-entry-icon  { color: var(--text-3); }
.opml-entry-skip .opml-entry-label { color: var(--text-2); }
.opml-entry-fail .opml-entry-icon  { color: var(--error); }
.opml-entry-fail .opml-entry-label { color: var(--error); }

/* ── Playlists ────────────────────────────────────────────── */
.playlist-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}
.playlist-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.playlist-card-info { flex: 1; min-width: 0; }
.playlist-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-card-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.playlist-card-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pl-detail-meta { font-size: 12px; color: var(--text-3); margin-bottom: 12px; }
.pl-ep-list { display: flex; flex-direction: column; }
.pl-ep-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.pl-ep-row:last-child { border-bottom: none; }
.pl-ep-idx { font-size: 11px; color: var(--text-3); width: 20px; text-align: right; flex-shrink: 0; }
.pl-ep-info { flex: 1; min-width: 0; }
.pl-ep-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-ep-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.pl-ep-actions { display: flex; gap: 4px; flex-shrink: 0; }
.pl-picker { display: flex; flex-direction: column; gap: 4px; }
.pl-pick-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; }
.btn-danger { color: var(--error) !important; }
.btn-danger:hover { background: color-mix(in srgb, var(--error) 10%, transparent) !important; }

/* ── Playlist detail page ────────────────────────────────────────────── */
.pl-detail-page { max-width: 860px; }
.pl-detail-header { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 24px; }
.pl-detail-art { width: 80px; height: 80px; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-3); }
.pl-detail-info { flex: 1; min-width: 0; }
.pl-detail-title { font-size: 22px; font-weight: 700; color: var(--text-1); margin-bottom: 4px; }
.pl-detail-desc { font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.pl-detail-meta-line { font-size: 12px; color: var(--text-3); margin-bottom: 12px; }
.pl-detail-actions { display: flex; gap: 8px; }
.pl-detail-ep-list { display: flex; flex-direction: column; }
.pl-detail-ep-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); transition: opacity 0.3s, max-height 0.3s; overflow: hidden; max-height: 100px; }
.pl-detail-ep-row.removing { opacity: 0; max-height: 0; padding: 0; }
.pl-detail-ep-num { font-size: 12px; color: var(--text-3); width: 24px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.pl-detail-ep-info { flex: 1; min-width: 0; }
.pl-detail-ep-title { font-size: 14px; font-weight: 500; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-detail-ep-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pl-detail-ep-actions { display: flex; gap: 4px; flex-shrink: 0; }
.ep-drag-handle { display: flex; align-items: center; color: var(--text-3); cursor: grab; padding: 0 2px; flex-shrink: 0; touch-action: none; }
.ep-drag-handle:active { cursor: grabbing; }
.episode-item.dragging { opacity: 0.4; }
.episode-item.drag-over-top { box-shadow: 0 -2px 0 var(--accent) !important; }
.episode-item.drag-over-bottom { box-shadow: 0 2px 0 var(--accent) !important; }
.pl-detail-page .episode-list { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.pl-detail-page .episode-item { border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.pl-detail-page .episode-item.drag-over-top { box-shadow: 0 -3px 0 var(--accent) !important; border-radius: 8px; }
.pl-detail-page .episode-item.drag-over-bottom { box-shadow: 0 3px 0 var(--accent) !important; border-radius: 8px; }
