@layer sections {
/* ── Playlists ──────────────────────────────────────────── */
.playlists-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.playlists-scroll {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* Grid */
.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

/* Card wrapper (positions the remove-from-playlist btn) */
.playlist-card-wrap { position: relative; height: 100%; }

.playlist-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  transition: box-shadow 0.18s, transform var(--t-slow);
}
.playlist-card:hover {
  box-shadow: 0 4px 24px oklch(var(--shadow-color) / 0.1);
  transform: translateY(-2px);
}

/* 2×2 mosaic */
.playlist-mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: 190px;
}
.playlist-mosaic-cell { overflow: hidden; }
.playlist-mosaic-empty { width: 100%; height: 100%; background: oklch(93% 0.008 65); }

.playlist-card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.playlist-card-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.2px;
  margin-bottom: 4px;
}
.playlist-card-desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.playlist-card-count { font-size: 11px; color: var(--faint); margin-top: auto; }

/* New-playlist modal */
.playlist-modal-overlay {
  position: fixed;
  inset: 0;
  background: oklch(var(--shadow-color) / 0.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.playlist-modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 440px;
  max-width: 92vw;
  box-shadow: 0 8px 40px oklch(var(--shadow-color) / 0.18);
  position: relative;
}
.playlist-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.playlist-modal-title { font-size: 17px; font-weight: 600; letter-spacing: -0.3px; }
.playlist-modal-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.playlist-modal-close:hover { background: var(--border); }

.playlist-form-field { margin-bottom: 16px; }
.playlist-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.playlist-form-input,
.playlist-form-textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
  outline: none;
  transition: border-color var(--t-slow);
}
.playlist-form-input:focus,
.playlist-form-textarea:focus { border-color: var(--sage-dot); }
.playlist-form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }

.playlist-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}

/* Playlist show, detail header */
.playlist-detail-header {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.playlist-detail-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.4px;
  margin-bottom: 4px;
}
.playlist-detail-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.5;
}
.playlist-detail-meta {
  display: flex;
  align-items: center;
  gap: 14px;
}
.playlist-detail-count { font-size: 12px; color: var(--faint); }

/* Add-recipes panel */
.add-recipes-panel {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  flex-shrink: 0;
}
.add-recipes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.add-recipes-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.add-recipes-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.add-recipe-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--r);
  border: 1px solid var(--border);
  cursor: pointer;
}
.add-recipe-row:has(.add-recipe-check:checked) {
  border-color: var(--text);
  background: var(--bg);
}
.add-recipe-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--text);
}
.add-recipes-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}
.add-recipes-actions .btn-accent-sm:disabled {
  opacity: 0.5;
  cursor: default;
}
.add-recipe-thumb {
  width: 40px;
  height: 32px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  overflow: hidden;
}
.add-recipe-name { flex: 1; font-size: 13px; font-weight: 500; }
.add-recipe-time { font-size: 11px; color: var(--faint); flex-shrink: 0; }

/* Remove-from-playlist button (overlays the recipe card) */
.playlist-recipe-wrap { position: relative; }
.playlist-remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: oklch(var(--shadow-color) / 0.55);
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background var(--t);
}
.playlist-recipe-wrap:hover .playlist-remove-btn { display: flex; }
.playlist-remove-btn:hover { background: oklch(48% 0.12 8 / 0.85); }

/* Danger outline button variant */
.btn-outline--danger {
  color: var(--danger-fg);
  border-color: oklch(85% 0.04 8);
}
.btn-outline--danger:hover { background: var(--danger-bg); }
}
