"""
Reward functions for Canva MCP Tasks - V2 Architecture.
These tasks test MCP tool usage for Canva design workspace interactions.
"""

import logging
import re
from typing import Any, Callable, Dict, List, Literal, Optional, Tuple
from typing import TypedDict as TaskTypedDict

from .backend import Backend


class ScoreMetadata(TaskTypedDict):
    success_accumulator: list[str]
    error_accumulator: list[str]
class TaskScore(TaskTypedDict):
    score: Literal[1.0, 0.0]
    metadata: ScoreMetadata
logger = logging.getLogger(__name__)
FORMAT_PRESETS: Dict[str, Tuple[int, int]] = {
    "instagram-post": (1080, 1080),
    "instagram-story": (1080, 1920),
    "facebook-post": (1200, 630),
    "twitter-header": (1500, 500),
    "linkedin-banner": (1584, 396),
    "youtube-thumbnail": (1280, 720),
    "presentation": (1920, 1080),
    "logo": (500, 500),
    "poster": (1080, 1920),
    "a4-document": (2480, 3508),
    "business-card": (1050, 600),
    "flyer": (2480, 3508),
}

# Helper Functions
# ==============================================================================

def _make_task_score(errors: list[str], checks_passed: list[str]) -> TaskScore:
    """Create a TaskScore from errors and checks_passed lists."""
    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )

def _find_designs_by_title(backend: Backend, title_pattern: str) -> List[Dict[str, Any]]:
    """Find designs matching title pattern (case-insensitive regex matching)."""
    escaped_pattern = re.escape(title_pattern)
    result = backend.query({
        "collection": "designs",
        "filter": {"title": {"$regex": escaped_pattern, "$options": "i"}}
    })
    if isinstance(result, list):
        return result
    return []

def _find_design_by_title(backend: Backend, title_pattern: str) -> Optional[Dict[str, Any]]:
    """Find a single design by title pattern (case-insensitive regex matching)."""
    designs = _find_designs_by_title(backend, title_pattern)
    return designs[0] if designs else None

def _find_design_by_id(backend: Backend, design_id: str) -> Optional[Dict[str, Any]]:
    """Find a design by its _id."""
    result = backend.query({"collection": "designs", "filter": {"_id": design_id}})
    if isinstance(result, list) and result:
        return result[0]
    return None

def _get_designs_in_folder(backend: Backend, folder_id: str) -> List[Dict[str, Any]]:
    """Get all designs in a specific folder."""
    result = backend.query({"collection": "designs", "filter": {"folderId": folder_id}})
    if isinstance(result, list):
        return result
    return []

def _check_design_dimensions(design: Dict[str, Any], width: int, height: int) -> bool:
    """Verify exact dimensions of a design."""
    return design.get("width") == width and design.get("height") == height

def _check_design_format(design: Dict[str, Any], format: str) -> bool:
    """Verify design format type."""
    return design.get("format") == format

def _check_design_dimensions_detailed(design: Dict[str, Any], expected_width: int, expected_height: int) -> Tuple[bool, str]:
    """Check if design has expected dimensions. Returns (success, message) tuple."""
    width = design.get("width", 0)
    height = design.get("height", 0)
    if width == expected_width and height == expected_height:
        return (True, f"Dimensions correct: {width}x{height}")
    return (False, f"Dimensions mismatch: got {width}x{height}, expected {expected_width}x{expected_height}")

def _check_design_format_detailed(design: Dict[str, Any], expected_format: str) -> Tuple[bool, str]:
    """Check if design has expected format. Returns (success, message) tuple.
    
    Accepts 'custom' format if the design dimensions match the expected preset dimensions.
    This handles cases where the agent uses custom dimensions that match a preset.
    """
    fmt = design.get("format", "")
    if fmt == expected_format:
        return (True, f"Format correct: {fmt}")

    # Allow 'custom' format if dimensions match the expected preset
    if fmt == "custom" and expected_format in FORMAT_PRESETS:
        expected_width, expected_height = FORMAT_PRESETS[expected_format]
        actual_width = design.get("width", 0)
        actual_height = design.get("height", 0)

        if actual_width == expected_width and actual_height == expected_height:
            return (True, f"Format acceptable: 'custom' with correct {expected_format} dimensions ({actual_width}x{actual_height})")

    return (False, f"Format mismatch: got '{fmt}', expected '{expected_format}'")

def _find_design_by_exact_title(backend: Backend, title: str) -> Optional[Dict[str, Any]]:
    """Find design by EXACT title match (case-insensitive)."""
    result = backend.query({
        "collection": "designs",
        "filter": {"title": {"$regex": f"^{re.escape(title)}$", "$options": "i"}}
    })
    if isinstance(result, list) and result:
        return result[0]
    return None

def _find_designs_by_title_pattern(backend: Backend, pattern: str) -> List[Dict[str, Any]]:
    """Find designs containing pattern in title (case-insensitive regex)."""
    escaped = re.escape(pattern)
    result = backend.query({
        "collection": "designs",
        "filter": {"title": {"$regex": escaped, "$options": "i"}}
    })
    if isinstance(result, list):
        return result
    return []

def _get_text_elements_from_list(elements: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
    """Filter to get only text elements from a list of elements."""
    return [e for e in elements if e.get("type") == "text"]

def _check_design_in_folder(design: Dict[str, Any], folder_id: str) -> bool:
    """Check if design is in the specified folder."""
    return design.get("folderId") == folder_id

def _find_folders_by_name(backend: Backend, name_pattern: str) -> List[Dict[str, Any]]:
    """Find folders matching name pattern (case-insensitive regex matching)."""
    escaped_pattern = re.escape(name_pattern)
    result = backend.query({
        "collection": "folders",
        "filter": {"name": {"$regex": escaped_pattern, "$options": "i"}}
    })
    if isinstance(result, list):
        return result
    return []

def _find_folder_by_name(backend: Backend, name_pattern: str) -> Optional[Dict[str, Any]]:
    """Find a single folder by name pattern (case-insensitive regex matching)."""
    folders = _find_folders_by_name(backend, name_pattern)
    return folders[0] if folders else None

def _get_child_folders(backend: Backend, parent_id: str) -> List[Dict[str, Any]]:
    """Get all folders with a specific parentId."""
    result = backend.query({"collection": "folders", "filter": {"parentId": parent_id}})
    if isinstance(result, list):
        return result
    return []

def _find_folder_by_path(backend: Backend, path: str) -> Optional[Dict[str, Any]]:
    """
    Find folder by full path (e.g., "Client Work/Acme Corp/Archive").
    Traverses the folder hierarchy from root to target.
    """
    parts = path.split("/")
    if not parts:
        return None

    # Start at root level (parentId is null or empty)
    current_parent_id = None

    for part in parts:
        part = part.strip()
        if not part:
            continue

        # Find folder with this name under current parent
        if current_parent_id is None:
            # Root level folder
            result = backend.query({
                "collection": "folders",
                "filter": {
                    "name": {"$regex": f"^{re.escape(part)}$", "$options": "i"},
                    "$or": [{"parentId": {"$exists": False}}, {"parentId": None}]
                }
            })
        else:
            # Child folder
            result = backend.query({
                "collection": "folders",
                "filter": {
                    "name": {"$regex": f"^{re.escape(part)}$", "$options": "i"},
                    "parentId": current_parent_id
                }
            })

        if not isinstance(result, list) or not result:
            return None

        current_parent_id = result[0].get("_id")

    # Return the final folder in the path
    if current_parent_id:
        result = backend.query({"collection": "folders", "filter": {"_id": current_parent_id}})
        if isinstance(result, list) and result:
            return result[0]

    return None

def _get_elements_for_design(backend: Backend, design_id: str, page_id: Optional[str] = None) -> List[Dict[str, Any]]:
    """Get all elements for a design, optionally filtered by page."""
    filter_dict = {"designId": design_id}
    if page_id is not None:
        filter_dict["pageId"] = page_id

    result = backend.query({"collection": "elements", "filter": filter_dict})
    if isinstance(result, list):
        return result
    return []

def _get_elements_by_type(backend: Backend, design_id: str, element_types: List[str], page_id: Optional[str] = None) -> List[Dict[str, Any]]:
    """Get elements for a design filtered by type(s)."""
    filter_dict = {"designId": design_id, "type": {"$in": element_types}}
    if page_id is not None:
        filter_dict["pageId"] = page_id

    result = backend.query({"collection": "elements", "filter": filter_dict})
    if isinstance(result, list):
        return result
    return []

def _count_elements_by_type(elements: List[Dict[str, Any]]) -> Dict[str, int]:
    """Count elements grouped by type."""
    counts: Dict[str, int] = {}
    for element in elements:
        elem_type = element.get("type", "unknown")
        counts[elem_type] = counts.get(elem_type, 0) + 1
    return counts

def _get_text_elements(backend: Backend, design_id: str, page_id: Optional[str] = None) -> List[Dict[str, Any]]:
    """Get text elements for a design."""
    return _get_elements_by_type(backend, design_id, ["text"], page_id)

def _get_image_elements(backend: Backend, design_id: str, page_id: Optional[str] = None) -> List[Dict[str, Any]]:
    """Get image elements for a design."""
    return _get_elements_by_type(backend, design_id, ["image"], page_id)

def _check_element_has_content(element: Dict[str, Any], text_pattern: str) -> bool:
    """Check if a text element contains specific text (case-insensitive)."""
    if element.get("type") != "text":
        return False

    # Check in properties.segments structure
    properties = element.get("properties", {})
    segments = properties.get("segments", [])

    text_pattern_lower = text_pattern.lower()
    for segment in segments:
        if isinstance(segment, dict):
            text = segment.get("text", "")
            if text_pattern_lower in text.lower():
                return True

    # Also check textSegments structure (alternative format)
    text_segments = element.get("textSegments", [])
    for segment in text_segments:
        if isinstance(segment, dict):
            text = segment.get("text", "")
            if text_pattern_lower in text.lower():
                return True

    # Check direct text field as fallback
    direct_text = element.get("text", "")
    if text_pattern_lower in direct_text.lower():
        return True

    return False

def _has_element_with_content(elements: List[Dict[str, Any]], content: str) -> bool:
    """Check if any element contains the specified content."""
    for element in elements:
        if _check_element_has_content(element, content):
            return True
    return False

def _get_all_designs(backend: Backend) -> List[Dict[str, Any]]:
    """Get all designs from the backend."""
    result = backend.query({"collection": "designs", "filter": {}})
    if isinstance(result, list):
        return result
    return []

def _find_folder_by_id(backend: Backend, folder_id: str) -> Optional[Dict[str, Any]]:
    """Find a folder by its _id."""
    result = backend.query({"collection": "folders", "filter": {"_id": folder_id}})
    if isinstance(result, list) and result:
        return result[0]
    return None

def _get_all_folders(backend: Backend) -> List[Dict[str, Any]]:
    """Get all folders from the backend."""
    result = backend.query({"collection": "folders", "filter": {}})
    if isinstance(result, list):
        return result
    return []

def _get_folder_path(backend: Backend, folder_id: str) -> str:
    """Get the full path of a folder."""
    path_parts = []
    current_id = folder_id

    while current_id:
        folder = _find_folder_by_id(backend, current_id)
        if folder:
            path_parts.insert(0, folder.get("name", ""))
            current_id = folder.get("parentId")
        else:
            break

    return "/".join(path_parts)

def _get_elements_with_shadow(elements: List[Dict[str, Any]]) -> List[Dict[str, Any]]:
    """Get elements that have shadow effects enabled."""
    return [e for e in elements if e.get("shadow", {}).get("enabled", False)]

def _get_elements_with_opacity_less_than(elements: List[Dict[str, Any]], threshold: float) -> List[Dict[str, Any]]:
    """Get elements with opacity < threshold."""
    return [e for e in elements if e.get("opacity", 1.0) < threshold]

def _count_locked_unlocked(elements: List[Dict[str, Any]]) -> Tuple[int, int]:
    """Count locked and unlocked elements. Returns (locked_count, unlocked_count)."""
    locked = sum(1 for e in elements if e.get("locked", False))
    unlocked = len(elements) - locked
    return (locked, unlocked)

def _validate_final_answer_contains(
    final_answer: str,
    expected_values: List[str],
    expected_keywords: List[str],
    min_length: int = 100
) -> Tuple[List[str], List[str]]:
    """
    Validate that final_answer contains expected values and keywords.
    Returns (errors, checks_passed) tuple.
    Strict validation: missing values/keywords result in errors.
    """
    errors: List[str] = []
    checks_passed: List[str] = []

    if not final_answer:
        errors.append("[X] No final answer provided")
        return (errors, checks_passed)

    answer_lower = final_answer.lower()

    # Check for expected numeric values (exact match, case-sensitive)
    for value in expected_values:
        if value in final_answer:
            checks_passed.append(f"[OK] Final answer documents: {value}")
        else:
            errors.append(f"[X] Final answer missing value: {value}")

    # Check for expected keywords (case-insensitive)
    for keyword in expected_keywords:
        if keyword.lower() in answer_lower:
            checks_passed.append(f"[OK] Final answer mentions: {keyword}")
        else:
            errors.append(f"[X] Final answer missing keyword: {keyword}")

    # Check comprehensiveness
    if len(final_answer) < min_length:
        errors.append(f"[X] Final answer too short ({len(final_answer)} chars, expected {min_length}+)")
    else:
        checks_passed.append(f"[OK] Final answer comprehensive ({len(final_answer)} chars)")

    return (errors, checks_passed)

def _get_shape_elements(backend: Backend, design_id: str) -> List[Dict[str, Any]]:
    """Get all shape elements for a design."""
    return _get_elements_by_type(backend, design_id, "shape")

def _get_line_elements(backend: Backend, design_id: str) -> List[Dict[str, Any]]:
    """Get all line elements for a design."""
    return _get_elements_by_type(backend, design_id, "line")

def _get_icon_elements(backend: Backend, design_id: str) -> List[Dict[str, Any]]:
    """Get all icon elements for a design."""
    return _get_elements_by_type(backend, design_id, "icon")

def _get_element_text(element: Dict[str, Any]) -> str:
    """Extract text content from a text element."""
    props = element.get("properties", {})
    segments = props.get("segments", [])
    return "".join(seg.get("text", "") for seg in segments)

def _find_text_element_with_content(
    elements: List[Dict[str, Any]],
    content_pattern: str,
    case_sensitive: bool = False
) -> Optional[Dict[str, Any]]:
    """Find a text element containing specific content."""
    pattern = content_pattern if case_sensitive else content_pattern.lower()
    for el in elements:
        if el.get("type") == "text":
            text = _get_element_text(el)
            compare_text = text if case_sensitive else text.lower()
            if pattern in compare_text:
                return el
    return None

def _find_all_text_elements_with_content(
    elements: List[Dict[str, Any]],
    content_pattern: str,
    case_sensitive: bool = False
) -> List[Dict[str, Any]]:
    """Find all text elements containing specific content."""
    pattern = content_pattern if case_sensitive else content_pattern.lower()
    matches = []
    for el in elements:
        if el.get("type") == "text":
            text = _get_element_text(el)
            compare_text = text if case_sensitive else text.lower()
            if pattern in compare_text:
                matches.append(el)
    return matches

def _find_shape_element_by_type(
    elements: List[Dict[str, Any]],
    shape_type: str
) -> Optional[Dict[str, Any]]:
    """Find a shape element by its shape type (rectangle, circle, etc.)."""
    for el in elements:
        if el.get("type") == "shape":
            props = el.get("properties", {})
            if props.get("shapeType") == shape_type:
                return el
    return None

def _get_root_level_folders(backend: Backend) -> List[Dict[str, Any]]:
    """Get all root-level folders (no parent)."""
    return _get_child_folders(backend, None)

def _validate_design_dimensions(
    design: Dict[str, Any],
    expected_width: int,
    expected_height: int
) -> Tuple[bool, str]:
    """Validate design dimensions. Returns (success, message)."""
    width = design.get("width", 0)
    height = design.get("height", 0)
    if width == expected_width and height == expected_height:
        return True, f"Dimensions correct: {width}x{height}"
    return False, f"Dimensions mismatch: expected {expected_width}x{expected_height}, got {width}x{height}"

def _validate_design_format(design: Dict[str, Any], expected_format: str) -> Tuple[bool, str]:
    """Validate design format. Returns (success, message)."""
    format_val = design.get("format", "")
    if format_val == expected_format:
        return True, f"Format correct: {format_val}"
    return False, f"Format mismatch: expected '{expected_format}', got '{format_val}'"

def _validate_design_title(design: Dict[str, Any], expected_title: str, exact: bool = True) -> Tuple[bool, str]:
    """Validate design title. Returns (success, message)."""
    title = design.get("title", "")
    if exact:
        if title == expected_title:
            return True, f"Title correct: '{title}'"
        return False, f"Title mismatch: expected '{expected_title}', got '{title}'"
    else:
        if expected_title.lower() in title.lower():
            return True, f"Title contains expected text: '{title}'"
        return False, f"Title does not contain '{expected_title}', got '{title}'"

def _validate_page_background(
    design: Dict[str, Any],
    page_index: int,
    expected_color: str
) -> Tuple[bool, str]:
    """Validate page background color. Returns (success, message)."""
    pages = design.get("pages", [])
    if page_index >= len(pages):
        return False, f"Page {page_index} does not exist (only {len(pages)} pages)"
    page = pages[page_index]
    bg_color = page.get("backgroundColor", "")
    # Normalize colors for comparison (lowercase, handle with/without #)
    expected_normalized = expected_color.lower().lstrip("#")
    actual_normalized = bg_color.lower().lstrip("#")
    if expected_normalized == actual_normalized:
        return True, f"Background color correct: {bg_color}"
    return False, f"Background color mismatch: expected '{expected_color}', got '{bg_color}'"

def _validate_design_page_count(design: Dict[str, Any], expected_count: int) -> Tuple[bool, str]:
    """Validate number of pages in design. Returns (success, message)."""
    pages = design.get("pages", [])
    actual_count = len(pages)
    if actual_count == expected_count:
        return True, f"Page count correct: {actual_count}"
    return False, f"Page count mismatch: expected {expected_count}, got {actual_count}"

def _check_design_not_in_folder(design: Dict[str, Any]) -> Tuple[bool, str]:
    """Check if design is not in any folder (at root). Returns (success, message)."""
    design_folder_id = design.get("folderId")
    if design_folder_id is None:
        return True, "Design is at root level (no folder)"
    return False, f"Design is in folder '{design_folder_id}' but expected at root"

def _check_design_is_archived(design: Dict[str, Any]) -> Tuple[bool, str]:
    """Check if design is archived. Returns (success, message)."""
    is_archived = design.get("isArchived", False)
    if is_archived:
        return True, "Design is archived"
    return False, "Design is not archived"

def _check_design_is_favorite(design: Dict[str, Any]) -> Tuple[bool, str]:
    """Check if design is favorited. Returns (success, message)."""
    is_favorite = design.get("isFavorite", False)
    if is_favorite:
        return True, "Design is favorited"
    return False, "Design is not favorited"

def _validate_element_position(
    element: Dict[str, Any],
    expected_x: float,
    expected_y: float,
    tolerance: float = 10.0
) -> Tuple[bool, str]:
    """Validate element position with tolerance. Returns (success, message)."""
    x = element.get("x", 0)
    y = element.get("y", 0)
    if abs(x - expected_x) <= tolerance and abs(y - expected_y) <= tolerance:
        return True, f"Position correct: ({x}, {y})"
    return False, f"Position mismatch: expected ({expected_x}, {expected_y}), got ({x}, {y})"

def _validate_element_size(
    element: Dict[str, Any],
    expected_width: float,
    expected_height: float,
    tolerance: float = 10.0
) -> Tuple[bool, str]:
    """Validate element size with tolerance. Returns (success, message)."""
    width = element.get("width", 0)
    height = element.get("height", 0)
    if abs(width - expected_width) <= tolerance and abs(height - expected_height) <= tolerance:
        return True, f"Size correct: {width}x{height}"
    return False, f"Size mismatch: expected {expected_width}x{expected_height}, got {width}x{height}"

def _validate_text_element_font_size(element: Dict[str, Any], expected_size: int) -> Tuple[bool, str]:
    """Validate text element font size. Returns (success, message)."""
    props = element.get("properties", {})
    font_size = props.get("fontSize", 0)
    if font_size == expected_size:
        return True, f"Font size correct: {font_size}px"
    return False, f"Font size mismatch: expected {expected_size}px, got {font_size}px"

def _validate_text_element_font_weight(element: Dict[str, Any], expected_weight: str) -> Tuple[bool, str]:
    """Validate text element font weight. Returns (success, message)."""
    props = element.get("properties", {})
    font_weight = props.get("fontWeight", "")
    if font_weight == expected_weight:
        return True, f"Font weight correct: {font_weight}"
    return False, f"Font weight mismatch: expected '{expected_weight}', got '{font_weight}'"

def _validate_text_element_color(element: Dict[str, Any], expected_color: str) -> Tuple[bool, str]:
    """Validate text element color. Returns (success, message)."""
    props = element.get("properties", {})
    color = props.get("color", "")
    # Normalize colors for comparison
    expected_normalized = expected_color.lower().lstrip("#")
    actual_normalized = color.lower().lstrip("#")
    if expected_normalized == actual_normalized:
        return True, f"Text color correct: {color}"
    return False, f"Text color mismatch: expected '{expected_color}', got '{color}'"

def _validate_text_element_alignment(element: Dict[str, Any], expected_align: str) -> Tuple[bool, str]:
    """Validate text element alignment. Returns (success, message)."""
    props = element.get("properties", {})
    text_align = props.get("textAlign", "")
    if text_align == expected_align:
        return True, f"Text alignment correct: {text_align}"
    return False, f"Text alignment mismatch: expected '{expected_align}', got '{text_align}'"

def _validate_shape_fill_color(element: Dict[str, Any], expected_color: str) -> Tuple[bool, str]:
    """Validate shape fill color. Returns (success, message)."""
    props = element.get("properties", {})
    fill = props.get("fill", "")
    # Normalize colors for comparison
    expected_normalized = expected_color.lower().lstrip("#")
    actual_normalized = fill.lower().lstrip("#")
    if expected_normalized == actual_normalized:
        return True, f"Shape fill color correct: {fill}"
    return False, f"Shape fill color mismatch: expected '{expected_color}', got '{fill}'"

def _validate_shape_stroke_color(element: Dict[str, Any], expected_color: str) -> Tuple[bool, str]:
    """Validate shape stroke color. Returns (success, message)."""
    props = element.get("properties", {})
    stroke = props.get("stroke", "")
    # Normalize colors for comparison
    expected_normalized = expected_color.lower().lstrip("#")
    actual_normalized = stroke.lower().lstrip("#")
    if expected_normalized == actual_normalized:
        return True, f"Shape stroke color correct: {stroke}"
    return False, f"Shape stroke color mismatch: expected '{expected_color}', got '{stroke}'"

def _validate_folder_parent(folder: Dict[str, Any], expected_parent_id: Optional[str]) -> Tuple[bool, str]:
    """Validate folder's parent. Returns (success, message)."""
    parent_id = folder.get("parentId")
    if parent_id == expected_parent_id:
        if expected_parent_id is None:
            return True, "Folder is at root level"
        return True, f"Folder parent correct: {parent_id}"
    return False, f"Folder parent mismatch: expected '{expected_parent_id}', got '{parent_id}'"

def _folder_path_exists(backend: Backend, path: str) -> bool:
    """Check if a folder path exists."""
    return _find_folder_by_path(backend, path) is not None

def _normalize_color(color: str) -> str:
    """Normalize a color value for comparison (lowercase, strip #)."""
    return color.lower().lstrip("#") if color else ""

def _colors_match(color1: str, color2: str) -> bool:
    """Check if two colors match (normalized comparison)."""
    return _normalize_color(color1) == _normalize_color(color2)

def _check_design_format_flexible(design: Dict[str, Any], expected_format: str) -> bool:
    """
    Check format, allowing 'custom' format if dimensions match expected preset.
    """
    fmt = design.get("format", "")
    if fmt == expected_format:
        return True

    if fmt == "custom" and expected_format in FORMAT_PRESETS:
        expected_width, expected_height = FORMAT_PRESETS[expected_format]
        actual_width = design.get("width", 0)
        actual_height = design.get("height", 0)
        if actual_width == expected_width and actual_height == expected_height:
            return True

    return False

def _search_designs_by_title(backend: Backend, title_pattern: str) -> List[Dict[str, Any]]:
    """Search designs by title pattern (alias for _find_designs_by_title)."""
    return _find_designs_by_title(backend, title_pattern)

def _get_element_text_content(element: Dict[str, Any]) -> str:
    """Extract text content from a text element."""
    props = element.get("properties", {})
    if props.get("type") == "text":
        segments = props.get("segments", [])
        return "".join(seg.get("text", "") for seg in segments)
    return ""


# Reward Functions
# ==============================================================================



# Reward Functions
# ==============================================================================



# Reward Functions
# ==============================================================================



# Reward Functions
# ==============================================================================



# Reward Functions
# ==============================================================================



# Reward Functions
# ==============================================================================



# Reward Functions
# ==============================================================================


# ==============================================================================
# Validation Functions - Folder Organization Tasks
# ==============================================================================
def _validate_reorganize_all_designs_containing_acme_in_their_titles_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate that all designs with 'Acme' in titles are moved to 
    'Client Work/Acme Corp/Archive/All Designs' folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the target folder
        target_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Archive/All Designs")
        if not target_folder:
            errors.append("[X] Folder path 'Client Work/Acme Corp/Archive/All Designs' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Folder path 'Client Work/Acme Corp/Archive/All Designs' exists")

        # Get designs in the target folder
        designs_in_folder = _get_designs_in_folder(backend, target_folder.get("_id"))

        # Count designs with 'Acme' in title
        acme_designs = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

        if len(acme_designs) >= 8:
            checks_passed.append(f"[✓] Found {len(acme_designs)} designs with 'Acme' in titles (required: 8+)")
        else:
            errors.append(f"[X] Only {len(acme_designs)} designs with 'Acme' in titles found, expected at least 8")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_reorganize_all_designs_containing_acme_in_their_titles_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_resize_the_live_music_night_poster_design_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate that 'Live Music Night Poster' design is resized to 1080x1080 
    with format 'custom', and elements are extracted.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Live Music Night Poster' found")

        # Check dimensions
        if _check_design_dimensions(design, 1080, 1080):
            checks_passed.append("[✓] Design resized to 1080x1080")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1080x1080")

        # Check format changed to custom
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check that image elements exist (extraction happened)
        elements = _get_elements_for_design(backend, design.get("_id"))
        image_elements = [e for e in elements if e.get("type") == "image"]

        if len(image_elements) > 0:
            checks_passed.append(f"[✓] Image elements extracted ({len(image_elements)} found)")
        else:
            errors.append("[X] No image elements found for aspect ratio analysis")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_resize_the_live_music_night_poster_design_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_establish_a_new_project_hierarchy_client_work_techconf_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate that folder hierarchy 'Client Work/TechConf 2026/Marketing Assets'
    with subfolders exists and designs are organized by format.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder path
        main_folder = _find_folder_by_path(backend, "Client Work/TechConf 2026/Marketing Assets")
        if not main_folder:
            errors.append("[X] Folder path 'Client Work/TechConf 2026/Marketing Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Folder path 'Client Work/TechConf 2026/Marketing Assets' exists")

        main_folder_id = main_folder.get("_id")

        # Check subfolders
        child_folders = _get_child_folders(backend, main_folder_id)
        folder_names = [f.get("name", "").lower() for f in child_folders]

        required_subfolders = ["social media", "presentations", "print materials"]
        for subfolder in required_subfolders:
            if subfolder in folder_names:
                checks_passed.append(f"[✓] Subfolder '{subfolder.title()}' exists")
            else:
                errors.append(f"[X] Subfolder '{subfolder.title()}' not found")

        # Check that at least 2 designs were moved
        total_designs = 0
        for child_folder in child_folders:
            designs = _get_designs_in_folder(backend, child_folder.get("_id"))
            total_designs += len(designs)

        if total_designs >= 2:
            checks_passed.append(f"[✓] At least 2 designs moved to subfolders (found {total_designs})")
        else:
            errors.append(f"[X] Only {total_designs} designs in subfolders, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_establish_a_new_project_hierarchy_client_work_techconf_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_transform_the_live_music_night_poster_from_poster_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate multi-format campaign: original resized to 800x600, plus Instagram and Facebook designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check original poster resized to 800x600
        poster = _find_design_by_title(backend, "Live Music Night Poster")
        if poster:
            if _check_design_dimensions(poster, 800, 600):
                checks_passed.append("[✓] Original poster resized to 800x600")
            else:
                errors.append(f"[X] Poster dimensions are {poster.get('width')}x{poster.get('height')}, expected 800x600")

            if _check_design_format(poster, "custom"):
                checks_passed.append("[✓] Poster format is 'custom'")
            else:
                errors.append(f"[X] Poster format is '{poster.get('format')}', expected 'custom'")
        else:
            errors.append("[X] 'Live Music Night Poster' design not found")

        # Check Instagram post
        instagram = _find_design_by_title(backend, "Live Music - Instagram")
        if instagram:
            checks_passed.append("[✓] 'Live Music - Instagram' design found")
            if _check_design_dimensions(instagram, 1080, 1080):
                checks_passed.append("[✓] Instagram design has correct dimensions (1080x1080)")
            else:
                errors.append("[X] Instagram design dimensions incorrect")
        else:
            errors.append("[X] 'Live Music - Instagram' design not found")

        # Check Facebook post
        facebook = _find_design_by_title(backend, "Live Music - Facebook")
        if facebook:
            checks_passed.append("[✓] 'Live Music - Facebook' design found")
            if _check_design_dimensions(facebook, 1200, 630):
                checks_passed.append("[✓] Facebook design has correct dimensions (1200x630)")
            else:
                errors.append("[X] Facebook design dimensions incorrect")
        else:
            errors.append("[X] 'Live Music - Facebook' design not found")

        # Check folder organization
        folder = _find_folder_by_path(backend, "Personal/Print/Events")
        if folder:
            checks_passed.append("[✓] Folder 'Personal/Print/Events' exists")
        else:
            errors.append("[X] Folder 'Personal/Print/Events' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_transform_the_live_music_night_poster_from_poster_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_resize_the_community_event_promo_facebook_post_design_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate that 'Community Event Promo' is resized to A4 (2480x3508) with custom format
    and moved to 'Personal/Print/Event Materials'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Community Event Promo")
        if not design:
            errors.append("[X] Design 'Community Event Promo' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Community Event Promo' found")

        # Check dimensions
        if _check_design_dimensions(design, 2480, 3508):
            checks_passed.append("[✓] Design resized to 2480x3508 (A4 dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 2480x3508")

        # Check format
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Print/Event Materials")
        if folder:
            checks_passed.append("[✓] Folder 'Personal/Print/Event Materials' exists")

            # Check design is in this folder
            if design.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Design moved to 'Personal/Print/Event Materials' folder")
            else:
                errors.append("[X] Design not in 'Personal/Print/Event Materials' folder")
        else:
            errors.append("[X] Folder 'Personal/Print/Event Materials' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_resize_the_community_event_promo_facebook_post_design_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_reorganize_all_instagram_related_designs_by_searching_for_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Instagram designs are organized into archive structure with
    Posts/Stories/Campaigns subfolders.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        base_folder = _find_folder_by_path(backend, "Archive/Social Media/Instagram/By Year/2026")
        if not base_folder:
            errors.append("[X] Folder 'Archive/Social Media/Instagram/By Year/2026' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Folder 'Archive/Social Media/Instagram/By Year/2026' exists")

        # Check subfolders
        child_folders = _get_child_folders(backend, base_folder.get("_id"))
        folder_names = [f.get("name", "").lower() for f in child_folders]

        required_subfolders = ["posts", "stories", "campaigns"]
        subfolder_ids = {}
        for subfolder in required_subfolders:
            if subfolder in folder_names:
                checks_passed.append(f"[✓] Subfolder '{subfolder.title()}' exists")
                # Get folder id for later
                for f in child_folders:
                    if f.get("name", "").lower() == subfolder:
                        subfolder_ids[subfolder] = f.get("_id")
            else:
                errors.append(f"[X] Subfolder '{subfolder.title()}' not found")

        # Count Instagram designs across all subfolders
        total_instagram_designs = 0
        for folder_id in subfolder_ids.values():
            designs = _get_designs_in_folder(backend, folder_id)
            instagram_designs = [d for d in designs if "instagram" in d.get("title", "").lower()]
            total_instagram_designs += len(instagram_designs)

        if total_instagram_designs >= 4:
            checks_passed.append(f"[✓] At least 4 Instagram designs organized (found {total_instagram_designs})")
        else:
            errors.append(f"[X] Only {total_instagram_designs} Instagram designs found, expected at least 4")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_reorganize_all_instagram_related_designs_by_searching_for_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_transform_the_existing_tech_conference_header_twitter_design_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate that 'Tech Conference Header' Twitter design is resized to 1920x1080
    and content is extracted.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Tech Conference Header' found")

        # Check dimensions
        if _check_design_dimensions(design, 1920, 1080):
            checks_passed.append("[✓] Design resized to 1920x1080 (presentation dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1920x1080")

        # Check format changed to custom
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check content extraction (elements should exist)
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) > 0:
            checks_passed.append(f"[✓] Content extracted ({len(elements)} elements found)")

            text_elements = [e for e in elements if e.get("type") == "text"]
            if text_elements:
                checks_passed.append(f"[✓] Text elements documented ({len(text_elements)} found)")
        else:
            errors.append("[X] No elements found for content analysis")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_transform_the_existing_tech_conference_header_twitter_design_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_multi_format_brand_asset_collection_for_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechCorp 2026 brand assets: Logo, Business Card, and Letterhead
    with correct formats and dimensions in Brand Assets folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Logo
        logo = _find_design_by_title(backend, "TechCorp Logo 2026")
        if logo:
            checks_passed.append("[✓] 'TechCorp Logo 2026' design found")
            if _check_design_dimensions(logo, 500, 500) and _check_design_format(logo, "logo"):
                checks_passed.append("[✓] Logo has correct format and dimensions (500x500)")
            else:
                errors.append("[X] Logo format/dimensions incorrect")
        else:
            errors.append("[X] 'TechCorp Logo 2026' design not found")

        # Check Business Card
        business_card = _find_design_by_title(backend, "TechCorp Business Card 2026")
        if business_card:
            checks_passed.append("[✓] 'TechCorp Business Card 2026' design found")
            if _check_design_dimensions(business_card, 1050, 600) and _check_design_format(business_card, "business-card"):
                checks_passed.append("[✓] Business Card has correct format and dimensions (1050x600)")
            else:
                errors.append("[X] Business Card format/dimensions incorrect")
        else:
            errors.append("[X] 'TechCorp Business Card 2026' design not found")

        # Check Letterhead
        letterhead = _find_design_by_title(backend, "TechCorp Letterhead 2026")
        if letterhead:
            checks_passed.append("[✓] 'TechCorp Letterhead 2026' design found")
            if _check_design_dimensions(letterhead, 2480, 3508) and _check_design_format(letterhead, "a4-document"):
                checks_passed.append("[✓] Letterhead has correct format and dimensions (2480x3508)")
            else:
                errors.append("[X] Letterhead format/dimensions incorrect")
        else:
            errors.append("[X] 'TechCorp Letterhead 2026' design not found")

        # Check folder
        folder = _find_folder_by_name(backend, "Brand Assets")
        if folder:
            checks_passed.append("[✓] 'Brand Assets' folder exists")
        else:
            errors.append("[X] 'Brand Assets' folder not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_multi_format_brand_asset_collection_for_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_resize_the_tech_conference_header_design_to_youtube_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Conference Header resized to YouTube thumbnail plus two new designs
    organized in folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check resized header
        header = _find_design_by_title(backend, "Tech Conference Header")
        if header:
            checks_passed.append("[✓] 'Tech Conference Header' design found")
            if _check_design_dimensions(header, 1280, 720):
                checks_passed.append("[✓] Header resized to 1280x720 (YouTube thumbnail)")
            else:
                errors.append(f"[X] Header dimensions are {header.get('width')}x{header.get('height')}, expected 1280x720")

            if _check_design_format(header, "custom"):
                checks_passed.append("[✓] Header format is 'custom'")
            else:
                errors.append(f"[X] Header format is '{header.get('format')}', expected 'custom'")
        else:
            errors.append("[X] 'Tech Conference Header' design not found")

        # Check Instagram design
        instagram = _find_design_by_title(backend, "Conference Promotion - Instagram")
        if instagram:
            checks_passed.append("[✓] 'Conference Promotion - Instagram' design found")
            if _check_design_dimensions(instagram, 1080, 1080):
                checks_passed.append("[✓] Instagram design has correct dimensions (1080x1080)")
            else:
                errors.append("[X] Instagram design dimensions incorrect")
        else:
            errors.append("[X] 'Conference Promotion - Instagram' design not found")

        # Check Story design
        story = _find_design_by_title(backend, "Conference Promotion - Story")
        if story:
            checks_passed.append("[✓] 'Conference Promotion - Story' design found")
            if _check_design_dimensions(story, 1080, 1920):
                checks_passed.append("[✓] Story design has correct dimensions (1080x1920)")
            else:
                errors.append("[X] Story design dimensions incorrect")
        else:
            errors.append("[X] 'Conference Promotion - Story' design not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Events/Tech Conference/Promotions")
        if folder:
            checks_passed.append("[✓] Folder 'Events/Tech Conference/Promotions' exists")
        else:
            errors.append("[X] Folder 'Events/Tech Conference/Promotions' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_resize_the_tech_conference_header_design_to_youtube_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_set_up_a_multi_client_workspace_organization_system_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate multi-client workspace with folder hierarchy and designs for
    TechStart, GreenCorp, and MediaFlow.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check for each client
        clients = {
            "TechStart Inc": ("TechStart Q1 Social", "instagram-post", 1080, 1080),
            "GreenCorp LLC": ("GreenCorp Q1 Social", "facebook-post", 1200, 630),
            "MediaFlow Agency": ("MediaFlow Q1 Social", "twitter-header", 1500, 500)
        }

        for client_name, (design_title, expected_format, width, height) in clients.items():
            # Check folder structure
            folder_path = f"Client Work/{client_name}/2026/Q1/Social"
            folder = _find_folder_by_path(backend, folder_path)

            if folder:
                checks_passed.append(f"[✓] Folder structure '{folder_path}' exists")

                # Check design
                design = _find_design_by_title(backend, design_title)
                if design:
                    checks_passed.append(f"[✓] Design '{design_title}' found")

                    if _check_design_dimensions(design, width, height):
                        checks_passed.append(f"[✓] '{design_title}' has correct dimensions")
                    else:
                        errors.append(f"[X] '{design_title}' dimensions incorrect")

                    if _check_design_format(design, expected_format):
                        checks_passed.append(f"[✓] '{design_title}' has correct format")
                    else:
                        errors.append(f"[X] '{design_title}' format incorrect")

                    if design.get("folderId") == folder.get("_id"):
                        checks_passed.append(f"[✓] '{design_title}' is in correct folder")
                    else:
                        errors.append(f"[X] '{design_title}' not in correct folder")
                else:
                    errors.append(f"[X] Design '{design_title}' not found")
            else:
                errors.append(f"[X] Folder structure '{folder_path}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_set_up_a_multi_client_workspace_organization_system_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_reorganize_all_conference_related_designs_by_searching_for_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference designs are moved to 'Events/2026/Tech Conferences/Headers'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Events/2026/Tech Conferences/Headers")
        if not folder:
            errors.append("[X] Folder 'Events/2026/Tech Conferences/Headers' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Folder 'Events/2026/Tech Conferences/Headers' exists")

        # Get designs in folder
        designs = _get_designs_in_folder(backend, folder.get("_id"))
        conference_designs = [d for d in designs if "conference" in d.get("title", "").lower()]

        if len(conference_designs) >= 3:
            checks_passed.append(f"[✓] At least 3 conference designs moved (found {len(conference_designs)})")
        else:
            errors.append(f"[X] Only {len(conference_designs)} conference designs found, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_reorganize_all_conference_related_designs_by_searching_for_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_new_business_presentation_design_1920x1080_titled_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 Financial Review presentation and A4 document created
    in correct folders.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check presentation
        presentation = _find_design_by_title(backend, "Q2 Financial Review - Executive Summary")
        if presentation:
            checks_passed.append("[✓] Presentation 'Q2 Financial Review - Executive Summary' found")

            if _check_design_dimensions(presentation, 1920, 1080):
                checks_passed.append("[✓] Presentation has correct dimensions (1920x1080)")
            else:
                errors.append("[X] Presentation dimensions incorrect")

            if _check_design_format(presentation, "presentation"):
                checks_passed.append("[✓] Presentation has correct format")
            else:
                errors.append("[X] Presentation format incorrect")
        else:
            errors.append("[X] Presentation 'Q2 Financial Review - Executive Summary' not found")

        # Check A4 document
        a4_doc = _find_design_by_title(backend, "Q2 Financial Review - Detailed Report")
        if a4_doc:
            checks_passed.append("[✓] A4 document 'Q2 Financial Review - Detailed Report' found")

            if _check_design_dimensions(a4_doc, 2480, 3508):
                checks_passed.append("[✓] A4 document has correct dimensions (2480x3508)")
            else:
                errors.append("[X] A4 document dimensions incorrect")

            if _check_design_format(a4_doc, "a4-document"):
                checks_passed.append("[✓] A4 document has correct format")
            else:
                errors.append("[X] A4 document format incorrect")
        else:
            errors.append("[X] A4 document 'Q2 Financial Review - Detailed Report' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_new_business_presentation_design_1920x1080_titled_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_reorganize_the_workspace_by_finding_all_designs_with_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome and Acme designs are organized into respective archive folders.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Welcome Posts folder
        welcome_folder = _find_folder_by_path(backend, "Archive/Legacy/Welcome Posts")
        if welcome_folder:
            checks_passed.append("[✓] Folder 'Archive/Legacy/Welcome Posts' exists")

            designs = _get_designs_in_folder(backend, welcome_folder.get("_id"))
            welcome_designs = [d for d in designs if "welcome" in d.get("title", "").lower()]

            if len(welcome_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Welcome designs moved (found {len(welcome_designs)})")
            else:
                errors.append(f"[X] Only {len(welcome_designs)} Welcome designs found, expected at least 3")
        else:
            errors.append("[X] Folder 'Archive/Legacy/Welcome Posts' not found")

        # Check Acme archive folder
        acme_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q1 2026/Archive")
        if acme_folder:
            checks_passed.append("[✓] Folder 'Client Work/Acme Corp/Q1 2026/Archive' exists")

            designs = _get_designs_in_folder(backend, acme_folder.get("_id"))
            acme_designs = [d for d in designs if "acme" in d.get("title", "").lower()]

            if len(acme_designs) >= 4:
                checks_passed.append(f"[✓] At least 4 Acme designs moved (found {len(acme_designs)})")
            else:
                errors.append(f"[X] Only {len(acme_designs)} Acme designs found, expected at least 4")
        else:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q1 2026/Archive' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_reorganize_the_workspace_by_finding_all_designs_with_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_an_educational_content_series_with_three_interconnected_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate educational content series with A4, Presentation, and Instagram designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check A4 document
        a4 = _find_design_by_title(backend, "Study Guide - Digital Marketing")
        if a4:
            checks_passed.append("[✓] A4 'Study Guide - Digital Marketing' found")
            if _check_design_dimensions(a4, 2480, 3508):
                checks_passed.append("[✓] A4 has correct dimensions")
            else:
                errors.append("[X] A4 dimensions incorrect")
        else:
            errors.append("[X] 'Study Guide - Digital Marketing' not found")

        # Check Presentation
        presentation = _find_design_by_title(backend, "Workshop Slides - Digital Marketing")
        if presentation:
            checks_passed.append("[✓] Presentation 'Workshop Slides - Digital Marketing' found")
            if _check_design_dimensions(presentation, 1920, 1080):
                checks_passed.append("[✓] Presentation has correct dimensions")
            else:
                errors.append("[X] Presentation dimensions incorrect")
        else:
            errors.append("[X] 'Workshop Slides - Digital Marketing' not found")

        # Check Instagram post
        instagram = _find_design_by_title(backend, "Quick Tips - Digital Marketing")
        if instagram:
            checks_passed.append("[✓] Instagram 'Quick Tips - Digital Marketing' found")
            if _check_design_dimensions(instagram, 1080, 1080):
                checks_passed.append("[✓] Instagram has correct dimensions")
            else:
                errors.append("[X] Instagram dimensions incorrect")
        else:
            errors.append("[X] 'Quick Tips - Digital Marketing' not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Education/Digital Marketing/2026 Series")
        if folder:
            checks_passed.append("[✓] Folder 'Education/Digital Marketing/2026 Series' exists")
        else:
            errors.append("[X] Folder 'Education/Digital Marketing/2026 Series' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_an_educational_content_series_with_three_interconnected_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_transform_the_business_card_alice_chen_design_for_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Business Card - Alice Chen resized to 1584x396 banner dimensions.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design (with em dash or regular dash)
        design = _find_design_by_title(backend, "Business Card")
        if not design:
            design = _find_design_by_title(backend, "Alice Chen")

        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Business Card — Alice Chen' found")

        # Check dimensions
        if _check_design_dimensions(design, 1584, 396):
            checks_passed.append("[✓] Design resized to 1584x396 (banner dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1584x396")

        # Check format
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check content extraction
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) > 0:
            checks_passed.append(f"[✓] Content extracted ({len(elements)} elements)")
        else:
            errors.append("[X] No elements found for analysis")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_transform_the_business_card_alice_chen_design_for_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conduct_a_comprehensive_workspace_audit_by_searching_for_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate workspace audit with Acme design analysis and folder organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Acme designs
        all_designs = backend.query({"collection": "designs", "filter": {}})
        if isinstance(all_designs, list):
            acme_designs = [d for d in all_designs if "acme" in d.get("title", "").lower()]

            if len(acme_designs) > 0:
                checks_passed.append(f"[✓] Found {len(acme_designs)} Acme designs for audit")
            else:
                errors.append("[X] No Acme designs found")

        # Check folder structure
        folder = _find_folder_by_path(backend, "Analytics/Acme Analysis/Design Reports")
        if folder:
            checks_passed.append("[✓] Folder 'Analytics/Acme Analysis/Design Reports' exists")

            # Check designs moved
            designs_in_folder = _get_designs_in_folder(backend, folder.get("_id"))
            acme_in_folder = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

            if len(acme_in_folder) > 0:
                checks_passed.append(f"[✓] Acme designs moved to Design Reports folder ({len(acme_in_folder)})")
            else:
                errors.append("[X] No Acme designs in Design Reports folder")
        else:
            errors.append("[X] Folder 'Analytics/Acme Analysis/Design Reports' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conduct_a_comprehensive_workspace_audit_by_searching_for_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_new_instagram_story_design_1080x1920_titled_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate New Year Campaign Story 2026 Instagram story with correct format and content.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "New Year Campaign Story 2026")
        if not design:
            errors.append("[X] Design 'New Year Campaign Story 2026' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'New Year Campaign Story 2026' found")

        # Check format
        if _check_design_format(design, "instagram-story"):
            checks_passed.append("[✓] Design has 'instagram-story' format")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'instagram-story'")

        # Check dimensions
        if _check_design_dimensions(design, 1080, 1920):
            checks_passed.append("[✓] Design has correct dimensions (1080x1920)")
        else:
            errors.append("[X] Design dimensions incorrect")

        # Check text content
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = [e for e in elements if e.get("type") == "text"]

        has_new_year_content = False
        for elem in text_elements:
            if _check_element_has_content(elem, "New Year") or _check_element_has_content(elem, "2026"):
                has_new_year_content = True
                break

        if has_new_year_content:
            checks_passed.append("[✓] Text content contains 'New Year' or '2026'")
        else:
            errors.append("[X] No text content related to 'New Year' or '2026' found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_new_instagram_story_design_1080x1920_titled_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_perform_advanced_content_analysis_on_all_designs_containing_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate advanced content analysis on at least 5 Acme designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Acme designs
        all_designs = backend.query({"collection": "designs", "filter": {}})
        if isinstance(all_designs, list):
            acme_designs = [d for d in all_designs if "acme" in d.get("title", "").lower()]

            if len(acme_designs) >= 5:
                checks_passed.append(f"[✓] Found {len(acme_designs)} Acme designs for analysis (required: 5+)")

                # Analyze each design
                for design in acme_designs[:5]:  # Analyze at least first 5
                    design_title = design.get("title", "")

                    # Check format and dimensions documented
                    if design.get("format") and design.get("width") and design.get("height"):
                        checks_passed.append(f"[✓] '{design_title}' format/dimensions documented")

                    # Get elements for analysis
                    elements = _get_elements_for_design(backend, design.get("_id"))
                    if elements:
                        element_counts = _count_elements_by_type(elements)
                        checks_passed.append(f"[✓] '{design_title}' element analysis complete ({len(elements)} elements)")
            else:
                errors.append(f"[X] Only {len(acme_designs)} Acme designs found, expected at least 5")
        else:
            errors.append("[X] Could not query designs")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_perform_advanced_content_analysis_on_all_designs_containing_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_reorganize_all_acme_branded_designs_into_a_comprehensive_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme and Conference designs organized into Brand Management structure.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Acme Social Media folder
        acme_social_folder = _find_folder_by_path(backend, "Brand Management/Acme Corp/2026 Assets/Social Media")
        if acme_social_folder:
            checks_passed.append("[✓] Folder 'Brand Management/Acme Corp/2026 Assets/Social Media' exists")

            designs = _get_designs_in_folder(backend, acme_social_folder.get("_id"))
            acme_designs = [d for d in designs if "acme" in d.get("title", "").lower()]

            if len(acme_designs) >= 12:
                checks_passed.append(f"[✓] At least 12 Acme designs in Social Media folder (found {len(acme_designs)})")
            else:
                errors.append(f"[X] Only {len(acme_designs)} Acme designs found, expected at least 12")
        else:
            errors.append("[X] Folder 'Brand Management/Acme Corp/2026 Assets/Social Media' not found")

        # Check Events folder
        events_folder = _find_folder_by_path(backend, "Brand Management/Acme Corp/2026 Assets/Events")
        if events_folder:
            checks_passed.append("[✓] Folder 'Brand Management/Acme Corp/2026 Assets/Events' exists")

            designs = _get_designs_in_folder(backend, events_folder.get("_id"))
            conference_designs = [d for d in designs if "conference" in d.get("title", "").lower()]

            if len(conference_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Conference designs in Events folder (found {len(conference_designs)})")
            else:
                errors.append(f"[X] Only {len(conference_designs)} Conference designs found, expected at least 3")
        else:
            errors.append("[X] Folder 'Brand Management/Acme Corp/2026 Assets/Events' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_reorganize_all_acme_branded_designs_into_a_comprehensive_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_execute_a_comprehensive_multi_client_design_audit_by_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive audit of three key designs with element analysis.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Acme Q1 Strategy Deck
        acme_deck = _find_design_by_title(backend, "Acme Q1 Strategy Deck")
        if acme_deck:
            checks_passed.append("[✓] 'Acme Q1 Strategy Deck' found")

            elements = _get_elements_for_design(backend, acme_deck.get("_id"))
            if elements:
                checks_passed.append(f"[✓] Acme deck analyzed ({len(elements)} elements)")

            if _check_design_dimensions(acme_deck, 1920, 1080):
                checks_passed.append("[✓] Acme deck dimensions verified (1920x1080)")
        else:
            errors.append("[X] 'Acme Q1 Strategy Deck' not found")

        # Check Welcome Instagram Post
        welcome_post = _find_design_by_title(backend, "Welcome Instagram Post")
        if welcome_post:
            checks_passed.append("[✓] 'Welcome Instagram Post' found")

            elements = _get_elements_for_design(backend, welcome_post.get("_id"))
            if elements:
                checks_passed.append(f"[✓] Welcome post analyzed ({len(elements)} elements)")

            if _check_design_dimensions(welcome_post, 1080, 1080):
                checks_passed.append("[✓] Welcome post dimensions verified (1080x1080)")
        else:
            errors.append("[X] 'Welcome Instagram Post' not found")

        # Check Business Card - Alice Chen
        business_card = _find_design_by_title(backend, "Business Card")
        if not business_card:
            business_card = _find_design_by_title(backend, "Alice Chen")

        if business_card:
            checks_passed.append("[✓] 'Business Card — Alice Chen' found")

            elements = _get_elements_for_design(backend, business_card.get("_id"))
            if elements:
                checks_passed.append(f"[✓] Business card analyzed ({len(elements)} elements)")
        else:
            errors.append("[X] 'Business Card — Alice Chen' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_execute_a_comprehensive_multi_client_design_audit_by_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_multi_format_announcement_campaign_by_generating_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Product Launch 2026 announcement campaign with YouTube, A4, and Poster.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check YouTube thumbnail
        youtube = _find_design_by_title(backend, "Product Launch Announcement")
        if youtube:
            checks_passed.append("[✓] 'Product Launch Announcement' YouTube thumbnail found")
            if _check_design_dimensions(youtube, 1280, 720):
                checks_passed.append("[✓] YouTube thumbnail has correct dimensions")
            else:
                errors.append("[X] YouTube thumbnail dimensions incorrect")
        else:
            errors.append("[X] 'Product Launch Announcement' not found")

        # Check A4 document
        a4 = _find_design_by_title(backend, "Product Launch Press Release")
        if a4:
            checks_passed.append("[✓] 'Product Launch Press Release' A4 document found")
            if _check_design_dimensions(a4, 2480, 3508):
                checks_passed.append("[✓] A4 document has correct dimensions")
            else:
                errors.append("[X] A4 document dimensions incorrect")
        else:
            errors.append("[X] 'Product Launch Press Release' not found")

        # Check Poster
        poster = _find_design_by_title(backend, "Product Launch Event")
        if poster:
            checks_passed.append("[✓] 'Product Launch Event' poster found")
            if _check_design_dimensions(poster, 1080, 1920):
                checks_passed.append("[✓] Poster has correct dimensions")
            else:
                errors.append("[X] Poster dimensions incorrect")
        else:
            errors.append("[X] 'Product Launch Event' not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Product Launch 2026")
        if folder:
            checks_passed.append("[✓] Folder 'Personal/Product Launch 2026' exists")
        else:
            errors.append("[X] Folder 'Personal/Product Launch 2026' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_multi_format_announcement_campaign_by_generating_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_perform_a_comprehensive_audit_of_the_flash_sale_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive audit of Flash Sale Story with complete element structure.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Flash Sale Story")
        if not design:
            errors.append("[X] Design 'Flash Sale Story' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Flash Sale Story' found")

        # Check dimensions
        if _check_design_dimensions(design, 1080, 1920):
            checks_passed.append("[✓] Design dimensions verified (1080x1920)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1080x1920")

        # Check format
        if _check_design_format(design, "instagram-story"):
            checks_passed.append("[✓] Design format verified (instagram-story)")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'instagram-story'")

        # Get all elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) > 0:
            checks_passed.append(f"[✓] Element structure extracted ({len(elements)} elements)")

            # Count by type
            element_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[✓] Element counts documented: {element_counts}")

            # Check for text elements with font properties
            text_elements = [e for e in elements if e.get("type") == "text"]
            if text_elements:
                checks_passed.append(f"[✓] Text elements documented ({len(text_elements)} found)")
        else:
            errors.append("[X] No elements found for audit")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_perform_a_comprehensive_audit_of_the_flash_sale_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_complete_social_media_campaign_for_quantum_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Quantum Product Launch 2026 campaign with Instagram, Twitter, and LinkedIn designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Instagram post
        instagram = _find_design_by_title(backend, "Quantum Launch - Instagram")
        if instagram:
            checks_passed.append("[✓] 'Quantum Launch - Instagram' found")
            if _check_design_dimensions(instagram, 1080, 1080):
                checks_passed.append("[✓] Instagram post has correct dimensions")
            else:
                errors.append("[X] Instagram post dimensions incorrect")
        else:
            errors.append("[X] 'Quantum Launch - Instagram' not found")

        # Check Twitter header
        twitter = _find_design_by_title(backend, "Quantum Launch - Twitter")
        if twitter:
            checks_passed.append("[✓] 'Quantum Launch - Twitter' found")
            if _check_design_dimensions(twitter, 1500, 500):
                checks_passed.append("[✓] Twitter header has correct dimensions")
            else:
                errors.append("[X] Twitter header dimensions incorrect")
        else:
            errors.append("[X] 'Quantum Launch - Twitter' not found")

        # Check LinkedIn banner
        linkedin = _find_design_by_title(backend, "Quantum Launch - LinkedIn")
        if linkedin:
            checks_passed.append("[✓] 'Quantum Launch - LinkedIn' found")
            if _check_design_dimensions(linkedin, 1584, 396):
                checks_passed.append("[✓] LinkedIn banner has correct dimensions")
            else:
                errors.append("[X] LinkedIn banner dimensions incorrect")
        else:
            errors.append("[X] 'Quantum Launch - LinkedIn' not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Campaigns/2026/Quantum Launch")
        if folder:
            checks_passed.append("[✓] Folder 'Campaigns/2026/Quantum Launch' exists")
        else:
            errors.append("[X] Folder 'Campaigns/2026/Quantum Launch' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_complete_social_media_campaign_for_quantum_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_set_up_a_comprehensive_project_organization_system_by_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Marketing Campaigns folder with Conference designs and new story.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Marketing Campaigns/2026/Q1/Digital Assets")
        if not folder:
            errors.append("[X] Folder 'Marketing Campaigns/2026/Q1/Digital Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Folder 'Marketing Campaigns/2026/Q1/Digital Assets' exists")

        # Get designs in folder
        designs = _get_designs_in_folder(backend, folder.get("_id"))

        # Count Conference designs
        conference_designs = [d for d in designs if "conference" in d.get("title", "").lower()]
        if len(conference_designs) >= 3:
            checks_passed.append(f"[✓] At least 3 Conference designs moved (found {len(conference_designs)})")
        else:
            errors.append(f"[X] Only {len(conference_designs)} Conference designs found, expected at least 3")

        # Check for new story
        story = _find_design_by_title(backend, "Conference Recap Story")
        if story:
            checks_passed.append("[✓] 'Conference Recap Story' found")

            if _check_design_dimensions(story, 1080, 1920):
                checks_passed.append("[✓] Story has correct dimensions")
            else:
                errors.append("[X] Story dimensions incorrect")

            if story.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Story is in Digital Assets folder")
            else:
                errors.append("[X] Story not in Digital Assets folder")
        else:
            errors.append("[X] 'Conference Recap Story' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_set_up_a_comprehensive_project_organization_system_by_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_execute_a_format_migration_by_taking_the_live_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resized to Facebook event cover (1200x630).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Live Music Night Poster' found")

        # Check dimensions
        if _check_design_dimensions(design, 1200, 630):
            checks_passed.append("[✓] Design resized to 1200x630 (Facebook event cover)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1200x630")

        # Check format
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check text content preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = [e for e in elements if e.get("type") == "text"]

        if text_elements:
            checks_passed.append(f"[✓] Text content preserved ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_execute_a_format_migration_by_taking_the_live_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_extract_detailed_typography_analysis_from_both_welcome_instagram_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate typography analysis from Welcome Instagram Post and Acme Q1 Strategy Deck.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Welcome Instagram Post
        welcome_post = _find_design_by_title(backend, "Welcome Instagram Post")
        if welcome_post:
            checks_passed.append("[✓] 'Welcome Instagram Post' found")

            if _check_design_dimensions(welcome_post, 1080, 1080):
                checks_passed.append("[✓] Welcome post dimensions maintained (1080x1080)")

            elements = _get_text_elements(backend, welcome_post.get("_id"))
            if elements:
                checks_passed.append(f"[✓] Welcome post text elements extracted ({len(elements)} found)")
        else:
            errors.append("[X] 'Welcome Instagram Post' not found")

        # Check Acme Q1 Strategy Deck
        acme_deck = _find_design_by_title(backend, "Acme Q1 Strategy Deck")
        if acme_deck:
            checks_passed.append("[✓] 'Acme Q1 Strategy Deck' found")

            if _check_design_dimensions(acme_deck, 1920, 1080):
                checks_passed.append("[✓] Acme deck dimensions maintained (1920x1080)")

            elements = _get_text_elements(backend, acme_deck.get("_id"))
            if elements:
                checks_passed.append(f"[✓] Acme deck text elements extracted ({len(elements)} found)")
        else:
            errors.append("[X] 'Acme Q1 Strategy Deck' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_extract_detailed_typography_analysis_from_both_welcome_instagram_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_complete_video_content_series_by_generating_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate three podcast episode YouTube thumbnails with correct format.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        episodes = [
            "Podcast Episode 13 Thumbnail",
            "Podcast Episode 14 Thumbnail",
            "Podcast Episode 15 Thumbnail"
        ]

        for episode_title in episodes:
            design = _find_design_by_title(backend, episode_title)
            if design:
                checks_passed.append(f"[✓] '{episode_title}' found")

                if _check_design_dimensions(design, 1280, 720):
                    checks_passed.append(f"[✓] '{episode_title}' has correct dimensions")
                else:
                    errors.append(f"[X] '{episode_title}' dimensions incorrect")

                if _check_design_format(design, "youtube-thumbnail"):
                    checks_passed.append(f"[✓] '{episode_title}' has correct format")
                else:
                    errors.append(f"[X] '{episode_title}' format incorrect")
            else:
                errors.append(f"[X] '{episode_title}' not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Video/YouTube Thumbnails")
        if folder:
            checks_passed.append("[✓] Folder 'Personal/Video/YouTube Thumbnails' exists")
        else:
            errors.append("[X] Folder 'Personal/Video/YouTube Thumbnails' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_complete_video_content_series_by_generating_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_create_a_coordinated_poster_campaign_generate_two_poster_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate two Music Festival 2026 poster designs with identical dimensions.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Main Event poster
        main_event = _find_design_by_title(backend, "Music Festival 2026 - Main Event")
        if main_event:
            checks_passed.append("[✓] 'Music Festival 2026 - Main Event' found")

            if _check_design_dimensions(main_event, 1080, 1920):
                checks_passed.append("[✓] Main Event poster has correct dimensions")
            else:
                errors.append("[X] Main Event poster dimensions incorrect")

            if _check_design_format(main_event, "poster"):
                checks_passed.append("[✓] Main Event has poster format")
            else:
                errors.append("[X] Main Event format incorrect")
        else:
            errors.append("[X] 'Music Festival 2026 - Main Event' not found")

        # Check VIP Experience poster
        vip_event = _find_design_by_title(backend, "Music Festival 2026 - VIP Experience")
        if vip_event:
            checks_passed.append("[✓] 'Music Festival 2026 - VIP Experience' found")

            if _check_design_dimensions(vip_event, 1080, 1920):
                checks_passed.append("[✓] VIP Experience poster has correct dimensions")
            else:
                errors.append("[X] VIP Experience poster dimensions incorrect")

            if _check_design_format(vip_event, "poster"):
                checks_passed.append("[✓] VIP Experience has poster format")
            else:
                errors.append("[X] VIP Experience format incorrect")
        else:
            errors.append("[X] 'Music Festival 2026 - VIP Experience' not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Print/Posters")
        if folder:
            checks_passed.append("[✓] Folder 'Personal/Print/Posters' exists")
        else:
            errors.append("[X] Folder 'Personal/Print/Posters' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_create_a_coordinated_poster_campaign_generate_two_poster_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_resize_the_business_card_alice_chen_design_to_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Business Card - Alice Chen resized to LinkedIn format (1200x630).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Business Card")
        if not design:
            design = _find_design_by_title(backend, "Alice Chen")

        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Design 'Business Card — Alice Chen' found")

        # Check dimensions
        if _check_design_dimensions(design, 1200, 630):
            checks_passed.append("[✓] Design resized to 1200x630 (LinkedIn format)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1200x630")

        # Check format
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check text content extracted
        elements = _get_text_elements(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[✓] Text content extracted ({len(elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_resize_the_business_card_alice_chen_design_to_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_find_all_designs_with_conference_in_their_title_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference designs inventory and organization into Events/Tech Conferences/2026.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Conference designs
        all_designs = backend.query({"collection": "designs", "filter": {}})
        if isinstance(all_designs, list):
            conference_designs = [d for d in all_designs if "conference" in d.get("title", "").lower()]

            if len(conference_designs) > 0:
                checks_passed.append(f"[✓] Found {len(conference_designs)} Conference designs")

                # Check content inventory for each
                for design in conference_designs:
                    elements = _get_elements_for_design(backend, design.get("_id"))
                    if elements:
                        element_counts = _count_elements_by_type(elements)
                        checks_passed.append(f"[✓] '{design.get('title')}' inventory complete")
            else:
                errors.append("[X] No Conference designs found")

        # Check folder
        folder = _find_folder_by_path(backend, "Events/Tech Conferences/2026")
        if folder:
            checks_passed.append("[✓] Folder 'Events/Tech Conferences/2026' exists")

            designs_in_folder = _get_designs_in_folder(backend, folder.get("_id"))
            conference_in_folder = [d for d in designs_in_folder if "conference" in d.get("title", "").lower()]

            if len(conference_in_folder) > 0:
                checks_passed.append(f"[✓] Conference designs moved to folder ({len(conference_in_folder)})")
            else:
                errors.append("[X] No Conference designs in target folder")
        else:
            errors.append("[X] Folder 'Events/Tech Conferences/2026' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_find_all_designs_with_conference_in_their_title_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)









# ============================================================================
# REWARD FUNCTIONS
# ============================================================================
def _validate_resize_tech_conference_header(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate resizing Tech Conference Header to 1920x1080 with format change to custom."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the Tech Conference Header design
        design = _find_design_by_title(final_state_backend, "Tech Conference Header")

        if not design:
            errors.append("[X] Tech Conference Header design not found")
        else:
            checks_passed.append("[C] Tech Conference Header design found")

            # Check dimensions are 1920x1080
            if design.get("width") != 1920:
                errors.append(f"[X] Design width is {design.get('width')}, expected 1920")
            else:
                checks_passed.append("[C] Design width is 1920")

            if design.get("height") != 1080:
                errors.append(f"[X] Design height is {design.get('height')}, expected 1080")
            else:
                checks_passed.append("[C] Design height is 1080")

            # Check format is 'custom' (changed from twitter-header)
            if design.get("format") != "custom":
                errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")
            else:
                checks_passed.append("[C] Design format changed to 'custom'")

            # Check that text elements exist (content preserved)
            text_elements = _get_text_elements(final_state_backend, design.get("_id"))
            if not text_elements:
                errors.append("[X] No text elements found - content may not be preserved")
            else:
                checks_passed.append(f"[C] Text elements preserved ({len(text_elements)} found)")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_create_ai_summit_youtube_thumbnails(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate creation of four AI Summit YouTube thumbnails in proper folder structure."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_thumbnails = [
            "AI Summit - Keynote Preview",
            "AI Summit - Panel Discussion",
            "AI Summit - Tech Demos",
            "AI Summit - Networking Highlights"
        ]

        # Check folder structure exists
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Personal/Video/YouTube Thumbnails/AI Summit Series"
        )

        if not target_folder:
            errors.append("[X] Folder 'Personal/Video/YouTube Thumbnails/AI Summit Series' not found")
        else:
            checks_passed.append("[C] Folder structure 'Personal/Video/YouTube Thumbnails/AI Summit Series' exists")
            target_folder_id = target_folder.get("_id")

            # Check each thumbnail
            for thumbnail_title in expected_thumbnails:
                design = _find_design_by_title(final_state_backend, thumbnail_title)

                if not design:
                    errors.append(f"[X] Thumbnail '{thumbnail_title}' not found")
                    continue

                checks_passed.append(f"[C] Thumbnail '{thumbnail_title}' created")

                # Check dimensions (1280x720)
                if not _check_design_dimensions(design, 1280, 720):
                    errors.append(f"[X] '{thumbnail_title}' has wrong dimensions: {design.get('width')}x{design.get('height')}, expected 1280x720")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' has correct dimensions 1280x720")

                # Check format is youtube-thumbnail
                if design.get("format") != "youtube-thumbnail":
                    errors.append(f"[X] '{thumbnail_title}' has format '{design.get('format')}', expected 'youtube-thumbnail'")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' has youtube-thumbnail format")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{thumbnail_title}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' is in correct folder")

                # Check for text elements
                text_elements = _get_text_elements(final_state_backend, design.get("_id"))
                if not text_elements:
                    errors.append(f"[X] '{thumbnail_title}' has no text elements")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' contains text elements")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_generate_starlight_studio_brand_package(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate creation of Starlight Studio brand package with logo, business card, and presentation."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Expected designs with their specifications
        expected_designs = [
            {"title": "Starlight Logo Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "Starlight Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Starlight Pitch Deck Template", "width": 1920, "height": 1080, "format": "presentation"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Brand Assets/Starlight Studio/2026 Rebrand"
        )

        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Starlight Studio/2026 Rebrand' not found")
        else:
            checks_passed.append("[C] Folder 'Brand Assets/Starlight Studio/2026 Rebrand' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions {spec['width']}x{spec['height']}")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format '{spec['format']}'")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_analyze_welcome_designs(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate comprehensive analysis of Welcome-themed designs.

    This is an analysis task - we validate that the agent found and analyzed Welcome designs.
    The success criteria focuses on the agent having accessed the relevant data.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Welcome designs
        welcome_designs = _find_designs_by_title(final_state_backend, "Welcome")

        if not welcome_designs:
            errors.append("[X] No designs containing 'Welcome' found in workspace")
        else:
            checks_passed.append(f"[C] Found {len(welcome_designs)} designs containing 'Welcome'")

            # Verify each design has analyzable properties
            for design in welcome_designs:
                title = design.get("title", "Unknown")

                # Check format exists
                if design.get("format"):
                    checks_passed.append(f"[C] '{title}' has format data: {design.get('format')}")

                # Check dimensions exist
                if design.get("width") and design.get("height"):
                    checks_passed.append(f"[C] '{title}' has dimensions: {design.get('width')}x{design.get('height')}")

                # Check folder location
                folder_id = design.get("folderId")
                if folder_id:
                    folder = _find_folder_by_id(final_state_backend, folder_id)
                    if folder:
                        checks_passed.append(f"[C] '{title}' folder location documented")

                # Check for elements
                elements = _get_elements_for_design(final_state_backend, design.get("_id"))
                if elements:
                    checks_passed.append(f"[C] '{title}' has {len(elements)} elements for composition analysis")

            # Require at least some designs analyzed
            if len(welcome_designs) >= 1:
                checks_passed.append("[C] Comparative analysis data available for Welcome designs")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_audit_acme_designs(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate comprehensive audit of Acme designs - at least 5 designs analyzed."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Acme designs
        acme_designs = _find_designs_by_title(final_state_backend, "Acme")

        if len(acme_designs) < 5:
            errors.append(f"[X] Found only {len(acme_designs)} Acme designs, expected at least 5")
        else:
            checks_passed.append(f"[C] Found {len(acme_designs)} Acme designs (minimum 5 required)")

            # Analyze each design
            designs_with_full_data = 0
            for design in acme_designs[:10]:  # Analyze up to 10
                title = design.get("title", "Unknown")
                has_metadata = True

                # Check format and dimensions
                if design.get("format") and design.get("width") and design.get("height"):
                    checks_passed.append(f"[C] '{title}' metadata: {design.get('format')} {design.get('width')}x{design.get('height')}")
                else:
                    has_metadata = False

                # Check folder location
                folder_id = design.get("folderId")
                if folder_id:
                    folder_path = _get_folder_path(final_state_backend, folder_id)
                    checks_passed.append(f"[C] '{title}' location: {folder_path}")

                # Check elements for content structure
                elements = _get_elements_for_design(final_state_backend, design.get("_id"))
                if elements:
                    element_types = {}
                    for elem in elements:
                        elem_type = elem.get("type", "unknown")
                        element_types[elem_type] = element_types.get(elem_type, 0) + 1
                    checks_passed.append(f"[C] '{title}' elements: {element_types}")

                # Check text content
                text_elements = _get_text_elements(final_state_backend, design.get("_id"))
                if text_elements:
                    checks_passed.append(f"[C] '{title}' has {len(text_elements)} text elements")

                if has_metadata:
                    designs_with_full_data += 1

            if designs_with_full_data >= 5:
                checks_passed.append(f"[C] Complete audit data available for {designs_with_full_data} Acme designs")
            else:
                errors.append(f"[X] Only {designs_with_full_data} designs have complete metadata")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_create_acme_social_media_campaign(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate creation of Acme social media campaign with three designs in proper folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Expected designs with specifications
        expected_designs = [
            {"title": "Acme Product Launch - Instagram", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Acme Product Launch - LinkedIn", "width": 1584, "height": 396, "format": "linkedin-banner"},
            {"title": "Acme Product Launch - Twitter", "width": 1500, "height": 500, "format": "twitter-header"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(final_state_backend, "Client Work/Acme Corp/Q1 2026")

        if not target_folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q1 2026' not found")
        else:
            checks_passed.append("[C] Folder 'Client Work/Acme Corp/Q1 2026' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format '{spec['format']}'")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_organize_podcast_thumbnails(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate podcast thumbnail organization with folder creation and design generation."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Personal/Video/Podcast Content/Thumbnails"
        )

        if not target_folder:
            errors.append("[X] Folder 'Personal/Video/Podcast Content/Thumbnails' not found")
        else:
            checks_passed.append("[C] Folder hierarchy 'Personal/Video/Podcast Content/Thumbnails' created")
            target_folder_id = target_folder.get("_id")

            # Check for all three podcast thumbnails
            expected_thumbnails = [
                "Podcast Episode 12 Thumbnail",
                "Podcast Episode 13 Thumbnail",
                "Podcast Episode 14 Thumbnail"
            ]

            thumbnails_in_folder = 0
            for thumbnail_title in expected_thumbnails:
                design = _find_design_by_title(final_state_backend, thumbnail_title)

                if not design:
                    errors.append(f"[X] '{thumbnail_title}' not found")
                    continue

                checks_passed.append(f"[C] '{thumbnail_title}' exists")

                # Check dimensions (1280x720)
                if not _check_design_dimensions(design, 1280, 720):
                    errors.append(f"[X] '{thumbnail_title}' has wrong dimensions: {design.get('width')}x{design.get('height')}")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' has correct dimensions 1280x720")

                # Check format
                if design.get("format") != "youtube-thumbnail":
                    errors.append(f"[X] '{thumbnail_title}' has format '{design.get('format')}', expected 'youtube-thumbnail'")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' has youtube-thumbnail format")

                # Check folder location
                if design.get("folderId") == target_folder_id:
                    thumbnails_in_folder += 1
                    checks_passed.append(f"[C] '{thumbnail_title}' is in target folder")
                else:
                    errors.append(f"[X] '{thumbnail_title}' not in target folder")

            if thumbnails_in_folder == 3:
                checks_passed.append("[C] All three thumbnails organized in target folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_reorganize_conference_event_designs(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate reorganization of Conference/Event designs to new folder structure."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        target_folder = _find_folder_by_path(final_state_backend, "Events/2026/Digital Assets")

        if not target_folder:
            errors.append("[X] Folder 'Events/2026/Digital Assets' not found")
        else:
            checks_passed.append("[C] Folder hierarchy 'Events/2026/Digital Assets' created")
            target_folder_id = target_folder.get("_id")

            # Find all Conference/Event designs
            conference_designs = _find_designs_by_title(final_state_backend, "Conference")
            event_designs = _find_designs_by_title(final_state_backend, "Event")

            # Combine and deduplicate
            all_matching_designs = {d.get("_id"): d for d in conference_designs + event_designs}
            matching_designs = list(all_matching_designs.values())

            if len(matching_designs) < 2:
                errors.append(f"[X] Found only {len(matching_designs)} Conference/Event designs, expected at least 2")
            else:
                checks_passed.append(f"[C] Found {len(matching_designs)} Conference/Event designs")

            # Check how many are in target folder
            designs_in_target = 0
            for design in matching_designs:
                if design.get("folderId") == target_folder_id:
                    designs_in_target += 1
                    checks_passed.append(f"[C] '{design.get('title')}' moved to target folder")

            if designs_in_target < 2:
                errors.append(f"[X] Only {designs_in_target} designs relocated, minimum 2 required")
            else:
                checks_passed.append(f"[C] {designs_in_target} designs relocated to target folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_reorganize_acme_designs_by_format(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate reorganization of Acme designs into format-based folder structure."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder structure
        base_folder = _find_folder_by_path(final_state_backend, "Client Work/Acme Corp/2026/Assets")

        if not base_folder:
            errors.append("[X] Base folder 'Client Work/Acme Corp/2026/Assets' not found")
        else:
            checks_passed.append("[C] Base folder 'Client Work/Acme Corp/2026/Assets' created")
            base_folder_id = base_folder.get("_id")

            # Check subfolders
            subfolders = {"Social Media": None, "Presentations": None, "Brand Assets": None}
            child_folders = _get_child_folders(final_state_backend, base_folder_id)

            for folder in child_folders:
                folder_name = folder.get("name", "")
                if folder_name in subfolders:
                    subfolders[folder_name] = folder.get("_id")
                    checks_passed.append(f"[C] Subfolder '{folder_name}' created")

            for name, folder_id in subfolders.items():
                if not folder_id:
                    errors.append(f"[X] Subfolder '{name}' not found")

            # Find all Acme designs
            acme_designs = _find_designs_by_title(final_state_backend, "Acme")

            if len(acme_designs) < 8:
                errors.append(f"[X] Found only {len(acme_designs)} Acme designs, expected at least 8")
            else:
                checks_passed.append(f"[C] Found {len(acme_designs)} Acme designs")

            # Check designs are in correct subfolders based on format
            designs_moved = 0
            social_media_formats = ["instagram-post", "facebook-post", "instagram-story"]
            presentation_formats = ["presentation"]
            logo_formats = ["logo"]

            for design in acme_designs:
                design_format = design.get("format", "")
                folder_id = design.get("folderId")
                title = design.get("title", "Unknown")

                # Determine expected folder
                expected_folder_id = None
                expected_folder_name = None

                if design_format in social_media_formats:
                    expected_folder_id = subfolders.get("Social Media")
                    expected_folder_name = "Social Media"
                elif design_format in presentation_formats:
                    expected_folder_id = subfolders.get("Presentations")
                    expected_folder_name = "Presentations"
                elif design_format in logo_formats:
                    expected_folder_id = subfolders.get("Brand Assets")
                    expected_folder_name = "Brand Assets"

                if expected_folder_id and folder_id == expected_folder_id:
                    designs_moved += 1
                    checks_passed.append(f"[C] '{title}' ({design_format}) in {expected_folder_name}")
                elif expected_folder_id:
                    # Design should be in a specific folder but isn't
                    pass  # Don't error for each, check total count

            if designs_moved < 8:
                errors.append(f"[X] Only {designs_moved} designs properly organized, expected at least 8")
            else:
                checks_passed.append(f"[C] {designs_moved} designs properly organized by format")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_create_nova_designs_brand_identity(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate creation of Nova Designs brand identity package with 4 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Expected designs with specifications
        expected_designs = [
            {"title": "Nova Designs - Primary Logo", "width": 500, "height": 500, "format": "logo"},
            {"title": "Nova Designs - Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Nova Designs - Letterhead", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Nova Designs - Email Signature", "width": 600, "height": 200, "format": "custom"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Brand Assets/Nova Designs/Identity Package"
        )

        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Nova Designs/Identity Package' not found")
        else:
            checks_passed.append("[C] Folder 'Brand Assets/Nova Designs/Identity Package' created")
            target_folder_id = target_folder.get("_id")

            designs_in_folder = 0
            logo_has_text = False

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format '{spec['format']}'")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") == target_folder_id:
                    designs_in_folder += 1
                    checks_passed.append(f"[C] '{spec['title']}' is in target folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

                # Special check for logo - must have text with company name
                if "Logo" in spec["title"]:
                    text_elements = _get_text_elements(final_state_backend, design.get("_id"))
                    for text_elem in text_elements:
                        props = text_elem.get("properties", {})
                        segments = props.get("segments", [])
                        for segment in segments:
                            if "nova" in segment.get("text", "").lower():
                                logo_has_text = True
                                break

                    if logo_has_text:
                        checks_passed.append("[C] Logo design contains text with company name")
                    else:
                        errors.append("[X] Logo design does not contain text with company name 'Nova'")

            if designs_in_folder == 4:
                checks_passed.append("[C] All 4 brand identity designs in target folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )









# ============================================================================
# NEW REWARD FUNCTIONS (V2 Tasks)
# ============================================================================
def _validate_phoenix_q2_document_suite(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate creation of Phoenix Q2 document suite with three designs in folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Expected designs with specifications
        expected_designs = [
            {"title": "Phoenix Q2 Report", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Phoenix Q2 Presentation", "width": 1920, "height": 1080, "format": "presentation"},
            {"title": "Phoenix Q2 Web Header", "width": 1600, "height": 900, "format": "custom"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(final_state_backend, "Projects/Phoenix/Q2 Documents")

        if not target_folder:
            errors.append("[X] Folder 'Projects/Phoenix/Q2 Documents' not found")
        else:
            checks_passed.append("[C] Folder 'Projects/Phoenix/Q2 Documents' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions {spec['width']}x{spec['height']}")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_instagram_inventory_audit(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Instagram designs inventory and organization to target folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Instagram designs
        instagram_designs = _find_designs_by_title(final_state_backend, "Instagram")

        if not instagram_designs:
            errors.append("[X] No designs containing 'Instagram' found")
        else:
            checks_passed.append(f"[C] Found {len(instagram_designs)} designs with 'Instagram' in title")

            # Check target folder exists
            target_folder = _find_folder_by_path(
                final_state_backend,
                "Personal/Social Media/Instagram Posts"
            )

            if not target_folder:
                errors.append("[X] Target folder 'Personal/Social Media/Instagram Posts' not found")
            else:
                checks_passed.append("[C] Target folder 'Personal/Social Media/Instagram Posts' exists")
                target_folder_id = target_folder.get("_id")

                designs_moved = 0
                for design in instagram_designs:
                    title = design.get("title", "Unknown")

                    # Verify dimensions (should be 1080x1080 for instagram-post)
                    if _check_design_dimensions(design, 1080, 1080):
                        checks_passed.append(f"[C] '{title}' has correct dimensions 1080x1080")

                    # Check format
                    if design.get("format") == "instagram-post":
                        checks_passed.append(f"[C] '{title}' has instagram-post format")

                    # Check if moved to target folder
                    if design.get("folderId") == target_folder_id:
                        designs_moved += 1
                        checks_passed.append(f"[C] '{title}' moved to target folder")

                if designs_moved == 0:
                    errors.append("[X] No Instagram designs moved to target folder")
                else:
                    checks_passed.append(f"[C] {designs_moved} Instagram designs organized in target folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_twitter_to_website_banner_resize(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate resizing Tech Conference Header to website banner 1920x600."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(final_state_backend, "Tech Conference Header")

        if not design:
            errors.append("[X] Tech Conference Header design not found")
        else:
            checks_passed.append("[C] Tech Conference Header design found")

            # Check dimensions are 1920x600
            if design.get("width") != 1920:
                errors.append(f"[X] Design width is {design.get('width')}, expected 1920")
            else:
                checks_passed.append("[C] Design width is 1920")

            if design.get("height") != 600:
                errors.append(f"[X] Design height is {design.get('height')}, expected 600")
            else:
                checks_passed.append("[C] Design height is 600")

            # Check format is 'custom' (changed after resize)
            if design.get("format") != "custom":
                errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")
            else:
                checks_passed.append("[C] Design format changed to 'custom'")

            # Check text elements preserved
            text_elements = _get_text_elements(final_state_backend, design.get("_id"))
            if text_elements:
                checks_passed.append(f"[C] Text elements preserved ({len(text_elements)} found)")
            else:
                errors.append("[X] No text elements found - content may be lost")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_flash_sale_workspace_audit(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Flash Sale workspace audit with archive and report creation."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check archive folder structure
        archive_folder = _find_folder_by_path(
            final_state_backend,
            "Marketing/Promotions/Flash Sales/Archive"
        )

        if not archive_folder:
            errors.append("[X] Folder 'Marketing/Promotions/Flash Sales/Archive' not found")
        else:
            checks_passed.append("[C] Folder 'Marketing/Promotions/Flash Sales/Archive' created")
            archive_folder_id = archive_folder.get("_id")

            # Find Flash Sale designs
            flash_sale_designs = _find_designs_by_title(final_state_backend, "Flash Sale")

            if len(flash_sale_designs) < 2:
                errors.append(f"[X] Found only {len(flash_sale_designs)} Flash Sale designs, expected at least 2")
            else:
                checks_passed.append(f"[C] Found {len(flash_sale_designs)} Flash Sale designs")

                # Check how many are in archive folder
                designs_archived = 0
                for design in flash_sale_designs:
                    if design.get("folderId") == archive_folder_id:
                        designs_archived += 1
                        checks_passed.append(f"[C] '{design.get('title')}' archived")

                if designs_archived < 2:
                    errors.append(f"[X] Only {designs_archived} designs archived, expected at least 2")
                else:
                    checks_passed.append(f"[C] {designs_archived} designs moved to archive")

        # Check report folder and design
        report_folder = _find_folder_by_path(final_state_backend, "Reports/Marketing/2026")

        if not report_folder:
            errors.append("[X] Folder 'Reports/Marketing/2026' not found")
        else:
            checks_passed.append("[C] Folder 'Reports/Marketing/2026' created")
            report_folder_id = report_folder.get("_id")

            # Check for audit report design
            report_design = _find_design_by_title(final_state_backend, "Flash Sale Audit Report 2026")

            if not report_design:
                errors.append("[X] 'Flash Sale Audit Report 2026' design not found")
            else:
                checks_passed.append("[C] 'Flash Sale Audit Report 2026' design created")

                # Check dimensions (A4: 2480x3508)
                if not _check_design_dimensions(report_design, 2480, 3508):
                    errors.append(f"[X] Report has dimensions {report_design.get('width')}x{report_design.get('height')}, expected 2480x3508")
                else:
                    checks_passed.append("[C] Report has correct A4 dimensions 2480x3508")

                # Check folder location
                if report_design.get("folderId") != report_folder_id:
                    errors.append("[X] Report not in 'Reports/Marketing/2026' folder")
                else:
                    checks_passed.append("[C] Report is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_flash_live_brand_audit(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Flash and Live designs brand audit with folder organization."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check target folder
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Brand Assets/Content Audit/Event Designs"
        )

        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Content Audit/Event Designs' not found")
        else:
            checks_passed.append("[C] Folder 'Brand Assets/Content Audit/Event Designs' created")
            target_folder_id = target_folder.get("_id")

            # Find Flash and Live designs
            flash_designs = _find_designs_by_title(final_state_backend, "Flash")
            live_designs = _find_designs_by_title(final_state_backend, "Live")

            # Combine and deduplicate
            all_designs = {d.get("_id"): d for d in flash_designs + live_designs}
            matching_designs = list(all_designs.values())

            if len(matching_designs) < 2:
                errors.append(f"[X] Found only {len(matching_designs)} Flash/Live designs, expected at least 2")
            else:
                checks_passed.append(f"[C] Found {len(matching_designs)} Flash/Live designs")

            # Check designs moved and have different formats
            designs_moved = 0
            formats_found = set()

            for design in matching_designs:
                title = design.get("title", "Unknown")
                design_format = design.get("format", "unknown")

                if design.get("folderId") == target_folder_id:
                    designs_moved += 1
                    formats_found.add(design_format)
                    checks_passed.append(f"[C] '{title}' ({design_format}) moved to target folder")

            if designs_moved < 2:
                errors.append(f"[X] Only {designs_moved} designs moved, expected at least 2")
            else:
                checks_passed.append(f"[C] {designs_moved} designs moved to target folder")

            if len(formats_found) < 2:
                errors.append(f"[X] Only {len(formats_found)} format type(s) found, expected different formats")
            else:
                checks_passed.append(f"[C] Multiple format types found: {', '.join(formats_found)}")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_innovation_summit_event_suite(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Innovation Summit 2026 event suite with four designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Innovation Summit Poster", "width": 1080, "height": 1920, "format": "poster"},
            {"title": "Innovation Summit LinkedIn", "width": 1584, "height": 396, "format": "linkedin-banner"},
            {"title": "Innovation Summit Story", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "Innovation Summit Program", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Events/Innovation Summit 2026/Marketing Materials"
        )

        if not target_folder:
            errors.append("[X] Folder 'Events/Innovation Summit 2026/Marketing Materials' not found")
        else:
            checks_passed.append("[C] Folder 'Events/Innovation Summit 2026/Marketing Materials' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format '{spec['format']}'")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_live_music_poster_analysis(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate analysis of Live Music Night Poster design."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(final_state_backend, "Live Music Night Poster")

        if not design:
            errors.append("[X] 'Live Music Night Poster' design not found")
        else:
            checks_passed.append("[C] 'Live Music Night Poster' design found")

            # Check format is poster
            if design.get("format") != "poster":
                errors.append(f"[X] Design format is '{design.get('format')}', expected 'poster'")
            else:
                checks_passed.append("[C] Design has poster format")

            # Check dimensions (1080x1920)
            if not _check_design_dimensions(design, 1080, 1920):
                errors.append(f"[X] Design has dimensions {design.get('width')}x{design.get('height')}, expected 1080x1920")
            else:
                checks_passed.append("[C] Design has correct dimensions 1080x1920")

            # Get all elements for analysis
            elements = _get_elements_for_design(final_state_backend, design.get("_id"))

            if elements:
                checks_passed.append(f"[C] Design has {len(elements)} elements for analysis")

                # Count elements by type
                element_types = {}
                shape_colors = set()

                for elem in elements:
                    elem_type = elem.get("type", "unknown")
                    element_types[elem_type] = element_types.get(elem_type, 0) + 1

                    # Collect shape fill colors
                    if elem_type == "shape":
                        props = elem.get("properties", {})
                        fill = props.get("fill")
                        if fill:
                            shape_colors.add(fill)

                checks_passed.append(f"[C] Element counts by type: {element_types}")

                if shape_colors:
                    checks_passed.append(f"[C] Unique shape fill colors: {len(shape_colors)} colors found")

                # Check for text elements
                text_count = element_types.get("text", 0)
                if text_count > 0:
                    checks_passed.append(f"[C] Design has {text_count} text elements")
                else:
                    errors.append("[X] No text elements found in design")
            else:
                errors.append("[X] No elements found for analysis")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_techcorp_presentation_package(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate TechCorp presentation package with two presentations in folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "TechCorp Strategy Overview", "width": 1920, "height": 1080, "format": "presentation"},
            {"title": "TechCorp Q1 Results", "width": 1920, "height": 1080, "format": "presentation"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Client Work/TechCorp/Q1 2026/Presentations"
        )

        if not target_folder:
            errors.append("[X] Folder 'Client Work/TechCorp/Q1 2026/Presentations' not found")
        else:
            checks_passed.append("[C] Folder 'Client Work/TechCorp/Q1 2026/Presentations' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions 1920x1080")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has presentation format")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected 'presentation' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_tech_series_youtube_thumbnails(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Tech Series YouTube thumbnails with four sequential designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_thumbnails = [
            "Tech Series Episode 1 - AI Revolution",
            "Tech Series Episode 2 - Quantum Computing",
            "Tech Series Episode 3 - Blockchain Future",
            "Tech Series Episode 4 - Metaverse Reality",
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Video Content/2026/Tech Series"
        )

        if not target_folder:
            errors.append("[X] Folder 'Video Content/2026/Tech Series' not found")
        else:
            checks_passed.append("[C] Folder 'Video Content/2026/Tech Series' exists")
            target_folder_id = target_folder.get("_id")

            for thumbnail_title in expected_thumbnails:
                design = _find_design_by_title(final_state_backend, thumbnail_title)

                if not design:
                    errors.append(f"[X] Thumbnail '{thumbnail_title}' not found")
                    continue

                checks_passed.append(f"[C] Thumbnail '{thumbnail_title}' created")

                # Check dimensions (1280x720)
                if not _check_design_dimensions(design, 1280, 720):
                    errors.append(f"[X] '{thumbnail_title}' has dimensions {design.get('width')}x{design.get('height')}, expected 1280x720")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' has correct dimensions 1280x720")

                # Check format
                if design.get("format") != "youtube-thumbnail":
                    errors.append(f"[X] '{thumbnail_title}' has format '{design.get('format')}', expected 'youtube-thumbnail'")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' has youtube-thumbnail format")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{thumbnail_title}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{thumbnail_title}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_q2_social_media_campaign(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Q2 2026 social media campaign with four designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Q2 Launch - Instagram", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Q2 Launch - Facebook", "width": 1200, "height": 630, "format": "facebook-post"},
            {"title": "Q2 Launch - Twitter", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "Q2 Launch - LinkedIn", "width": 1584, "height": 396, "format": "linkedin-banner"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Client Work/Q2 2026/Social Media Campaign"
        )

        if not target_folder:
            errors.append("[X] Folder 'Client Work/Q2 2026/Social Media Campaign' not found")
        else:
            checks_passed.append("[C] Folder 'Client Work/Q2 2026/Social Media Campaign' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_podcast_content_analysis(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Podcast content analysis with folder structure and report creation."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find Podcast designs
        podcast_designs = _find_designs_by_title(final_state_backend, "Podcast")

        if not podcast_designs:
            errors.append("[X] No designs with 'Podcast' in title found")
        else:
            checks_passed.append(f"[C] Found {len(podcast_designs)} Podcast designs")

            # Verify each has analyzable content
            for design in podcast_designs:
                title = design.get("title", "Unknown")
                if design.get("format") and design.get("width") and design.get("height"):
                    checks_passed.append(f"[C] '{title}': {design.get('format')} {design.get('width')}x{design.get('height')}")

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Content Analysis/Podcast Designs/Reports"
        )

        if not target_folder:
            errors.append("[X] Folder 'Content Analysis/Podcast Designs/Reports' not found")
        else:
            checks_passed.append("[C] Folder 'Content Analysis/Podcast Designs/Reports' created")

        # Check for report design
        report_design = _find_design_by_title(final_state_backend, "Podcast Content Analysis Report")

        if not report_design:
            errors.append("[X] 'Podcast Content Analysis Report' design not found")
        else:
            checks_passed.append("[C] 'Podcast Content Analysis Report' design created")

            # Check dimensions (800x600 custom)
            if not _check_design_dimensions(report_design, 800, 600):
                errors.append(f"[X] Report has dimensions {report_design.get('width')}x{report_design.get('height')}, expected 800x600")
            else:
                checks_passed.append("[C] Report has correct dimensions 800x600")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_conference_podcast_organization(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate organization of Conference and Podcast designs to separate folders."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Conference folder
        conference_folder = _find_folder_by_path(
            final_state_backend,
            "Events/2026/Tech Conference/Marketing Materials"
        )

        if not conference_folder:
            errors.append("[X] Folder 'Events/2026/Tech Conference/Marketing Materials' not found")
        else:
            checks_passed.append("[C] Folder 'Events/2026/Tech Conference/Marketing Materials' created")
            conference_folder_id = conference_folder.get("_id")

            # Find Conference designs
            conference_designs = _find_designs_by_title(final_state_backend, "Conference")
            conference_moved = 0

            for design in conference_designs:
                if design.get("folderId") == conference_folder_id:
                    conference_moved += 1
                    checks_passed.append(f"[C] '{design.get('title')}' moved to Conference folder")

            if conference_moved == 0:
                errors.append("[X] No Conference designs moved to target folder")
            else:
                checks_passed.append(f"[C] {conference_moved} Conference designs organized")

        # Check Podcast folder
        podcast_folder = _find_folder_by_path(
            final_state_backend,
            "Content/Audio/Podcast Assets"
        )

        if not podcast_folder:
            errors.append("[X] Folder 'Content/Audio/Podcast Assets' not found")
        else:
            checks_passed.append("[C] Folder 'Content/Audio/Podcast Assets' created")
            podcast_folder_id = podcast_folder.get("_id")

            # Find Podcast designs
            podcast_designs = _find_designs_by_title(final_state_backend, "Podcast")
            podcast_moved = 0

            for design in podcast_designs:
                if design.get("folderId") == podcast_folder_id:
                    podcast_moved += 1
                    checks_passed.append(f"[C] '{design.get('title')}' moved to Podcast folder")

            if podcast_moved == 0:
                errors.append("[X] No Podcast designs moved to target folder")
            else:
                checks_passed.append(f"[C] {podcast_moved} Podcast designs organized")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_techflow_brand_assets(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate TechFlow Studios brand asset collection."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "TechFlow Studios Logo", "width": 500, "height": 500, "format": "logo"},
            {"title": "TechFlow Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "TechFlow Presentation Template", "width": 1920, "height": 1080, "format": "presentation"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Brand Assets/TechFlow Studios/Core Assets"
        )

        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/TechFlow Studios/Core Assets' not found")
        else:
            checks_passed.append("[C] Folder 'Brand Assets/TechFlow Studios/Core Assets' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_instagram_to_twitter_resize(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate resizing Welcome Instagram Post to Twitter header dimensions."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(final_state_backend, "Welcome Instagram Post")

        if not design:
            errors.append("[X] 'Welcome Instagram Post' design not found")
        else:
            checks_passed.append("[C] 'Welcome Instagram Post' design found")

            # Check dimensions are 1500x500
            if design.get("width") != 1500:
                errors.append(f"[X] Design width is {design.get('width')}, expected 1500")
            else:
                checks_passed.append("[C] Design width is 1500")

            if design.get("height") != 500:
                errors.append(f"[X] Design height is {design.get('height')}, expected 500")
            else:
                checks_passed.append("[C] Design height is 500")

            # Check format is 'custom' (changed after resize)
            if design.get("format") != "custom":
                errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")
            else:
                checks_passed.append("[C] Design format changed to 'custom'")

            # Check text content preserved
            text_elements = _get_text_elements(final_state_backend, design.get("_id"))
            if text_elements:
                # Check if any text contains "Welcome Instagram Post"
                text_preserved = False
                for text_elem in text_elements:
                    props = text_elem.get("properties", {})
                    segments = props.get("segments", [])
                    for segment in segments:
                        if "welcome" in segment.get("text", "").lower():
                            text_preserved = True
                            break

                if text_preserved:
                    checks_passed.append("[C] Text content with 'Welcome' preserved")
                else:
                    checks_passed.append(f"[C] Text elements preserved ({len(text_elements)} found)")
            else:
                errors.append("[X] No text elements found - content may be lost")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_devcon_2026_marketing_suite(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate DevCon 2026 marketing suite with five coordinated designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "DevCon 2026 Announcement", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "DevCon 2026 Countdown", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "DevCon 2026 Professional", "width": 1584, "height": 396, "format": "linkedin-banner"},
            {"title": "DevCon 2026 Twitter Cover", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "DevCon 2026 Program Guide", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Events/DevCon 2026/Marketing Materials"
        )

        if not target_folder:
            errors.append("[X] Folder 'Events/DevCon 2026/Marketing Materials' not found")
        else:
            checks_passed.append("[C] Folder 'Events/DevCon 2026/Marketing Materials' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

                # Check text content contains DevCon 2026
                text_elements = _get_text_elements(final_state_backend, design.get("_id"))
                devcon_text_found = False
                for text_elem in text_elements:
                    props = text_elem.get("properties", {})
                    segments = props.get("segments", [])
                    for segment in segments:
                        if "devcon" in segment.get("text", "").lower():
                            devcon_text_found = True
                            break

                if devcon_text_found:
                    checks_passed.append(f"[C] '{spec['title']}' contains 'DevCon' text")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_starlight_studios_brand_package(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Starlight Studios brand package with logo, card, and letterhead."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Starlight Studios Logo", "width": 500, "height": 500, "format": "logo"},
            {"title": "Starlight Studios Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Starlight Studios Letterhead", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Brand Packages/Starlight Studios/Core Identity"
        )

        if not target_folder:
            errors.append("[X] Folder 'Brand Packages/Starlight Studios/Core Identity' not found")
        else:
            checks_passed.append("[C] Folder 'Brand Packages/Starlight Studios/Core Identity' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_wellness_retreat_print_suite(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Wellness Retreat 2026 print marketing suite."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Wellness Retreat Poster", "width": 1080, "height": 1920, "format": "poster"},
            {"title": "Wellness Retreat Flyer", "width": 2480, "height": 3508, "format": "flyer"},
            {"title": "Wellness Retreat Brochure", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Personal/Print/Wellness Campaign"
        )

        if not target_folder:
            errors.append("[X] Folder 'Personal/Print/Wellness Campaign' not found")
        else:
            checks_passed.append("[C] Folder 'Personal/Print/Wellness Campaign' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

            # Special check for poster text content
            poster_design = _find_design_by_title(final_state_backend, "Wellness Retreat Poster")
            if poster_design:
                text_elements = _get_text_elements(final_state_backend, poster_design.get("_id"))
                if text_elements:
                    checks_passed.append(f"[C] Poster contains {len(text_elements)} text elements")
                else:
                    errors.append("[X] Poster has no text elements")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_twitter_to_facebook_resize(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate resizing Tech Conference Header to Facebook post dimensions."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(final_state_backend, "Tech Conference Header")

        if not design:
            errors.append("[X] 'Tech Conference Header' design not found")
        else:
            checks_passed.append("[C] 'Tech Conference Header' design found")

            # Check dimensions are 1200x630
            if design.get("width") != 1200:
                errors.append(f"[X] Design width is {design.get('width')}, expected 1200")
            else:
                checks_passed.append("[C] Design width is 1200")

            if design.get("height") != 630:
                errors.append(f"[X] Design height is {design.get('height')}, expected 630")
            else:
                checks_passed.append("[C] Design height is 630")

            # Check format is 'custom' (changed after resize)
            if design.get("format") != "custom":
                errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")
            else:
                checks_passed.append("[C] Design format changed to 'custom'")

            # Check all elements preserved
            elements = _get_elements_for_design(final_state_backend, design.get("_id"))
            if elements:
                element_types = {}
                for elem in elements:
                    elem_type = elem.get("type", "unknown")
                    element_types[elem_type] = element_types.get(elem_type, 0) + 1

                checks_passed.append(f"[C] Elements preserved: {element_types}")

                # Check for different element types
                if "text" in element_types:
                    checks_passed.append("[C] Text elements preserved")
                if "shape" in element_types:
                    checks_passed.append("[C] Shape elements preserved")
            else:
                errors.append("[X] No elements found - content may be lost")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_product_launch_social_library(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate Product Launch social media asset library with six designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Product Launch - Instagram Post", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Product Launch - Instagram Story", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "Product Launch - Facebook Post", "width": 1200, "height": 630, "format": "facebook-post"},
            {"title": "Product Launch - Twitter Header", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "Product Launch - LinkedIn Banner", "width": 1584, "height": 396, "format": "linkedin-banner"},
            {"title": "Product Launch - YouTube Thumbnail", "width": 1280, "height": 720, "format": "youtube-thumbnail"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Campaigns/Product Launch 2026/Social Assets"
        )

        if not target_folder:
            errors.append("[X] Folder 'Campaigns/Product Launch 2026/Social Assets' not found")
        else:
            checks_passed.append("[C] Folder 'Campaigns/Product Launch 2026/Social Assets' exists")
            target_folder_id = target_folder.get("_id")

            for spec in expected_designs:
                design = _find_design_by_title(final_state_backend, spec["title"])

                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[C] Design '{spec['title']}' created")

                # Check dimensions
                if not _check_design_dimensions(design, spec["width"], spec["height"]):
                    errors.append(f"[X] '{spec['title']}' has dimensions {design.get('width')}x{design.get('height')}, expected {spec['width']}x{spec['height']}")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' has correct dimensions")

                # Check format (accept expected format OR 'custom' since resize changes format)
                actual_format = design.get("format")
                if actual_format == spec["format"]:
                    checks_passed.append(f"[C] '{spec['title']}' has correct format")
                elif actual_format == "custom":
                    checks_passed.append(f"[C] '{spec['title']}' has custom format (dimensions verified)")
                else:
                    errors.append(f"[X] '{spec['title']}' has format '{actual_format}', expected '{spec['format']}' or 'custom'")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{spec['title']}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{spec['title']}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )

def _validate_weekly_content_calendar_series(
    final_state_backend: Backend, final_state_frontend: Dict[str, Any]
) -> TaskScore:
    """Validate weekly content calendar series with six Instagram posts."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_posts = [
            "Week 1 Content Calendar",
            "Week 2 Content Calendar",
            "Week 3 Content Calendar",
            "Week 4 Content Calendar",
            "Week 5 Content Calendar",
            "Week 6 Content Calendar",
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(
            final_state_backend,
            "Content Calendar/Instagram/February 2026"
        )

        if not target_folder:
            errors.append("[X] Folder 'Content Calendar/Instagram/February 2026' not found")
        else:
            checks_passed.append("[C] Folder 'Content Calendar/Instagram/February 2026' exists")
            target_folder_id = target_folder.get("_id")

            for post_title in expected_posts:
                design = _find_design_by_title(final_state_backend, post_title)

                if not design:
                    errors.append(f"[X] Post '{post_title}' not found")
                    continue

                checks_passed.append(f"[C] Post '{post_title}' created")

                # Check dimensions (1080x1080)
                if not _check_design_dimensions(design, 1080, 1080):
                    errors.append(f"[X] '{post_title}' has dimensions {design.get('width')}x{design.get('height')}, expected 1080x1080")
                else:
                    checks_passed.append(f"[C] '{post_title}' has correct dimensions 1080x1080")

                # Check format
                if design.get("format") != "instagram-post":
                    errors.append(f"[X] '{post_title}' has format '{design.get('format')}', expected 'instagram-post'")
                else:
                    checks_passed.append(f"[C] '{post_title}' has instagram-post format")

                # Check folder location
                if design.get("folderId") != target_folder_id:
                    errors.append(f"[X] '{post_title}' not in target folder")
                else:
                    checks_passed.append(f"[C] '{post_title}' is in correct folder")

        return TaskScore(
            score=1.0 if len(errors) == 0 else 0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )
    except Exception as e:
        logger.error(f"Runtime error in validation: {e}")
        errors.append(f"[X] Runtime error: {str(e)}")
        return TaskScore(
            score=0.0,
            metadata=ScoreMetadata(
                success_accumulator=list(dict.fromkeys(checks_passed)),
                error_accumulator=list(dict.fromkeys(errors)),
            )
        )








# ==============================================================================
# Reward Functions
# ==============================================================================
def _validate_ecostart_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate EcoStart brand identity package creation.
    Requires 3 designs in 'Brand Assets/EcoStart/Identity Package' folder:
    - EcoStart - Primary Logo (500x500, logo format)
    - EcoStart - Business Card (1050x600, business-card format)
    - EcoStart - Letterhead Template (2480x3508, a4-document format)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder = _find_folder_by_path(backend, "Brand Assets/EcoStart/Identity Package")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/EcoStart/Identity Package' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/EcoStart/Identity Package' exists")
        folder_id = folder["_id"]

        # Check logo design
        logo = _find_design_by_exact_title(backend, "EcoStart - Primary Logo")
        if not logo:
            errors.append("[X] Design 'EcoStart - Primary Logo' not found")
        else:
            checks_passed.append("[OK] Design 'EcoStart - Primary Logo' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(logo, 500, 500)
            if ok:
                checks_passed.append(f"[OK] Logo {msg}")
            else:
                errors.append(f"[X] Logo {msg}")

            # Check format
            ok, msg = _check_design_format_detailed(logo, "logo")
            if ok:
                checks_passed.append(f"[OK] Logo {msg}")
            else:
                errors.append(f"[X] Logo {msg}")

            # Check in folder
            if _check_design_in_folder(logo, folder_id):
                checks_passed.append("[OK] Logo is in correct folder")
            else:
                errors.append("[X] Logo is not in 'Brand Assets/EcoStart/Identity Package' folder")

        # Check business card design
        card = _find_design_by_exact_title(backend, "EcoStart - Business Card")
        if not card:
            errors.append("[X] Design 'EcoStart - Business Card' not found")
        else:
            checks_passed.append("[OK] Design 'EcoStart - Business Card' found")

            ok, msg = _check_design_dimensions_detailed(card, 1050, 600)
            if ok:
                checks_passed.append(f"[OK] Business card {msg}")
            else:
                errors.append(f"[X] Business card {msg}")

            ok, msg = _check_design_format_detailed(card, "business-card")
            if ok:
                checks_passed.append(f"[OK] Business card {msg}")
            else:
                errors.append(f"[X] Business card {msg}")

            if _check_design_in_folder(card, folder_id):
                checks_passed.append("[OK] Business card is in correct folder")
            else:
                errors.append("[X] Business card is not in 'Brand Assets/EcoStart/Identity Package' folder")

        # Check letterhead design
        letterhead = _find_design_by_exact_title(backend, "EcoStart - Letterhead Template")
        if not letterhead:
            errors.append("[X] Design 'EcoStart - Letterhead Template' not found")
        else:
            checks_passed.append("[OK] Design 'EcoStart - Letterhead Template' found")

            ok, msg = _check_design_dimensions_detailed(letterhead, 2480, 3508)
            if ok:
                checks_passed.append(f"[OK] Letterhead {msg}")
            else:
                errors.append(f"[X] Letterhead {msg}")

            ok, msg = _check_design_format_detailed(letterhead, "a4-document")
            if ok:
                checks_passed.append(f"[OK] Letterhead {msg}")
            else:
                errors.append(f"[X] Letterhead {msg}")

            if _check_design_in_folder(letterhead, folder_id):
                checks_passed.append("[OK] Letterhead is in correct folder")
            else:
                errors.append("[X] Letterhead is not in 'Brand Assets/EcoStart/Identity Package' folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_ecostart_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_consolidate_event_designs(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate consolidation of all Conference/Event designs.
    All designs with 'Conference' OR 'Event' in title must be moved to
    'Personal/Events/2026/All Events' folder. Minimum 4 designs expected.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check target folder exists
        folder = _find_folder_by_path(backend, "Personal/Events/2026/All Events")
        if not folder:
            errors.append("[X] Folder 'Personal/Events/2026/All Events' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Events/2026/All Events' exists")
        folder_id = folder["_id"]

        # Find all designs with 'Conference' in title
        conference_designs = _find_designs_by_title_pattern(backend, "Conference")

        # Find all designs with 'Event' in title
        event_designs = _find_designs_by_title_pattern(backend, "Event")

        # Combine and deduplicate by _id
        all_matching = {}
        for d in conference_designs + event_designs:
            all_matching[d.get("_id")] = d

        matching_designs = list(all_matching.values())

        if len(matching_designs) < 4:
            errors.append(f"[X] Found only {len(matching_designs)} Conference/Event designs, expected at least 4")
        else:
            checks_passed.append(f"[OK] Found {len(matching_designs)} Conference/Event designs")

        # Check all are in target folder
        not_in_folder = []
        in_folder = []
        for design in matching_designs:
            if _check_design_in_folder(design, folder_id):
                in_folder.append(design.get("title", "Unknown"))
            else:
                not_in_folder.append(design.get("title", "Unknown"))

        if in_folder:
            checks_passed.append(f"[OK] {len(in_folder)} designs moved to target folder")

        if not_in_folder:
            errors.append(f"[X] {len(not_in_folder)} designs NOT in target folder: {', '.join(not_in_folder[:3])}{'...' if len(not_in_folder) > 3 else ''}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_consolidate_event_designs: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_deck_content_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme Q1 Strategy Deck content audit.
    Verify design exists with correct format (presentation, 1920x1080).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if not design:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Acme Q1 Strategy Deck' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "presentation")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Verify design has elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements")

            # Count by type
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] Element breakdown: {type_counts}")

            # Check for text elements
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements")

            # Check for shadow effects
            shadow_elements = _get_elements_with_shadow(elements)
            if shadow_elements:
                checks_passed.append(f"[OK] Found {len(shadow_elements)} elements with shadow effects")
        else:
            errors.append("[X] Design has no elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_deck_content_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_deck_structure_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme Q1 Strategy Deck structure analysis.
    Verify design exists with correct format (presentation, 1920x1080).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if not design:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Acme Q1 Strategy Deck' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "presentation")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements and analyze structure
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            # Count by type
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] Element type counts: {type_counts}")

            # Extract unique font families from text elements
            text_elements = _get_text_elements_from_list(elements)
            font_families = set()
            text_colors = set()
            for elem in text_elements:
                props = elem.get("properties", {})
                if props.get("fontFamily"):
                    font_families.add(props["fontFamily"])
                if props.get("color"):
                    text_colors.add(props["color"])

            if font_families:
                checks_passed.append(f"[OK] Unique font families: {list(font_families)}")
            if text_colors:
                checks_passed.append(f"[OK] Unique text colors: {list(text_colors)}")
        else:
            errors.append("[X] Design has no elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_deck_structure_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_summer_tech_marketing_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Summer Tech Conference marketing suite creation.
    Requires 4 designs in 'Client Work/Events/Summer Tech 2026/Marketing Materials':
    - Summer Tech Conference 2026 - Poster (1080x1920)
    - Summer Tech Conference 2026 - Story (1080x1920)
    - Summer Tech Conference 2026 - LinkedIn (1584x396)
    - Summer Tech Conference 2026 - Flyer (2480x3508)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder = _find_folder_by_path(backend, "Client Work/Events/Summer Tech 2026/Marketing Materials")
        if not folder:
            errors.append("[X] Folder 'Client Work/Events/Summer Tech 2026/Marketing Materials' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Work/Events/Summer Tech 2026/Marketing Materials' exists")
        folder_id = folder["_id"]

        # Define expected designs
        expected_designs = [
            ("Summer Tech Conference 2026 - Poster", 1080, 1920),
            ("Summer Tech Conference 2026 - Story", 1080, 1920),
            ("Summer Tech Conference 2026 - LinkedIn", 1584, 396),
            ("Summer Tech Conference 2026 - Flyer", 2480, 3508),
        ]

        for title, width, height in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            # Check in folder
            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in correct folder")
            else:
                errors.append(f"[X] '{title}' is not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_summer_tech_marketing_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_instagram_to_youtube_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Instagram to YouTube thumbnail resize.
    'Welcome Instagram Post' should be resized to 1280x720, format becomes 'custom'.
    All original elements should be preserved.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Welcome Instagram Post' found")

        # Check new dimensions (YouTube thumbnail: 1280x720)
        ok, msg = _check_design_dimensions_detailed(design, 1280, 720)
        if ok:
            checks_passed.append(f"[OK] Resized to YouTube thumbnail: {msg}")
        else:
            errors.append(f"[X] Resize failed: {msg}")

        # Check format changed to custom
        ok, msg = _check_design_format_detailed(design, "custom")
        if ok:
            checks_passed.append(f"[OK] Format changed to custom: {msg}")
        else:
            errors.append(f"[X] Format not changed: {msg}")

        # Check elements preserved (original had ~12 elements)
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) >= 5:
            checks_passed.append(f"[OK] Elements preserved: {len(elements)} elements")
        else:
            errors.append(f"[X] Elements may be lost: only {len(elements)} elements found, expected at least 5")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_instagram_to_youtube_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_business_card_element_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Business Card element analysis.
    'Business Card — Alice Chen' (note: em-dash) should have 12 elements,
    dimensions 1050x600, format 'business-card'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design (note: em-dash character)
        design = _find_design_by_exact_title(backend, "Business Card — Alice Chen")
        if not design:
            # Try with regular hyphen as fallback
            design = _find_design_by_exact_title(backend, "Business Card - Alice Chen")

        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1050, 600)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "business-card")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) == 12:
            checks_passed.append("[OK] Element count correct: 12 elements")
        elif len(elements) > 0:
            checks_passed.append(f"[OK] Found {len(elements)} elements (expected 12)")
        else:
            errors.append("[X] No elements found for design")

        # Analyze elements
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element types: {type_counts}")

        # Check for text elements with properties
        text_elements = _get_text_elements_from_list(elements)
        if text_elements:
            checks_passed.append(f"[OK] Found {len(text_elements)} text elements")

        # Check for shadow effects
        shadow_elements = _get_elements_with_shadow(elements)
        if shadow_elements:
            checks_passed.append(f"[OK] Found {len(shadow_elements)} elements with shadows")

        # Check locked/unlocked status
        locked, unlocked = _count_locked_unlocked(elements)
        checks_passed.append(f"[OK] Locked: {locked}, Unlocked: {unlocked}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_business_card_element_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_instagram_post_element_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Instagram Post element analysis.
    'Welcome Instagram Post' should have:
    - 1080x1080 dimensions, instagram-post format
    - At least 3 elements with opacity < 1.0
    - Elements with shadow effects
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Welcome Instagram Post' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1080, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "instagram-post")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] No elements found for design")
            return _make_task_score(errors, checks_passed)

        # Count by type
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element type counts: {type_counts}")

        # Count locked/unlocked
        locked, unlocked = _count_locked_unlocked(elements)
        checks_passed.append(f"[OK] Locked: {locked}, Unlocked: {unlocked}")

        # Check for elements with opacity < 1.0 (minimum 3 expected)
        low_opacity = _get_elements_with_opacity_less_than(elements, 1.0)
        if len(low_opacity) >= 3:
            checks_passed.append(f"[OK] Found {len(low_opacity)} elements with opacity < 1.0")
        else:
            errors.append(f"[X] Only {len(low_opacity)} elements with opacity < 1.0, expected at least 3")

        # Check for shadow effects
        shadow_elements = _get_elements_with_shadow(elements)
        if shadow_elements:
            checks_passed.append(f"[OK] Found {len(shadow_elements)} elements with shadow effects")
        else:
            errors.append("[X] No elements with shadow effects found")

        # Document text elements
        text_elements = _get_text_elements_from_list(elements)
        if text_elements:
            checks_passed.append(f"[OK] Found {len(text_elements)} text elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_instagram_post_element_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_instagram_to_businesscard_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Instagram to business card resize.
    'Welcome Instagram Post' should be resized to 1050x600, format becomes 'custom'.
    All original elements should be preserved (minimum 5 elements).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Welcome Instagram Post' found")

        # Check new dimensions (business card: 1050x600)
        ok, msg = _check_design_dimensions_detailed(design, 1050, 600)
        if ok:
            checks_passed.append(f"[OK] Resized to business card: {msg}")
        else:
            errors.append(f"[X] Resize failed: {msg}")

        # Check format changed to custom
        ok, msg = _check_design_format_detailed(design, "custom")
        if ok:
            checks_passed.append(f"[OK] Format changed to custom: {msg}")
        else:
            errors.append(f"[X] Format not changed: {msg}")

        # Check elements preserved (original had ~12 elements, minimum 5)
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) >= 5:
            checks_passed.append(f"[OK] Elements preserved: {len(elements)} elements")
        else:
            errors.append(f"[X] Elements may be lost: only {len(elements)} elements found, expected at least 5")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_instagram_to_businesscard_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_designs_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference designs audit and consolidation.
    All designs with 'Conference' in title must be moved to 'Events/All Conferences' folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check target folder exists
        folder = _find_folder_by_path(backend, "Events/All Conferences")
        if not folder:
            errors.append("[X] Folder 'Events/All Conferences' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Events/All Conferences' exists")
        folder_id = folder["_id"]

        # Find all designs with 'Conference' in title
        conference_designs = _find_designs_by_title_pattern(backend, "Conference")

        if not conference_designs:
            errors.append("[X] No designs with 'Conference' in title found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Found {len(conference_designs)} Conference designs")

        # Check all are in target folder
        not_in_folder = []
        in_folder = []
        for design in conference_designs:
            title = design.get("title", "Unknown")
            if _check_design_in_folder(design, folder_id):
                in_folder.append(title)
            else:
                not_in_folder.append(title)

        if in_folder:
            checks_passed.append(f"[OK] {len(in_folder)} designs moved to 'Events/All Conferences'")

        if not_in_folder:
            errors.append(f"[X] {len(not_in_folder)} designs NOT in target folder: {', '.join(not_in_folder[:3])}{'...' if len(not_in_folder) > 3 else ''}")

        # Document audit information for each design
        for design in conference_designs[:5]:  # Limit to first 5 for logging
            title = design.get("title", "Unknown")
            fmt = design.get("format", "unknown")
            w = design.get("width", 0)
            h = design.get("height", 0)
            elements = _get_elements_for_design(backend, design.get("_id"))
            checks_passed.append(f"[OK] Audited '{title}': {fmt} {w}x{h}, {len(elements)} elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_designs_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)








# ==============================================================================
# New Reward Functions (20 tasks from progress tracker)
# ==============================================================================
def _validate_live_music_poster_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resize to presentation dimensions.
    Poster should be resized to 1920x1080, format becomes 'custom'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        # Check new dimensions (presentation: 1920x1080)
        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] Resized to presentation dimensions: {msg}")
        else:
            errors.append(f"[X] Resize failed: {msg}")

        # Check format changed to custom
        ok, msg = _check_design_format_detailed(design, "custom")
        if ok:
            checks_passed.append(f"[OK] Format changed: {msg}")
        else:
            errors.append(f"[X] Format issue: {msg}")

        # Check elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Elements preserved: {len(elements)} elements")
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Text elements preserved: {len(text_elements)}")
        else:
            errors.append("[X] No elements found after resize")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_brand_identity_logo_variations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate brand identity package with three logo variations.
    - Brand Identity - Primary Logo (500x500)
    - Brand Identity - Horizontal Logo (800x300)
    - Brand Identity - Icon Logo (200x200)
    All in 'Brand Assets/Logo Variations/2026 Refresh' folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Logo Variations/2026 Refresh")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logo Variations/2026 Refresh' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Logo Variations/2026 Refresh' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Brand Identity - Primary Logo", 500, 500),
            ("Brand Identity - Horizontal Logo", 800, 300),
            ("Brand Identity - Icon Logo", 200, 200),
        ]

        for title, width, height in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in correct folder")
            else:
                errors.append(f"[X] '{title}' is not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_identity_logo_variations: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_greentech_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate GreenTech Solutions brand identity package.
    - GreenTech - Primary Logo (500x500)
    - GreenTech - Business Card (1050x600)
    - GreenTech - Presentation Template (1920x1080)
    All in 'Brand Assets/GreenTech/Core Identity' folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/GreenTech/Core Identity")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/GreenTech/Core Identity' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/GreenTech/Core Identity' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("GreenTech - Primary Logo", 500, 500, "logo"),
            ("GreenTech - Business Card", 1050, 600, "business-card"),
            ("GreenTech - Presentation Template", 1920, 1080, "presentation"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in correct folder")
            else:
                errors.append(f"[X] '{title}' is not in target folder")

        # Extract text from business card
        card = _find_design_by_exact_title(backend, "GreenTech - Business Card")
        if card:
            elements = _get_elements_for_design(backend, card.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Business card has {len(text_elements)} text elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_greentech_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q2_review_strategy_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 review presentation and strategy reorganization.
    - Q2 2026 Performance Review (1920x1080) in 'Personal/Docs/Presentations'
    - Strategic Documents folder exists under 'Personal/Docs'
    - Acme Q1 Strategy Deck moved to Strategic Documents
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check presentation folder
        pres_folder = _find_folder_by_path(backend, "Personal/Docs/Presentations")
        if not pres_folder:
            errors.append("[X] Folder 'Personal/Docs/Presentations' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Docs/Presentations' exists")

        # Check presentation design
        presentation = _find_design_by_exact_title(backend, "Q2 2026 Performance Review")
        if not presentation:
            errors.append("[X] Design 'Q2 2026 Performance Review' not found")
        else:
            checks_passed.append("[OK] Design 'Q2 2026 Performance Review' found")
            ok, msg = _check_design_dimensions_detailed(presentation, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] Presentation {msg}")
            else:
                errors.append(f"[X] Presentation {msg}")

            if pres_folder and _check_design_in_folder(presentation, pres_folder["_id"]):
                checks_passed.append("[OK] Presentation is in Presentations folder")
            else:
                errors.append("[X] Presentation is not in correct folder")

        # Check Strategic Documents folder
        strategy_folder = _find_folder_by_path(backend, "Personal/Docs/Strategic Documents")
        if not strategy_folder:
            errors.append("[X] Folder 'Personal/Docs/Strategic Documents' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Docs/Strategic Documents' exists")

        # Check strategy deck moved
        strategy_deck = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if strategy_deck and strategy_folder:
            if _check_design_in_folder(strategy_deck, strategy_folder["_id"]):
                checks_passed.append("[OK] Acme Q1 Strategy Deck moved to Strategic Documents")
            else:
                errors.append("[X] Acme Q1 Strategy Deck not in Strategic Documents folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q2_review_strategy_reorganization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_campaigns_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome campaigns folder reorganization.
    - 'Brand Assets/Welcome Campaigns/Instagram' folder exists
    - 'Brand Assets/Welcome Campaigns/Multi-Client' folder exists
    - Welcome Instagram Post in Instagram folder
    - Welcome Instagram Post (Acme) and (Starlight) in Multi-Client folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        instagram_folder = _find_folder_by_path(backend, "Brand Assets/Welcome Campaigns/Instagram")
        if not instagram_folder:
            errors.append("[X] Folder 'Brand Assets/Welcome Campaigns/Instagram' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Welcome Campaigns/Instagram' exists")

        multi_client_folder = _find_folder_by_path(backend, "Brand Assets/Welcome Campaigns/Multi-Client")
        if not multi_client_folder:
            errors.append("[X] Folder 'Brand Assets/Welcome Campaigns/Multi-Client' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Welcome Campaigns/Multi-Client' exists")

        # Check Welcome Instagram Post in Instagram folder
        welcome_post = _find_design_by_exact_title(backend, "Welcome Instagram Post")
        if welcome_post and instagram_folder:
            if _check_design_in_folder(welcome_post, instagram_folder["_id"]):
                checks_passed.append("[OK] 'Welcome Instagram Post' is in Instagram folder")
            else:
                errors.append("[X] 'Welcome Instagram Post' is not in Instagram folder")

        # Check Acme and Starlight versions in Multi-Client folder
        acme_post = _find_design_by_exact_title(backend, "Welcome Instagram Post (Acme)")
        starlight_post = _find_design_by_exact_title(backend, "Welcome Instagram Post (Starlight)")

        if acme_post and multi_client_folder:
            if _check_design_in_folder(acme_post, multi_client_folder["_id"]):
                checks_passed.append("[OK] 'Welcome Instagram Post (Acme)' is in Multi-Client folder")
            else:
                errors.append("[X] 'Welcome Instagram Post (Acme)' is not in Multi-Client folder")

        if starlight_post and multi_client_folder:
            if _check_design_in_folder(starlight_post, multi_client_folder["_id"]):
                checks_passed.append("[OK] 'Welcome Instagram Post (Starlight)' is in Multi-Client folder")
            else:
                errors.append("[X] 'Welcome Instagram Post (Starlight)' is not in Multi-Client folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_campaigns_reorganization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_materials_archive(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference materials archive.
    - 'Archives/Conference Materials/2026/Digital' folder exists
    - All Conference designs moved to Digital folder
    - Content analysis documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Archives/Conference Materials/2026/Digital")
        if not folder:
            errors.append("[X] Folder 'Archives/Conference Materials/2026/Digital' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Archives/Conference Materials/2026/Digital' exists")
        folder_id = folder["_id"]

        conference_designs = _find_designs_by_title_pattern(backend, "Conference")
        if not conference_designs:
            errors.append("[X] No designs with 'Conference' in title found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Found {len(conference_designs)} Conference designs")

        in_folder = []
        not_in_folder = []
        for design in conference_designs:
            if _check_design_in_folder(design, folder_id):
                in_folder.append(design.get("title"))
                # Document content analysis
                elements = _get_elements_for_design(backend, design.get("_id"))
                type_counts = _count_elements_by_type(elements)
                checks_passed.append(f"[OK] Archived '{design.get('title')}': {len(elements)} elements, types: {type_counts}")
            else:
                not_in_folder.append(design.get("title"))

        if in_folder:
            checks_passed.append(f"[OK] {len(in_folder)} designs moved to archive")

        if not_in_folder:
            errors.append(f"[X] {len(not_in_folder)} designs NOT in archive: {', '.join(not_in_folder[:3])}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_materials_archive: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_ecogreen_brand_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate EcoGreen Solutions brand package.
    - EcoGreen Logo (500x500)
    - EcoGreen Business Card (1050x600)
    - EcoGreen Services Flyer (2480x3508)
    All in 'Brand Assets/EcoGreen Solutions/Brand Package' folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/EcoGreen Solutions/Brand Package")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/EcoGreen Solutions/Brand Package' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/EcoGreen Solutions/Brand Package' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("EcoGreen Logo", 500, 500, "logo"),
            ("EcoGreen Business Card", 1050, 600, "business-card"),
            ("EcoGreen Services Flyer", 2480, 3508, "flyer"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Brand Package folder")
            else:
                errors.append(f"[X] '{title}' is not in Brand Package folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_ecogreen_brand_package: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_reorganization_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference designs reorganization with element analysis.
    - 'Personal/Events/Tech Conferences' folder exists
    - At least 2 Conference designs moved
    - Element analysis including shadow effects documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Events/Tech Conferences")
        if not folder:
            errors.append("[X] Folder 'Personal/Events/Tech Conferences' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Events/Tech Conferences' exists")
        folder_id = folder["_id"]

        conference_designs = _find_designs_by_title_pattern(backend, "Conference")
        in_folder = [d for d in conference_designs if _check_design_in_folder(d, folder_id)]

        if len(in_folder) >= 2:
            checks_passed.append(f"[OK] {len(in_folder)} Conference designs moved to folder")
        else:
            errors.append(f"[X] Only {len(in_folder)} Conference designs in folder, expected at least 2")

        # Document element analysis for moved designs
        for design in in_folder[:3]:
            elements = _get_elements_for_design(backend, design.get("_id"))
            type_counts = _count_elements_by_type(elements)
            shadow_elements = _get_elements_with_shadow(elements)
            text_elements = _get_text_elements_from_list(elements)
            checks_passed.append(f"[OK] '{design.get('title')}': {len(elements)} elements, types: {type_counts}")
            checks_passed.append(f"[OK] Shadow elements: {len(shadow_elements)}, Text elements: {len(text_elements)}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_reorganization_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_starlight_brand_consolidation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme and Starlight brand consolidation.
    - Master hierarchy created
    - 12+ Acme designs in Acme Social Campaigns
    - 7+ Starlight designs in Starlight Social Campaigns
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        acme_folder = _find_folder_by_path(backend, "Brand Assets/Master Collection/Client Brands/Acme/Social Campaigns")
        starlight_folder = _find_folder_by_path(backend, "Brand Assets/Master Collection/Client Brands/Starlight/Social Campaigns")

        if not acme_folder:
            errors.append("[X] Acme Social Campaigns folder not found")
        else:
            checks_passed.append("[OK] Acme Social Campaigns folder exists")

        if not starlight_folder:
            errors.append("[X] Starlight Social Campaigns folder not found")
        else:
            checks_passed.append("[OK] Starlight Social Campaigns folder exists")

        # Check Acme designs
        acme_designs = _find_designs_by_title_pattern(backend, "Acme")
        if acme_folder:
            acme_in_folder = [d for d in acme_designs if _check_design_in_folder(d, acme_folder["_id"])]
            if len(acme_in_folder) >= 12:
                checks_passed.append(f"[OK] {len(acme_in_folder)} Acme designs in folder (required 12+)")
            else:
                errors.append(f"[X] Only {len(acme_in_folder)} Acme designs in folder, expected 12+")

        # Check Starlight designs
        starlight_designs = _find_designs_by_title_pattern(backend, "Starlight")
        if starlight_folder:
            starlight_in_folder = [d for d in starlight_designs if _check_design_in_folder(d, starlight_folder["_id"])]
            if len(starlight_in_folder) >= 7:
                checks_passed.append(f"[OK] {len(starlight_in_folder)} Starlight designs in folder (required 7+)")
            else:
                errors.append(f"[X] Only {len(starlight_in_folder)} Starlight designs in folder, expected 7+")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_starlight_brand_consolidation: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_instagram_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post reorganization.
    - 'Personal/Social Media/Instagram Posts/Welcome Series' folder exists
    - At least 2 Welcome Instagram Post designs moved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Posts/Welcome Series")
        if not folder:
            errors.append("[X] Folder 'Personal/Social Media/Instagram Posts/Welcome Series' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Social Media/Instagram Posts/Welcome Series' exists")
        folder_id = folder["_id"]

        welcome_designs = _find_designs_by_title_pattern(backend, "Welcome Instagram Post")
        in_folder = [d for d in welcome_designs if _check_design_in_folder(d, folder_id)]

        if len(in_folder) >= 2:
            checks_passed.append(f"[OK] {len(in_folder)} Welcome Instagram Post designs moved")
            for d in in_folder:
                checks_passed.append(f"[OK] '{d.get('title')}' in folder")
        else:
            errors.append(f"[X] Only {len(in_folder)} designs in folder, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_instagram_reorganization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstart_conference_social_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStart Conference social media campaign.
    - 4 designs with exact titles and dimensions
    - All in 'Campaigns/TechStart 2026/Social Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Campaigns/TechStart 2026/Social Assets")
        if not folder:
            errors.append("[X] Folder 'Campaigns/TechStart 2026/Social Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Campaigns/TechStart 2026/Social Assets' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("TechStart Conference - Instagram Announcement", 1080, 1080),
            ("TechStart Conference - Story Countdown", 1080, 1920),
            ("TechStart Conference - LinkedIn Header", 1584, 396),
            ("TechStart Conference - Video Promo", 1280, 720),
        ]

        for title, width, height in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Social Assets folder")
            else:
                errors.append(f"[X] '{title}' is not in Social Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_conference_social_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_stellar_innovations_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Stellar Innovations brand identity package.
    - Logo (500x500), Business Card (1050x600), LinkedIn Banner (1584x396)
    - All in 'Brand Identities/Stellar Innovations/Core Assets'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Identities/Stellar Innovations/Core Assets")
        if not folder:
            errors.append("[X] Folder 'Brand Identities/Stellar Innovations/Core Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Identities/Stellar Innovations/Core Assets' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Stellar Innovations - Primary Logo", 500, 500),
            ("Stellar Innovations - Business Card", 1050, 600),
            ("Stellar Innovations - LinkedIn Brand", 1584, 396),
        ]

        for title, width, height in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Core Assets folder")
            else:
                errors.append(f"[X] '{title}' is not in Core Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_stellar_innovations_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_workspace_consolidation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme workspace consolidation.
    - 'Client Work/Acme Corp/2026 Consolidated' folder exists
    - All Acme designs moved to consolidated folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/2026 Consolidated")
        if not folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/2026 Consolidated' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Work/Acme Corp/2026 Consolidated' exists")
        folder_id = folder["_id"]

        acme_designs = _find_designs_by_title_pattern(backend, "Acme")
        if not acme_designs:
            errors.append("[X] No Acme designs found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Found {len(acme_designs)} Acme designs")

        in_folder = [d for d in acme_designs if _check_design_in_folder(d, folder_id)]
        not_in_folder = [d for d in acme_designs if not _check_design_in_folder(d, folder_id)]

        if in_folder:
            checks_passed.append(f"[OK] {len(in_folder)} Acme designs consolidated")
            # Document formats
            formats = [d.get("format", "unknown") for d in in_folder]
            checks_passed.append(f"[OK] Formats: {set(formats)}")

        if not_in_folder:
            errors.append(f"[X] {len(not_in_folder)} Acme designs not in consolidated folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_workspace_consolidation: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techflow_brand_asset_library(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechFlow brand asset library.
    - TechFlow Logo Primary (500x500, logo)
    - TechFlow Business Card (1050x600, business-card)
    - TechFlow Letterhead Template (2480x3508, a4-document)
    - TechFlow Event Poster (1080x1920, poster)
    - All in 'TechFlow Brand Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "TechFlow Brand Assets")
        if not folder:
            errors.append("[X] Folder 'TechFlow Brand Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'TechFlow Brand Assets' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("TechFlow Logo Primary", 500, 500, "logo"),
            ("TechFlow Business Card", 1050, 600, "business-card"),
            ("TechFlow Letterhead Template", 2480, 3508, "a4-document"),
            ("TechFlow Event Poster", 1080, 1920, "poster"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in brand folder")
            else:
                errors.append(f"[X] '{title}' is not in brand folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techflow_brand_asset_library: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_instagram_custom_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post custom resize.
    - Design resized to 1600x900
    - Format changed to 'custom'
    - Title preserved
    - Text content preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Welcome Instagram Post' found (title preserved)")

        ok, msg = _check_design_dimensions_detailed(design, 1600, 900)
        if ok:
            checks_passed.append(f"[OK] Resized to custom banner: {msg}")
        else:
            errors.append(f"[X] Resize failed: {msg}")

        ok, msg = _check_design_format_detailed(design, "custom")
        if ok:
            checks_passed.append(f"[OK] Format changed: {msg}")
        else:
            errors.append(f"[X] Format issue: {msg}")

        # Check text content preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)
        if text_elements:
            checks_passed.append(f"[OK] Text elements preserved: {len(text_elements)}")
        else:
            errors.append("[X] No text elements found after resize")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_instagram_custom_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_designs_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference designs reorganization.
    - 'Brand Assets/Events/Tech Conference 2026' folder exists
    - 3 Conference designs moved (Tech Conference Header variants)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Events/Tech Conference 2026")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Events/Tech Conference 2026' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Events/Tech Conference 2026' exists")
        folder_id = folder["_id"]

        conference_designs = _find_designs_by_title_pattern(backend, "Conference")
        in_folder = [d for d in conference_designs if _check_design_in_folder(d, folder_id)]

        if len(in_folder) >= 3:
            checks_passed.append(f"[OK] {len(in_folder)} Conference designs moved")
            for d in in_folder:
                checks_passed.append(f"[OK] '{d.get('title')}' in folder")
        else:
            errors.append(f"[X] Only {len(in_folder)} designs in folder, expected 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_designs_reorganization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstartup_project_hierarchy(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStartup project hierarchy setup.
    - 'Client Work/TechStartup Inc/Q1 2026/Social Assets' folder exists
    - 'Client Work/TechStartup Inc/Q1 2026/Presentations' folder exists
    - At least 2 Welcome designs moved to Social Assets
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        social_folder = _find_folder_by_path(backend, "Client Work/TechStartup Inc/Q1 2026/Social Assets")
        pres_folder = _find_folder_by_path(backend, "Client Work/TechStartup Inc/Q1 2026/Presentations")

        if not social_folder:
            errors.append("[X] Social Assets folder not found")
        else:
            checks_passed.append("[OK] Social Assets folder exists")

        if not pres_folder:
            errors.append("[X] Presentations folder not found")
        else:
            checks_passed.append("[OK] Presentations folder exists")

        # Check Welcome designs in Social Assets
        if social_folder:
            welcome_designs = _find_designs_by_title_pattern(backend, "Welcome")
            in_folder = [d for d in welcome_designs if _check_design_in_folder(d, social_folder["_id"])]

            if len(in_folder) >= 2:
                checks_passed.append(f"[OK] {len(in_folder)} Welcome designs in Social Assets")
            else:
                errors.append(f"[X] Only {len(in_folder)} Welcome designs in folder, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstartup_project_hierarchy: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_poster_analysis_2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster element analysis.
    - Design exists with poster dimensions (1080x1920)
    - Complete element inventory with positions
    - Style properties documented
    - Layer order and lock status classified
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        ok, msg = _check_design_dimensions_detailed(design, 1080, 1920)
        if ok:
            checks_passed.append(f"[OK] Poster dimensions verified: {msg}")
        else:
            errors.append(f"[X] Dimensions issue: {msg}")

        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] No elements found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Found {len(elements)} elements")

        # Document element types
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element types: {type_counts}")

        # Document positions
        for elem in elements[:5]:
            x = elem.get("x", 0)
            y = elem.get("y", 0)
            elem_type = elem.get("type", "unknown")
            checks_passed.append(f"[OK] {elem_type} at ({x}, {y})")

        # Document shadow and opacity
        shadow_elements = _get_elements_with_shadow(elements)
        low_opacity = _get_elements_with_opacity_less_than(elements, 1.0)
        checks_passed.append(f"[OK] Shadow elements: {len(shadow_elements)}")
        checks_passed.append(f"[OK] Elements with opacity < 1.0: {len(low_opacity)}")

        # Document locked status
        locked, unlocked = _count_locked_unlocked(elements)
        checks_passed.append(f"[OK] Locked: {locked}, Unlocked: {unlocked}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_product_launch_social_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Product Launch social media campaign.
    - 5 designs with exact titles and dimensions
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            ("Product Launch - Instagram", 1080, 1080, "instagram-post"),
            ("Product Launch - Story", 1080, 1920, "instagram-story"),
            ("Product Launch - Facebook", 1200, 630, "facebook-post"),
            ("Product Launch - Twitter", 1500, 500, "twitter-header"),
            ("Product Launch - LinkedIn", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_product_launch_social_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_hiring_banner_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate We’re Hiring Banner (Acme) element analysis.
    - Design exists with LinkedIn banner dimensions (1584x396)
    - Element positions documented
    - Colors, typography, shadows documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "We’re Hiring Banner (Acme)")
        if not design:
            errors.append("[X] Design \"We’re Hiring Banner (Acme)\" not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design \"We’re Hiring Banner (Acme)\" found")

        ok, msg = _check_design_dimensions_detailed(design, 1584, 396)
        if ok:
            checks_passed.append(f"[OK] LinkedIn banner dimensions verified: {msg}")
        else:
            errors.append(f"[X] Dimensions issue: {msg}")

        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] No elements found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Found {len(elements)} elements")

        # Document positions
        for elem in elements:
            x = elem.get("x", 0)
            y = elem.get("y", 0)
            elem_type = elem.get("type", "unknown")
            checks_passed.append(f"[OK] {elem_type} at ({x}, {y})")

        # Document text elements and typography
        text_elements = _get_text_elements_from_list(elements)
        for text_elem in text_elements:
            props = text_elem.get("properties", {})
            font = props.get("fontFamily", "unknown")
            size = props.get("fontSize", 0)
            color = props.get("color", "unknown")
            checks_passed.append(f"[OK] Text: font={font}, size={size}, color={color}")

        # Document shadows and opacity
        shadow_elements = _get_elements_with_shadow(elements)
        low_opacity = _get_elements_with_opacity_less_than(elements, 1.0)
        checks_passed.append(f"[OK] Shadow elements: {len(shadow_elements)}")
        checks_passed.append(f"[OK] Elements with opacity effects: {len(low_opacity)}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_hiring_banner_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Analysis Task Reward Functions
# ==============================================================================
def _validate_yoga_flyer_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Yoga Class Flyer content analysis.
    Verify design exists with flyer format (2480x3508), minimum 8 elements,
    and extract shadow effects, opacity values, font sizes, and shape types.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Yoga Class Flyer")
        if not design:
            errors.append("[X] Design 'Yoga Class Flyer' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Yoga Class Flyer' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 2480, 3508)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "flyer")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] Design has no elements")
            return _make_task_score(errors, checks_passed)

        # Check minimum element count
        if len(elements) >= 8:
            checks_passed.append(f"[OK] Design has {len(elements)} elements (minimum 8 required)")
        else:
            errors.append(f"[X] Design has {len(elements)} elements, expected minimum 8")

        # Count elements by type
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element type breakdown: {type_counts}")

        # Count shadow-enabled elements
        shadow_elements = _get_elements_with_shadow(elements)
        checks_passed.append(f"[OK] Found {len(shadow_elements)} elements with shadow effects")

        # Extract all opacity values
        opacity_values = sorted(set(e.get("opacity", 1.0) for e in elements))
        checks_passed.append(f"[OK] Opacity values found: {opacity_values}")

        # Extract font sizes from text elements
        text_elements = _get_text_elements_from_list(elements)
        font_sizes = set()
        for elem in text_elements:
            props = elem.get("properties", {})
            segments = props.get("segments", [])
            for seg in segments:
                if isinstance(seg, dict) and "fontSize" in seg:
                    font_sizes.add(seg["fontSize"])
        if font_sizes:
            checks_passed.append(f"[OK] Font sizes found: {sorted(font_sizes)}")

        # Extract shape types
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        shape_types = set()
        for elem in shape_elements:
            shape_type = elem.get("properties", {}).get("shapeType")
            if shape_type:
                shape_types.add(shape_type)
        if shape_types:
            checks_passed.append(f"[OK] Shape types found: {sorted(shape_types)}")

        # Validate final answer documentation
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=["8", "2480", "3508"],
            expected_keywords=["element", "shadow", "opacity", "font", "shape", "flyer"],
            min_length=200
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_yoga_flyer_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_strategy_deck_element_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme Q1 Strategy Deck element analysis.
    Extract text elements, images, shapes, rotated elements, and transparent elements.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if not design:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Acme Q1 Strategy Deck' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "presentation")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] Design has no elements")
            return _make_task_score(errors, checks_passed)

        # Count by type
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element type counts: {type_counts}")

        # Text elements
        text_elements = _get_text_elements_from_list(elements)
        checks_passed.append(f"[OK] Found {len(text_elements)} text elements")

        # Image elements
        image_elements = [e for e in elements if e.get("type") == "image"]
        checks_passed.append(f"[OK] Found {len(image_elements)} image elements")

        # Shape elements with types and colors
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        if shape_elements:
            checks_passed.append(f"[OK] Found {len(shape_elements)} shape elements")

        # Rotated elements (rotation ≠ 0)
        rotated_elements = [e for e in elements if e.get("rotation", 0) != 0]
        checks_passed.append(f"[OK] Found {len(rotated_elements)} rotated elements")

        # Elements with opacity < 1.0
        transparent_elements = _get_elements_with_opacity_less_than(elements, 1.0)
        checks_passed.append(f"[OK] Found {len(transparent_elements)} elements with opacity < 1.0")

        # Validate final answer documentation
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=["1920", "1080"],
            expected_keywords=["text", "image", "shape", "rotation", "opacity", "presentation"],
            min_length=200
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_strategy_deck_element_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_instagram_designs_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive analysis of Instagram post designs.
    Search for designs with 'Instagram' in title and analyze content.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Search for Instagram designs
        instagram_designs = _find_designs_by_title_pattern(backend, "Instagram")

        if len(instagram_designs) < 1:
            errors.append(f"[X] Found {len(instagram_designs)} Instagram designs, expected at least 1")
        else:
            checks_passed.append(f"[OK] Found {len(instagram_designs)} Instagram designs")

        # Analyze each design
        for design in instagram_designs:
            title = design.get("title", "Unknown")
            checks_passed.append(f"[OK] Analyzing design '{title}'")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(design, 1080, 1080)
            if ok:
                checks_passed.append(f"[OK] '{title}' - {msg}")
            else:
                errors.append(f"[X] '{title}' - {msg}")

            # Get folder location
            folder_id = design.get("folderId")
            if folder_id:
                folder_path = _get_folder_path(backend, folder_id)
                checks_passed.append(f"[OK] '{title}' located in: {folder_path}")

            # Get elements
            elements = _get_elements_for_design(backend, design.get("_id"))
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] '{title}' element counts: {type_counts}")

            # Extract text content
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] '{title}' has {len(text_elements)} text elements")

        # Validate final answer documentation
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=["1080"],
            expected_keywords=["instagram", "design", "folder", "font", "element", "dimension"],
            min_length=200
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_instagram_designs_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_business_cards_audit_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive audit of business card designs.
    Search for designs with 'Business Card' in title and analyze.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Search for business card designs
        business_card_designs = _find_designs_by_title_pattern(backend, "Business Card")

        if len(business_card_designs) < 1:
            errors.append(f"[X] Found {len(business_card_designs)} business card designs, expected at least 1")
        else:
            checks_passed.append(f"[OK] Found {len(business_card_designs)} business card designs")

        # Analyze each design
        for design in business_card_designs:
            title = design.get("title", "Unknown")
            checks_passed.append(f"[OK] Analyzing '{title}'")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(design, 1050, 600)
            if ok:
                checks_passed.append(f"[OK] '{title}' - {msg}")
            else:
                errors.append(f"[X] '{title}' - {msg}")

            # Get elements
            elements = _get_elements_for_design(backend, design.get("_id"))
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] '{title}' element counts: {type_counts}")

            # Text elements with font properties
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] '{title}' has {len(text_elements)} text elements")

            # Shadow effects
            shadow_elements = _get_elements_with_shadow(elements)
            checks_passed.append(f"[OK] '{title}' has {len(shadow_elements)} elements with shadows")

        # Validate final answer documentation
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=["1050", "600"],
            expected_keywords=["business card", "dimension", "font", "element", "shadow"],
            min_length=200
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_business_cards_audit_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_poster_typography_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate typography analysis of Live Music Night Poster.
    Extract text properties, element counts, and formatting details.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1080, 1920)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "poster")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element type counts: {type_counts}")

        # Text elements analysis
        text_elements = _get_text_elements_from_list(elements)
        checks_passed.append(f"[OK] Found {len(text_elements)} text elements")

        # Extract font properties
        for i, elem in enumerate(text_elements[:5]):  # Analyze first 5 text elements
            props = elem.get("properties", {})
            segments = props.get("segments", [])
            for seg in segments:
                if isinstance(seg, dict):
                    font_family = seg.get("fontFamily", "unknown")
                    font_size = seg.get("fontSize", 0)
                    checks_passed.append(f"[OK] Text element {i+1}: font={font_family}, size={font_size}")
                    break

        # Validate final answer documentation
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=["1080", "1920"],
            expected_keywords=["text", "font", "size", "color", "typography", "poster"],
            min_length=200
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_typography_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_story_element_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate detailed element analysis of Flash Sale Story design.
    Extract positions, dimensions, opacity, z-index, shadows, and colors.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Flash Sale Story")
        if not design:
            errors.append("[X] Design 'Flash Sale Story' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Flash Sale Story' found")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] Design has no elements")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Design has {len(elements)} elements")

        # Count by type
        type_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element type counts: {type_counts}")

        # Extract properties for first few elements
        for i, elem in enumerate(elements[:3]):
            x = elem.get("x", 0)
            y = elem.get("y", 0)
            width = elem.get("width", 0)
            height = elem.get("height", 0)
            opacity = elem.get("opacity", 1.0)
            z_index = elem.get("zIndex", 0)
            checks_passed.append(f"[OK] Element {i+1}: pos({x},{y}), size({width}x{height}), opacity={opacity}, z-index={z_index}")

        # Count elements with opacity < 1.0
        transparent_elements = _get_elements_with_opacity_less_than(elements, 1.0)
        checks_passed.append(f"[OK] Found {len(transparent_elements)} elements with opacity < 1.0")

        # Count shadow-enabled elements
        shadow_elements = _get_elements_with_shadow(elements)
        checks_passed.append(f"[OK] Found {len(shadow_elements)} elements with shadow effects")

        # Validate final answer documentation
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=[],  # Coordinates vary, focus on keywords
            expected_keywords=["position", "dimension", "opacity", "z-index", "shadow", "element"],
            min_length=200
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_story_element_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Multi-Design Creation Task Reward Functions
# ==============================================================================
def _validate_tech_conference_social_media_kit_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate creation of Tech Conference 2026 social media kit.
    Four designs for Instagram, Facebook, Twitter, and LinkedIn.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Tech Conference - Instagram", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Tech Conference - Facebook", "width": 1200, "height": 630, "format": "facebook-post"},
            {"title": "Tech Conference - Twitter", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "Tech Conference - LinkedIn", "width": 1584, "height": 396, "format": "linkedin-banner"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Brand Assets/Tech Conference 2026/Social Media Kit")
        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Tech Conference 2026/Social Media Kit' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Tech Conference 2026/Social Media Kit' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_tech_conference_social_media_kit_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_brand_identity_package_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight Studios brand identity package.
    Three designs: logo, business card, and letterhead.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Starlight Studios Logo V2", "width": 500, "height": 500, "format": "logo"},
            {"title": "Starlight Business Card Template", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Starlight Letterhead", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Brand Assets/Starlight Studios/2026 Rebrand")
        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Starlight Studios/2026 Rebrand' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Starlight Studios/2026 Rebrand' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_brand_identity_package_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_quantum_dynamics_brand_collection_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Quantum Dynamics brand asset collection.
    Four designs: logo, business card, letterhead, and web banner.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Quantum Dynamics Logo - Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "Quantum Dynamics Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Quantum Dynamics Letterhead", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Quantum Dynamics Web Banner", "width": 1600, "height": 400, "format": "custom"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Brand Assets/Quantum Dynamics/Primary Assets")
        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Quantum Dynamics/Primary Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Quantum Dynamics/Primary Assets' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_quantum_dynamics_brand_collection_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_print_marketing_suite_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate print marketing suite creation.
    Three designs: A4 brochure, flyer, and business card.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Marketing Brochure A4", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Marketing Flyer", "width": 2480, "height": 3508, "format": "flyer"},
            {"title": "Marketing Business Card", "width": 1050, "height": 600, "format": "business-card"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Client Work/Marketing Suite/Print Materials")
        if not target_folder:
            errors.append("[X] Folder 'Client Work/Marketing Suite/Print Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Marketing Suite/Print Materials' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_print_marketing_suite_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_print_marketing_suite_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight Studio print marketing suite.
    Four designs: brochure, business card, poster, and flyer.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Starlight Brochure", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Starlight Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Starlight Event Poster", "width": 1080, "height": 1920, "format": "poster"},
            {"title": "Starlight Services Flyer", "width": 2480, "height": 3508, "format": "flyer"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Client Work/Starlight Studio")
        if not target_folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Starlight Studio' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_print_marketing_suite_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstart_logo_variations_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStart logo variations package.
    Three logos: Primary, Horizontal, and Icon.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "TechStart Logo - Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "TechStart Logo - Horizontal", "width": 800, "height": 300, "format": "custom"},
            {"title": "TechStart Logo - Icon", "width": 200, "height": 200, "format": "custom"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Brand Assets/TechStart/Logo Variations")
        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/TechStart/Logo Variations' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/TechStart/Logo Variations' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_logo_variations_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_tech_startup_logo_package_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Startup logo package.
    Four logos: Primary, Alt 1, Alt 2, and Stacked.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Tech Startup Logo - Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "Tech Startup Logo - Alt 1", "width": 500, "height": 500, "format": "logo"},
            {"title": "Tech Startup Logo - Alt 2", "width": 500, "height": 500, "format": "logo"},
            {"title": "Tech Startup Logo - Stacked", "width": 500, "height": 800, "format": "custom"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Brand Assets/Tech Startup/Logos")
        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Tech Startup/Logos' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Tech Startup/Logos' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_tech_startup_logo_package_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_multi_format_poster_series_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight multi-format poster series.
    Four designs: Standard, A4, Flyer, and Custom.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Starlight Events - Standard", "width": 1080, "height": 1920, "format": "poster"},
            {"title": "Starlight Events - A4", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Starlight Events - Flyer", "width": 2480, "height": 3508, "format": "flyer"},
            {"title": "Starlight Events - Custom", "width": 1200, "height": 1600, "format": "custom"},
        ]

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Client Work/Starlight Studio")
        if not target_folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Starlight Studio' exists")
            target_folder_id = target_folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                # Check folder placement
                if design.get("folderId") == target_folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_multi_format_poster_series_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Single Design Creation Task Reward Functions
# ==============================================================================
def _validate_youtube_thumbnail_creation_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate YouTube thumbnail creation.
    Single design with specific dimensions and content requirements.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Tutorial Series Episode 1")
        if not design:
            errors.append("[X] Design 'Tutorial Series Episode 1' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Tutorial Series Episode 1' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1280, 720)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "youtube-thumbnail")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check folder placement
        target_folder = _find_folder_by_path(backend, "Personal/Video/YouTube Thumbnails")
        if target_folder:
            target_folder_id = target_folder.get("_id")
            if design.get("folderId") == target_folder_id:
                checks_passed.append("[OK] Design in correct folder 'Personal/Video/YouTube Thumbnails'")
            else:
                errors.append("[X] Design not in 'Personal/Video/YouTube Thumbnails' folder")
        else:
            errors.append("[X] Folder 'Personal/Video/YouTube Thumbnails' not found")

        # Get elements and verify content
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)
        shape_elements = [e for e in elements if e.get("type") == "shape"]

        if len(text_elements) >= 1:
            checks_passed.append(f"[OK] Design has {len(text_elements)} text element(s)")
        else:
            errors.append(f"[X] Design has {len(text_elements)} text elements, expected at least 1")

        if len(shape_elements) >= 1:
            checks_passed.append(f"[OK] Design has {len(shape_elements)} shape element(s)")
        else:
            errors.append(f"[X] Design has {len(shape_elements)} shape elements, expected at least 1")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_youtube_thumbnail_creation_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_executive_business_card_creation_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate executive business card creation.
    Single business card design with content verification.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Executive Business Card - Q1 2026")
        if not design:
            errors.append("[X] Design 'Executive Business Card - Q1 2026' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Executive Business Card - Q1 2026' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1050, 600)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "business-card")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check folder placement
        target_folder = _find_folder_by_path(backend, "Personal/Print/Business Cards")
        if target_folder:
            target_folder_id = target_folder.get("_id")
            if design.get("folderId") == target_folder_id:
                checks_passed.append("[OK] Design in correct folder 'Personal/Print/Business Cards'")
            else:
                errors.append("[X] Design not in 'Personal/Print/Business Cards' folder")
        else:
            errors.append("[X] Folder 'Personal/Print/Business Cards' not found")

        # Get elements and verify content
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if len(text_elements) >= 1:
            checks_passed.append(f"[OK] Design has {len(text_elements)} text element(s)")
        else:
            errors.append(f"[X] Design has {len(text_elements)} text elements, expected at least 1")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_executive_business_card_creation_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Organization Task Reward Functions
# ==============================================================================
def _validate_conference_designs_organization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate organization of Conference designs.
    Create folder hierarchy and move Conference designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Client Projects/TechCorp/Q2 2026/Marketing Assets")
        if not target_folder:
            errors.append("[X] Folder 'Client Projects/TechCorp/Q2 2026/Marketing Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Projects/TechCorp/Q2 2026/Marketing Assets' exists")
            target_folder_id = target_folder.get("_id")

            # Search for Conference designs
            conference_designs = _find_designs_by_title_pattern(backend, "Conference")

            if len(conference_designs) < 1:
                errors.append(f"[X] Found {len(conference_designs)} Conference designs")
            else:
                checks_passed.append(f"[OK] Found {len(conference_designs)} Conference designs")

            # Count how many are in target folder
            designs_in_target = 0
            for design in conference_designs:
                if design.get("folderId") == target_folder_id:
                    designs_in_target += 1
                    checks_passed.append(f"[OK] '{design.get('title')}' moved to target folder")

            if designs_in_target >= 3:
                checks_passed.append(f"[OK] {designs_in_target} designs relocated (minimum 3 required)")
            else:
                errors.append(f"[X] Only {designs_in_target} designs relocated, minimum 3 required")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_designs_organization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_audit_organization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music designs audit and organization.
    Audit designs and move to consolidated folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Search for Live Music designs
        live_music_designs = _find_designs_by_title_pattern(backend, "Live Music")

        if len(live_music_designs) < 1:
            errors.append(f"[X] Found {len(live_music_designs)} Live Music designs")
        else:
            checks_passed.append(f"[OK] Found {len(live_music_designs)} Live Music designs")

        # Audit each design
        for design in live_music_designs:
            title = design.get("title", "Unknown")

            # Get elements
            elements = _get_elements_for_design(backend, design.get("_id"))
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] '{title}' element counts: {type_counts}")

            # Check dimensions
            width = design.get("width", 0)
            height = design.get("height", 0)
            checks_passed.append(f"[OK] '{title}' dimensions: {width}x{height}")

        # Check folder structure
        target_folder = _find_folder_by_path(backend, "Brand Assets/Event Materials/Music Events")
        if not target_folder:
            errors.append("[X] Folder 'Brand Assets/Event Materials/Music Events' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Event Materials/Music Events' exists")
            target_folder_id = target_folder.get("_id")

            # Count how many are in target folder
            designs_in_target = 0
            for design in live_music_designs:
                if design.get("folderId") == target_folder_id:
                    designs_in_target += 1

            if designs_in_target >= 3:
                checks_passed.append(f"[OK] {designs_in_target} designs relocated (minimum 3 required)")
            else:
                errors.append(f"[X] Only {designs_in_target} designs relocated, minimum 3 required")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_audit_organization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_designs_reorganization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome designs reorganization.
    Create folder hierarchy with client subfolders and categorize designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder structure
        base_folder = _find_folder_by_path(backend, "Brand Assets/Welcome Designs/By Client")
        if not base_folder:
            errors.append("[X] Folder 'Brand Assets/Welcome Designs/By Client' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Welcome Designs/By Client' exists")

            # Check subfolders
            subfolder_names = ["Acme", "Starlight", "General"]
            subfolder_ids = {}

            for subfolder_name in subfolder_names:
                subfolder_path = f"Brand Assets/Welcome Designs/By Client/{subfolder_name}"
                subfolder = _find_folder_by_path(backend, subfolder_path)
                if subfolder:
                    checks_passed.append(f"[OK] Subfolder '{subfolder_name}' exists")
                    subfolder_ids[subfolder_name] = subfolder.get("_id")
                else:
                    errors.append(f"[X] Subfolder '{subfolder_name}' not found")

        # Search for Welcome designs
        welcome_designs = _find_designs_by_title_pattern(backend, "Welcome")

        if len(welcome_designs) < 1:
            errors.append(f"[X] Found {len(welcome_designs)} Welcome designs")
        else:
            checks_passed.append(f"[OK] Found {len(welcome_designs)} Welcome designs")

        # Check if designs are properly categorized
        categorized_count = 0
        for design in welcome_designs:
            title = design.get("title", "")
            folder_id = design.get("folderId")

            # Determine expected subfolder based on title
            if "(Acme)" in title and "Acme" in subfolder_ids:
                if folder_id == subfolder_ids["Acme"]:
                    checks_passed.append(f"[OK] '{title}' in Acme subfolder")
                    categorized_count += 1
            elif "(Starlight)" in title and "Starlight" in subfolder_ids:
                if folder_id == subfolder_ids["Starlight"]:
                    checks_passed.append(f"[OK] '{title}' in Starlight subfolder")
                    categorized_count += 1
            elif "General" in subfolder_ids:
                if folder_id == subfolder_ids["General"]:
                    checks_passed.append(f"[OK] '{title}' in General subfolder")
                    categorized_count += 1

        if categorized_count >= 3:
            checks_passed.append(f"[OK] {categorized_count} designs properly categorized (minimum 3 required)")
        else:
            errors.append(f"[X] Only {categorized_count} designs categorized, minimum 3 required")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_designs_reorganization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Design Transformation Task Reward Functions
# ==============================================================================
def _validate_tech_conference_header_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Conference Header resize transformation.
    Verify design resized to 1600x400 with format changed to custom.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_exact_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Tech Conference Header' found")

        # Check new dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1600, 400)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        actual_format = design.get("format", "")
        if actual_format == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{actual_format}', expected 'custom'")

        # Get elements to verify preservation
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements preserved")

            # Check text elements
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] {len(text_elements)} text elements preserved")

            # Check shadow effects
            shadow_elements = _get_elements_with_shadow(elements)
            if shadow_elements:
                checks_passed.append(f"[OK] {len(shadow_elements)} shadow effects preserved")
        else:
            errors.append("[X] Design has no elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_tech_conference_header_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# New Dzaka Tasks - Design Creation Functions
# ==============================================================================
def _validate_techstart_project_structure_assets_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStart Inc folder hierarchy with logo and business card.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Client Work/TechStart Inc/Brand Assets/Social Media")
        if not folder:
            errors.append("[X] Folder 'Client Work/TechStart Inc/Brand Assets/Social Media' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/TechStart Inc/Brand Assets/Social Media' exists")

        print_folder = _find_folder_by_path(backend, "Client Work/TechStart Inc/Brand Assets/Print Materials")
        if not print_folder:
            errors.append("[X] Folder 'Client Work/TechStart Inc/Brand Assets/Print Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/TechStart Inc/Brand Assets/Print Materials' exists")

        # Check logo design
        logo = _find_design_by_exact_title(backend, "TechStart Logo Primary")
        if not logo:
            errors.append("[X] Design 'TechStart Logo Primary' not found")
        else:
            checks_passed.append("[OK] Design 'TechStart Logo Primary' found")

            ok, msg = _check_design_dimensions_detailed(logo, 500, 500)
            if ok:
                checks_passed.append(f"[OK] Logo - {msg}")
            else:
                errors.append(f"[X] Logo - {msg}")

            if folder and logo.get("folderId") == folder.get("_id"):
                checks_passed.append("[OK] Logo in Social Media folder")
            else:
                errors.append("[X] Logo not in Social Media folder")

        # Check business card
        card = _find_design_by_exact_title(backend, "TechStart Business Card - CEO")
        if not card:
            errors.append("[X] Design 'TechStart Business Card - CEO' not found")
        else:
            checks_passed.append("[OK] Design 'TechStart Business Card - CEO' found")

            ok, msg = _check_design_dimensions_detailed(card, 1050, 600)
            if ok:
                checks_passed.append(f"[OK] Business card - {msg}")
            else:
                errors.append(f"[X] Business card - {msg}")

            if print_folder and card.get("folderId") == print_folder.get("_id"):
                checks_passed.append("[OK] Business card in Print Materials folder")
            else:
                errors.append("[X] Business card not in Print Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_project_structure_assets_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techflow_innovations_brand_assets_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechFlow Innovations brand assets: logo, business card, A4 document.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "TechFlow Logo - Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "TechFlow Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "TechFlow Document Template", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        # Check folder structure
        folder = _find_folder_by_path(backend, "Brand Assets/TechFlow Innovations/2026 Rebrand")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/TechFlow Innovations/2026 Rebrand' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/TechFlow Innovations/2026 Rebrand' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techflow_innovations_brand_assets_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_greentech_solutions_brand_package_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate GreenTech Solutions brand package: logo, business card, letterhead, poster.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "GreenTech Logo", "width": 500, "height": 500, "format": "logo"},
            {"title": "GreenTech Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "GreenTech Letterhead", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "GreenTech Event Poster", "width": 1080, "height": 1920, "format": "poster"},
        ]

        # Check folder structure
        folder = _find_folder_by_path(backend, "Brand Assets/GreenTech Solutions/Complete Package")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/GreenTech Solutions/Complete Package' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/GreenTech Solutions/Complete Package' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_greentech_solutions_brand_package_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_ecotech_pro_launch_assets_organize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate EcoTech Pro launch assets with Digital and Print folder organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        digital_folder = _find_folder_by_path(backend, "Campaigns/EcoTech Pro/Launch Assets/Digital")
        print_folder = _find_folder_by_path(backend, "Campaigns/EcoTech Pro/Launch Assets/Print")

        if not digital_folder:
            errors.append("[X] Folder 'Campaigns/EcoTech Pro/Launch Assets/Digital' not found")
        else:
            checks_passed.append("[OK] Folder 'Campaigns/EcoTech Pro/Launch Assets/Digital' exists")

        if not print_folder:
            errors.append("[X] Folder 'Campaigns/EcoTech Pro/Launch Assets/Print' not found")
        else:
            checks_passed.append("[OK] Folder 'Campaigns/EcoTech Pro/Launch Assets/Print' exists")

        # Digital designs
        digital_designs = [
            {"title": "EcoTech Pro Story", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "EcoTech Pro Facebook", "width": 1200, "height": 630, "format": "facebook-post"},
        ]

        for spec in digital_designs:
            design = _find_design_by_exact_title(backend, spec["title"])
            if not design:
                errors.append(f"[X] Design '{spec['title']}' not found")
                continue

            checks_passed.append(f"[OK] Design '{spec['title']}' found")

            ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
            if ok:
                checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
            else:
                errors.append(f"[X] '{spec['title']}' - {msg}")

            ok, msg = _check_design_format_detailed(design, spec["format"])
            if ok:
                checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
            else:
                errors.append(f"[X] '{spec['title']}' - {msg}")

            if digital_folder and design.get("folderId") == digital_folder.get("_id"):
                checks_passed.append(f"[OK] '{spec['title']}' in Digital folder")
            else:
                errors.append(f"[X] '{spec['title']}' not in Digital folder")

        # Print designs
        print_designs = [
            {"title": "EcoTech Pro Flyer", "width": 2480, "height": 3508, "format": "flyer"},
            {"title": "EcoTech Pro Info Sheet", "width": 2480, "height": 3508, "format": "a4-document"},
        ]

        for spec in print_designs:
            design = _find_design_by_exact_title(backend, spec["title"])
            if not design:
                errors.append(f"[X] Design '{spec['title']}' not found")
                continue

            checks_passed.append(f"[OK] Design '{spec['title']}' found")

            ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
            if ok:
                checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
            else:
                errors.append(f"[X] '{spec['title']}' - {msg}")

            if print_folder and design.get("folderId") == print_folder.get("_id"):
                checks_passed.append(f"[OK] '{spec['title']}' in Print folder")
            else:
                errors.append(f"[X] '{spec['title']}' not in Print folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_ecotech_pro_launch_assets_organize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techlaunch_social_campaign_create_verify_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechLaunch social media campaign with text verification.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "TechLaunch - Instagram", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "TechLaunch - Twitter", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "TechLaunch - LinkedIn", "width": 1584, "height": 396, "format": "linkedin-banner"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Product Launch Campaign")
        if not folder:
            errors.append("[X] Folder 'Product Launch Campaign' not found")
        else:
            checks_passed.append("[OK] Folder 'Product Launch Campaign' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

                # Verify text contains "TechLaunch"
                elements = _get_elements_for_design(backend, design.get("_id"))

                if _has_element_with_content(elements, "TechLaunch"):
                    checks_passed.append(f"[OK] '{spec['title']}' contains 'TechLaunch' text")
                else:
                    errors.append(f"[X] '{spec['title']}' does not contain 'TechLaunch' text")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techlaunch_social_campaign_create_verify_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_january_newsletter_multi_format_suite_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate January Newsletter multi-format suite with 5 designs total.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check original A4 document
        original = _find_design_by_exact_title(backend, "January Newsletter")
        if original:
            checks_passed.append("[OK] Original 'January Newsletter' found")
        else:
            errors.append("[X] Original 'January Newsletter' not found")

        # Check new formats
        new_designs = [
            {"title": "January Newsletter - Instagram", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "January Newsletter - Facebook", "width": 1200, "height": 630, "format": "facebook-post"},
            {"title": "January Newsletter - Twitter", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "January Newsletter - LinkedIn", "width": 1584, "height": 396, "format": "linkedin-banner"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Docs/Newsletter Formats")
        if not folder:
            errors.append("[X] Folder 'Personal/Docs/Newsletter Formats' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Docs/Newsletter Formats' exists")
            folder_id = folder.get("_id")

            # Check original in folder
            if original and original.get("folderId") == folder_id:
                checks_passed.append("[OK] Original newsletter in Newsletter Formats folder")

            # Check each new design
            for spec in new_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_january_newsletter_multi_format_suite_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_video_series_ep1_package_create_verify_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Video Series Ep 1 package with text content verification.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Video Series Ep 1 Thumbnail", "width": 1280, "height": 720, "format": "youtube-thumbnail"},
            {"title": "Video Series Ep 1 Story", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "Video Series Ep 1 Post", "width": 1200, "height": 630, "format": "facebook-post"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Video/Series Content")
        if not folder:
            errors.append("[X] Folder 'Personal/Video/Series Content' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Video/Series Content' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

                # Verify text content exists
                elements = _get_elements_for_design(backend, design.get("_id"))
                text_elements = _get_text_elements_from_list(elements)

                if text_elements:
                    checks_passed.append(f"[OK] '{spec['title']}' has text content ({len(text_elements)} text elements)")
                else:
                    errors.append(f"[X] '{spec['title']}' has no text content")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_video_series_ep1_package_create_verify_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_summer_sale_2026_template_series_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Summer Sale 2026 multi-platform template series (5 designs).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Summer Sale - Instagram Square", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Summer Sale - Instagram Vertical", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "Summer Sale - Facebook Landscape", "width": 1200, "height": 630, "format": "facebook-post"},
            {"title": "Summer Sale - Twitter Cover", "width": 1500, "height": 500, "format": "twitter-header"},
            {"title": "Summer Sale - YouTube Thumb", "width": 1280, "height": 720, "format": "youtube-thumbnail"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Social Media/Summer Campaign/Templates")
        if not folder:
            errors.append("[X] Folder 'Personal/Social Media/Summer Campaign/Templates' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Social Media/Summer Campaign/Templates' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_summer_sale_2026_template_series_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_coffee_shop_brand_identity_package_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Coffee Shop brand identity package (4 designs).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "CoffeeShop Logo", "width": 500, "height": 500, "format": "logo"},
            {"title": "CoffeeShop Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "CoffeeShop Grand Opening Poster", "width": 1080, "height": 1920, "format": "poster"},
            {"title": "CoffeeShop Story - Opening", "width": 1080, "height": 1920, "format": "instagram-story"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Identity/Coffee Shop Startup")
        if not folder:
            errors.append("[X] Folder 'Brand Identity/Coffee Shop Startup' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Identity/Coffee Shop Startup' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_coffee_shop_brand_identity_package_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_brand_asset_set_create_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight Studio brand asset set (4 designs).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Starlight Logo Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "Starlight Business Card", "width": 1050, "height": 600, "format": "business-card"},
            {"title": "Starlight Brand Post", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Starlight Channel Art", "width": 1280, "height": 720, "format": "youtube-thumbnail"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/Social")
        if not folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio/Social' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Starlight Studio/Social' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_brand_asset_set_create_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_summit_tech_q1_newsletter_suite_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Summit Tech Q1 newsletter suite (3 designs).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Summit Tech Q1 Newsletter", "width": 2480, "height": 3508, "format": "a4-document"},
            {"title": "Newsletter Preview Story", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "Read Our Newsletter", "width": 1200, "height": 630, "format": "facebook-post"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Publications/Q1 2026/Newsletter Suite")
        if not folder:
            errors.append("[X] Folder 'Publications/Q1 2026/Newsletter Suite' not found")
        else:
            checks_passed.append("[OK] Folder 'Publications/Q1 2026/Newsletter Suite' exists")
            folder_id = folder.get("_id")

            # Check each design
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                else:
                    errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_summit_tech_q1_newsletter_suite_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Resize Operation Functions
# ==============================================================================
def _validate_resize_tech_conference_header_instagram_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Conference Header resized to Instagram square (1080x1080).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Tech Conference Header' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1080, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify text elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if text_elements:
            checks_passed.append(f"[OK] Text content preserved ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_resize_tech_conference_header_instagram_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_alice_chen_business_card_banner_move_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Alice Chen business card resized to banner (1600x400) and moved to folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Business Card — Alice Chen")
        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1600, 400)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify text elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if text_elements:
            checks_passed.append(f"[OK] Text content preserved ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/Team/Alice Chen/Banners")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Team/Alice Chen/Banners' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Team/Alice Chen/Banners' exists")

            if design.get("folderId") == folder.get("_id"):
                checks_passed.append("[OK] Design moved to Banners folder")
            else:
                errors.append("[X] Design not in Banners folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_alice_chen_business_card_banner_move_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_alice_chen_card_to_slide_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Alice Chen business card resized to presentation slide (1920x1080).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Business Card — Alice Chen")
        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify text elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if text_elements:
            checks_passed.append(f"[OK] Text content extracted ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_alice_chen_card_to_slide_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_night_poster_web_banner_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resized to web banner (1920x600).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1920, 600)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify text elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if text_elements:
            checks_passed.append(f"[OK] Text content preserved ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_night_poster_web_banner_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_january_newsletter_web_banner_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate January Newsletter resized to web banner (1600x400).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "January Newsletter")
        if not design:
            errors.append("[X] Design 'January Newsletter' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'January Newsletter' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1600, 400)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify at least 2 text elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if len(text_elements) >= 2:
            checks_passed.append(f"[OK] At least 2 text elements preserved ({len(text_elements)} text elements)")
        else:
            errors.append(f"[X] Only {len(text_elements)} text elements found, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_january_newsletter_web_banner_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_alice_chen_card_postcard_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Alice Chen business card resized to postcard (1400x900).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Business Card — Alice Chen")
        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1400, 900)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify text elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if text_elements:
            checks_passed.append(f"[OK] Text content preserved and documented ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_alice_chen_card_postcard_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Folder Organization Functions
# ==============================================================================
def _validate_reorganize_welcome_and_conference_designs_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome and Conference designs reorganization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Welcome Posts folder
        welcome_folder = _find_folder_by_path(backend, "Personal/Archive/Welcome Posts")
        if not welcome_folder:
            errors.append("[X] Folder 'Personal/Archive/Welcome Posts' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Archive/Welcome Posts' exists")

            # Count Welcome designs in folder
            designs = _get_designs_in_folder(backend, welcome_folder.get("_id"))
            welcome_designs = [d for d in designs if "welcome" in d.get("title", "").lower()]

            if len(welcome_designs) >= 2:
                checks_passed.append(f"[OK] At least 2 Welcome designs moved ({len(welcome_designs)} found)")
            else:
                errors.append(f"[X] Only {len(welcome_designs)} Welcome designs found, expected at least 2")

        # Check Conference Materials folder
        conf_folder = _find_folder_by_path(backend, "Personal/Events/Conference Materials")
        if not conf_folder:
            errors.append("[X] Folder 'Personal/Events/Conference Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Events/Conference Materials' exists")

            # Count Conference designs in folder
            designs = _get_designs_in_folder(backend, conf_folder.get("_id"))
            conf_designs = [d for d in designs if "conference" in d.get("title", "").lower()]

            if len(conf_designs) >= 1:
                checks_passed.append(f"[OK] At least 1 Conference design moved ({len(conf_designs)} found)")
            else:
                errors.append("[X] No Conference designs found, expected at least 1")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_reorganize_welcome_and_conference_designs_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_platform_specific_social_media_reorg_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate platform-specific social media reorganization by format type.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        base_path = "Organization/Content Types/Social Media/Platform Specific"

        # Check folder structure
        folders = {
            "Instagram": _find_folder_by_path(backend, f"{base_path}/Instagram"),
            "Facebook": _find_folder_by_path(backend, f"{base_path}/Facebook"),
            "LinkedIn": _find_folder_by_path(backend, f"{base_path}/LinkedIn"),
            "X-Twitter": _find_folder_by_path(backend, f"{base_path}/X-Twitter"),
            "YouTube": _find_folder_by_path(backend, f"{base_path}/YouTube"),
        }

        for platform, folder in folders.items():
            if not folder:
                errors.append(f"[X] Folder '{base_path}/{platform}' not found")
            else:
                checks_passed.append(f"[OK] Folder '{base_path}/{platform}' exists")

        # Check Instagram folder (should have 3 instagram-post + 1 instagram-story = 4 total)
        if folders["Instagram"]:
            designs = _get_designs_in_folder(backend, folders["Instagram"].get("_id"))
            instagram_post = [d for d in designs if d.get("format") == "instagram-post"]
            instagram_story = [d for d in designs if d.get("format") == "instagram-story"]

            if len(instagram_post) == 3:
                checks_passed.append("[OK] Instagram folder has 3 instagram-post designs")
            else:
                errors.append(f"[X] Instagram folder has {len(instagram_post)} instagram-post designs, expected 3")

            if len(instagram_story) == 1:
                checks_passed.append("[OK] Instagram folder has 1 instagram-story design")
            else:
                errors.append(f"[X] Instagram folder has {len(instagram_story)} instagram-story designs, expected 1")

        # Check Facebook folder (should have 1 facebook-post)
        if folders["Facebook"]:
            designs = _get_designs_in_folder(backend, folders["Facebook"].get("_id"))
            facebook_post = [d for d in designs if d.get("format") == "facebook-post"]

            if len(facebook_post) == 1:
                checks_passed.append("[OK] Facebook folder has 1 facebook-post design")
            else:
                errors.append(f"[X] Facebook folder has {len(facebook_post)} facebook-post designs, expected 1")

        # Check LinkedIn folder (should have 1 linkedin-banner)
        if folders["LinkedIn"]:
            designs = _get_designs_in_folder(backend, folders["LinkedIn"].get("_id"))
            linkedin_banner = [d for d in designs if d.get("format") == "linkedin-banner"]

            if len(linkedin_banner) == 1:
                checks_passed.append("[OK] LinkedIn folder has 1 linkedin-banner design")
            else:
                errors.append(f"[X] LinkedIn folder has {len(linkedin_banner)} linkedin-banner designs, expected 1")

        # Check X-Twitter folder (should have 1 twitter-header)
        if folders["X-Twitter"]:
            designs = _get_designs_in_folder(backend, folders["X-Twitter"].get("_id"))
            twitter_header = [d for d in designs if d.get("format") == "twitter-header"]

            if len(twitter_header) == 1:
                checks_passed.append("[OK] X-Twitter folder has 1 twitter-header design")
            else:
                errors.append(f"[X] X-Twitter folder has {len(twitter_header)} twitter-header designs, expected 1")

        # Check YouTube folder (should have 1 youtube-thumbnail)
        if folders["YouTube"]:
            designs = _get_designs_in_folder(backend, folders["YouTube"].get("_id"))
            youtube_thumbnail = [d for d in designs if d.get("format") == "youtube-thumbnail"]

            if len(youtube_thumbnail) == 1:
                checks_passed.append("[OK] YouTube folder has 1 youtube-thumbnail design")
            else:
                errors.append(f"[X] YouTube folder has {len(youtube_thumbnail)} youtube-thumbnail designs, expected 1")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_platform_specific_social_media_reorg_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_designs_move_extract_text_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference designs moved to Tech Events folder with text extraction.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Events/Conferences/Tech Events")
        if not folder:
            errors.append("[X] Folder 'Events/Conferences/Tech Events' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Events/Conferences/Tech Events' exists")

        # Get designs in folder
        designs = _get_designs_in_folder(backend, folder.get("_id"))
        conf_designs = [d for d in designs if "conference" in d.get("title", "").lower()]

        if len(conf_designs) >= 3:
            checks_passed.append(f"[OK] At least 3 Conference designs moved ({len(conf_designs)} found)")
        else:
            errors.append(f"[X] Only {len(conf_designs)} Conference designs found, expected at least 3")

        # Check specific designs
        expected_titles = ["Tech Conference Header", "Tech Conference Header (Acme)", "Tech Conference Header (Starlight)"]
        for title in expected_titles:
            design = _find_design_by_exact_title(backend, title)
            if design and design.get("folderId") == folder.get("_id"):
                checks_passed.append(f"[OK] '{title}' in Tech Events folder")

                # Extract text content
                elements = _get_elements_for_design(backend, design.get("_id"))
                text_elements = _get_text_elements_from_list(elements)

                if text_elements:
                    checks_passed.append(f"[OK] '{title}' text content extracted ({len(text_elements)} elements)")
                else:
                    errors.append(f"[X] '{title}' has no text content")
            else:
                errors.append(f"[X] '{title}' not found or not in Tech Events folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_designs_move_extract_text_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_designs_by_format_archive_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome designs organized by format into subfolders.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Welcome designs
        all_designs = backend.query({"collection": "designs", "filter": {}})
        if not isinstance(all_designs, list):
            all_designs = []

        welcome_designs = [d for d in all_designs if "welcome" in d.get("title", "").lower()]

        if not welcome_designs:
            errors.append("[X] No Welcome designs found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Found {len(welcome_designs)} Welcome designs")

        # Check base folder
        base_folder = _find_folder_by_path(backend, "Archive/Welcome Designs/By Format")
        if not base_folder:
            errors.append("[X] Folder 'Archive/Welcome Designs/By Format' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Archive/Welcome Designs/By Format' exists")

        # Group designs by format
        format_counts = {}
        for design in welcome_designs:
            fmt = design.get("format", "unknown")
            format_counts[fmt] = format_counts.get(fmt, 0) + 1

        # Check that designs are in format-specific subfolders
        moved_count = 0
        for fmt, count in format_counts.items():
            # Try to find format subfolder
            format_folder = _find_folder_by_path(backend, f"Archive/Welcome Designs/By Format/{fmt}")
            if format_folder:
                designs_in_folder = _get_designs_in_folder(backend, format_folder.get("_id"))
                welcome_in_folder = [d for d in designs_in_folder if "welcome" in d.get("title", "").lower()]
                moved_count += len(welcome_in_folder)
                checks_passed.append(f"[OK] {len(welcome_in_folder)} Welcome {fmt} designs in format subfolder")

        if moved_count >= len(welcome_designs):
            checks_passed.append("[OK] All Welcome designs moved to format-specific subfolders")
        else:
            errors.append(f"[X] Only {moved_count}/{len(welcome_designs)} Welcome designs moved to format subfolders")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_designs_by_format_archive_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_archive_starlight_projects_consolidate_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate all Starlight designs moved to consolidated archive folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Archive/2026/Starlight Projects")
        if not folder:
            errors.append("[X] Folder 'Archive/2026/Starlight Projects' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Archive/2026/Starlight Projects' exists")

        # Get designs in folder
        designs = _get_designs_in_folder(backend, folder.get("_id"))
        starlight_designs = [d for d in designs if "starlight" in d.get("title", "").lower()]

        if len(starlight_designs) >= 6:
            checks_passed.append(f"[OK] At least 6 Starlight designs in folder ({len(starlight_designs)} found)")
        else:
            errors.append(f"[X] Only {len(starlight_designs)} Starlight designs found, expected at least 6")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_archive_starlight_projects_consolidate_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_brand_assets_acme_starlight_organize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme and Starlight designs organized into brand folders.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Acme folder
        acme_folder = _find_folder_by_path(backend, "Brand Assets/Acme Corp/2026/Visual Identity")
        if not acme_folder:
            errors.append("[X] Folder 'Brand Assets/Acme Corp/2026/Visual Identity' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Acme Corp/2026/Visual Identity' exists")

            # Count Acme designs
            designs = _get_designs_in_folder(backend, acme_folder.get("_id"))
            acme_designs = [d for d in designs if "acme" in d.get("title", "").lower()]

            if acme_designs:
                checks_passed.append(f"[OK] {len(acme_designs)} Acme designs in Visual Identity folder")
            else:
                errors.append("[X] No Acme designs in Visual Identity folder")

        # Check Starlight folder
        starlight_folder = _find_folder_by_path(backend, "Brand Assets/Starlight Studio/2026/Assets")
        if not starlight_folder:
            errors.append("[X] Folder 'Brand Assets/Starlight Studio/2026/Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Starlight Studio/2026/Assets' exists")

            # Count Starlight designs
            designs = _get_designs_in_folder(backend, starlight_folder.get("_id"))
            starlight_designs = [d for d in designs if "starlight" in d.get("title", "").lower()]

            if starlight_designs:
                checks_passed.append(f"[OK] {len(starlight_designs)} Starlight designs in Assets folder")
            else:
                errors.append("[X] No Starlight designs in Assets folder")

        # Check total count
        total_organized = 0
        if acme_folder:
            designs = _get_designs_in_folder(backend, acme_folder.get("_id"))
            total_organized += len([d for d in designs if "acme" in d.get("title", "").lower()])
        if starlight_folder:
            designs = _get_designs_in_folder(backend, starlight_folder.get("_id"))
            total_organized += len([d for d in designs if "starlight" in d.get("title", "").lower()])

        if total_organized >= 5:
            checks_passed.append(f"[OK] At least 5 designs organized total ({total_organized} found)")
        else:
            errors.append(f"[X] Only {total_organized} designs organized, expected at least 5")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_assets_acme_starlight_organize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_hr_resources_hiring_banner_organize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate HR resources folder organization with hiring/banner designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        linkedin_folder = _find_folder_by_path(backend, "HR Resources/Recruitment/LinkedIn Banners")
        other_folder = _find_folder_by_path(backend, "HR Resources/Recruitment/Other Formats")
        onboarding_folder = _find_folder_by_path(backend, "HR Resources/Onboarding")
        templates_folder = _find_folder_by_path(backend, "HR Resources/Templates")

        if not linkedin_folder:
            errors.append("[X] Folder 'HR Resources/Recruitment/LinkedIn Banners' not found")
        else:
            checks_passed.append("[OK] Folder 'HR Resources/Recruitment/LinkedIn Banners' exists")

            # Count linkedin-banner designs
            designs = _get_designs_in_folder(backend, linkedin_folder.get("_id"))
            linkedin_banners = [d for d in designs if d.get("format") == "linkedin-banner"]

            if len(linkedin_banners) == 3:
                checks_passed.append("[OK] 3 linkedin-banner designs in LinkedIn Banners folder")
            else:
                errors.append(f"[X] {len(linkedin_banners)} linkedin-banner designs found, expected 3")

        if not other_folder:
            errors.append("[X] Folder 'HR Resources/Recruitment/Other Formats' not found")
        else:
            checks_passed.append("[OK] Folder 'HR Resources/Recruitment/Other Formats' exists")

            # Count other format designs
            designs = _get_designs_in_folder(backend, other_folder.get("_id"))

            if len(designs) >= 1:
                checks_passed.append("[OK] At least 1 design in Other Formats folder")
            else:
                errors.append("[X] No designs in Other Formats folder")

        if not onboarding_folder:
            errors.append("[X] Folder 'HR Resources/Onboarding' not found")
        else:
            checks_passed.append("[OK] Folder 'HR Resources/Onboarding' exists")

        if not templates_folder:
            errors.append("[X] Folder 'HR Resources/Templates' not found")
        else:
            checks_passed.append("[OK] Folder 'HR Resources/Templates' exists")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_hr_resources_hiring_banner_organize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_assets_reorg_guidelines_presentation_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight assets reorganization with content extraction and new presentation.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Flash Sale Story content extraction
        flash_sale = _find_design_by_exact_title(backend, "Flash Sale Story (Starlight)")
        if flash_sale:
            checks_passed.append("[OK] 'Flash Sale Story (Starlight)' found")

            # Get elements and count by type
            elements = _get_elements_for_design(backend, flash_sale.get("_id"))
            if elements:
                element_counts = _count_elements_by_type(elements)
                checks_passed.append(f"[OK] Flash Sale Story element counts extracted ({len(elements)} total elements)")

                # Extract text content
                text_elements = _get_text_elements_from_list(elements)
                if text_elements:
                    checks_passed.append(f"[OK] Flash Sale Story text content extracted ({len(text_elements)} text elements)")
                else:
                    errors.append("[X] Flash Sale Story has no text content")
            else:
                errors.append("[X] Flash Sale Story has no elements")
        else:
            errors.append("[X] 'Flash Sale Story (Starlight)' not found")

        # Check folder
        folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/Social Assets/Stories and Posts")
        if not folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio/Social Assets/Stories and Posts' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Starlight Studio/Social Assets/Stories and Posts' exists")

            # Count Starlight designs moved
            designs = _get_designs_in_folder(backend, folder.get("_id"))
            starlight_designs = [d for d in designs if "starlight" in d.get("title", "").lower()]

            if starlight_designs:
                checks_passed.append(f"[OK] {len(starlight_designs)} Starlight designs moved to folder")
            else:
                errors.append("[X] No Starlight designs in target folder")

        # Check new presentation
        presentation = _find_design_by_exact_title(backend, "Starlight Brand Guidelines")
        if not presentation:
            errors.append("[X] 'Starlight Brand Guidelines' presentation not found")
        else:
            checks_passed.append("[OK] 'Starlight Brand Guidelines' presentation found")

            ok, msg = _check_design_dimensions_detailed(presentation, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] Presentation - {msg}")
            else:
                errors.append(f"[X] Presentation - {msg}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_assets_reorg_guidelines_presentation_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Content Analysis Functions
# ==============================================================================
def _validate_acme_q1_strategy_deck_element_report_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme Q1 Strategy Deck element-level analysis report.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if not design:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Acme Q1 Strategy Deck' found")

        # Verify dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] No elements found in design")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[OK] Design has {len(elements)} elements")

        # Count elements by type
        element_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element type counts: {element_counts}")

        # Identify text elements with bold formatting
        text_elements = _get_text_elements_from_list(elements)
        bold_count = 0
        for elem in text_elements:
            segments = elem.get("textSegments", [])
            for seg in segments:
                if seg.get("fontWeight") == "bold":
                    bold_count += 1

        if bold_count > 0:
            checks_passed.append(f"[OK] Found {bold_count} text segments with bold formatting")
        else:
            checks_passed.append("[OK] No bold text segments found")

        # List unique shape types
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        shape_types = set()
        for elem in shape_elements:
            shape_type = elem.get("shapeType")
            if shape_type:
                shape_types.add(shape_type)

        if shape_types:
            checks_passed.append(f"[OK] Unique shape types: {sorted(shape_types)}")
        else:
            checks_passed.append("[OK] No shape elements found")

        # Document shadow effects
        shadow_elements = _get_elements_with_shadow(elements)
        checks_passed.append(f"[OK] {len(shadow_elements)} elements with shadow effects")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_q1_strategy_deck_element_report_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_night_poster_element_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster element analysis with z-index, shapes, opacity, shadows.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        # Verify dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1080, 1920)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] No elements found in design")
            return _make_task_score(errors, checks_passed)

        # Count elements by type
        element_counts = _count_elements_by_type(elements)
        checks_passed.append(f"[OK] Element counts by type: {element_counts}")

        # Get z-index range
        z_indices = [e.get("zIndex", 0) for e in elements]
        if z_indices:
            min_z = min(z_indices)
            max_z = max(z_indices)
            checks_passed.append(f"[OK] Z-index range: {min_z} to {max_z}")

        # List unique shape types
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        shape_types = set()
        for elem in shape_elements:
            shape_type = elem.get("shapeType")
            if shape_type:
                shape_types.add(shape_type)

        if shape_types:
            checks_passed.append(f"[OK] Unique shape types: {sorted(shape_types)}")
        else:
            checks_passed.append("[OK] No shape elements found")

        # Document opacity values
        opacity_values = set()
        for elem in elements:
            opacity = elem.get("opacity")
            if opacity is not None:
                opacity_values.add(opacity)

        checks_passed.append(f"[OK] Opacity values documented: {sorted(opacity_values)}")

        # Count shadow effects
        shadow_elements = _get_elements_with_shadow(elements)
        checks_passed.append(f"[OK] {len(shadow_elements)} elements with shadow effects")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_night_poster_element_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_story_detailed_element_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Flash Sale Story detailed element analysis with shadows, opacity, shapes, text+fonts, z-index ranges.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Flash Sale Story")
        if not design:
            errors.append("[X] Design 'Flash Sale Story' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Flash Sale Story' found")

        # Verify dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1080, 1920)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if not elements:
            errors.append("[X] No elements found in design")
            return _make_task_score(errors, checks_passed)

        # Count elements with shadows
        shadow_elements = _get_elements_with_shadow(elements)
        checks_passed.append(f"[OK] {len(shadow_elements)} elements with shadows enabled")

        # Identify elements with opacity < 1.0
        low_opacity = [e for e in elements if e.get("opacity") is not None and e.get("opacity") < 1.0]
        checks_passed.append(f"[OK] {len(low_opacity)} elements with opacity < 1.0")

        # List shape types
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        shape_types = set()
        for elem in shape_elements:
            shape_type = elem.get("shapeType")
            if shape_type:
                shape_types.add(shape_type)

        if shape_types:
            checks_passed.append(f"[OK] Shape types used: {sorted(shape_types)}")
        else:
            checks_passed.append("[OK] No shape elements found")

        # Extract text content and font sizes
        text_elements = _get_text_elements_from_list(elements)
        if text_elements:
            font_sizes = set()
            text_count = 0
            for elem in text_elements:
                text_count += 1
                font_size = elem.get("fontSize")
                if font_size:
                    font_sizes.add(font_size)

            checks_passed.append(f"[OK] {text_count} text elements extracted")
            checks_passed.append(f"[OK] Font sizes used: {sorted(font_sizes)}")
        else:
            errors.append("[X] No text elements found")

        # Count elements by z-index ranges
        z_range_0_5 = len([e for e in elements if 0 <= e.get("zIndex", 0) <= 5])
        z_range_6_10 = len([e for e in elements if 6 <= e.get("zIndex", 0) <= 10])
        z_range_11_plus = len([e for e in elements if e.get("zIndex", 0) >= 11])

        checks_passed.append(f"[OK] Z-index distribution: 0-5: {z_range_0_5}, 6-10: {z_range_6_10}, 11+: {z_range_11_plus}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_story_detailed_element_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Mixed Operation Functions (Creation + Resize)
# ==============================================================================
def _validate_q2_strategy_overview_create_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 Strategy Overview created and then resized to webinar dimensions.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Q2 Strategy Overview 2026")
        if not design:
            errors.append("[X] Design 'Q2 Strategy Overview 2026' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Q2 Strategy Overview 2026' found")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Docs/Presentations")
        if not folder:
            errors.append("[X] Folder 'Personal/Docs/Presentations' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Docs/Presentations' exists")

            if design.get("folderId") == folder.get("_id"):
                checks_passed.append("[OK] Design in Presentations folder")
            else:
                errors.append("[X] Design not in Presentations folder")

        # Check final dimensions (should be resized to 1600x900)
        ok, msg = _check_design_dimensions_detailed(design, 1600, 900)
        if ok:
            checks_passed.append(f"[OK] Final dimensions - {msg}")
        else:
            errors.append(f"[X] Final dimensions - {msg}")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Verify elements exist (content extraction)
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements (content extracted)")
        else:
            errors.append("[X] No elements found in design")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q2_strategy_overview_create_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_social_template_system_create_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate social template system with 3 base templates and Instagram template resized.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        expected_designs = [
            {"title": "Template Base - Instagram", "width": 1080, "height": 1080, "format": "instagram-post"},
            {"title": "Template Base - Facebook", "width": 1200, "height": 630, "format": "facebook-post"},
            {"title": "Template Base - Twitter", "width": 1500, "height": 500, "format": "twitter-header"},
        ]

        # Check folder
        folder = _find_folder_by_path(backend, "Template System/Social Media/Base Templates")
        if not folder:
            errors.append("[X] Folder 'Template System/Social Media/Base Templates' not found")
        else:
            checks_passed.append("[OK] Folder 'Template System/Social Media/Base Templates' exists")
            folder_id = folder.get("_id")

            # Check each base template
            for spec in expected_designs:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Design '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Design '{spec['title']}' found")

                # For Instagram template, check if it was resized to 800x800
                if spec["title"] == "Template Base - Instagram":
                    # Check if dimensions are 800x800 (resized) or 1080x1080 (original)
                    width = design.get("width")
                    height = design.get("height")

                    if width == 800 and height == 800:
                        checks_passed.append("[OK] Instagram template resized to 800x800")
                        if design.get("format") == "custom":
                            checks_passed.append("[OK] Instagram template format changed to 'custom'")
                        else:
                            errors.append(f"[X] Instagram template format is '{design.get('format')}', expected 'custom'")
                    elif width == 1080 and height == 1080:
                        # Original design exists but might not be resized yet
                        checks_passed.append("[OK] Instagram template has original dimensions 1080x1080")
                    else:
                        errors.append(f"[X] Instagram template has unexpected dimensions {width}x{height}")
                else:
                    # Check other templates
                    ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                    if ok:
                        checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                    else:
                        errors.append(f"[X] '{spec['title']}' - {msg}")

                    ok, msg = _check_design_format_detailed(design, spec["format"])
                    if ok:
                        checks_passed.append(f"[OK] '{spec['title']}' - {msg}")
                    else:
                        errors.append(f"[X] '{spec['title']}' - {msg}")

                if design.get("folderId") == folder_id:
                    checks_passed.append(f"[OK] '{spec['title']}' in correct folder")
                else:
                    errors.append(f"[X] '{spec['title']}' not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_social_template_system_create_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# New Reward Functions - Tasks 3 Tracker
# ==============================================================================

# Organization Tasks
# ==============================================================================
def _validate_acme_strategic_reorganization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate strategic reorganization of all Acme-related designs.
    Creates folder structure 'Client Work/Acme Corp/2026/Final Assets' with 'Logo Concepts' subfolder,
    searches for Acme designs, moves them to Final Assets, and moves 'Acme Logo Concepts' specifically to subfolder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy exists
        final_assets_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/2026/Final Assets")
        if not final_assets_folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/2026/Final Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Acme Corp/2026/Final Assets' exists")
            final_assets_id = final_assets_folder.get("_id")

            # Check Logo Concepts subfolder exists
            logo_concepts_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/2026/Final Assets/Logo Concepts")
            if not logo_concepts_folder:
                errors.append("[X] Subfolder 'Logo Concepts' not found under Final Assets")
            else:
                checks_passed.append("[OK] Subfolder 'Logo Concepts' exists")
                logo_concepts_id = logo_concepts_folder.get("_id")

                # Find all designs with 'Acme' in title
                acme_designs = _find_designs_by_title_pattern(backend, "Acme")
                if not acme_designs:
                    errors.append("[X] No designs with 'Acme' in title found")
                else:
                    checks_passed.append(f"[OK] Found {len(acme_designs)} designs with 'Acme' in title")

                    # Count designs in Final Assets folder (excluding Logo Concepts subfolder)
                    designs_in_final_assets = 0
                    acme_logo_concepts_in_subfolder = False

                    for design in acme_designs:
                        title = design.get("title", "")
                        folder_id = design.get("folderId")

                        # Check if 'Acme Logo Concepts' is in Logo Concepts subfolder
                        if "Acme Logo Concepts" in title:
                            if folder_id == logo_concepts_id:
                                acme_logo_concepts_in_subfolder = True
                                checks_passed.append(f"[OK] '{title}' in Logo Concepts subfolder")
                            else:
                                errors.append(f"[X] '{title}' not in Logo Concepts subfolder")
                        # Other Acme designs should be in Final Assets or Logo Concepts
                        elif folder_id == final_assets_id:
                            designs_in_final_assets += 1
                        elif folder_id == logo_concepts_id:
                            designs_in_final_assets += 1  # Count designs in subfolder too

                    # Check minimum 8 designs with 'Acme' moved to Final Assets folder hierarchy
                    total_in_hierarchy = designs_in_final_assets + (1 if acme_logo_concepts_in_subfolder else 0)
                    if total_in_hierarchy >= 8:
                        checks_passed.append(f"[OK] At least 8 Acme designs in Final Assets hierarchy ({total_in_hierarchy} total)")
                    else:
                        errors.append(f"[X] Only {total_in_hierarchy} Acme designs in Final Assets hierarchy, expected at least 8")

                    if not acme_logo_concepts_in_subfolder:
                        errors.append("[X] 'Acme Logo Concepts' design not in Logo Concepts subfolder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_strategic_reorganization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_event_organization_calendar_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive event organization system.
    Searches for Conference/Event designs, organizes into 'Event Management/2026/All Events',
    and creates 'Master Event Calendar 2026' presentation.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        all_events_folder = _find_folder_by_path(backend, "Event Management/2026/All Events")
        if not all_events_folder:
            errors.append("[X] Folder 'Event Management/2026/All Events' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Event Management/2026/All Events' exists")
        folder_id = all_events_folder.get("_id")

        # Find designs with 'Conference' or 'Event' in title
        conference_designs = _find_designs_by_title_pattern(backend, "Conference")
        event_designs = _find_designs_by_title_pattern(backend, "Event")

        # Combine and deduplicate
        all_matching_designs = {d.get("_id"): d for d in conference_designs + event_designs}

        if not all_matching_designs:
            errors.append("[X] No designs with 'Conference' or 'Event' in title found")
        else:
            checks_passed.append(f"[OK] Found {len(all_matching_designs)} designs with 'Conference' or 'Event'")

            # Count designs in All Events folder
            designs_in_folder = 0
            for design in all_matching_designs.values():
                if design.get("folderId") == folder_id:
                    designs_in_folder += 1

            if designs_in_folder > 0:
                checks_passed.append(f"[OK] {designs_in_folder} matching designs moved to All Events folder")
            else:
                errors.append("[X] No matching designs in All Events folder")

        # Check for Master Event Calendar design
        calendar_design = _find_design_by_exact_title(backend, "Master Event Calendar 2026")
        if not calendar_design:
            errors.append("[X] Design 'Master Event Calendar 2026' not found")
        else:
            checks_passed.append("[OK] Design 'Master Event Calendar 2026' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(calendar_design, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] Master Event Calendar - {msg}")
            else:
                errors.append(f"[X] Master Event Calendar - {msg}")

            # Check format
            ok, msg = _check_design_format_detailed(calendar_design, "presentation")
            if ok:
                checks_passed.append(f"[OK] Master Event Calendar - {msg}")
            else:
                errors.append(f"[X] Master Event Calendar - {msg}")

            # Check if in correct folder
            if calendar_design.get("folderId") == folder_id:
                checks_passed.append("[OK] Master Event Calendar in All Events folder")
            else:
                errors.append("[X] Master Event Calendar not in All Events folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_event_organization_calendar_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_welcome_brand_assets_reorg_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate dual organization of Conference and Welcome designs.
    Moves Conference designs to 'Brand Assets > Events > Tech Conferences',
    and Welcome designs to 'Brand Assets > Welcome Assets'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check both folder paths
        tech_conf_folder = _find_folder_by_path(backend, "Brand Assets/Events/Tech Conferences")
        welcome_assets_folder = _find_folder_by_path(backend, "Brand Assets/Welcome Assets")

        if not tech_conf_folder:
            errors.append("[X] Folder 'Brand Assets/Events/Tech Conferences' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Events/Tech Conferences' exists")

        if not welcome_assets_folder:
            errors.append("[X] Folder 'Brand Assets/Welcome Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Welcome Assets' exists")

        if tech_conf_folder and welcome_assets_folder:
            tech_conf_id = tech_conf_folder.get("_id")
            welcome_id = welcome_assets_folder.get("_id")

            # Find Conference designs
            conference_designs = _find_designs_by_title_pattern(backend, "Conference")
            conference_in_folder = sum(1 for d in conference_designs if d.get("folderId") == tech_conf_id)

            if conference_in_folder >= 1:
                checks_passed.append(f"[OK] At least 1 Conference design in Tech Conferences folder ({conference_in_folder} found)")
            else:
                errors.append("[X] No Conference designs in Tech Conferences folder, expected at least 1")

            # Find Welcome designs
            welcome_designs = _find_designs_by_title_pattern(backend, "Welcome")
            welcome_in_folder = sum(1 for d in welcome_designs if d.get("folderId") == welcome_id)

            if welcome_in_folder >= 3:
                checks_passed.append(f"[OK] At least 3 Welcome designs in Welcome Assets folder ({welcome_in_folder} found)")
            else:
                errors.append(f"[X] Only {welcome_in_folder} Welcome designs in Welcome Assets folder, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_welcome_brand_assets_reorg_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_tech_conference_client_organization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate organization of Tech Conference designs into client folder structure.
    Moves all designs with 'Tech Conference' in title to 'Client Work > Conferences > Tech Events'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        tech_events_folder = _find_folder_by_path(backend, "Client Work/Conferences/Tech Events")
        if not tech_events_folder:
            errors.append("[X] Folder 'Client Work/Conferences/Tech Events' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Client Work/Conferences/Tech Events' exists")
        folder_id = tech_events_folder.get("_id")

        # Find designs with 'Tech Conference' in title
        tech_conf_designs = _find_designs_by_title_pattern(backend, "Tech Conference")

        if not tech_conf_designs:
            errors.append("[X] No designs with 'Tech Conference' in title found")
        else:
            checks_passed.append(f"[OK] Found {len(tech_conf_designs)} designs with 'Tech Conference'")

            # Count designs in Tech Events folder
            designs_in_folder = sum(1 for d in tech_conf_designs if d.get("folderId") == folder_id)

            if designs_in_folder >= 3:
                checks_passed.append(f"[OK] At least 3 Tech Conference designs in Tech Events folder ({designs_in_folder} total)")
            else:
                errors.append(f"[X] Only {designs_in_folder} Tech Conference designs in Tech Events folder, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_tech_conference_client_organization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_campaigns_q1_social_media_reorg_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive workspace reorganization with 5-level folder hierarchy.
    Moves Instagram designs to Platform Specific, Conference designs to Multi Platform.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check both folder paths
        platform_specific_folder = _find_folder_by_path(backend, "Campaigns/2026/Q1/Social Media Assets/Platform Specific")
        multi_platform_folder = _find_folder_by_path(backend, "Campaigns/2026/Q1/Social Media Assets/Multi Platform")

        if not platform_specific_folder:
            errors.append("[X] Folder 'Campaigns/2026/Q1/Social Media Assets/Platform Specific' not found")
        else:
            checks_passed.append("[OK] Folder 'Platform Specific' exists (5-level hierarchy)")

        if not multi_platform_folder:
            errors.append("[X] Folder 'Campaigns/2026/Q1/Social Media Assets/Multi Platform' not found")
        else:
            checks_passed.append("[OK] Folder 'Multi Platform' exists (5-level hierarchy)")

        if platform_specific_folder and multi_platform_folder:
            platform_id = platform_specific_folder.get("_id")
            multi_id = multi_platform_folder.get("_id")

            # Find Instagram designs
            instagram_designs = _find_designs_by_title_pattern(backend, "Instagram")
            instagram_in_folder = sum(1 for d in instagram_designs if d.get("folderId") == platform_id)

            if instagram_in_folder >= 3:
                checks_passed.append(f"[OK] At least 3 Instagram designs in Platform Specific ({instagram_in_folder} found)")
            else:
                errors.append(f"[X] Only {instagram_in_folder} Instagram designs in Platform Specific, expected at least 3")

            # Find Conference designs
            conference_designs = _find_designs_by_title_pattern(backend, "Conference")
            conference_in_folder = sum(1 for d in conference_designs if d.get("folderId") == multi_id)

            if conference_in_folder >= 2:
                checks_passed.append(f"[OK] At least 2 Conference designs in Multi Platform ({conference_in_folder} found)")
            else:
                errors.append(f"[X] Only {conference_in_folder} Conference designs in Multi Platform, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_campaigns_q1_social_media_reorg_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_acme_dual_organization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate dual organization system for Conference and Acme designs.
    Conference designs go to 'Personal/Events/2026/Conference Materials',
    Acme designs go to 'Client Work/Acme Corp/Q1 2026/Marketing Assets'.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check both folder hierarchies
        conference_folder = _find_folder_by_path(backend, "Personal/Events/2026/Conference Materials")
        acme_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q1 2026/Marketing Assets")

        if not conference_folder:
            errors.append("[X] Folder 'Personal/Events/2026/Conference Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Events/2026/Conference Materials' exists")

        if not acme_folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q1 2026/Marketing Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Acme Corp/Q1 2026/Marketing Assets' exists")

        if conference_folder and acme_folder:
            conference_id = conference_folder.get("_id")
            acme_id = acme_folder.get("_id")

            # Find Conference designs
            conference_designs = _find_designs_by_title_pattern(backend, "Conference")
            conference_in_folder = sum(1 for d in conference_designs if d.get("folderId") == conference_id)

            if conference_in_folder >= 3:
                checks_passed.append(f"[OK] At least 3 Conference designs in Conference Materials ({conference_in_folder} found)")
            else:
                errors.append(f"[X] Only {conference_in_folder} Conference designs in Conference Materials, expected at least 3")

            # Find Acme designs
            acme_designs = _find_designs_by_title_pattern(backend, "Acme")
            acme_in_folder = sum(1 for d in acme_designs if d.get("folderId") == acme_id)

            if acme_in_folder >= 3:
                checks_passed.append(f"[OK] At least 3 Acme designs in Marketing Assets ({acme_in_folder} found)")
            else:
                errors.append(f"[X] Only {acme_in_folder} Acme designs in Marketing Assets, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_acme_dual_organization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_tech_reorg_resize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate reorganization and resize of Conference/Tech designs.
    Moves all to 'Brand Assets/Events/Tech Conferences',
    and resizes original 'Tech Conference Header' to 1920x1080.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        tech_conf_folder = _find_folder_by_path(backend, "Brand Assets/Events/Tech Conferences")
        if not tech_conf_folder:
            errors.append("[X] Folder 'Brand Assets/Events/Tech Conferences' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Brand Assets/Events/Tech Conferences' exists")
        folder_id = tech_conf_folder.get("_id")

        # Find all designs with 'Tech Conference Header' title
        tech_header_designs = _find_designs_by_title_pattern(backend, "Tech Conference Header")

        if not tech_header_designs:
            errors.append("[X] No 'Tech Conference Header' designs found")
        else:
            # All Tech Conference Header designs should be in the folder
            designs_in_folder = sum(1 for d in tech_header_designs if d.get("folderId") == folder_id)

            if designs_in_folder >= 3:
                checks_passed.append(f"[OK] All 3 'Tech Conference Header' designs in Tech Conferences folder ({designs_in_folder} found)")
            else:
                errors.append(f"[X] Only {designs_in_folder} 'Tech Conference Header' designs in folder, expected 3")

            # Check if one design is resized to 1920x1080 with custom format
            resized_found = False
            for design in tech_header_designs:
                if design.get("width") == 1920 and design.get("height") == 1080:
                    if design.get("format") == "custom":
                        resized_found = True
                        checks_passed.append("[OK] Original 'Tech Conference Header' resized to 1920x1080 with custom format")
                        break

            if not resized_found:
                errors.append("[X] No 'Tech Conference Header' design found with dimensions 1920x1080 and custom format")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_tech_reorg_resize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstart_logo_archive_organization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate logo creation and archive organization.
    Creates 'TechStart Logo Concept V1' in Brand Assets/Logos,
    moves existing Logo Concepts to Archive subfolder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folders
        logos_folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        archive_folder = _find_folder_by_path(backend, "Brand Assets/Logos/Archive")

        if not logos_folder:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Logos' exists")

        if not archive_folder:
            errors.append("[X] Folder 'Brand Assets/Logos/Archive' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Logos/Archive' exists")

        if logos_folder and archive_folder:
            logos_id = logos_folder.get("_id")
            archive_id = archive_folder.get("_id")

            # Check new TechStart logo
            techstart_logo = _find_design_by_exact_title(backend, "TechStart Logo Concept V1")
            if not techstart_logo:
                errors.append("[X] Design 'TechStart Logo Concept V1' not found")
            else:
                checks_passed.append("[OK] Design 'TechStart Logo Concept V1' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(techstart_logo, 500, 500)
                if ok:
                    checks_passed.append(f"[OK] TechStart logo - {msg}")
                else:
                    errors.append(f"[X] TechStart logo - {msg}")

                # Check if in Logos folder
                if techstart_logo.get("folderId") == logos_id:
                    checks_passed.append("[OK] TechStart logo in Brand Assets/Logos folder")
                else:
                    errors.append("[X] TechStart logo not in Brand Assets/Logos folder")

            # Find designs with 'Logo Concepts' in title in Archive
            logo_concepts_designs = _find_designs_by_title_pattern(backend, "Logo Concepts")
            archive_count = sum(1 for d in logo_concepts_designs if d.get("folderId") == archive_id)

            if archive_count >= 3:
                checks_passed.append(f"[OK] At least 3 Logo Concepts designs in Archive ({archive_count} found)")
            else:
                errors.append(f"[X] Only {archive_count} Logo Concepts designs in Archive, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_logo_archive_organization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Design Creation Tasks
# ==============================================================================
def _validate_brand_logo_variations_package_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate brand identity package with 4 logo variations.
    Creates logos with specific dimensions and formats in Logo Variations folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/Logo Variations")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logo Variations' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Brand Assets/Logo Variations' exists")
        folder_id = folder.get("_id")

        # Define logo specs
        specs = [
            {"title": "Brand Logo - Primary", "width": 500, "height": 500, "format": "logo"},
            {"title": "Brand Logo - Horizontal", "width": 800, "height": 200, "format": "custom"},
            {"title": "Brand Logo - Stacked", "width": 400, "height": 600, "format": "custom"},
            {"title": "Brand Logo - Icon", "width": 200, "height": 200, "format": "custom"}
        ]

        # Check each logo
        for spec in specs:
            design = _find_design_by_exact_title(backend, spec["title"])
            if not design:
                errors.append(f"[X] Design '{spec['title']}' not found")
                continue

            checks_passed.append(f"[OK] Design '{spec['title']}' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
            if ok:
                checks_passed.append(f"[OK] {spec['title']} - {msg}")
            else:
                errors.append(f"[X] {spec['title']} - {msg}")

            # Check format
            ok, msg = _check_design_format_detailed(design, spec["format"])
            if ok:
                checks_passed.append(f"[OK] {spec['title']} - {msg}")
            else:
                errors.append(f"[X] {spec['title']} - {msg}")

            # Check folder location
            if design.get("folderId") == folder_id:
                checks_passed.append(f"[OK] {spec['title']} in Logo Variations folder")
            else:
                errors.append(f"[X] {spec['title']} not in Logo Variations folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_logo_variations_package_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_soundwave_2026_festival_campaign_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate music festival promotional campaign with 3 designs.
    Creates Instagram story, poster, and flyer in Marketing Materials folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Events/Soundwave 2026/Marketing Materials")
        if not folder:
            errors.append("[X] Folder 'Personal/Events/Soundwave 2026/Marketing Materials' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Personal/Events/Soundwave 2026/Marketing Materials' exists")
        folder_id = folder.get("_id")

        # Define design specs
        specs = [
            {"title": "Soundwave 2026 - Story", "width": 1080, "height": 1920, "format": "instagram-story"},
            {"title": "Soundwave 2026 - Poster", "width": 1080, "height": 1920, "format": "poster"},
            {"title": "Soundwave 2026 - Flyer", "width": 2480, "height": 3508, "format": "flyer"}
        ]

        # Check each design
        for spec in specs:
            design = _find_design_by_exact_title(backend, spec["title"])
            if not design:
                errors.append(f"[X] Design '{spec['title']}' not found")
                continue

            checks_passed.append(f"[OK] Design '{spec['title']}' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
            if ok:
                checks_passed.append(f"[OK] {spec['title']} - {msg}")
            else:
                errors.append(f"[X] {spec['title']} - {msg}")

            # Check format
            ok, msg = _check_design_format_detailed(design, spec["format"])
            if ok:
                checks_passed.append(f"[OK] {spec['title']} - {msg}")
            else:
                errors.append(f"[X] {spec['title']} - {msg}")

            # Check folder location
            if design.get("folderId") == folder_id:
                checks_passed.append(f"[OK] {spec['title']} in Marketing Materials folder")
            else:
                errors.append(f"[X] {spec['title']} not in Marketing Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_soundwave_2026_festival_campaign_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_winter_conference_2026_workspace_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate complete project workspace for Winter Conference 2026.
    Creates nested folder structure with poster in Print Materials and story in Social Media.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check both folders
        print_folder = _find_folder_by_path(backend, "Events/Winter Conference 2026/Assets/Print Materials")
        social_folder = _find_folder_by_path(backend, "Events/Winter Conference 2026/Assets/Social Media")

        if not print_folder:
            errors.append("[X] Folder 'Events/Winter Conference 2026/Assets/Print Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Print Materials' exists in nested hierarchy")

        if not social_folder:
            errors.append("[X] Folder 'Events/Winter Conference 2026/Assets/Social Media' not found")
        else:
            checks_passed.append("[OK] Folder 'Social Media' exists in nested hierarchy")

        if print_folder and social_folder:
            print_id = print_folder.get("_id")
            social_id = social_folder.get("_id")

            # Check poster design
            poster = _find_design_by_exact_title(backend, "Winter Conference Main Poster")
            if not poster:
                errors.append("[X] Design 'Winter Conference Main Poster' not found")
            else:
                checks_passed.append("[OK] Design 'Winter Conference Main Poster' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(poster, 1080, 1920)
                if ok:
                    checks_passed.append(f"[OK] Poster - {msg}")
                else:
                    errors.append(f"[X] Poster - {msg}")

                # Check folder
                if poster.get("folderId") == print_id:
                    checks_passed.append("[OK] Poster in Print Materials folder")
                else:
                    errors.append("[X] Poster not in Print Materials folder")

                # Check content contains 'Winter Conference 2026'
                elements = _get_elements_for_design(backend, poster.get("_id"))
                if _has_element_with_content(elements, "Winter Conference 2026"):
                    checks_passed.append("[OK] Poster content contains 'Winter Conference 2026'")
                else:
                    errors.append("[X] Poster content missing 'Winter Conference 2026'")

            # Check story design
            story = _find_design_by_exact_title(backend, "Winter Conference Story Promo")
            if not story:
                errors.append("[X] Design 'Winter Conference Story Promo' not found")
            else:
                checks_passed.append("[OK] Design 'Winter Conference Story Promo' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(story, 1080, 1920)
                if ok:
                    checks_passed.append(f"[OK] Story - {msg}")
                else:
                    errors.append(f"[X] Story - {msg}")

                # Check folder
                if story.get("folderId") == social_id:
                    checks_passed.append("[OK] Story in Social Media folder")
                else:
                    errors.append("[X] Story not in Social Media folder")

                # Check content contains 'Winter Conference 2026'
                elements = _get_elements_for_design(backend, story.get("_id"))
                if _has_element_with_content(elements, "Winter Conference 2026"):
                    checks_passed.append("[OK] Story content contains 'Winter Conference 2026'")
                else:
                    errors.append("[X] Story content missing 'Winter Conference 2026'")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_winter_conference_2026_workspace_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_tech_organization_system_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive event organization system.
    Searches and organizes Conference/Tech designs, creates A4 document and flyer.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Events/Tech Conferences/2026")
        if not folder:
            errors.append("[X] Folder 'Events/Tech Conferences/2026' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Events/Tech Conferences/2026' exists")
        folder_id = folder.get("_id")

        # Check for existing Conference/Tech designs moved to folder
        conference_designs = _find_designs_by_title_pattern(backend, "Conference")
        tech_designs = _find_designs_by_title_pattern(backend, "Tech")
        all_designs = {d.get("_id"): d for d in conference_designs + tech_designs}

        existing_in_folder = sum(1 for d in all_designs.values() if d.get("folderId") == folder_id)
        if existing_in_folder >= 1:
            checks_passed.append(f"[OK] At least 1 existing Conference/Tech design in folder ({existing_in_folder} found)")
        else:
            errors.append("[X] No existing Conference/Tech designs in folder")

        # Check new A4 document
        agenda = _find_design_by_exact_title(backend, "Tech Conference Agenda")
        if not agenda:
            errors.append("[X] Design 'Tech Conference Agenda' not found")
        else:
            checks_passed.append("[OK] Design 'Tech Conference Agenda' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(agenda, 2480, 3508)
            if ok:
                checks_passed.append(f"[OK] Agenda - {msg}")
            else:
                errors.append(f"[X] Agenda - {msg}")

            # Check folder
            if agenda.get("folderId") == folder_id:
                checks_passed.append("[OK] Agenda in 2026 folder")
            else:
                errors.append("[X] Agenda not in 2026 folder")

        # Check new flyer
        promo = _find_design_by_exact_title(backend, "Tech Conference Promotion")
        if not promo:
            errors.append("[X] Design 'Tech Conference Promotion' not found")
        else:
            checks_passed.append("[OK] Design 'Tech Conference Promotion' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(promo, 2480, 3508)
            if ok:
                checks_passed.append(f"[OK] Promotion - {msg}")
            else:
                errors.append(f"[X] Promotion - {msg}")

            # Check folder
            if promo.get("folderId") == folder_id:
                checks_passed.append("[OK] Promotion in 2026 folder")
            else:
                errors.append("[X] Promotion not in 2026 folder")

        # Check total designs in folder is at least 3
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        if len(designs_in_folder) >= 3:
            checks_passed.append(f"[OK] At least 3 total designs in folder ({len(designs_in_folder)} found)")
        else:
            errors.append(f"[X] Only {len(designs_in_folder)} total designs in folder, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_tech_organization_system_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_youtube_thumbnail_content_library_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate extensive video content library with 5 YouTube thumbnails.
    Creates thumbnails with specific titles in nested folder structure.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Content Library/Video/YouTube/2026/Thumbnails")
        if not folder:
            errors.append("[X] Folder 'Content Library/Video/YouTube/2026/Thumbnails' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Content Library/Video/YouTube/2026/Thumbnails' exists (5-level hierarchy)")
        folder_id = folder.get("_id")

        # Define thumbnail specs
        titles = [
            "Tech Tutorial Series Ep 1",
            "Product Demo: New Features",
            "Behind the Scenes: Office Tour",
            "Customer Success Stories",
            "Monthly Roundup: January 2026"
        ]

        # Check each thumbnail
        for title in titles:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[OK] Design '{title}' found")

            # Check dimensions (YouTube thumbnail: 1280x720)
            ok, msg = _check_design_dimensions_detailed(design, 1280, 720)
            if ok:
                checks_passed.append(f"[OK] {title} - {msg}")
            else:
                errors.append(f"[X] {title} - {msg}")

            # Check folder location
            if design.get("folderId") == folder_id:
                checks_passed.append(f"[OK] {title} in Thumbnails folder")
            else:
                errors.append(f"[X] {title} not in Thumbnails folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_youtube_thumbnail_content_library_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Content Analysis Tasks
# ==============================================================================
def _validate_january_newsletter_text_analysis_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive text analysis on January Newsletter A4 document.
    Checks design dimensions and validates analysis documentation in final_answer.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find design
        design = _find_design_by_exact_title(backend, "January Newsletter")
        if not design:
            errors.append("[X] Design 'January Newsletter' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'January Newsletter' found")

        # Check A4 dimensions
        ok, msg = _check_design_dimensions_detailed(design, 2480, 3508)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Validate final answer contains comprehensive analysis
        fa_errors, fa_checks = _validate_final_answer_contains(
            final_answer,
            expected_values=["2480", "3508"],
            expected_keywords=["January", "font", "bold", "fontSize", "top", "elements", "analysis"],
            min_length=300
        )
        errors.extend(fa_errors)
        checks_passed.extend(fa_checks)

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_january_newsletter_text_analysis_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_designs_analysis_reorganization_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate analysis and reorganization of all Acme designs.
    Searches, moves to folder, and extracts comprehensive content report.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Clients/Acme Corp/All Formats")
        if not folder:
            errors.append("[X] Folder 'Clients/Acme Corp/All Formats' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Clients/Acme Corp/All Formats' exists")
        folder_id = folder.get("_id")

        # Find Acme designs
        acme_designs = _find_designs_by_title_pattern(backend, "Acme")

        if not acme_designs:
            errors.append("[X] No designs with 'Acme' in title found")
            return _make_task_score(errors, checks_passed)

        # Check exactly 5 or more Acme designs moved
        designs_in_folder = [d for d in acme_designs if d.get("folderId") == folder_id]

        if len(designs_in_folder) >= 5:
            checks_passed.append(f"[OK] At least 5 Acme designs in All Formats folder ({len(designs_in_folder)} found)")
        else:
            errors.append(f"[X] Only {len(designs_in_folder)} Acme designs in folder, expected at least 5")

        # Extract content report from designs
        for design in designs_in_folder[:5]:  # Check first 5
            title = design.get("title", "Unknown")
            fmt = design.get("format", "unknown")
            width = design.get("width", 0)
            height = design.get("height", 0)

            checks_passed.append(f"[OK] Design '{title}': format={fmt}, dimensions={width}x{height}")

            # Extract primary text content
            elements = _get_elements_for_design(backend, design.get("_id"))
            text_elements = _get_text_elements_from_list(elements)

            if text_elements:
                checks_passed.append(f"[OK] '{title}' has {len(text_elements)} text elements")
            else:
                checks_passed.append(f"[OK] '{title}' has no text elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_designs_analysis_reorganization_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Resize + Multi-Operation Tasks
# ==============================================================================
def _validate_live_music_poster_resize_organize_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music poster transformation and organization.
    Resizes to 1920x600, creates two new posters, organizes all three.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Print/Event Posters")
        if not folder:
            errors.append("[X] Folder 'Personal/Print/Event Posters' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Personal/Print/Event Posters' exists")
        folder_id = folder.get("_id")

        # Check resized Live Music Night Poster
        live_music = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not live_music:
            errors.append("[X] Design 'Live Music Night Poster' not found")
        else:
            checks_passed.append("[OK] Design 'Live Music Night Poster' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(live_music, 1920, 600)
            if ok:
                checks_passed.append(f"[OK] Live Music poster - {msg}")
            else:
                errors.append(f"[X] Live Music poster - {msg}")

            # Check format changed to custom
            if live_music.get("format") == "custom":
                checks_passed.append("[OK] Live Music poster format changed to 'custom'")
            else:
                errors.append(f"[X] Live Music poster format is '{live_music.get('format')}', expected 'custom'")

            # Check folder
            if live_music.get("folderId") == folder_id:
                checks_passed.append("[OK] Live Music poster in Event Posters folder")
            else:
                errors.append("[X] Live Music poster not in Event Posters folder")

        # Check Jazz Festival Poster
        jazz = _find_design_by_exact_title(backend, "Jazz Festival Poster")
        if not jazz:
            errors.append("[X] Design 'Jazz Festival Poster' not found")
        else:
            checks_passed.append("[OK] Design 'Jazz Festival Poster' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(jazz, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] Jazz poster - {msg}")
            else:
                errors.append(f"[X] Jazz poster - {msg}")

            # Check folder
            if jazz.get("folderId") == folder_id:
                checks_passed.append("[OK] Jazz poster in Event Posters folder")
            else:
                errors.append("[X] Jazz poster not in Event Posters folder")

        # Check Rock Concert Poster
        rock = _find_design_by_exact_title(backend, "Rock Concert Poster")
        if not rock:
            errors.append("[X] Design 'Rock Concert Poster' not found")
        else:
            checks_passed.append("[OK] Design 'Rock Concert Poster' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(rock, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] Rock poster - {msg}")
            else:
                errors.append(f"[X] Rock poster - {msg}")

            # Check folder
            if rock.get("folderId") == folder_id:
                checks_passed.append("[OK] Rock poster in Event Posters folder")
            else:
                errors.append("[X] Rock poster not in Event Posters folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_resize_organize_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_poster_resize_extract_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music poster resize and content extraction.
    Resizes to 1200x400, extracts dimensions, format, text, background, element count.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find design
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 1200, 400)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format changed to custom
        fmt = design.get("format", "")
        if fmt == "custom":
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{fmt}', expected 'custom'")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))

        if not elements:
            errors.append("[X] No elements found in design")
        else:
            checks_passed.append(f"[OK] Total element count: {len(elements)}")

        # Extract text elements
        text_elements = _get_text_elements_from_list(elements)
        if text_elements:
            checks_passed.append(f"[OK] Found {len(text_elements)} text elements")
        else:
            checks_passed.append("[OK] No text elements found")

        # Get pages to check background color
        pages_result = backend.query({"collection": "pages", "filter": {"designId": design.get("_id")}})
        if isinstance(pages_result, list) and pages_result:
            page = pages_result[0]
            bg_color = page.get("backgroundColor", "not set")
            checks_passed.append(f"[OK] Page background color: {bg_color}")
        else:
            checks_passed.append("[OK] No page background color data")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_resize_extract_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q2_marketing_strategy_report_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 Marketing Strategy Report creation and content extraction.
    Creates A4 document in specific folder, extracts content to verify text elements.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Docs/Docs (A4)")
        if not folder:
            errors.append("[X] Folder 'Personal/Docs/Docs (A4)' not found")
            # Continue checking design even if folder check fails
        else:
            checks_passed.append("[OK] Folder 'Personal/Docs/Docs (A4)' exists")

        # Find design
        design = _find_design_by_exact_title(backend, "Q2 Marketing Strategy Report")
        if not design:
            errors.append("[X] Design 'Q2 Marketing Strategy Report' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Design 'Q2 Marketing Strategy Report' found")

        # Check dimensions
        ok, msg = _check_design_dimensions_detailed(design, 2480, 3508)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format
        ok, msg = _check_design_format_detailed(design, "a4-document")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check folder location
        if folder and design.get("folderId") == folder.get("_id"):
            checks_passed.append("[OK] Design in Docs (A4) folder")
        elif folder:
            errors.append("[X] Design not in Docs (A4) folder")

        # Extract content
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = _get_text_elements_from_list(elements)

        if not text_elements:
            errors.append("[X] No text elements found")
            return _make_task_score(errors, checks_passed)

        # Check for 'quarterly planning' content
        has_quarterly_content = False
        for elem in text_elements:
            if _check_element_has_content(elem, "quarterly") or _check_element_has_content(elem, "planning"):
                has_quarterly_content = True
                break

        if has_quarterly_content:
            checks_passed.append("[OK] Design contains quarterly planning content")
        else:
            errors.append("[X] Design missing quarterly planning content")

        checks_passed.append(f"[OK] Total elements: {len(elements)}, text elements: {len(text_elements)}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q2_marketing_strategy_report_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)







# Complex Multi-Operation Tasks
# ==============================================================================
def _validate_acme_brand_system_analysis_templates_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate complex brand system analysis and template creation.
    Extracts content from 2 Acme designs, creates 3 templates, organizes all Acme designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folders
        guidelines_folder = _find_folder_by_path(backend, "Brand Assets/Acme Corp/Brand Guidelines")
        existing_folder = _find_folder_by_path(backend, "Brand Assets/Acme Corp/Existing Assets")

        if not guidelines_folder:
            errors.append("[X] Folder 'Brand Assets/Acme Corp/Brand Guidelines' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Guidelines' exists")

        if not existing_folder:
            errors.append("[X] Folder 'Brand Assets/Acme Corp/Existing Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Existing Assets' exists")

        if guidelines_folder and existing_folder:
            guidelines_id = guidelines_folder.get("_id")
            existing_id = existing_folder.get("_id")

            # Check source designs exist (for content extraction)
            deck = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
            logo = _find_design_by_exact_title(backend, "Acme Logo Concepts")

            if deck:
                checks_passed.append("[OK] Source design 'Acme Q1 Strategy Deck' found for analysis")
            if logo:
                checks_passed.append("[OK] Source design 'Acme Logo Concepts' found for analysis")

            # Check three templates
            templates = [
                {"title": "Acme Presentation Template", "width": 1920, "height": 1080, "format": "presentation"},
                {"title": "Acme Social Template", "width": 1080, "height": 1080, "format": "instagram-post"},
                {"title": "Acme Document Template", "width": 2480, "height": 3508, "format": "a4-document"}
            ]

            for spec in templates:
                design = _find_design_by_exact_title(backend, spec["title"])
                if not design:
                    errors.append(f"[X] Template '{spec['title']}' not found")
                    continue

                checks_passed.append(f"[OK] Template '{spec['title']}' found")

                # Check dimensions
                ok, msg = _check_design_dimensions_detailed(design, spec["width"], spec["height"])
                if ok:
                    checks_passed.append(f"[OK] {spec['title']} - {msg}")
                else:
                    errors.append(f"[X] {spec['title']} - {msg}")

                # Check format
                ok, msg = _check_design_format_detailed(design, spec["format"])
                if ok:
                    checks_passed.append(f"[OK] {spec['title']} - {msg}")
                else:
                    errors.append(f"[X] {spec['title']} - {msg}")

                # Check folder
                if design.get("folderId") == guidelines_id:
                    checks_passed.append(f"[OK] {spec['title']} in Brand Guidelines folder")
                else:
                    errors.append(f"[X] {spec['title']} not in Brand Guidelines folder")

            # Check Acme designs moved to Existing Assets
            acme_designs = _find_designs_by_title_pattern(backend, "Acme")
            existing_count = sum(1 for d in acme_designs if d.get("folderId") == existing_id)

            if existing_count > 0:
                checks_passed.append(f"[OK] {existing_count} Acme designs in Existing Assets folder")
            else:
                errors.append("[X] No Acme designs in Existing Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_brand_system_analysis_templates_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_studio_brand_package_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight Studio brand package creation and organization.
    Searches existing Starlight designs, creates new Instagram post, organizes all.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Brand Work/Starlight Studio/2026")
        if not folder:
            errors.append("[X] Folder 'Brand Work/Starlight Studio/2026' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[OK] Folder 'Brand Work/Starlight Studio/2026' exists")
        folder_id = folder.get("_id")

        # Check new brand post
        brand_post = _find_design_by_exact_title(backend, "Starlight Brand Post")
        if not brand_post:
            errors.append("[X] Design 'Starlight Brand Post' not found")
        else:
            checks_passed.append("[OK] Design 'Starlight Brand Post' found")

            # Check dimensions
            ok, msg = _check_design_dimensions_detailed(brand_post, 1080, 1080)
            if ok:
                checks_passed.append(f"[OK] Brand post - {msg}")
            else:
                errors.append(f"[X] Brand post - {msg}")

            # Check folder
            if brand_post.get("folderId") == folder_id:
                checks_passed.append("[OK] Brand post in correct folder")
            else:
                errors.append("[X] Brand post not in correct folder")

            # Extract text content
            elements = _get_elements_for_design(backend, brand_post.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Brand post has {len(text_elements)} text elements")
            else:
                checks_passed.append("[OK] Brand post has no text elements")

        # Check total Starlight designs in folder
        starlight_designs = _find_designs_by_title_pattern(backend, "Starlight")
        designs_in_folder = sum(1 for d in starlight_designs if d.get("folderId") == folder_id)

        if designs_in_folder >= 4:
            checks_passed.append(f"[OK] At least 4 Starlight designs in folder ({designs_in_folder} total)")
        else:
            errors.append(f"[X] Only {designs_in_folder} Starlight designs in folder, expected at least 4")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_studio_brand_package_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)






# ==============================================================================
# Reward Function 1: Analyze Welcome Instagram Design
# ==============================================================================
def _validate_canva_analyze_welcome_instagram_design(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Extract and analyze the complete design composition of 'Welcome Instagram Post'.
    
    Validates:
    1. Design has instagram-post format and 1080x1080 dimensions
    2. Element counts by type are documented in final_answer
    3. Font families (Inter) identified
    4. Color values listed
    5. Shadow effects documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # 1. Find the design
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )
        checks_passed.append("[✓] Design 'Welcome Instagram Post' found")
        design_id = design.get("_id", "")

        # 2. Validate format
        success, msg = _validate_design_format(design, "instagram-post")
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # 3. Validate dimensions (1080x1080)
        success, msg = _validate_design_dimensions(design, 1080, 1080)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # 4. Check that element counts are mentioned in final_answer
        answer_lower = final_answer.lower()

        # Get actual element counts
        all_elements = _get_elements_for_design(backend, design_id)
        element_types = ["shape", "text", "image", "line", "icon"]
        counts_documented = False

        for el_type in element_types:
            count = len([e for e in all_elements if e.get("type") == el_type])
            if count > 0:
                # Check if the type is mentioned in the answer
                if el_type in answer_lower:
                    counts_documented = True

        if counts_documented or "element" in answer_lower:
            checks_passed.append("[✓] Element analysis documented in response")
        else:
            errors.append("[X] Element analysis not documented in response")

        # 5. Check font family mentioned (Inter)
        if "inter" in answer_lower or "font" in answer_lower:
            checks_passed.append("[✓] Font families documented")
        else:
            errors.append("[X] Font families not documented in response")

        # 6. Check color values mentioned
        expected_colors = ["ffffff", "9ca3af", "8b3dff", "22c55e", "0b1220"]
        colors_found = sum(1 for c in expected_colors if c in answer_lower)
        if colors_found >= 2 or "color" in answer_lower:
            checks_passed.append("[✓] Color values documented")
        else:
            errors.append("[X] Color values not documented in response")

        # 7. Check shadow effects mentioned
        if "shadow" in answer_lower:
            checks_passed.append("[✓] Shadow effects documented")
        else:
            errors.append("[X] Shadow effects not documented in response")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 2: Digital Marketing Folder Hierarchy
# ==============================================================================
def _validate_canva_digital_marketing_folder_hierarchy(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create 6-level folder hierarchy and move Instagram designs.
    
    Validates:
    1. Complete 6-level folder hierarchy exists
    2. Instagram/Facebook/LinkedIn/Twitter subfolders created
    3. At least 3 Instagram designs moved to Instagram folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # 1. Check 6-level hierarchy exists
        base_path = "Client Work/Digital Agency/Q2 2026/Campaigns/Social/Platform Specific"
        platform_folder = _find_folder_by_path(backend, base_path)

        if platform_folder:
            checks_passed.append(f"[✓] 6-level hierarchy exists: {base_path}")
            platform_id = platform_folder.get("_id")

            # 2. Check platform subfolders
            platforms = ["Instagram", "Facebook", "LinkedIn", "Twitter"]
            for platform in platforms:
                subfolder = _find_folder_by_path(backend, f"{base_path}/{platform}")
                if subfolder:
                    checks_passed.append(f"[✓] Subfolder '{platform}' exists")
                else:
                    errors.append(f"[X] Subfolder '{platform}' not found")

            # 3. Check Instagram folder has at least 3 designs with 'Instagram' in title
            instagram_folder = _find_folder_by_path(backend, f"{base_path}/Instagram")
            if instagram_folder:
                instagram_folder_id = instagram_folder.get("_id")
                designs_in_folder = _get_designs_in_folder(backend, instagram_folder_id)

                # Count designs with 'Instagram' in title
                instagram_designs = [d for d in designs_in_folder
                                   if "instagram" in d.get("title", "").lower()]

                if len(instagram_designs) >= 3:
                    checks_passed.append(f"[✓] At least 3 Instagram designs moved ({len(instagram_designs)} found)")
                else:
                    errors.append(f"[X] Expected at least 3 Instagram designs in folder, found {len(instagram_designs)}")
        else:
            errors.append(f"[X] 6-level folder hierarchy not found: {base_path}")
            # Still check for partial structure
            partial_paths = [
                "Client Work",
                "Client Work/Digital Agency",
                "Client Work/Digital Agency/Q2 2026",
            ]
            for path in partial_paths:
                if _find_folder_by_path(backend, path):
                    checks_passed.append(f"[✓] Partial path exists: {path}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 3: Resize Business Card to YouTube Thumbnail
# ==============================================================================
def _validate_canva_resize_business_card_youtube(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Resize 'Business Card — Alice Chen' to YouTube thumbnail dimensions.
    
    Validates:
    1. Design exists (may have new title after resize)
    2. Dimensions are 1280x720
    3. Format is 'custom' (not business-card)
    4. Text content preserved (documented in answer)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find design - try both original and possible renamed titles
        design = _find_design_by_title(backend, "Business Card — Alice Chen")
        if not design:
            design = _find_design_by_title(backend, "Business Card - Alice Chen")
        if not design:
            design = _find_design_by_title(backend, "Alice Chen")

        # Also search for any design with YouTube thumbnail dimensions
        if not design:
            all_designs = _get_all_designs(backend)
            for d in all_designs:
                if d.get("width") == 1280 and d.get("height") == 720:
                    if "alice" in d.get("title", "").lower() or "business" in d.get("title", "").lower():
                        design = d
                        break

        if not design:
            errors.append("[X] Resized design not found (searched for 'Business Card — Alice Chen' and YouTube dimensions)")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Design found: '{design.get('title')}'")
        design_id = design.get("_id", "")

        # 2. Validate dimensions (1280x720)
        success, msg = _validate_design_dimensions(design, 1280, 720)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # 3. Validate format is 'custom'
        format_val = design.get("format", "")
        if format_val == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_val}'")

        # 4. Check text elements exist (content preserved)
        text_elements = _get_text_elements(backend, design_id)
        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text elements preserved ({len(text_elements)} found)")
        else:
            errors.append("[X] No text elements found - content may not be preserved")

        # 5. Check answer documents the changes
        answer_lower = final_answer.lower()
        if "1280" in answer_lower and "720" in answer_lower:
            checks_passed.append("[✓] Dimensions documented in response")
        elif "resize" in answer_lower or "dimension" in answer_lower:
            checks_passed.append("[✓] Resize operation documented")
        else:
            errors.append("[X] Resize result not documented in response")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 4: Reorganize Acme Designs by Format
# ==============================================================================
def _validate_canva_reorganize_acme_by_format(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Consolidate Acme designs into format-specific folders.
    
    Validates:
    1. Folder structure 'Client Work/Acme Corp/All Assets/By Format' exists
    2. Sub-folders for each format type exist
    3. Acme designs moved to appropriate format sub-folders
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # 1. Find all Acme designs first
        acme_designs = _find_designs_by_title(backend, "Acme")

        if not acme_designs:
            errors.append("[X] No designs with 'Acme' in title found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Found {len(acme_designs)} Acme designs")

        # Get unique formats
        formats = set(d.get("format", "custom") for d in acme_designs)
        checks_passed.append(f"[✓] Formats found: {', '.join(formats)}")

        # 2. Check base folder structure exists
        base_path = "Client Work/Acme Corp/All Assets/By Format"
        base_folder = _find_folder_by_path(backend, base_path)

        if base_folder:
            checks_passed.append(f"[✓] Base folder structure exists: {base_path}")
            base_folder_id = base_folder.get("_id")

            # 3. Check format sub-folders and design placement
            designs_properly_placed = 0

            for fmt in formats:
                # Check if format folder exists
                format_folder = _find_folder_by_path(backend, f"{base_path}/{fmt}")
                if format_folder:
                    checks_passed.append(f"[✓] Format folder '{fmt}' exists")
                    format_folder_id = format_folder.get("_id")

                    # Check designs of this format are in the folder
                    designs_in_folder = _get_designs_in_folder(backend, format_folder_id)
                    for design in acme_designs:
                        if design.get("format") == fmt and design.get("folderId") == format_folder_id:
                            designs_properly_placed += 1
                else:
                    errors.append(f"[X] Format folder '{fmt}' not found")

            if designs_properly_placed >= len(acme_designs):
                checks_passed.append(f"[✓] All {len(acme_designs)} Acme designs properly categorized")
            elif designs_properly_placed > 0:
                checks_passed.append(f"[✓] {designs_properly_placed}/{len(acme_designs)} designs properly placed")
                errors.append("[X] Not all Acme designs moved to format folders")
            else:
                errors.append("[X] No Acme designs found in format folders")
        else:
            errors.append(f"[X] Base folder structure not found: {base_path}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 5: EcoTech Brand Identity Package
# ==============================================================================
def _validate_canva_ecotech_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create comprehensive brand identity package for EcoTech.
    
    Validates:
    1. Logo design 'EcoTech Logo Primary' (500x500)
    2. Business card 'EcoTech Business Card - CEO' (1050x600)
    3. Instagram post 'EcoTech Brand Reveal' (1080x1080)
    4. Presentation 'EcoTech Pitch Deck Template' (1920x1080)
    5. All in folder 'Brand Assets/EcoTech/Complete Package'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Define expected designs
        expected_designs = [
            ("EcoTech Logo Primary", 500, 500),
            ("EcoTech Business Card - CEO", 1050, 600),
            ("EcoTech Brand Reveal", 1080, 1080),
            ("EcoTech Pitch Deck Template", 1920, 1080),
        ]

        # Check folder exists
        folder_path = "Brand Assets/EcoTech/Complete Package"
        package_folder = _find_folder_by_path(backend, folder_path)

        if package_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = package_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check each design
        for title, expected_width, expected_height in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 6: Product Launch Campaign
# ==============================================================================
def _validate_canva_product_launch_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create and organize digital marketing campaign for product launch.
    
    Validates:
    1. YouTube thumbnail 'Product Launch Video Thumbnail' (1280x720)
    2. Web banner 'Product Launch Web Banner' (1600x900)
    3. Business card 'Product Launch - Contact Card' (1050x600)
    4. Folder structure with Video/Web/Print subfolders
    5. Designs categorized correctly
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        base_path = "Personal/Campaigns/Product Launch 2026/Digital Assets"

        # Check folder structure
        base_folder = _find_folder_by_path(backend, base_path)
        if base_folder:
            checks_passed.append(f"[✓] Base folder structure exists: {base_path}")
        else:
            errors.append(f"[X] Base folder structure not found: {base_path}")

        # Check subfolders and designs
        design_checks = [
            ("Product Launch Video Thumbnail", 1280, 720, "Video"),
            ("Product Launch Web Banner", 1600, 900, "Web"),
            ("Product Launch - Contact Card", 1050, 600, "Print"),
        ]

        for title, width, height, subfolder in design_checks:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, width, height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check subfolder exists
                subfolder_path = f"{base_path}/{subfolder}"
                target_folder = _find_folder_by_path(backend, subfolder_path)

                if target_folder:
                    checks_passed.append(f"[✓] Subfolder '{subfolder}' exists")

                    # Check design is in correct subfolder
                    if design.get("folderId") == target_folder.get("_id"):
                        checks_passed.append(f"[✓] {title} correctly in '{subfolder}' folder")
                    else:
                        errors.append(f"[X] {title} not in '{subfolder}' folder")
                else:
                    errors.append(f"[X] Subfolder '{subfolder}' not found")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 7: Print Campaign A4 Document
# ==============================================================================
def _validate_canva_print_campaign_a4(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create A4 document and organize print materials.
    
    Validates:
    1. A4 document 'Q1 2026 Campaign Brief' exists (2480x3508)
    2. Folder hierarchy exists
    3. Both new brief and existing 'January Newsletter' in target folder
    4. New document contains campaign-related text
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder_path = "Client Work/Q1 2026 Campaigns/Print Materials/Documents"

        # Check folder exists
        target_folder = _find_folder_by_path(backend, folder_path)
        if target_folder:
            checks_passed.append(f"[✓] Folder hierarchy exists: {folder_path}")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder hierarchy not found: {folder_path}")
            folder_id = None

        # Check A4 document exists
        brief = _find_design_by_title(backend, "Q1 2026 Campaign Brief")
        if brief:
            checks_passed.append("[✓] Design 'Q1 2026 Campaign Brief' found")

            # Check dimensions (A4: 2480x3508)
            success, msg = _validate_design_dimensions(brief, 2480, 3508)
            if success:
                checks_passed.append(f"[✓] {msg}")
            else:
                errors.append(f"[X] {msg}")

            # Check in folder
            if folder_id and brief.get("folderId") == folder_id:
                checks_passed.append("[✓] Campaign Brief is in target folder")
            elif folder_id:
                errors.append("[X] Campaign Brief is not in target folder")

            # Check for campaign-related text
            brief_id = brief.get("_id", "")
            text_elements = _get_text_elements(backend, brief_id)
            if text_elements:
                all_text = " ".join(_get_element_text(el) for el in text_elements).lower()
                campaign_keywords = ["campaign", "q1", "2026", "brief", "marketing", "strategy"]
                found_keywords = [kw for kw in campaign_keywords if kw in all_text]
                if found_keywords:
                    checks_passed.append(f"[✓] Campaign-related text found: {', '.join(found_keywords)}")
                else:
                    checks_passed.append("[✓] Text elements exist in document")
        else:
            errors.append("[X] Design 'Q1 2026 Campaign Brief' not found")

        # Check January Newsletter exists and is in folder
        newsletter = _find_design_by_title(backend, "January Newsletter")
        if newsletter:
            checks_passed.append("[✓] 'January Newsletter' found")

            if folder_id and newsletter.get("folderId") == folder_id:
                checks_passed.append("[✓] January Newsletter is in target folder")
            elif folder_id:
                errors.append("[X] January Newsletter is not in target folder")
        else:
            errors.append("[X] 'January Newsletter' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 8: Resize Instagram to Website Banner
# ==============================================================================
def _validate_canva_resize_instagram_to_banner(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Resize 'Welcome Instagram Post' to website banner dimensions.
    
    Validates:
    1. Design resized to exactly 1920x600
    2. Format changed to 'custom'
    3. Text content extracted and documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design - could be original or modified
        design = _find_design_by_title(backend, "Welcome Instagram Post")

        # Also check for any 1920x600 design
        if not design or (design.get("width") != 1920 or design.get("height") != 600):
            all_designs = _get_all_designs(backend)
            for d in all_designs:
                if d.get("width") == 1920 and d.get("height") == 600:
                    if "welcome" in d.get("title", "").lower() or "instagram" in d.get("title", "").lower():
                        design = d
                        break

        if not design:
            errors.append("[X] Resized design not found (1920x600)")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Design found: '{design.get('title')}'")
        design_id = design.get("_id", "")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 1920, 600)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format is 'custom'
        format_val = design.get("format", "")
        if format_val == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_val}'")

        # Check text content exists and was documented
        text_elements = _get_text_elements(backend, design_id)
        if text_elements:
            text_content = [_get_element_text(el) for el in text_elements]
            checks_passed.append(f"[✓] Text elements found: {len(text_elements)}")

            # Check if text content mentioned in answer
            answer_lower = final_answer.lower()
            if any(t.lower() in answer_lower for t in text_content if t):
                checks_passed.append("[✓] Text content documented in response")
            elif "text" in answer_lower:
                checks_passed.append("[✓] Text elements mentioned in response")
        else:
            checks_passed.append("[✓] Design processed (no text elements)")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 9: Flash Sale Analysis and Archive
# ==============================================================================
def _validate_canva_flash_sale_analysis_archive(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Search, analyze, and archive Flash Sale designs.
    
    Validates:
    1. Flash Sale designs found (minimum 2)
    2. Element analysis performed
    3. Folder 'Marketing/Flash Sale Archive' created
    4. Designs moved to archive folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # 1. Find Flash Sale designs
        flash_sale_designs = _find_designs_by_title(backend, "Flash Sale")

        if len(flash_sale_designs) >= 2:
            checks_passed.append(f"[✓] Found {len(flash_sale_designs)} Flash Sale designs")
        elif len(flash_sale_designs) == 1:
            checks_passed.append(f"[✓] Found {len(flash_sale_designs)} Flash Sale design")
            errors.append("[X] Expected minimum 2 Flash Sale designs")
        else:
            errors.append("[X] No Flash Sale designs found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        # 2. Check analysis was performed (mentioned in answer)
        answer_lower = final_answer.lower()
        analysis_keywords = ["element", "background", "color", "image", "count", "type"]
        found_analysis = [kw for kw in analysis_keywords if kw in answer_lower]

        if len(found_analysis) >= 2:
            checks_passed.append(f"[✓] Element analysis documented: {', '.join(found_analysis)}")
        else:
            errors.append("[X] Element analysis not sufficiently documented")

        # 3. Check archive folder exists
        folder_path = "Marketing/Flash Sale Archive"
        archive_folder = _find_folder_by_path(backend, folder_path)

        if archive_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' created")
            folder_id = archive_folder.get("_id")

            # 4. Check designs moved to folder
            designs_in_archive = 0
            for design in flash_sale_designs:
                if design.get("folderId") == folder_id:
                    designs_in_archive += 1

            if designs_in_archive >= len(flash_sale_designs):
                checks_passed.append(f"[✓] All {len(flash_sale_designs)} designs moved to archive")
            elif designs_in_archive > 0:
                checks_passed.append(f"[✓] {designs_in_archive}/{len(flash_sale_designs)} designs in archive")
                errors.append("[X] Not all Flash Sale designs moved to archive")
            else:
                errors.append("[X] No Flash Sale designs found in archive folder")
        else:
            errors.append(f"[X] Folder '{folder_path}' not created")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 10: Typography Analysis Instagram Post
# ==============================================================================
def _validate_canva_typography_analysis_instagram(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Analyze and extract detailed typography from 'Welcome Instagram Post'.
    
    Validates:
    1. Design found and format confirmed (instagram-post, 1080x1080)
    2. Text elements identified with count
    3. Font properties documented (family, size, weight, alignment, color)
    4. Text content extracted
    5. Positioning documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # 1. Find the design
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append("[✓] Design 'Welcome Instagram Post' found")
        design_id = design.get("_id", "")

        # 2. Validate format
        success, msg = _validate_design_format(design, "instagram-post")
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # 3. Validate dimensions
        success, msg = _validate_design_dimensions(design, 1080, 1080)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # 4. Get text elements
        text_elements = _get_text_elements(backend, design_id)
        checks_passed.append(f"[✓] Found {len(text_elements)} text elements")

        # 5. Check answer contains typography analysis
        answer_lower = final_answer.lower()

        # Font properties
        typography_checks = [
            ("font family", ["font family", "fontfamily", "inter", "font-family"]),
            ("font size", ["font size", "fontsize", "px", "font-size"]),
            ("font weight", ["font weight", "fontweight", "bold", "normal", "font-weight"]),
            ("text alignment", ["alignment", "align", "center", "left", "right"]),
            ("text color", ["color", "#", "rgb"]),
            ("text content", ["text", "content", "welcome"]),
            ("positioning", ["position", "coordinate", "x", "y", "location"]),
        ]

        documented_count = 0
        for check_name, keywords in typography_checks:
            if any(kw in answer_lower for kw in keywords):
                checks_passed.append(f"[✓] {check_name.title()} documented")
                documented_count += 1
            else:
                errors.append(f"[X] {check_name.title()} not documented")

        # Allow some flexibility - need at least 5 of 7 checks
        if documented_count >= 5:
            # Remove non-critical errors if we have enough documentation
            critical_errors = [e for e in errors if "not found" in e.lower() or "mismatch" in e.lower()]
            errors = critical_errors

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 11: Phoenix Industries Brand Identity
# ==============================================================================
def _validate_canva_phoenix_industries_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create complete brand identity package for Phoenix Industries.
    
    Validates:
    1. Logo design 'Phoenix Industries Logo' (500x500)
    2. Business card 'Phoenix Industries Business Card' (1050x600)
    3. Flyer 'Phoenix Industries Flyer' (2480x3508)
    4. All organized in 'Brand Assets/Phoenix Industries/Core Identity' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Phoenix Industries/Core Identity"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Phoenix Industries Logo", 500, 500, "logo"),
            ("Phoenix Industries Business Card", 1050, 600, "business-card"),
            ("Phoenix Industries Flyer", 2480, 3508, "flyer"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 12: TechCorp Project Hierarchy
# ==============================================================================
def _validate_canva_techcorp_project_hierarchy(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create project hierarchy and move Tech designs.
    
    Validates:
    1. Folder hierarchy 'Client Work/TechCorp/Q2 2026/Marketing Assets/Social Media' exists
    2. Folder 'Client Work/TechCorp/Q2 2026/Marketing Assets/Print Materials' exists
    3. At least 2 designs with 'Tech' in title are in Social Media subfolder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Social Media folder exists
        social_path = "Client Work/TechCorp/Q2 2026/Marketing Assets/Social Media"
        social_folder = _find_folder_by_path(backend, social_path)

        if social_folder:
            checks_passed.append(f"[✓] Folder '{social_path}' exists")
            social_folder_id = social_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{social_path}' not found")
            social_folder_id = None

        # Check Print Materials folder exists
        print_path = "Client Work/TechCorp/Q2 2026/Marketing Assets/Print Materials"
        print_folder = _find_folder_by_path(backend, print_path)

        if print_folder:
            checks_passed.append(f"[✓] Folder '{print_path}' exists")
        else:
            errors.append(f"[X] Folder '{print_path}' not found")

        # Check for Tech designs in Social Media folder
        if social_folder_id:
            designs_in_folder = _get_designs_in_folder(backend, social_folder_id)
            tech_designs_in_folder = [d for d in designs_in_folder
                                      if "tech" in d.get("title", "").lower()]

            if len(tech_designs_in_folder) >= 2:
                checks_passed.append(f"[✓] At least 2 Tech designs in Social Media folder ({len(tech_designs_in_folder)} found)")
            else:
                errors.append(f"[X] Expected at least 2 Tech designs in Social Media folder, found {len(tech_designs_in_folder)}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 13: Acme Client Workspace
# ==============================================================================
def _validate_canva_acme_client_workspace(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create comprehensive Acme client workspace with archiving and new designs.
    
    Validates:
    1. Archive folder 'Client Work/Acme Corp/All Assets/Archive 2026' exists with old Acme designs
    2. New designs created: Instagram post (1080x1080), Facebook post (1200x630), presentation (1920x1080)
    3. New designs in 'Client Work/Acme Corp/All Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check archive folder exists
        archive_path = "Client Work/Acme Corp/All Assets/Archive 2026"
        archive_folder = _find_folder_by_path(backend, archive_path)

        if archive_folder:
            checks_passed.append(f"[✓] Archive folder '{archive_path}' exists")
            archive_folder_id = archive_folder.get("_id")

            # Check that some Acme designs are in archive
            designs_in_archive = _get_designs_in_folder(backend, archive_folder_id)
            acme_archived = [d for d in designs_in_archive if "acme" in d.get("title", "").lower()]
            if acme_archived:
                checks_passed.append(f"[✓] {len(acme_archived)} Acme designs archived")
            else:
                errors.append("[X] No Acme designs found in archive folder")
        else:
            errors.append(f"[X] Archive folder '{archive_path}' not found")

        # Check main assets folder
        assets_path = "Client Work/Acme Corp/All Assets"
        assets_folder = _find_folder_by_path(backend, assets_path)

        if assets_folder:
            checks_passed.append(f"[✓] Assets folder '{assets_path}' exists")
            assets_folder_id = assets_folder.get("_id")
        else:
            errors.append(f"[X] Assets folder '{assets_path}' not found")
            assets_folder_id = None

        # Check new Acme designs
        new_designs = [
            ("Acme - New Product Launch", 1080, 1080, "instagram-post"),
            ("Acme - Facebook Campaign", 1200, 630, "facebook-post"),
            ("Acme - Client Presentation", 1920, 1080, "presentation"),
        ]

        for title, width, height, expected_format in new_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, width, height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in assets folder
                if assets_folder_id:
                    if design.get("folderId") == assets_folder_id:
                        checks_passed.append(f"[✓] {title} is in assets folder")
                    else:
                        errors.append(f"[X] {title} is not in '{assets_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 14: Live Music Poster Resize Square
# ==============================================================================
def _validate_canva_live_music_poster_resize_square(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Resize Live Music Night Poster to square format and analyze content.
    
    Validates:
    1. Design resized from poster (1080x1920) to square (1080x1080)
    2. Format changed to 'custom'
    3. Content analysis performed (text elements, shapes, shadows)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Live Music Night Poster")

        if not design:
            # Try finding any design with matching dimensions that was resized
            all_designs = _get_all_designs(backend)
            for d in all_designs:
                if d.get("width") == 1080 and d.get("height") == 1080:
                    if "live" in d.get("title", "").lower() or "music" in d.get("title", "").lower():
                        design = d
                        break

        if not design:
            errors.append("[X] 'Live Music Night Poster' design not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Design '{design.get('title')}' found")
        design_id = design.get("_id", "")

        # Check dimensions are now 1080x1080
        success, msg = _validate_design_dimensions(design, 1080, 1080)
        if success:
            checks_passed.append(f"[✓] {msg} (resized to square)")
        else:
            errors.append(f"[X] {msg} - expected 1080x1080 square format")

        # Check format is 'custom'
        format_val = design.get("format", "")
        if format_val == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_val}'")

        # Check answer contains content analysis
        answer_lower = final_answer.lower()
        analysis_checks = [
            ("text elements", ["text", "font"]),
            ("shape/image elements", ["shape", "image", "element"]),
            ("positioning", ["position", "coordinate", "x", "y"]),
            ("shadow effects", ["shadow"]),
        ]

        for check_name, keywords in analysis_checks:
            if any(kw in answer_lower for kw in keywords):
                checks_passed.append(f"[✓] {check_name.title()} documented")
            else:
                errors.append(f"[X] {check_name.title()} not documented in response")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 15: Instagram Collection Reorganize
# ==============================================================================
def _validate_canva_instagram_collection_reorganize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Reorganize all Instagram designs into a dedicated folder.
    
    Validates:
    1. Folder 'Personal/Social Media Archives/Instagram Collection' exists
    2. All designs with 'Instagram' in title moved to this folder
    3. Expected designs: Welcome Instagram Post, Welcome Instagram Post (Acme), Welcome Instagram Post (Starlight)
    4. Each design confirmed to contain text elements
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Personal/Social Media Archives/Instagram Collection"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' created")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Find all Instagram designs
        instagram_designs = _find_designs_by_title(backend, "Instagram")

        if len(instagram_designs) >= 3:
            checks_passed.append(f"[✓] Found {len(instagram_designs)} Instagram designs")
        elif len(instagram_designs) > 0:
            checks_passed.append(f"[✓] Found {len(instagram_designs)} Instagram designs")
        else:
            errors.append("[X] No designs with 'Instagram' in title found")

        # Check each Instagram design is in folder and has text elements
        if folder_id:
            designs_in_folder = 0
            designs_with_text = 0

            for design in instagram_designs:
                design_title = design.get("title", "")
                design_id = design.get("_id", "")

                if design.get("folderId") == folder_id:
                    designs_in_folder += 1

                # Check for text elements
                text_elements = _get_text_elements(backend, design_id)
                if text_elements:
                    designs_with_text += 1

            if designs_in_folder >= 3:
                checks_passed.append(f"[✓] All {designs_in_folder} Instagram designs moved to folder")
            elif designs_in_folder > 0:
                checks_passed.append(f"[✓] {designs_in_folder} Instagram designs in folder")
                if designs_in_folder < len(instagram_designs):
                    errors.append(f"[X] Not all Instagram designs moved (expected {len(instagram_designs)}, got {designs_in_folder})")
            else:
                errors.append("[X] No Instagram designs found in target folder")

            if designs_with_text >= 3:
                checks_passed.append(f"[✓] All {designs_with_text} designs contain text elements")
            elif designs_with_text > 0:
                checks_passed.append(f"[✓] {designs_with_text} designs have text elements")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 16: TechFlow Brand Identity
# ==============================================================================
def _validate_canva_techflow_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create complete brand identity package for TechFlow client.
    
    Validates:
    1. Logo 'TechFlow Logo Primary' (500x500, logo format)
    2. Business card 'TechFlow Business Card' (1050x600, business-card format)
    3. Presentation 'TechFlow Pitch Deck Template' (1920x1080, presentation format)
    4. All in folder 'Client Work/TechFlow/Brand Identity'
    5. Logo content extracted showing visual elements
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Client Work/TechFlow/Brand Identity"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("TechFlow Logo Primary", 500, 500, "logo"),
            ("TechFlow Business Card", 1050, 600, "business-card"),
            ("TechFlow Pitch Deck Template", 1920, 1080, "presentation"),
        ]

        logo_design = None
        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                if "Logo" in title:
                    logo_design = design

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                success, msg = _validate_design_format(design, expected_format)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check logo content extraction mentioned in answer
        if logo_design:
            answer_lower = final_answer.lower()
            if "color" in answer_lower or "visual" in answer_lower or "element" in answer_lower or "logo" in answer_lower:
                checks_passed.append("[✓] Logo content/visual elements documented")
            else:
                errors.append("[X] Logo content extraction not documented in response")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 17: Client Work Reorganization
# ==============================================================================
def _validate_canva_client_work_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Acme and Starlight designs into client folders.
    
    Validates:
    1. At least 4 Acme designs in 'Client Work/Acme Corp/Q1 2026/Social'
    2. At least 4 Starlight designs in 'Client Work/Starlight Studio/Social'
    3. Both folder hierarchies exist
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Acme folder structure
        acme_path = "Client Work/Acme Corp/Q1 2026/Social"
        acme_folder = _find_folder_by_path(backend, acme_path)

        if acme_folder:
            checks_passed.append(f"[✓] Acme folder '{acme_path}' exists")
            acme_folder_id = acme_folder.get("_id")

            # Count Acme designs in folder
            designs_in_acme = _get_designs_in_folder(backend, acme_folder_id)
            acme_designs = [d for d in designs_in_acme if "acme" in d.get("title", "").lower()]

            if len(acme_designs) >= 4:
                checks_passed.append(f"[✓] At least 4 Acme designs in folder ({len(acme_designs)} found)")
            else:
                errors.append(f"[X] Expected at least 4 Acme designs in folder, found {len(acme_designs)}")
        else:
            errors.append(f"[X] Acme folder '{acme_path}' not found")

        # Check Starlight folder structure
        starlight_path = "Client Work/Starlight Studio/Social"
        starlight_folder = _find_folder_by_path(backend, starlight_path)

        if starlight_folder:
            checks_passed.append(f"[✓] Starlight folder '{starlight_path}' exists")
            starlight_folder_id = starlight_folder.get("_id")

            # Count Starlight designs in folder
            designs_in_starlight = _get_designs_in_folder(backend, starlight_folder_id)
            starlight_designs = [d for d in designs_in_starlight if "starlight" in d.get("title", "").lower()]

            if len(starlight_designs) >= 4:
                checks_passed.append(f"[✓] At least 4 Starlight designs in folder ({len(starlight_designs)} found)")
            else:
                errors.append(f"[X] Expected at least 4 Starlight designs in folder, found {len(starlight_designs)}")
        else:
            errors.append(f"[X] Starlight folder '{starlight_path}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 18: TechStart Logo Suite
# ==============================================================================
def _validate_canva_techstart_logo_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create logo design suite for TechStart 2026.
    
    Validates:
    1. 'TechStart Logo - Primary' (500x500, logo format)
    2. 'TechStart Logo - Alternative' (500x500, logo format)
    3. 'TechStart Logo - Dark Version' (500x500, logo format)
    4. All in folder 'Brand Assets/Logos'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Logos"
        target_folder = _find_folder_by_path(backend, folder_path)

        # Also accept the folder ID mentioned in the task
        expected_folder_id = "10000000-0000-4000-8000-000000000017"

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            # Try finding by ID
            folder_by_id = _find_folder_by_id(backend, expected_folder_id)
            if folder_by_id:
                checks_passed.append("[✓] Brand Assets/Logos folder exists (by ID)")
                folder_id = expected_folder_id
            else:
                errors.append(f"[X] Folder '{folder_path}' not found")
                folder_id = None

        # Define expected designs
        expected_designs = [
            "TechStart Logo - Primary",
            "TechStart Logo - Alternative",
            "TechStart Logo - Dark Version",
        ]

        for title in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions (500x500)
                success, msg = _validate_design_dimensions(design, 500, 500)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format is logo
                success, msg = _validate_design_format(design, "logo")
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 19: Live Music Poster Audit
# ==============================================================================
def _validate_canva_live_music_poster_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Audit Live Music Night Poster and resize to A4.
    
    Validates:
    1. Design resized to A4 dimensions (2480x3508)
    2. Format changed to 'custom'
    3. Original audit documented (poster format 1080x1920)
    4. Element properties (positions, dimensions, colors, effects) documented
    5. Before/after comparison in response
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Live Music Night Poster")

        if not design:
            # Try finding by A4 dimensions
            all_designs = _get_all_designs(backend)
            for d in all_designs:
                if d.get("width") == 2480 and d.get("height") == 3508:
                    if "live" in d.get("title", "").lower() or "music" in d.get("title", "").lower():
                        design = d
                        break

        if not design:
            errors.append("[X] 'Live Music Night Poster' design not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Design '{design.get('title')}' found")
        design_id = design.get("_id", "")

        # Check dimensions are A4 (2480x3508)
        success, msg = _validate_design_dimensions(design, 2480, 3508)
        if success:
            checks_passed.append(f"[✓] {msg} (A4 format)")
        else:
            errors.append(f"[X] {msg} - expected A4 dimensions 2480x3508")

        # Check format is 'custom'
        format_val = design.get("format", "")
        if format_val == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_val}'")

        # Check answer documents audit details
        answer_lower = final_answer.lower()

        audit_checks = [
            ("original dimensions", ["1080x1920", "1080 x 1920", "poster"]),
            ("element positions", ["position", "coordinate", "x", "y"]),
            ("element dimensions", ["width", "height", "size"]),
            ("colors", ["color", "#"]),
            ("before/after comparison", ["before", "after", "original", "resize"]),
        ]

        documented_count = 0
        for check_name, keywords in audit_checks:
            if any(kw in answer_lower for kw in keywords):
                checks_passed.append(f"[✓] {check_name.title()} documented")
                documented_count += 1
            else:
                errors.append(f"[X] {check_name.title()} not documented")

        # Be more lenient - require at least 3 of 5 checks
        if documented_count >= 3:
            # Remove non-critical documentation errors
            errors = [e for e in errors if "not found" in e.lower() or "expected" in e.lower()]

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 20: Flash Sale Story Transform
# ==============================================================================
def _validate_canva_flash_sale_story_transform(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Transform Flash Sale Story from Instagram story to square format.
    
    Validates:
    1. Design resized to 1080x1080 (from 1080x1920)
    2. Format changed to 'custom'
    3. Original title 'Flash Sale Story' preserved
    4. Elements properly repositioned for square format
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Flash Sale Story")

        if not design:
            # Try finding any Flash Sale design with square dimensions
            all_designs = _get_all_designs(backend)
            for d in all_designs:
                if d.get("width") == 1080 and d.get("height") == 1080:
                    if "flash" in d.get("title", "").lower() and "sale" in d.get("title", "").lower():
                        design = d
                        break

        if not design:
            errors.append("[X] 'Flash Sale Story' design not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Design '{design.get('title')}' found")
        design_id = design.get("_id", "")

        # Check dimensions are 1080x1080
        success, msg = _validate_design_dimensions(design, 1080, 1080)
        if success:
            checks_passed.append(f"[✓] {msg} (square format)")
        else:
            errors.append(f"[X] {msg} - expected 1080x1080 square format")

        # Check format is 'custom'
        format_val = design.get("format", "")
        if format_val == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_val}'")

        # Check title preserved
        title = design.get("title", "")
        if "Flash Sale Story" in title:
            checks_passed.append("[✓] Original title 'Flash Sale Story' preserved")
        elif "flash" in title.lower() and "sale" in title.lower():
            checks_passed.append(f"[✓] Flash Sale title preserved: '{title}'")
        else:
            errors.append(f"[X] Title changed unexpectedly: '{title}'")

        # Check elements exist (properly repositioned)
        elements = _get_elements_for_design(backend, design_id)
        if elements:
            checks_passed.append(f"[✓] {len(elements)} elements found in design")

            # Check that elements are within square bounds
            elements_in_bounds = 0
            for el in elements:
                x = el.get("x", 0)
                y = el.get("y", 0)
                if 0 <= x <= 1080 and 0 <= y <= 1080:
                    elements_in_bounds += 1

            if elements_in_bounds == len(elements):
                checks_passed.append("[✓] All elements positioned within square format")
            elif elements_in_bounds > len(elements) / 2:
                checks_passed.append(f"[✓] Most elements repositioned ({elements_in_bounds}/{len(elements)})")

        # Check answer documents the changes
        answer_lower = final_answer.lower()
        if "1080x1080" in answer_lower or "1080 x 1080" in answer_lower or "square" in answer_lower:
            checks_passed.append("[✓] New dimensions documented in response")
        elif "resize" in answer_lower or "transform" in answer_lower:
            checks_passed.append("[✓] Transformation documented in response")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 21: Flash Sale Campaign Reorganization
# ==============================================================================
def _validate_canva_flash_sale_campaign_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Flash Sale designs by format type into campaign structure.
    
    Validates:
    1. Folder 'Client Work/Flash Sale Q1/Campaign Assets' exists
    2. Subfolders 'Stories' and 'Posts' exist within Campaign Assets
    3. Designs with 'Flash Sale' in title found and moved
    4. Instagram-story designs in Stories subfolder
    5. Instagram-post designs in Posts subfolder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Flash Sale designs first
        flash_sale_designs = _find_designs_by_title(backend, "Flash Sale")

        if not flash_sale_designs:
            errors.append("[X] No designs with 'Flash Sale' in title found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Found {len(flash_sale_designs)} Flash Sale designs")

        # Check main folder structure
        base_path = "Client Work/Flash Sale Q1/Campaign Assets"
        campaign_folder = _find_folder_by_path(backend, base_path)

        if campaign_folder:
            checks_passed.append(f"[✓] Folder '{base_path}' exists")
            campaign_folder_id = campaign_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{base_path}' not found")
            campaign_folder_id = None

        # Check Stories subfolder
        stories_path = f"{base_path}/Stories"
        stories_folder = _find_folder_by_path(backend, stories_path)
        stories_folder_id = None

        if stories_folder:
            checks_passed.append("[✓] Subfolder 'Stories' exists")
            stories_folder_id = stories_folder.get("_id")
        else:
            errors.append("[X] Subfolder 'Stories' not found")

        # Check Posts subfolder
        posts_path = f"{base_path}/Posts"
        posts_folder = _find_folder_by_path(backend, posts_path)
        posts_folder_id = None

        if posts_folder:
            checks_passed.append("[✓] Subfolder 'Posts' exists")
            posts_folder_id = posts_folder.get("_id")
        else:
            errors.append("[X] Subfolder 'Posts' not found")

        # Check designs are in correct subfolders
        stories_count = 0
        posts_count = 0

        for design in flash_sale_designs:
            design_format = design.get("format", "")
            design_folder_id = design.get("folderId")

            if "story" in design_format.lower():
                if design_folder_id == stories_folder_id:
                    stories_count += 1
            elif "post" in design_format.lower():
                if design_folder_id == posts_folder_id:
                    posts_count += 1

        # Count expected story and post designs
        expected_stories = len([d for d in flash_sale_designs if "story" in d.get("format", "").lower()])
        expected_posts = len([d for d in flash_sale_designs if "post" in d.get("format", "").lower()])

        if expected_stories > 0:
            if stories_count >= expected_stories:
                checks_passed.append(f"[✓] All {stories_count} instagram-story designs in Stories folder")
            elif stories_count > 0:
                checks_passed.append(f"[✓] {stories_count}/{expected_stories} story designs in Stories folder")
                errors.append("[X] Not all story designs moved to Stories folder")
            else:
                errors.append("[X] No story designs found in Stories folder")

        if expected_posts > 0:
            if posts_count >= expected_posts:
                checks_passed.append(f"[✓] All {posts_count} instagram-post designs in Posts folder")
            elif posts_count > 0:
                checks_passed.append(f"[✓] {posts_count}/{expected_posts} post designs in Posts folder")
                errors.append("[X] Not all post designs moved to Posts folder")
            else:
                errors.append("[X] No post designs found in Posts folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 22: Q2 Revenue Forecast Multi-Format
# ==============================================================================
def _validate_canva_q2_revenue_forecast_multiformat(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create Q2 Revenue Forecast in multiple formats and organize.
    
    Validates:
    1. 'Q2 Revenue Forecast Presentation' (1920x1080, presentation format)
    2. 'Q2 Revenue Forecast - Document' (2480x3508, A4 document)
    3. 'Q2 Revenue Forecast - Poster Display' (1080x1920, poster)
    4. All three in folder 'Financial Reports/Q2 2026'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Financial Reports/Q2 2026"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Q2 Revenue Forecast Presentation", 1920, 1080, "presentation"),
            ("Q2 Revenue Forecast - Document", 2480, 3508, "custom"),
            ("Q2 Revenue Forecast - Poster Display", 1080, 1920, "custom"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 23: Live Music Poster Advanced Analysis
# ==============================================================================
def _validate_canva_live_music_poster_advanced_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Conduct advanced content analysis of Live Music Night Poster.
    
    Validates:
    1. Design exists with poster format (1080x1920)
    2. Element counts by type documented
    3. Typography analysis (fonts, sizes, weights, alignment)
    4. Color palette documented
    5. Spatial analysis (positioning, zIndex)
    6. Special effects (shadows, opacity, borders) documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append("[✓] Design 'Live Music Night Poster' found")
        design_id = design.get("_id", "")

        # Check format (poster)
        success, msg = _validate_design_format(design, "poster")
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            # May have been resized, check dimensions instead
            width = design.get("width", 0)
            height = design.get("height", 0)
            if width == 1080 and height == 1920:
                checks_passed.append("[✓] Dimensions correct: 1080x1920")
            else:
                errors.append(f"[X] {msg}")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 1080, 1920)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements for analysis
        all_elements = _get_elements_for_design(backend, design_id)

        if all_elements:
            checks_passed.append(f"[✓] Found {len(all_elements)} elements in design")
        else:
            errors.append("[X] No elements found in design")

        # Check answer contains comprehensive analysis
        answer_lower = final_answer.lower()

        analysis_checks = [
            ("element count by type", ["shape", "text", "image", "line", "icon", "element", "count"]),
            ("typography analysis", ["font", "size", "weight", "alignment", "inter"]),
            ("color palette", ["color", "#", "fill", "stroke"]),
            ("spatial analysis", ["position", "coordinate", "x", "y", "zindex", "layer"]),
            ("special effects", ["shadow", "opacity", "border", "effect"]),
        ]

        documented_count = 0
        for check_name, keywords in analysis_checks:
            keyword_matches = sum(1 for kw in keywords if kw in answer_lower)
            if keyword_matches >= 2:
                checks_passed.append(f"[✓] {check_name.title()} documented")
                documented_count += 1
            elif keyword_matches >= 1:
                checks_passed.append(f"[✓] {check_name.title()} partially documented")
                documented_count += 0.5
            else:
                errors.append(f"[X] {check_name.title()} not documented")

        # Require at least 4 of 5 analysis sections
        if documented_count < 4:
            # Keep only the critical errors
            errors = [e for e in errors if "not found" in e.lower() or "dimension" in e.lower()]

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 24: Innovation Summit Social Media Campaign
# ==============================================================================
def _validate_canva_innovation_summit_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create social media campaign package for Innovation Summit 2026.
    
    Validates:
    1. 'Innovation Summit - Instagram Launch' (1080x1080)
    2. 'Innovation Summit - LinkedIn Header' (1584x396)
    3. 'Innovation Summit - YouTube Promo' (1280x720)
    4. Each design has text mentioning 'Innovation Summit'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Define expected designs
        expected_designs = [
            ("Innovation Summit - Instagram Launch", 1080, 1080),
            ("Innovation Summit - LinkedIn Header", 1584, 396),
            ("Innovation Summit - YouTube Promo", 1280, 720),
        ]

        for title, expected_width, expected_height in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")
                design_id = design.get("_id", "")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check for 'Innovation Summit' text in design
                text_elements = _get_text_elements(backend, design_id)
                innovation_text_found = False

                for el in text_elements:
                    text_content = _get_element_text(el).lower()
                    if "innovation" in text_content and "summit" in text_content:
                        innovation_text_found = True
                        break
                    elif "innovation summit" in text_content:
                        innovation_text_found = True
                        break

                if innovation_text_found:
                    checks_passed.append(f"[✓] {title} contains 'Innovation Summit' text")
                elif text_elements:
                    checks_passed.append(f"[✓] {title} has {len(text_elements)} text elements")
                else:
                    errors.append(f"[X] {title} has no text elements with 'Innovation Summit'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 25: YouTube Tech Review Content Package
# ==============================================================================
def _validate_canva_youtube_tech_review_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create YouTube content package for Tech Review channel.
    
    Validates:
    1. 'Tech Review Main Thumbnail' (1280x720, youtube-thumbnail)
    2. 'Tech Review End Screen' (1280x720, youtube-thumbnail)
    3. 'Tech Review Channel Art' (2560x1440, custom)
    4. All moved to 'YouTube Content/Tech Reviews' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "YouTube Content/Tech Reviews"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Tech Review Main Thumbnail", 1280, 720, "youtube-thumbnail"),
            ("Tech Review End Screen", 1280, 720, "youtube-thumbnail"),
            ("Tech Review Channel Art", 2560, 1440, "custom"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                elif expected_format == "custom":
                    # Custom format is acceptable for resized designs
                    checks_passed.append(f"[✓] {title}: Format is '{design_format}'")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 26: Q2 Business Review Resize
# ==============================================================================
def _validate_canva_q2_business_review_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create presentation and resize to poster for print display.
    
    Validates:
    1. Design 'Q2 2026 Business Review' exists
    2. Final dimensions are 1080x1920 (poster)
    3. Format is 'custom' after resize
    4. Contains business-appropriate text content
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Q2 2026 Business Review")

        if not design:
            # Try finding by dimensions
            all_designs = _get_all_designs(backend)
            for d in all_designs:
                if d.get("width") == 1080 and d.get("height") == 1920:
                    title = d.get("title", "").lower()
                    if "q2" in title and ("business" in title or "review" in title):
                        design = d
                        break

        if not design:
            errors.append("[X] Design 'Q2 2026 Business Review' not found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Design '{design.get('title')}' found")
        design_id = design.get("_id", "")

        # Check dimensions (1080x1920 poster)
        success, msg = _validate_design_dimensions(design, 1080, 1920)
        if success:
            checks_passed.append(f"[✓] {msg} (poster dimensions)")
        else:
            errors.append(f"[X] {msg} - expected poster dimensions 1080x1920")

        # Check format is 'custom'
        format_val = design.get("format", "")
        if format_val == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_val}'")

        # Check for business-appropriate text content
        text_elements = _get_text_elements(backend, design_id)
        if text_elements:
            all_text = " ".join(_get_element_text(el) for el in text_elements).lower()
            business_keywords = ["q2", "2026", "business", "review", "quarterly", "report", "revenue", "metrics"]
            found_keywords = [kw for kw in business_keywords if kw in all_text]

            if found_keywords:
                checks_passed.append(f"[✓] Business-appropriate text found: {', '.join(found_keywords)}")
            else:
                checks_passed.append(f"[✓] {len(text_elements)} text elements present")
        else:
            checks_passed.append("[✓] Design processed (no text elements)")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 27: Acme Complete Portfolio Organization
# ==============================================================================
def _validate_canva_acme_complete_portfolio(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Organize all Acme designs and verify content extraction.
    
    Validates:
    1. Folder 'Client Work/Acme Corp/Complete Portfolio' created
    2. 12 Acme designs moved to folder
    3. 'Acme Q1 Strategy Deck' contains main title text
    4. Strategy deck has at least 4 text elements
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Client Work/Acme Corp/Complete Portfolio"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' created")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Find all Acme designs
        acme_designs = _find_designs_by_title(backend, "Acme")
        checks_passed.append(f"[✓] Found {len(acme_designs)} Acme designs total")

        # Check how many are in the folder
        if folder_id:
            designs_in_folder = [d for d in acme_designs if d.get("folderId") == folder_id]

            if len(designs_in_folder) >= 12:
                checks_passed.append(f"[✓] 12 Acme designs moved to folder ({len(designs_in_folder)} found)")
            elif len(designs_in_folder) >= 10:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Acme designs in folder (expected 12)")
            else:
                errors.append(f"[X] Expected 12 Acme designs in folder, found {len(designs_in_folder)}")

        # Find and analyze Acme Q1 Strategy Deck
        strategy_deck = _find_design_by_title(backend, "Acme Q1 Strategy Deck")
        if not strategy_deck:
            strategy_deck = _find_design_by_title(backend, "Acme.*Strategy.*Deck")

        if strategy_deck:
            checks_passed.append("[✓] 'Acme Q1 Strategy Deck' found")
            deck_id = strategy_deck.get("_id", "")

            # Get text elements
            text_elements = _get_text_elements(backend, deck_id)

            if len(text_elements) >= 4:
                checks_passed.append(f"[✓] Strategy deck has {len(text_elements)} text elements (≥4)")
            else:
                errors.append(f"[X] Strategy deck has {len(text_elements)} text elements (expected ≥4)")

            # Check for main title text
            title_found = False
            for el in text_elements:
                text = _get_element_text(el).lower()
                if "acme" in text and ("q1" in text or "strategy" in text):
                    title_found = True
                    break

            if title_found:
                checks_passed.append("[✓] Strategy deck contains main title text")
            elif text_elements:
                checks_passed.append("[✓] Strategy deck has text content")
        else:
            errors.append("[X] 'Acme Q1 Strategy Deck' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 28: Acme Brand Assets Organization
# ==============================================================================
def _validate_canva_acme_brand_assets_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Organize Acme designs by content type into brand assets.
    
    Validates:
    1. Folder 'Brand Assets/Acme Corporation/2026 Assets' created
    2. At least 5 Acme designs moved to folder
    3. Format variety documented (multiple design types)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Acme Corporation/2026 Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' created")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Find all Acme designs
        acme_designs = _find_designs_by_title(backend, "Acme")

        if not acme_designs:
            errors.append("[X] No Acme designs found")
            return TaskScore(
                score=0.0,
                metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
            )

        checks_passed.append(f"[✓] Found {len(acme_designs)} Acme designs total")

        # Check how many are in the folder
        if folder_id:
            designs_in_folder = [d for d in acme_designs if d.get("folderId") == folder_id]

            if len(designs_in_folder) >= 5:
                checks_passed.append(f"[✓] At least 5 Acme designs moved ({len(designs_in_folder)} found)")
            else:
                errors.append(f"[X] Expected at least 5 Acme designs in folder, found {len(designs_in_folder)}")

            # Document format variety
            formats_in_folder = set(d.get("format", "custom") for d in designs_in_folder)

            if len(formats_in_folder) >= 2:
                checks_passed.append(f"[✓] Format variety documented: {', '.join(formats_in_folder)}")
            elif len(formats_in_folder) == 1:
                checks_passed.append(f"[✓] Designs have format: {list(formats_in_folder)[0]}")

        # Document overall format variety
        all_formats = set(d.get("format", "custom") for d in acme_designs)
        checks_passed.append(f"[✓] Acme design formats: {', '.join(all_formats)}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 29: Corporate Templates and Strategy Decks
# ==============================================================================
def _validate_canva_corporate_templates_strategy_decks(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create presentation templates and organize strategy decks.
    
    Validates:
    1. 'Corporate Template - Blue' (1920x1080, presentation)
    2. 'Corporate Template - Dark' (1920x1080, presentation)
    3. 'Corporate Template - Light' (1920x1080, presentation)
    4. All 3 in 'Templates/Presentations/Corporate' folder
    5. Strategy deck designs moved to 'Templates/Presentations/Strategy'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Corporate folder exists
        corporate_path = "Templates/Presentations/Corporate"
        corporate_folder = _find_folder_by_path(backend, corporate_path)

        if corporate_folder:
            checks_passed.append(f"[✓] Folder '{corporate_path}' exists")
            corporate_folder_id = corporate_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{corporate_path}' not found")
            corporate_folder_id = None

        # Check Strategy folder exists
        strategy_path = "Templates/Presentations/Strategy"
        strategy_folder = _find_folder_by_path(backend, strategy_path)

        if strategy_folder:
            checks_passed.append(f"[✓] Folder '{strategy_path}' exists")
            strategy_folder_id = strategy_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{strategy_path}' not found")
            strategy_folder_id = None

        # Check Corporate templates
        templates = [
            "Corporate Template - Blue",
            "Corporate Template - Dark",
            "Corporate Template - Light",
        ]

        templates_found = 0
        for title in templates:
            design = _find_design_by_title(backend, title)

            if design:
                templates_found += 1
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, 1920, 1080)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if corporate_folder_id:
                    if design.get("folderId") == corporate_folder_id:
                        checks_passed.append(f"[✓] {title} in Corporate folder")
                    else:
                        errors.append(f"[X] {title} not in Corporate folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        if templates_found == 3:
            checks_passed.append("[✓] All 3 corporate templates created")

        # Check Strategy Deck designs moved
        if strategy_folder_id:
            strategy_designs = _find_designs_by_title(backend, "Strategy Deck")
            designs_in_strategy = [d for d in strategy_designs if d.get("folderId") == strategy_folder_id]

            if designs_in_strategy:
                checks_passed.append(f"[✓] {len(designs_in_strategy)} strategy deck designs in Strategy folder")
            else:
                errors.append("[X] No strategy deck designs found in Strategy folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 30: Zenith Tech Logo Variations
# ==============================================================================
def _validate_canva_zenith_tech_logo_variations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create brand identity logo package for Zenith Tech.
    
    Validates:
    1. 'Zenith Tech Logo - Primary' (500x500, logo)
    2. 'Zenith Tech Logo - Horizontal' (1000x400, custom)
    3. 'Zenith Tech Logo - Icon' (300x300, logo)
    4. All in folder 'Brand Assets/Zenith Tech/Logos'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Zenith Tech/Logos"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        # Note: Primary (500x500) should use "logo" preset, Icon (300x300) must be custom (no preset exists)
        expected_designs = [
            ("Zenith Tech Logo - Primary", 500, 500, "logo"),
            ("Zenith Tech Logo - Horizontal", 1000, 400, "custom"),
            ("Zenith Tech Logo - Icon", 300, 300, "custom"),  # No 300x300 preset, must be custom
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                elif expected_format == "custom":
                    # Accept any format for custom designs
                    checks_passed.append(f"[✓] {title}: Format is '{design_format}'")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 31: Q2 Business Review Presentation and Poster
# ==============================================================================
def _validate_canva_q2_business_review_multiformat(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create Q2 2026 Business Review presentation and matching poster.
    
    Validates:
    1. 'Q2 2026 Business Review' presentation (1920x1080) in Personal/Docs/Presentations
    2. Contains at least one text element
    3. 'Q2 2026 Business Review - Poster' poster (1080x1920) in Personal/Print/Posters
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check presentation design
        presentation = _find_design_by_title(backend, "Q2 2026 Business Review")
        if presentation and "Poster" not in presentation.get("title", ""):
            # Find exact match without "Poster"
            all_designs = _find_designs_by_title(backend, "Q2 2026 Business Review")
            presentation = None
            for d in all_designs:
                title = d.get("title", "")
                if title == "Q2 2026 Business Review":
                    presentation = d
                    break

        if presentation:
            checks_passed.append("[✓] Design 'Q2 2026 Business Review' found")

            # Check dimensions
            success, msg = _validate_design_dimensions(presentation, 1920, 1080)
            if success:
                checks_passed.append(f"[✓] Presentation: {msg}")
            else:
                errors.append(f"[X] Presentation: {msg}")

            # Check format
            design_format = presentation.get("format", "")
            if design_format == "presentation":
                checks_passed.append("[✓] Presentation format correct")
            else:
                errors.append(f"[X] Presentation format: expected 'presentation', got '{design_format}'")

            # Check folder
            presentations_folder = _find_folder_by_path(backend, "Personal/Docs/Presentations")
            if presentations_folder:
                if presentation.get("folderId") == presentations_folder.get("_id"):
                    checks_passed.append("[✓] Presentation in Personal/Docs/Presentations folder")
                else:
                    errors.append("[X] Presentation not in Personal/Docs/Presentations folder")
            else:
                errors.append("[X] Folder 'Personal/Docs/Presentations' not found")

            # Check for text elements
            elements = _get_text_elements(backend, presentation.get("_id", ""))
            if len(elements) >= 1:
                checks_passed.append(f"[✓] Presentation has {len(elements)} text element(s)")
            else:
                errors.append("[X] Presentation has no text elements")
        else:
            errors.append("[X] Design 'Q2 2026 Business Review' not found")

        # Check poster design
        poster = _find_design_by_title(backend, "Q2 2026 Business Review - Poster")
        if poster:
            checks_passed.append("[✓] Design 'Q2 2026 Business Review - Poster' found")

            # Check dimensions
            success, msg = _validate_design_dimensions(poster, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] Poster: {msg}")
            else:
                errors.append(f"[X] Poster: {msg}")

            # Check format
            design_format = poster.get("format", "")
            if design_format == "poster":
                checks_passed.append("[✓] Poster format correct")
            else:
                errors.append(f"[X] Poster format: expected 'poster', got '{design_format}'")

            # Check folder
            posters_folder = _find_folder_by_path(backend, "Personal/Print/Posters")
            if posters_folder:
                if poster.get("folderId") == posters_folder.get("_id"):
                    checks_passed.append("[✓] Poster in Personal/Print/Posters folder")
                else:
                    errors.append("[X] Poster not in Personal/Print/Posters folder")
            else:
                errors.append("[X] Folder 'Personal/Print/Posters' not found")
        else:
            errors.append("[X] Design 'Q2 2026 Business Review - Poster' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 32: TechStart Brand Package
# ==============================================================================
def _validate_canva_techstart_brand_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create comprehensive brand package for TechStart.
    
    Validates:
    1. 'TechStart Logo 2026' (500x500, logo format)
    2. 'TechStart Business Card' (1050x600, business-card format)
    3. 'TechStart Website Header' (1920x400, custom format)
    4. All in 'TechStart Brand Package/Core Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "TechStart Brand Package/Core Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("TechStart Logo 2026", 500, 500, "logo"),
            ("TechStart Business Card", 1050, 600, "business-card"),
            ("TechStart Website Header", 1920, 400, "custom"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                elif expected_format == "custom":
                    checks_passed.append(f"[✓] {title}: Format is '{design_format}'")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 33: Q1 Marketing Report and Newsletter Resize
# ==============================================================================
def _validate_canva_q1_marketing_report_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Generate A4 document and resize January Newsletter.
    
    Validates:
    1. 'Q1 2026 Marketing Report' (2480x3508, A4) in Personal/Docs/Docs (A4)
    2. 'January Newsletter' resized to 1920x2560 with custom format
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Q1 Marketing Report
        report = _find_design_by_title(backend, "Q1 2026 Marketing Report")
        if report:
            checks_passed.append("[✓] Design 'Q1 2026 Marketing Report' found")

            # Check dimensions
            success, msg = _validate_design_dimensions(report, 2480, 3508)
            if success:
                checks_passed.append(f"[✓] Marketing Report: {msg}")
            else:
                errors.append(f"[X] Marketing Report: {msg}")

            # Check folder
            a4_folder = _find_folder_by_path(backend, "Personal/Docs/Docs (A4)")
            if a4_folder:
                if report.get("folderId") == a4_folder.get("_id"):
                    checks_passed.append("[✓] Marketing Report in correct folder")
                else:
                    errors.append("[X] Marketing Report not in Personal/Docs/Docs (A4) folder")
            else:
                errors.append("[X] Folder 'Personal/Docs/Docs (A4)' not found")
        else:
            errors.append("[X] Design 'Q1 2026 Marketing Report' not found")

        # Check January Newsletter resize
        newsletter = _find_design_by_title(backend, "January Newsletter")
        if newsletter:
            checks_passed.append("[✓] Design 'January Newsletter' found")

            # Check resized dimensions
            success, msg = _validate_design_dimensions(newsletter, 1920, 2560)
            if success:
                checks_passed.append(f"[✓] Newsletter resized: {msg}")
            else:
                errors.append(f"[X] Newsletter not resized correctly: {msg}")

            # Check format is custom
            design_format = newsletter.get("format", "")
            if design_format == "custom":
                checks_passed.append("[✓] Newsletter format is 'custom'")
            else:
                checks_passed.append(f"[✓] Newsletter format is '{design_format}'")
        else:
            errors.append("[X] Design 'January Newsletter' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 34: Welcome Instagram Post Format Variants
# ==============================================================================
def _validate_canva_welcome_format_variants(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Transform Welcome Instagram Post to multiple formats.
    
    Validates:
    1. 'Welcome Instagram Post' resized to 1280x720 (YouTube thumbnail)
    2. 'Welcome Slide' created (1920x1080, presentation)
    3. 'Welcome Poster' created (1080x1920, poster)
    4. All in 'Welcome Campaign Variants' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder = _find_folder_by_name(backend, "Welcome Campaign Variants")
        if folder:
            checks_passed.append("[✓] Folder 'Welcome Campaign Variants' exists")
            folder_id = folder.get("_id")
        else:
            errors.append("[X] Folder 'Welcome Campaign Variants' not found")
            folder_id = None

        # Check resized Welcome Instagram Post
        welcome_post = _find_design_by_title(backend, "Welcome Instagram Post")
        if welcome_post:
            checks_passed.append("[✓] 'Welcome Instagram Post' found")

            success, msg = _validate_design_dimensions(welcome_post, 1280, 720)
            if success:
                checks_passed.append(f"[✓] Welcome Instagram Post resized: {msg}")
            else:
                errors.append(f"[X] Welcome Instagram Post not resized correctly: {msg}")

            if folder_id and welcome_post.get("folderId") == folder_id:
                checks_passed.append("[✓] Welcome Instagram Post in correct folder")
            elif folder_id:
                errors.append("[X] Welcome Instagram Post not in 'Welcome Campaign Variants' folder")
        else:
            errors.append("[X] 'Welcome Instagram Post' not found")

        # Check Welcome Slide
        welcome_slide = _find_design_by_title(backend, "Welcome Slide")
        if welcome_slide:
            checks_passed.append("[✓] 'Welcome Slide' created")

            success, msg = _validate_design_dimensions(welcome_slide, 1920, 1080)
            if success:
                checks_passed.append(f"[✓] Welcome Slide: {msg}")
            else:
                errors.append(f"[X] Welcome Slide: {msg}")

            if folder_id and welcome_slide.get("folderId") == folder_id:
                checks_passed.append("[✓] Welcome Slide in correct folder")
            elif folder_id:
                errors.append("[X] Welcome Slide not in 'Welcome Campaign Variants' folder")
        else:
            errors.append("[X] 'Welcome Slide' not found")

        # Check Welcome Poster
        welcome_poster = _find_design_by_title(backend, "Welcome Poster")
        if welcome_poster:
            checks_passed.append("[✓] 'Welcome Poster' created")

            success, msg = _validate_design_dimensions(welcome_poster, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] Welcome Poster: {msg}")
            else:
                errors.append(f"[X] Welcome Poster: {msg}")

            if folder_id and welcome_poster.get("folderId") == folder_id:
                checks_passed.append("[✓] Welcome Poster in correct folder")
            elif folder_id:
                errors.append("[X] Welcome Poster not in 'Welcome Campaign Variants' folder")
        else:
            errors.append("[X] 'Welcome Poster' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 35: Brand Logo Variations
# ==============================================================================
def _validate_canva_brand_logo_variations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create brand logo variations.
    
    Validates:
    1. 'Brand Logo - Square' (500x500, logo)
    2. 'Brand Logo - Wide' (800x400, custom)
    3. 'Brand Logo - Vertical' (400x800, custom)
    4. 'Brand Logo - Favicon' (64x64, custom)
    5. All in 'Brand Assets/Logos' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Logos"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Brand Logo - Square", 500, 500, "logo"),
            ("Brand Logo - Wide", 800, 400, "custom"),
            ("Brand Logo - Vertical", 400, 800, "custom"),
            ("Brand Logo - Favicon", 64, 64, "custom"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                elif expected_format == "custom":
                    checks_passed.append(f"[✓] {title}: Format is '{design_format}'")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 36: Conference 2026 Folder Organization
# ==============================================================================
def _validate_canva_conference_2026_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Set up conference event folder structure and move Conference designs.
    
    Validates:
    1. Folder hierarchy 'Brand Assets/Conference 2026/Digital Assets/Social Media' exists (4 levels)
    2. At least 1 design with 'Conference' in title moved to Social Media folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check full folder hierarchy exists
        folder_path = "Brand Assets/Conference 2026/Digital Assets/Social Media"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Full folder hierarchy '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder hierarchy '{folder_path}' not complete")
            folder_id = None

        # Check intermediate folders exist
        level_2 = _find_folder_by_path(backend, "Brand Assets/Conference 2026")
        if level_2:
            checks_passed.append("[✓] 'Brand Assets/Conference 2026' folder exists")

        level_3 = _find_folder_by_path(backend, "Brand Assets/Conference 2026/Digital Assets")
        if level_3:
            checks_passed.append("[✓] 'Brand Assets/Conference 2026/Digital Assets' folder exists")

        # Check Conference designs moved
        if folder_id:
            conference_designs = _find_designs_by_title(backend, "Conference")
            designs_in_folder = [d for d in conference_designs if d.get("folderId") == folder_id]

            if len(designs_in_folder) >= 1:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Conference design(s) moved to Social Media folder")
            else:
                errors.append("[X] No Conference designs found in Social Media folder")
        else:
            # Check if any conference designs exist at all
            conference_designs = _find_designs_by_title(backend, "Conference")
            if conference_designs:
                errors.append(f"[X] Found {len(conference_designs)} Conference design(s) but target folder doesn't exist")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 37: Video Content Series
# ==============================================================================
def _validate_canva_video_content_series(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create video content series designs.
    
    Validates:
    1. 'Series Episode 1 Thumbnail' (1280x720, youtube-thumbnail)
    2. 'Series Episode 1 Story' (1080x1920, instagram-story)
    3. 'Series Episode 1 Poster' (1080x1920, poster)
    4. All in 'Personal/Video/YouTube Thumbnails' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Personal/Video/YouTube Thumbnails"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Series Episode 1 Thumbnail", 1280, 720, "youtube-thumbnail"),
            ("Series Episode 1 Story", 1080, 1920, "instagram-story"),
            ("Series Episode 1 Poster", 1080, 1920, "poster"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 38: Conference and Newsletter Reorganization
# ==============================================================================
def _validate_canva_conference_newsletter_reorg(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Conference and Newsletter designs.
    
    Validates:
    1. 'Personal > Events > Conference Materials' folder exists
    2. 'Personal > Docs > A4' folder exists (may already exist)
    3. At least 1 Conference design moved to Conference Materials
    4. At least 1 Newsletter design moved to A4 folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Conference Materials folder
        conference_folder = _find_folder_by_path(backend, "Personal/Events/Conference Materials")
        if conference_folder:
            checks_passed.append("[✓] Folder 'Personal/Events/Conference Materials' exists")
            conference_folder_id = conference_folder.get("_id")
        else:
            errors.append("[X] Folder 'Personal/Events/Conference Materials' not found")
            conference_folder_id = None

        # Check A4 folder exists
        a4_folder = _find_folder_by_path(backend, "Personal/Docs/A4")
        if a4_folder:
            checks_passed.append("[✓] Folder 'Personal/Docs/A4' exists")
            a4_folder_id = a4_folder.get("_id")
        else:
            errors.append("[X] Folder 'Personal/Docs/A4' not found")
            a4_folder_id = None

        # Check Conference designs moved
        if conference_folder_id:
            conference_designs = _find_designs_by_title(backend, "Conference")
            designs_in_folder = [d for d in conference_designs if d.get("folderId") == conference_folder_id]

            if len(designs_in_folder) >= 1:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Conference design(s) in Conference Materials folder")
            else:
                errors.append("[X] No Conference designs found in Conference Materials folder")

        # Check Newsletter designs moved
        if a4_folder_id:
            newsletter_designs = _find_designs_by_title(backend, "Newsletter")
            designs_in_folder = [d for d in newsletter_designs if d.get("folderId") == a4_folder_id]

            if len(designs_in_folder) >= 1:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Newsletter design(s) in A4 folder")
            else:
                errors.append("[X] No Newsletter designs found in A4 folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 39: Welcome Designs Content Analysis
# ==============================================================================
def _validate_canva_welcome_content_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Search and analyze Welcome designs content.
    
    Validates:
    1. At least 3 Welcome designs found
    2. Dimensions documented for each
    3. Text content extracted
    4. Font family Inter identified
    5. Similar text patterns documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all Welcome designs
        welcome_designs = _find_designs_by_title(backend, "Welcome")

        if len(welcome_designs) >= 3:
            checks_passed.append(f"[✓] Found {len(welcome_designs)} Welcome designs (>= 3 required)")
        else:
            errors.append(f"[X] Only found {len(welcome_designs)} Welcome designs (need >= 3)")

        # Document dimensions for each
        dimensions_documented = True
        for design in welcome_designs:
            width = design.get("width", 0)
            height = design.get("height", 0)
            title = design.get("title", "Unknown")
            if width > 0 and height > 0:
                checks_passed.append(f"[✓] '{title}' dimensions: {width}x{height}")
            else:
                dimensions_documented = False

        if dimensions_documented and welcome_designs:
            checks_passed.append("[✓] Dimensions documented for all Welcome designs")

        # Extract text content and check for Inter font
        all_fonts = set()
        text_contents = []

        for design in welcome_designs:
            design_id = design.get("_id", "")
            text_elements = _get_text_elements(backend, design_id)

            for el in text_elements:
                # Get text content
                text = _get_element_text(el)
                if text:
                    text_contents.append(text)

                # Get font families
                props = el.get("properties", {})
                for seg in props.get("segments", []):
                    if "fontFamily" in seg:
                        all_fonts.add(seg["fontFamily"])

        if text_contents:
            checks_passed.append(f"[✓] Text content extracted from {len(text_contents)} text elements")
        else:
            checks_passed.append("[✓] Text content analysis completed (no text found)")

        if "Inter" in all_fonts:
            checks_passed.append(f"[✓] Inter font family found (fonts: {all_fonts})")
        elif all_fonts:
            checks_passed.append(f"[✓] Fonts documented: {all_fonts}")
        else:
            checks_passed.append("[✓] Font analysis completed")

        # Check for similar patterns (presence of "welcome" text)
        welcome_text_count = sum(1 for t in text_contents if "welcome" in t.lower())
        if welcome_text_count > 0:
            checks_passed.append(f"[✓] Similar text patterns identified ({welcome_text_count} elements with 'welcome')")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 40: TechStart Branding Package (4 designs)
# ==============================================================================
def _validate_canva_techstart_branding_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create complete business branding package for TechStart.
    
    Validates:
    1. 'TechStart Logo Primary' (500x500, logo)
    2. 'TechStart Business Card' (1050x600, business-card)
    3. 'TechStart LinkedIn Banner' (1584x396, linkedin-banner)
    4. 'TechStart Pitch Deck Cover' (1920x1080, presentation)
    5. All in 'Brand Assets/TechStart/2026 Rebrand' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/TechStart/2026 Rebrand"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("TechStart Logo Primary", 500, 500, "logo"),
            ("TechStart Business Card", 1050, 600, "business-card"),
            ("TechStart LinkedIn Banner", 1584, 396, "linkedin-banner"),
            ("TechStart Pitch Deck Cover", 1920, 1080, "presentation"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 41: Q1 2026 Content Folder Structure
# ==============================================================================
def _validate_canva_q1_2026_content_folders(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create Q1 2026 Content folder structure and move podcast thumbnail.
    
    Validates:
    1. 'Personal/Video/Q1 2026 Content/Thumbnails' exists
    2. 'Personal/Video/Q1 2026 Content/Intros' exists
    3. 'Personal/Video/Q1 2026 Content/Outros' exists
    4. 'Podcast Episode 12 Thumbnail' moved to Thumbnails folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Thumbnails folder
        thumbnails_folder = _find_folder_by_path(backend, "Personal/Video/Q1 2026 Content/Thumbnails")
        if thumbnails_folder:
            checks_passed.append("[✓] Folder 'Personal/Video/Q1 2026 Content/Thumbnails' exists")
            thumbnails_folder_id = thumbnails_folder.get("_id")
        else:
            errors.append("[X] Folder 'Personal/Video/Q1 2026 Content/Thumbnails' not found")
            thumbnails_folder_id = None

        # Check Intros folder
        intros_folder = _find_folder_by_path(backend, "Personal/Video/Q1 2026 Content/Intros")
        if intros_folder:
            checks_passed.append("[✓] Folder 'Personal/Video/Q1 2026 Content/Intros' exists")
        else:
            errors.append("[X] Folder 'Personal/Video/Q1 2026 Content/Intros' not found")

        # Check Outros folder
        outros_folder = _find_folder_by_path(backend, "Personal/Video/Q1 2026 Content/Outros")
        if outros_folder:
            checks_passed.append("[✓] Folder 'Personal/Video/Q1 2026 Content/Outros' exists")
        else:
            errors.append("[X] Folder 'Personal/Video/Q1 2026 Content/Outros' not found")

        # Check podcast thumbnail moved
        podcast_design = _find_design_by_title(backend, "Podcast Episode 12 Thumbnail")
        if podcast_design:
            checks_passed.append("[✓] Design 'Podcast Episode 12 Thumbnail' found")

            if thumbnails_folder_id and podcast_design.get("folderId") == thumbnails_folder_id:
                checks_passed.append("[✓] Podcast Episode 12 Thumbnail in Thumbnails folder")
            elif thumbnails_folder_id:
                errors.append("[X] Podcast Episode 12 Thumbnail not in Thumbnails folder")
        else:
            errors.append("[X] Design 'Podcast Episode 12 Thumbnail' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 42: Phoenix Launch Campaign
# ==============================================================================
def _validate_canva_phoenix_launch_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create product launch campaign for Phoenix.
    
    Validates:
    1. 'Phoenix Launch - Instagram' (1080x1080)
    2. 'Phoenix Launch - Twitter' (1500x500)
    3. 'Phoenix Launch - LinkedIn' (1584x396)
    4. All in 'Campaigns/2026/Phoenix Launch' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Campaigns/2026/Phoenix Launch"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Phoenix Launch - Instagram", 1080, 1080),
            ("Phoenix Launch - Twitter", 1500, 500),
            ("Phoenix Launch - LinkedIn", 1584, 396),
        ]

        for title, expected_width, expected_height in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 43: Acme Rebrand Campaign
# ==============================================================================
def _validate_canva_acme_rebrand_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create rebrand campaign for Acme Corp.
    
    Validates:
    1. 'Acme Rebrand - Instagram' (1080x1080)
    2. 'Acme Rebrand - LinkedIn' (1584x396)
    3. 'Acme Rebrand - Twitter' (1500x500)
    4. All in 'Client Work/Acme Corp/2026 Rebrand/Social Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Client Work/Acme Corp/2026 Rebrand/Social Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Acme Rebrand - Instagram", 1080, 1080),
            ("Acme Rebrand - LinkedIn", 1584, 396),
            ("Acme Rebrand - Twitter", 1500, 500),
        ]

        for title, expected_width, expected_height in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 44: Flash Sale and Yoga Reorganization
# ==============================================================================
def _validate_canva_flash_sale_yoga_reorg(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Flash Sale and Yoga designs.
    
    Validates:
    1. 'Personal/Marketing Campaigns/Flash Sales' folder exists
    2. 'Personal/Health & Wellness/Yoga Classes' folder exists
    3. At least 3 Flash Sale designs moved
    4. At least 2 Yoga designs moved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Flash Sales folder
        flash_folder = _find_folder_by_path(backend, "Personal/Marketing Campaigns/Flash Sales")
        if flash_folder:
            checks_passed.append("[✓] Folder 'Personal/Marketing Campaigns/Flash Sales' exists")
            flash_folder_id = flash_folder.get("_id")
        else:
            errors.append("[X] Folder 'Personal/Marketing Campaigns/Flash Sales' not found")
            flash_folder_id = None

        # Check Yoga folder
        yoga_folder = _find_folder_by_path(backend, "Personal/Health & Wellness/Yoga Classes")
        if yoga_folder:
            checks_passed.append("[✓] Folder 'Personal/Health & Wellness/Yoga Classes' exists")
            yoga_folder_id = yoga_folder.get("_id")
        else:
            errors.append("[X] Folder 'Personal/Health & Wellness/Yoga Classes' not found")
            yoga_folder_id = None

        # Check Flash Sale designs moved
        if flash_folder_id:
            flash_designs = _find_designs_by_title(backend, "Flash Sale")
            designs_in_folder = [d for d in flash_designs if d.get("folderId") == flash_folder_id]

            if len(designs_in_folder) >= 3:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Flash Sale designs in folder (>= 3)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} Flash Sale designs in folder (need >= 3)")

        # Check Yoga designs moved
        if yoga_folder_id:
            yoga_designs = _find_designs_by_title(backend, "Yoga")
            designs_in_folder = [d for d in yoga_designs if d.get("folderId") == yoga_folder_id]

            if len(designs_in_folder) >= 2:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Yoga designs in folder (>= 2)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} Yoga designs in folder (need >= 2)")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 45: Acme Logo Consolidation
# ==============================================================================
def _validate_canva_acme_logo_consolidation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Consolidate Acme logo assets.
    
    Validates:
    1. 'Brand Assets/Logo Variations/Acme Concepts' folder exists
    2. 'Acme Logo Concepts' moved to folder
    3. 'Acme Logo - Dark Version' (500x500)
    4. 'Acme Logo - Light Version' (500x500)
    5. 'Acme Logo - Monogram' (500x500)
    6. All 4 logos in target folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Logo Variations/Acme Concepts"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check original Acme Logo Concepts moved
        original = _find_design_by_title(backend, "Acme Logo Concepts")
        if original:
            checks_passed.append("[✓] 'Acme Logo Concepts' found")
            if folder_id and original.get("folderId") == folder_id:
                checks_passed.append("[✓] 'Acme Logo Concepts' in correct folder")
            elif folder_id:
                errors.append("[X] 'Acme Logo Concepts' not in correct folder")
        else:
            errors.append("[X] 'Acme Logo Concepts' not found")

        # Check new logo variations
        new_logos = [
            "Acme Logo - Dark Version",
            "Acme Logo - Light Version",
            "Acme Logo - Monogram",
        ]

        for title in new_logos:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions (500x500)
                success, msg = _validate_design_dimensions(design, 500, 500)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Verify total count in folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            if len(designs_in_folder) >= 4:
                checks_passed.append(f"[✓] {len(designs_in_folder)} logo designs in folder (>= 4)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} designs in folder (need 4)")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 46: Moonlight Agency Q1 Campaign
# ==============================================================================
def _validate_canva_moonlight_q1_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Set up Moonlight Agency client project with designs.
    
    Validates:
    1. 'Client Work/Moonlight Agency/Q1 Campaign' folder exists
    2. 'Moonlight Q1 Poster' (1080x1920, poster)
    3. 'Moonlight Q1 Flyer' (2480x3508, flyer)
    4. 'Moonlight Q1 Story' (1080x1920, instagram-story)
    5. All designs in Q1 Campaign folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Client Work/Moonlight Agency/Q1 Campaign"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Moonlight Q1 Poster", 1080, 1920, "poster"),
            ("Moonlight Q1 Flyer", 2480, 3508, "flyer"),
            ("Moonlight Q1 Story", 1080, 1920, "instagram-story"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 47: Starlight Studio Consolidation
# ==============================================================================
def _validate_canva_starlight_consolidation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Consolidate Starlight Studio assets with analysis.
    
    Validates:
    1. 'Clients/Starlight Studio/Complete Assets' folder exists
    2. At least 3 Starlight designs moved to folder
    3. Text content analyzed (character counts)
    4. Inter font usage documented
    5. Background colors identified
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Clients/Starlight Studio/Complete Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check Starlight designs moved
        starlight_designs = _find_designs_by_title(backend, "Starlight")

        if folder_id:
            designs_in_folder = [d for d in starlight_designs if d.get("folderId") == folder_id]

            if len(designs_in_folder) >= 3:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Starlight designs in folder (>= 3)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} Starlight designs in folder (need >= 3)")
        elif len(starlight_designs) >= 3:
            errors.append(f"[X] Found {len(starlight_designs)} Starlight designs but target folder doesn't exist")

        # Analyze text content and fonts
        total_chars = 0
        all_fonts = set()
        bg_colors = set()

        for design in starlight_designs:
            design_id = design.get("_id", "")

            # Get text elements
            text_elements = _get_text_elements(backend, design_id)
            for el in text_elements:
                text = _get_element_text(el)
                total_chars += len(text)

                # Get fonts
                props = el.get("properties", {})
                for seg in props.get("segments", []):
                    if "fontFamily" in seg:
                        all_fonts.add(seg["fontFamily"])

            # Get background colors from pages
            pages = design.get("pages", [])
            for page in pages:
                bg = page.get("backgroundColor", "")
                if bg:
                    bg_colors.add(bg)

        if total_chars > 0:
            checks_passed.append(f"[✓] Text character count analyzed: {total_chars} total characters")
        else:
            checks_passed.append("[✓] Text content analysis completed")

        if "Inter" in all_fonts:
            checks_passed.append(f"[✓] Inter font documented (fonts: {all_fonts})")
        elif all_fonts:
            checks_passed.append(f"[✓] Fonts documented: {all_fonts}")
        else:
            checks_passed.append("[✓] Font analysis completed")

        if bg_colors:
            checks_passed.append(f"[✓] Background colors identified: {bg_colors}")
        else:
            checks_passed.append("[✓] Background color analysis completed")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 48: Social Media Title-Based Reorganization
# ==============================================================================
def _validate_canva_social_media_title_reorg(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Social Media folder by title patterns.
    
    Validates:
    1. 'Personal/Social Media/Instagram Posts' folder has designs with 'Post' in title
    2. 'Personal/Social Media/Instagram Stories' folder has designs with 'Story' in title
    3. 'Personal/Social Media/Headers & Banners' folder has designs with 'Header' or 'Banner'
    4. At least 6 designs total distributed across folders
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        total_distributed = 0

        # Check Instagram Posts folder
        posts_folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Posts")
        if posts_folder:
            checks_passed.append("[✓] Folder 'Personal/Social Media/Instagram Posts' exists")
            posts_folder_id = posts_folder.get("_id")

            post_designs = _find_designs_by_title(backend, "Post")
            posts_in_folder = [d for d in post_designs if d.get("folderId") == posts_folder_id]
            total_distributed += len(posts_in_folder)

            if posts_in_folder:
                checks_passed.append(f"[✓] {len(posts_in_folder)} 'Post' designs in Instagram Posts folder")
        else:
            errors.append("[X] Folder 'Personal/Social Media/Instagram Posts' not found")

        # Check Instagram Stories folder
        stories_folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Stories")
        if stories_folder:
            checks_passed.append("[✓] Folder 'Personal/Social Media/Instagram Stories' exists")
            stories_folder_id = stories_folder.get("_id")

            story_designs = _find_designs_by_title(backend, "Story")
            stories_in_folder = [d for d in story_designs if d.get("folderId") == stories_folder_id]
            total_distributed += len(stories_in_folder)

            if stories_in_folder:
                checks_passed.append(f"[✓] {len(stories_in_folder)} 'Story' designs in Instagram Stories folder")
        else:
            errors.append("[X] Folder 'Personal/Social Media/Instagram Stories' not found")

        # Check Headers & Banners folder
        headers_folder = _find_folder_by_path(backend, "Personal/Social Media/Headers & Banners")
        if headers_folder:
            checks_passed.append("[✓] Folder 'Personal/Social Media/Headers & Banners' exists")
            headers_folder_id = headers_folder.get("_id")

            header_designs = _find_designs_by_title(backend, "Header")
            banner_designs = _find_designs_by_title(backend, "Banner")
            all_header_banner = header_designs + banner_designs

            hb_in_folder = [d for d in all_header_banner if d.get("folderId") == headers_folder_id]
            total_distributed += len(hb_in_folder)

            if hb_in_folder:
                checks_passed.append(f"[✓] {len(hb_in_folder)} 'Header'/'Banner' designs in Headers & Banners folder")
        else:
            errors.append("[X] Folder 'Personal/Social Media/Headers & Banners' not found")

        # Check total distributed
        if total_distributed >= 6:
            checks_passed.append(f"[✓] {total_distributed} designs distributed across folders (>= 6)")
        else:
            errors.append(f"[X] Only {total_distributed} designs distributed (need >= 6)")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 49: Welcome Collection Organization and Analysis
# ==============================================================================
def _validate_canva_welcome_collection_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Organize Welcome designs and analyze Welcome Instagram Post typography.
    
    Validates:
    1. 'Brand Assets/Welcome Collection/By Format' folder exists
    2. At least 2 Welcome designs moved to Welcome Collection
    3. Welcome Instagram Post text analysis: element count, fonts, sizes, content
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Brand Assets/Welcome Collection/By Format"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check Welcome designs moved (to Welcome Collection, not necessarily By Format)
        welcome_collection_folder = _find_folder_by_path(backend, "Brand Assets/Welcome Collection")
        if welcome_collection_folder:
            wc_folder_id = welcome_collection_folder.get("_id")
            welcome_designs = _find_designs_by_title(backend, "Welcome")

            # Check designs in Welcome Collection or By Format
            designs_in_wc = []
            for d in welcome_designs:
                d_folder = d.get("folderId")
                if d_folder == wc_folder_id or (folder_id and d_folder == folder_id):
                    designs_in_wc.append(d)

            if len(designs_in_wc) >= 2:
                checks_passed.append(f"[✓] {len(designs_in_wc)} Welcome designs in Welcome Collection (>= 2)")
            else:
                errors.append(f"[X] Only {len(designs_in_wc)} Welcome designs in Welcome Collection (need >= 2)")
        elif folder_id:
            # Check just By Format folder
            welcome_designs = _find_designs_by_title(backend, "Welcome")
            designs_in_folder = [d for d in welcome_designs if d.get("folderId") == folder_id]

            if len(designs_in_folder) >= 2:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Welcome designs in folder (>= 2)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} Welcome designs in folder (need >= 2)")

        # Analyze Welcome Instagram Post
        welcome_post = _find_design_by_title(backend, "Welcome Instagram Post")
        if welcome_post:
            design_id = welcome_post.get("_id", "")
            text_elements = _get_text_elements(backend, design_id)

            # Count text elements
            text_count = len(text_elements)
            if text_count > 0:
                checks_passed.append(f"[✓] Welcome Instagram Post has {text_count} text element(s)")

            # Extract fonts, sizes, and content
            fonts = set()
            sizes = set()
            all_text = []

            for el in text_elements:
                text = _get_element_text(el)
                if text:
                    all_text.append(text)

                props = el.get("properties", {})
                if "fontSize" in props:
                    sizes.add(props["fontSize"])

                for seg in props.get("segments", []):
                    if "fontFamily" in seg:
                        fonts.add(seg["fontFamily"])
                    if "fontSize" in seg:
                        sizes.add(seg["fontSize"])

            if fonts:
                checks_passed.append(f"[✓] Font families: {fonts}")
            if sizes:
                checks_passed.append(f"[✓] Font sizes: {sizes}")
            if all_text:
                checks_passed.append(f"[✓] Text content extracted from {len(all_text)} element(s)")
        else:
            checks_passed.append("[✓] Welcome Instagram Post analysis attempted")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 50: Aurora Wellness Spa Digital Marketing
# ==============================================================================
def _validate_canva_aurora_spa_marketing(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Task: Create digital marketing asset library for Aurora Wellness Spa.
    
    Validates:
    1. 'Aurora Spa - Instagram' (1080x1080, instagram-post)
    2. 'Aurora Spa - Story' (1080x1920, instagram-story)
    3. 'Aurora Spa - Facebook' (1200x630, facebook-post)
    4. 'Aurora Spa - YouTube' (1280x720, youtube-thumbnail)
    5. 'Aurora Spa - Web Banner' (1600x400, custom)
    6. All in 'Client Work/Aurora Wellness Spa/Digital Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder_path = "Client Work/Aurora Wellness Spa/Digital Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Define expected designs
        expected_designs = [
            ("Aurora Spa - Instagram", 1080, 1080, "instagram-post"),
            ("Aurora Spa - Story", 1080, 1920, "instagram-story"),
            ("Aurora Spa - Facebook", 1200, 630, "facebook-post"),
            ("Aurora Spa - YouTube", 1280, 720, "youtube-thumbnail"),
            ("Aurora Spa - Web Banner", 1600, 400, "custom"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                # Check dimensions
                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                # Check format
                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                elif expected_format == "custom":
                    checks_passed.append(f"[✓] {title}: Format is '{design_format}'")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                # Check if in folder
                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 51: Community Event Promo Resize and Story
# ==============================================================================
def _validate_canva_community_event_resize_story(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Resize Community Event Promo to YouTube thumbnail and create Instagram story.

    Validates:
    1. Original design resized to 1280x720 with custom format
    2. Text content extracted/documented
    3. New Instagram story created with title 'Community Event Story' (1080x1920)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # 1. Check resized original design
        design = _find_design_by_title(backend, "Community Event Promo")
        if design:
            checks_passed.append("[✓] 'Community Event Promo' design found")

            success, msg = _validate_design_dimensions(design, 1280, 720)
            if success:
                checks_passed.append(f"[✓] {msg}")
            else:
                errors.append(f"[X] Community Event Promo: {msg}")

            design_format = design.get("format", "")
            if design_format == "youtube-thumbnail":
                checks_passed.append("[✓] Format is 'youtube-thumbnail' after resize to YouTube thumbnail dimensions")
            else:
                errors.append(f"[X] Format should be 'youtube-thumbnail' after resize, got '{design_format}'")
        else:
            errors.append("[X] 'Community Event Promo' design not found")

        # 2. Check new Instagram story design
        story_design = _find_design_by_title(backend, "Community Event Story")
        if story_design:
            checks_passed.append("[✓] 'Community Event Story' design created")

            success, msg = _validate_design_dimensions(story_design, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] Story: {msg}")
            else:
                errors.append(f"[X] Community Event Story: {msg}")
        else:
            errors.append("[X] 'Community Event Story' design not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 52: Q2 2026 Acme Campaign Collection
# ==============================================================================
def _validate_canva_q2_acme_campaign_collection(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Q2 2026 campaign asset collection for Acme Corp.

    Validates:
    1. Three designs with exact titles
    2. Correct formats and dimensions
    3. Folder hierarchy 'Client Work/Acme Corp/Q2 2026/Campaign Assets' exists
    4. All designs in Campaign Assets folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder_path = "Client Work/Acme Corp/Q2 2026/Campaign Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check three designs
        expected_designs = [
            ("Q2 Launch Campaign - Instagram", 1080, 1080, "instagram-post"),
            ("Q2 Launch Campaign - LinkedIn", 1584, 396, "linkedin-banner"),
            ("Q2 Launch Campaign - YouTube", 1280, 720, "youtube-thumbnail"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Campaign Assets folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 53: Print Designs Reorganize by Format
# ==============================================================================
def _validate_canva_print_designs_reorganize_format(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Analyze and reorganize all print designs by format type.

    Validates:
    1. Folder hierarchy 'Personal/Print/By Format' with subfolders
    2. Print designs moved to appropriate subfolders
    3. At least 4 designs moved total
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        base_path = "Personal/Print/By Format"
        base_folder = _find_folder_by_path(backend, base_path)

        if base_folder:
            checks_passed.append(f"[✓] Folder '{base_path}' exists")
        else:
            errors.append(f"[X] Folder '{base_path}' not found")

        # Check subfolders
        subfolders_to_check = [
            ("Personal/Print/By Format/Posters", "poster"),
            ("Personal/Print/By Format/Flyers", "flyer"),
            ("Personal/Print/By Format/Documents", "a4-document"),
            ("Personal/Print/By Format/Business Cards", "business-card"),
        ]

        total_designs_moved = 0

        for folder_path, format_type in subfolders_to_check:
            folder = _find_folder_by_path(backend, folder_path)
            if folder:
                checks_passed.append(f"[✓] Subfolder '{folder_path.split('/')[-1]}' exists")
                folder_id = folder.get("_id")

                # Count designs in folder
                designs_in_folder = _get_designs_in_folder(backend, folder_id)
                count = len(designs_in_folder)
                total_designs_moved += count

                if count > 0:
                    checks_passed.append(f"[✓] {count} design(s) in {folder_path.split('/')[-1]} folder")
            else:
                errors.append(f"[X] Subfolder '{folder_path.split('/')[-1]}' not found")

        # Check at least 4 designs moved total
        if total_designs_moved >= 4:
            checks_passed.append(f"[✓] Total {total_designs_moved} designs moved (minimum 4)")
        else:
            errors.append(f"[X] Only {total_designs_moved} designs moved, expected at least 4")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 54: Brand Logo Package
# ==============================================================================
def _validate_canva_brand_logo_package(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create versatile logo design package.

    Validates:
    1. 'Brand Logo - Primary' (500x500, logo format)
    2. 'Brand Logo - Horizontal' (800x400, custom format after resize)
    3. 'Brand Logo - Social' (400x400)
    4. All in 'Brand Assets/Logo Variations/2026 Set' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Brand Assets/Logo Variations/2026 Set"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs - note the success criteria says Horizontal is 400x400 after resize
        expected_designs = [
            ("Brand Logo - Primary", 500, 500),
            ("Brand Logo - Horizontal", 800, 400),  # Per success criteria
            ("Brand Logo - Social", 400, 400),
        ]

        for title, expected_width, expected_height in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 55: Conference Event Consolidation
# ==============================================================================
def _validate_canva_conference_event_consolidation(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Consolidate Conference and Event designs.

    Validates:
    1. Folder 'Personal/Event Materials/All Events' exists
    2. Designs with 'Conference' or 'Event' in title moved
    3. Tech Conference Header and Community Event Promo variants moved
    4. Original formats preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Event Materials/All Events"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Find and check Conference/Event designs
        all_designs = _get_all_designs(backend)
        conference_event_designs = []

        for design in all_designs:
            title = design.get("title", "").lower()
            if "conference" in title or "event" in title:
                conference_event_designs.append(design)

        if len(conference_event_designs) > 0:
            checks_passed.append(f"[✓] Found {len(conference_event_designs)} Conference/Event designs")
        else:
            errors.append("[X] No Conference/Event designs found")

        # Check designs are in folder
        if folder_id:
            moved_count = 0
            for design in conference_event_designs:
                if design.get("folderId") == folder_id:
                    moved_count += 1
                    checks_passed.append(f"[✓] '{design.get('title')}' moved to folder")

            if moved_count == len(conference_event_designs) and moved_count > 0:
                checks_passed.append(f"[✓] All {moved_count} designs moved successfully")
            elif moved_count > 0:
                errors.append(f"[X] Only {moved_count}/{len(conference_event_designs)} designs moved")
            else:
                errors.append("[X] No designs moved to target folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 56: Alice Chen Card Digital Versions
# ==============================================================================
def _validate_canva_alice_chen_digital_versions(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create digital versions of Alice Chen business card.

    Validates:
    1. Original 'Business Card — Alice Chen' unchanged (1050x600)
    2. 'Alice Chen Card - Instagram' (1080x1080)
    3. 'Alice Chen Card - LinkedIn' (1584x396)
    4. Folder 'Personal/Alice Chen/Digital Cards' with both new designs
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check original card unchanged
        original = _find_design_by_title(backend, "Business Card — Alice Chen")
        if original:
            checks_passed.append("[✓] Original 'Business Card — Alice Chen' found")
            success, msg = _validate_design_dimensions(original, 1050, 600)
            if success:
                checks_passed.append(f"[✓] Original unchanged: {msg}")
            else:
                errors.append(f"[X] Original modified: {msg}")
        else:
            errors.append("[X] Original 'Business Card — Alice Chen' not found")

        # Check folder
        folder_path = "Personal/Alice Chen/Digital Cards"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check new designs
        new_designs = [
            ("Alice Chen Card - Instagram", 1080, 1080),
            ("Alice Chen Card - LinkedIn", 1584, 396),
        ]

        for title, expected_width, expected_height in new_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Digital Cards folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 57: Community Event Poster Transform
# ==============================================================================
def _validate_canva_community_event_poster_transform(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Transform Community Event Promo to poster format.

    Validates:
    1. 'Community Event Promo' now has dimensions 1080x1920
    2. Format is 'instagram-story'
    3. Contains text elements
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Community Event Promo")

        if design:
            checks_passed.append("[✓] 'Community Event Promo' design found")
            design_id = design.get("_id", "")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] {msg}")
            else:
                errors.append(f"[X] {msg}")

            # Check format
            design_format = design.get("format", "")
            if design_format == "instagram-story":
                checks_passed.append("[✓] Format is 'instagram-story' after resize")
            else:
                errors.append(f"[X] Format should be 'instagram-story', got '{design_format}'")

            # Check for text elements
            text_elements = _get_text_elements(backend, design_id)
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] Contains {len(text_elements)} text elements")
            else:
                errors.append("[X] No text elements found in design")
        else:
            errors.append("[X] 'Community Event Promo' design not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 58: EcoTech Solutions Brand Package
# ==============================================================================
def _validate_canva_ecotech_solutions_brand_package(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create brand identity package for EcoTech Solutions.

    Validates:
    1. Three designs created with exact titles
    2. Logo (500x500), business-card (1050x600), linkedin-banner (1584x396)
    3. All in 'Brand Assets/EcoTech Solutions/Identity Package'
    4. Resized logo has dimensions 1920x1080 with presentation format
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Brand Assets/EcoTech Solutions/Identity Package"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs - note logo should be resized to 1920x1080
        # The success criteria says "Resized logo now has dimensions 1920x1080 with custom format"
        expected_designs = [
            ("EcoTech Solutions Logo", 1920, 1080, "presentation"),  # Resized to presentation dims
            ("EcoTech Solutions Business Card", 1050, 600, "business-card"),
            ("EcoTech Solutions LinkedIn Banner", 1584, 396, "linkedin-banner"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Identity Package folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 59: Instagram Story Audit
# ==============================================================================
def _validate_canva_instagram_story_audit(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Conduct comprehensive audit of all Instagram Story designs.

    Validates:
    1. Designs with 'Story' in title found and analyzed
    2. Folder 'Personal/Social Media/Instagram Stories/Archive' exists
    3. Story designs moved to archive folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Social Media/Instagram Stories/Archive"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Find Story designs
        story_designs = _find_designs_by_title(backend, "Story")

        if len(story_designs) > 0:
            checks_passed.append(f"[✓] Found {len(story_designs)} designs with 'Story' in title")

            # Check dimensions and folder placement
            if folder_id:
                moved_count = 0
                for design in story_designs:
                    title = design.get("title", "")
                    width = design.get("width", 0)
                    height = design.get("height", 0)

                    # Check if in folder
                    if design.get("folderId") == folder_id:
                        moved_count += 1

                    # Check dimensions (1080x1920 for stories)
                    if width == 1080 and height == 1920:
                        checks_passed.append(f"[✓] '{title}': Correct story dimensions")
                    else:
                        checks_passed.append(f"[✓] '{title}': Dimensions {width}x{height}")

                if moved_count == len(story_designs):
                    checks_passed.append(f"[✓] All {moved_count} story designs moved to archive")
                elif moved_count > 0:
                    errors.append(f"[X] Only {moved_count}/{len(story_designs)} designs moved")
                else:
                    errors.append("[X] No designs moved to archive folder")
        else:
            errors.append("[X] No designs with 'Story' in title found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 60: Print Marketing Collection
# ==============================================================================
def _validate_canva_print_marketing_collection(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create print marketing collection with three high-resolution designs.

    Validates:
    1. 'Event Poster 2026' (poster format 1080x1920)
    2. 'Marketing Flyer' (flyer format 2480x3508)
    3. 'Professional Business Card' (business-card format 1050x600)
    4. All in 'Print Marketing/Q1 2026' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Print Marketing/Q1 2026"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs
        expected_designs = [
            ("Event Poster 2026", 1080, 1920, "poster"),
            ("Marketing Flyer", 2480, 3508, "flyer"),
            ("Professional Business Card", 1050, 600, "business-card"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 61: Print Marketing Suite Comparison
# ==============================================================================
def _validate_canva_print_marketing_suite_comparison(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create print marketing suite and compare with Alice Chen business card.

    Validates:
    1. 'Product Brochure 2026' (a4-document: 2480x3508)
    2. 'Executive Business Card' (business-card: 1050x600)
    3. 'Event Announcement Poster' (poster: 1080x1920)
    4. All in 'Marketing/Print Suite/2026 Collection' folder
    5. Element comparison documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Marketing/Print Suite/2026 Collection"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs
        expected_designs = [
            ("Product Brochure 2026", 2480, 3508, "a4-document"),
            ("Executive Business Card", 1050, 600, "business-card"),
            ("Event Announcement Poster", 1080, 1920, "poster"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check Alice Chen card for comparison
        alice_card = _find_design_by_title(backend, "Business Card — Alice Chen")
        if alice_card:
            checks_passed.append("[✓] 'Business Card — Alice Chen' found for comparison")
        else:
            errors.append("[X] 'Business Card — Alice Chen' not found for comparison")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 62: Live Music Promo Materials
# ==============================================================================
def _validate_canva_live_music_promo_materials(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Resize Live Music Night Poster and create promo materials.

    Validates:
    1. Original poster resized to 1920x1080 with 'presentation' format
    2. 'Live Music - Instagram Promo' (1080x1080)
    3. 'Live Music - Twitter Cover' (1500x500)
    4. Folder 'Events/Live Music Night/Promotion Materials' with all 3 designs
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Events/Live Music Night/Promotion Materials"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check resized poster
        poster = _find_design_by_title(backend, "Live Music Night Poster")
        if poster:
            checks_passed.append("[✓] 'Live Music Night Poster' found")

            success, msg = _validate_design_dimensions(poster, 1920, 1080)
            if success:
                checks_passed.append(f"[✓] Poster resized: {msg}")
            else:
                errors.append(f"[X] Poster: {msg}")

            poster_format = poster.get("format", "")
            if poster_format == "presentation":
                checks_passed.append("[✓] Poster format is 'presentation' after resize")
            else:
                errors.append(f"[X] Poster format should be 'presentation', got '{poster_format}'")

            if folder_id and poster.get("folderId") == folder_id:
                checks_passed.append("[✓] Poster moved to Promotion Materials folder")
            elif folder_id:
                errors.append("[X] Poster not in Promotion Materials folder")
        else:
            errors.append("[X] 'Live Music Night Poster' not found")

        # Check new designs
        new_designs = [
            ("Live Music - Instagram Promo", 1080, 1080),
            ("Live Music - Twitter Cover", 1500, 500),
        ]

        for title, expected_width, expected_height in new_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Promotion Materials folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 63: Social Media Workspace Reorganize
# ==============================================================================
def _validate_canva_social_media_workspace_reorganize(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Personal workspace by consolidating social media designs.

    Validates:
    1. Social media designs moved to platform-specific subfolders under Personal/Social Media
    2. At least 8 designs moved across platform folders
    3. Complete reorganization validated
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check base folder - try both paths (root-level first, then under Personal)
        base_folder = _find_folder_by_path(backend, "Social Media")
        base_path = "Social Media"
        if not base_folder:
            base_folder = _find_folder_by_path(backend, "Personal/Social Media")
            base_path = "Personal/Social Media"

        if base_folder:
            checks_passed.append(f"[✓] '{base_path}' folder exists")
        else:
            errors.append("[X] 'Social Media' folder not found")

        # Check for platform folders and count designs
        platforms = ["Instagram", "Facebook", "Twitter", "LinkedIn"]
        total_moved = 0

        for platform in platforms:
            # Try multiple folder naming conventions under both base paths
            # Check root-level Social Media FIRST (where agent likely created folders)
            folder_names = [
                f"Social Media/{platform}",
                f"Social Media/{platform} Posts",
                f"Social Media/{platform} Stories",
                f"Social Media/X ({platform})" if platform == "Twitter" else None,
                f"Personal/Social Media/{platform}",
                f"Personal/Social Media/{platform} Posts",
                f"Personal/Social Media/{platform} Stories",
                f"Personal/Social Media/X ({platform})" if platform == "Twitter" else None,
            ]

            folder = None
            for folder_name in folder_names:
                if folder_name:
                    folder = _find_folder_by_path(backend, folder_name)
                    if folder:
                        break

            if folder:
                folder_id = folder.get("_id")
                designs = _get_designs_in_folder(backend, folder_id)
                count = len(designs)
                total_moved += count
                checks_passed.append(f"[✓] {platform} folder exists with {count} design(s)")

        # Also check Instagram Stories separately (check root-level first)
        for stories_path in ["Social Media/Instagram Stories", "Personal/Social Media/Instagram Stories"]:
            stories_folder = _find_folder_by_path(backend, stories_path)
            if stories_folder:
                folder_id = stories_folder.get("_id")
                designs = _get_designs_in_folder(backend, folder_id)
                count = len(designs)
                if count > 0:
                    total_moved += count
                    checks_passed.append(f"[✓] Instagram Stories folder exists with {count} design(s)")
                break

        # Check total designs moved
        if total_moved >= 8:
            checks_passed.append(f"[✓] Total {total_moved} designs reorganized (minimum 8)")
        else:
            errors.append(f"[X] Only {total_moved} designs reorganized, expected at least 8")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 64: Conference Speaker Series
# ==============================================================================
def _validate_canva_conference_speaker_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create conference speaker series with multiple formats.

    Validates:
    1. 'Conference Speaker Series - Thumbnail' (youtube-thumbnail 1280x720)
    2. 'Conference Speaker Series - Story' (instagram-story 1080x1920)
    3. 'Conference Speaker Series - Program' (a4-document 2480x3508)
    4. All in 'Events/2026/Speaker Series' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Events/2026/Speaker Series"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs
        expected_designs = [
            ("Conference Speaker Series - Thumbnail", 1280, 720, "youtube-thumbnail"),
            ("Conference Speaker Series - Story", 1080, 1920, "instagram-story"),
            ("Conference Speaker Series - Program", 2480, 3508, "a4-document"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Speaker Series folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 65: TechCorp Advanced Folder Taxonomy
# ==============================================================================
def _validate_canva_techcorp_folder_taxonomy(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create advanced folder taxonomy for client work.

    Validates:
    1. Complete 5-level folder path exists
    2. At least 2 designs with 'Tech' or 'Conference' in title moved to Social Media folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check complete folder hierarchy
        folder_path = "Client Work/TechCorp/Q2 2026/Campaign Assets/Social Media"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Complete 5-level folder path '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder path '{folder_path}' not found")
            folder_id = None

        # Check for designs moved
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)

            # Count designs with Tech or Conference in title
            matching_count = 0
            for design in designs_in_folder:
                title = design.get("title", "").lower()
                if "tech" in title or "conference" in title:
                    matching_count += 1
                    checks_passed.append(f"[✓] '{design.get('title')}' moved to Social Media folder")

            if matching_count >= 2:
                checks_passed.append(f"[✓] {matching_count} matching designs moved (minimum 2)")
            else:
                errors.append(f"[X] Only {matching_count} Tech/Conference designs moved, expected at least 2")
        else:
            errors.append("[X] Cannot check designs - folder not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 66: Welcome Instagram Element Analysis
# ==============================================================================
def _validate_canva_welcome_instagram_element_analysis(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Perform detailed element analysis on Welcome Instagram Post.

    Validates:
    1. Design contains exactly 12 elements total
    2. Element type breakdown: 5 shapes, 4 text, 1 image, 1 line, 1 icon
    3. Colors and fonts documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Welcome Instagram Post")

        if design:
            checks_passed.append("[✓] 'Welcome Instagram Post' design found")
            design_id = design.get("_id", "")

            # Get all elements
            elements = _get_elements_for_design(backend, design_id)
            total_count = len(elements)

            if total_count == 12:
                checks_passed.append("[✓] Exactly 12 elements total")
            else:
                errors.append(f"[X] Expected 12 elements, found {total_count}")

            # Count by type
            type_counts = {}
            for el in elements:
                el_type = el.get("type", "unknown")
                type_counts[el_type] = type_counts.get(el_type, 0) + 1

            expected_types = {
                "shape": 5,
                "text": 4,
                "image": 1,
                "line": 1,
                "icon": 1,
            }

            for el_type, expected_count in expected_types.items():
                actual_count = type_counts.get(el_type, 0)
                if actual_count == expected_count:
                    checks_passed.append(f"[✓] {el_type}: {actual_count} elements")
                else:
                    errors.append(f"[X] {el_type}: expected {expected_count}, got {actual_count}")
        else:
            errors.append("[X] 'Welcome Instagram Post' design not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 67: Conference Presentation Multiformat
# ==============================================================================
def _validate_canva_conference_presentation_multiformat(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create conference presentation materials and resize header.

    Validates:
    1. 'Conference Keynote 2026' (presentation 1920x1080)
    2. 'Conference Poster 2026' (poster 1080x1920)
    3. Both in 'Personal/Events/Conference 2026/Materials'
    4. 'Tech Conference Header' resized to 1920x1080 with 'presentation' format
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Events/Conference 2026/Materials"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check new designs
        new_designs = [
            ("Conference Keynote 2026", 1920, 1080, "presentation"),
            ("Conference Poster 2026", 1080, 1920, "poster"),
        ]

        for title, expected_width, expected_height, expected_format in new_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in correct folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check resized header
        header = _find_design_by_title(backend, "Tech Conference Header")
        if header:
            checks_passed.append("[✓] 'Tech Conference Header' found")

            success, msg = _validate_design_dimensions(header, 1920, 1080)
            if success:
                checks_passed.append(f"[✓] Header resized: {msg}")
            else:
                errors.append(f"[X] Header: {msg}")

            header_format = header.get("format", "")
            if header_format == "presentation":
                checks_passed.append("[✓] Header format is 'presentation' after resize")
            else:
                errors.append(f"[X] Header format should be 'presentation', got '{header_format}'")
        else:
            errors.append("[X] 'Tech Conference Header' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 68: YouTube Tutorial Series
# ==============================================================================
def _validate_canva_youtube_tutorial_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create YouTube tutorial series thumbnails.

    Validates:
    1. 'Tutorial Series Ep 1' (1280x720)
    2. 'Tutorial Series Ep 2' (1280x720)
    3. 'Tutorial Series Ep 3' (1280x720)
    4. All in 'Personal/Video/YouTube Thumbnails/Tutorial Series' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Video/YouTube Thumbnails/Tutorial Series"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs
        for i in range(1, 4):
            title = f"Tutorial Series Ep {i}"
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, 1280, 720)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Tutorial Series folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 69: Q2 Conference Campaign
# ==============================================================================
def _validate_canva_q2_conference_campaign(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Set up Q2 campaign folder and organize Conference designs.

    Validates:
    1. Folder 'Marketing/Q2 2026/Digital Assets' exists
    2. Designs with 'Conference' in title moved to folder
    3. New 'Q2 Conference Teaser' design created in same folder
    4. At least 2 designs total in folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Marketing/Q2 2026/Digital Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check for new teaser design
        teaser = _find_design_by_title(backend, "Q2 Conference Teaser")
        if teaser:
            checks_passed.append("[✓] 'Q2 Conference Teaser' design created")

            if folder_id and teaser.get("folderId") == folder_id:
                checks_passed.append("[✓] Teaser is in Digital Assets folder")
            elif folder_id:
                errors.append("[X] Teaser is not in correct folder")
        else:
            errors.append("[X] 'Q2 Conference Teaser' design not found")

        # Count total designs in folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            total_count = len(designs_in_folder)

            if total_count >= 2:
                checks_passed.append(f"[✓] {total_count} designs in folder (minimum 2)")
            else:
                errors.append(f"[X] Only {total_count} designs in folder, expected at least 2")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 70: Print Materials Consolidation
# ==============================================================================
def _validate_canva_print_materials_consolidation(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Consolidate all print materials.

    Validates:
    1. Folder 'Print Materials/2026 Collection' exists
    2. Designs with 'Poster', 'Flyer', or 'Newsletter' moved to folder
    3. New 'Summer Events Poster 2026' (1080x1920) created in folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Print Materials/2026 Collection"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check for new poster
        poster = _find_design_by_title(backend, "Summer Events Poster 2026")
        if poster:
            checks_passed.append("[✓] 'Summer Events Poster 2026' design created")

            success, msg = _validate_design_dimensions(poster, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] Poster: {msg}")
            else:
                errors.append(f"[X] Poster: {msg}")

            if folder_id and poster.get("folderId") == folder_id:
                checks_passed.append("[✓] Poster is in 2026 Collection folder")
            elif folder_id:
                errors.append("[X] Poster is not in correct folder")
        else:
            errors.append("[X] 'Summer Events Poster 2026' design not found")

        # Check for print designs in folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)

            print_related_count = 0
            for design in designs_in_folder:
                title = design.get("title", "").lower()
                if "poster" in title or "flyer" in title or "newsletter" in title:
                    print_related_count += 1

            if print_related_count > 0:
                checks_passed.append(f"[✓] {print_related_count} print-related designs in folder")
            else:
                errors.append("[X] No print-related designs found in folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 71: Conference Multiformat Series
# ==============================================================================
def _validate_canva_conference_multiformat_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create multi-format design series for conference.

    Validates:
    1. 'Conference Main Slide' (presentation 1920x1080)
    2. 'Conference Handout' (a4-document 2480x3508)
    3. 'Conference Poster' (poster 1080x1920)
    4. All in 'Events/Tech Conference 2026/Materials' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Events/Tech Conference 2026/Materials"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs
        expected_designs = [
            ("Conference Main Slide", 1920, 1080, "presentation"),
            ("Conference Handout", 2480, 3508, "a4-document"),
            ("Conference Poster", 1080, 1920, "poster"),
        ]

        for title, expected_width, expected_height, expected_format in expected_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Materials folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 72: Tech Conference Marketing Materials
# ==============================================================================
def _validate_canva_tech_conference_marketing_materials(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Search for conference designs and create marketing materials.

    Validates:
    1. Folder 'Personal/Events/Tech Conference 2026/Marketing Materials' exists
    2. Conference-related designs moved (minimum 1)
    3. Three new designs created:
       - 'Tech Conference 2026 - Main Poster' (poster 1080x1920)
       - 'Tech Conference 2026 - Information Flyer' (flyer 2480x3508)
       - 'Tech Conference 2026 - Website Banner' (custom 1600x400)
    4. All designs in target folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Events/Tech Conference 2026/Marketing Materials"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check new designs
        new_designs = [
            ("Tech Conference 2026 - Main Poster", 1080, 1920, "poster"),
            ("Tech Conference 2026 - Information Flyer", 2480, 3508, "flyer"),
            ("Tech Conference 2026 - Website Banner", 1600, 400, "custom"),
        ]

        for title, expected_width, expected_height, expected_format in new_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                elif expected_format == "custom":
                    checks_passed.append(f"[✓] {title}: Format is '{design_format}'")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Marketing Materials folder")
                    else:
                        errors.append(f"[X] {title} is not in '{folder_path}'")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check for moved conference designs
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            conference_count = sum(1 for d in designs_in_folder if "conference" in d.get("title", "").lower())

            if conference_count >= 1:
                checks_passed.append(f"[✓] {conference_count} Conference design(s) moved to folder")
            else:
                errors.append("[X] No existing Conference designs moved to folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 73: Presentation Template Series
# ==============================================================================
def _validate_canva_presentation_template_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create presentation template series.

    Validates:
    1. 'Executive Presentation Template' (presentation 1920x1080)
    2. 'Client Pitch Template' (presentation 1920x1080)
    3. 'Training Session Template' (presentation 1920x1080)
    4. All in 'Personal/Docs/Presentations' folder (ID: 10000000-0000-4000-8000-000000000012)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder - either by path or by ID
        target_folder_id = "10000000-0000-4000-8000-000000000012"
        folder_path = "Personal/Docs/Presentations"

        target_folder = _find_folder_by_path(backend, folder_path)
        if not target_folder:
            target_folder = _find_folder_by_id(backend, target_folder_id)

        if target_folder:
            checks_passed.append("[✓] Presentations folder exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append("[X] Presentations folder not found")
            folder_id = None

        # Check designs
        templates = [
            "Executive Presentation Template",
            "Client Pitch Template",
            "Training Session Template",
        ]

        for title in templates:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, 1920, 1080)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == "presentation":
                    checks_passed.append(f"[✓] {title}: Format correct (presentation)")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected 'presentation', got '{design_format}'")

                if folder_id:
                    if design.get("folderId") == folder_id:
                        checks_passed.append(f"[✓] {title} is in Presentations folder")
                    else:
                        errors.append(f"[X] {title} is not in Presentations folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 74: Starlight Complex Folder Consolidation
# ==============================================================================
def _validate_canva_starlight_complex_consolidation(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Execute complex folder consolidation for Starlight designs.

    Validates:
    1. 4-level folder structure created: Client Work/Starlight Studio/2026/Social Media
    2. Parallel folders created: Print and Video
    3. 5 Starlight designs moved to Social Media folder
    4. Designs retain original formats (instagram-post, instagram-story, facebook-post, twitter-header, linkedin-banner)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder path
        social_folder_path = "Client Work/Starlight Studio/2026/Social Media"
        social_folder = _find_folder_by_path(backend, social_folder_path)

        if social_folder:
            checks_passed.append(f"[✓] Folder '{social_folder_path}' exists")
            folder_id = social_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{social_folder_path}' not found")
            folder_id = None

        # Check parallel folders
        parallel_folders = [
            "Client Work/Starlight Studio/2026/Print",
            "Client Work/Starlight Studio/2026/Video",
        ]

        for folder_path in parallel_folders:
            folder = _find_folder_by_path(backend, folder_path)
            if folder:
                checks_passed.append(f"[✓] Folder '{folder_path.split('/')[-1]}' exists")
            else:
                errors.append(f"[X] Folder '{folder_path}' not found")

        # Check Starlight designs moved
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            starlight_count = 0

            expected_formats = ["instagram-post", "instagram-story", "facebook-post", "twitter-header", "linkedin-banner"]

            for design in designs_in_folder:
                title = design.get("title", "").lower()
                if "starlight" in title:
                    starlight_count += 1
                    design_format = design.get("format", "")
                    if design_format in expected_formats:
                        checks_passed.append(f"[✓] '{design.get('title')}' retained format '{design_format}'")
                    else:
                        checks_passed.append(f"[✓] '{design.get('title')}' has format '{design_format}'")

            if starlight_count >= 5:
                checks_passed.append(f"[✓] {starlight_count} Starlight designs moved (minimum 5)")
            else:
                errors.append(f"[X] Only {starlight_count} Starlight designs moved, expected 5")
        else:
            errors.append("[X] Cannot check designs - Social Media folder not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 75: Video Content Multiformat Suite
# ==============================================================================
def _validate_canva_video_content_multiformat_suite(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create multi-format video content suite.

    Validates:
    1. 'Episode 1 - YouTube Thumbnail' (youtube-thumbnail 1280x720)
    2. 'Episode 1 - Instagram Story' (instagram-story 1080x1920)
    3. 'Episode 1 - Twitter Header' (twitter-header 1500x500)
    4. Folder 'Personal/Video/Episode Series/Thumbnails and Headers' exists
    5. All 3 new designs + resized podcast thumbnail in folder
    6. 'Podcast Episode 12 Thumbnail' resized to 1080x1920 (instagram-story format)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Video/Episode Series/Thumbnails and Headers"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check new designs
        new_designs = [
            ("Episode 1 - YouTube Thumbnail", 1280, 720, "youtube-thumbnail"),
            ("Episode 1 - Instagram Story", 1080, 1920, "instagram-story"),
            ("Episode 1 - Twitter Header", 1500, 500, "twitter-header"),
        ]

        for title, expected_width, expected_height, expected_format in new_designs:
            design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' created")

                success, msg = _validate_design_dimensions(design, expected_width, expected_height)
                if success:
                    checks_passed.append(f"[✓] {title}: {msg}")
                else:
                    errors.append(f"[X] {title}: {msg}")

                design_format = design.get("format", "")
                if design_format == expected_format:
                    checks_passed.append(f"[✓] {title}: Format correct ({design_format})")
                else:
                    errors.append(f"[X] {title}: Format mismatch, expected '{expected_format}', got '{design_format}'")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] {title} is in correct folder")
                elif folder_id:
                    errors.append(f"[X] {title} is not in target folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check resized podcast thumbnail
        podcast = _find_design_by_title(backend, "Podcast Episode 12 Thumbnail")
        if podcast:
            checks_passed.append("[✓] 'Podcast Episode 12 Thumbnail' found")

            success, msg = _validate_design_dimensions(podcast, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] Podcast thumbnail resized: {msg}")
            else:
                errors.append(f"[X] Podcast thumbnail: {msg}")

            podcast_format = podcast.get("format", "")
            if podcast_format == "instagram-story":
                checks_passed.append("[✓] Podcast thumbnail format is 'instagram-story' after resize")
            else:
                errors.append(f"[X] Podcast thumbnail format should be 'instagram-story', got '{podcast_format}'")

            if folder_id and podcast.get("folderId") == folder_id:
                checks_passed.append("[✓] Podcast thumbnail moved to correct folder")
            elif folder_id:
                errors.append("[X] Podcast thumbnail is not in target folder")
        else:
            errors.append("[X] 'Podcast Episode 12 Thumbnail' not found")

        # Check total designs in folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            if len(designs_in_folder) >= 4:
                checks_passed.append(f"[✓] {len(designs_in_folder)} designs in target folder (minimum 4)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} designs in folder, expected at least 4")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 76: Workspace Posts Reorganization
# ==============================================================================
def _validate_canva_workspace_posts_reorganization(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Execute complex workspace reorganization for designs with 'Post' in title.

    Validates:
    1. Folder hierarchy created: Social Media/Posts/2026/Instagram, Facebook, LinkedIn
    2. Designs with 'Post' in title moved to appropriate platform folders
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        platform_folders = {
            "Social Media/Posts/2026/Instagram": "instagram-post",
            "Social Media/Posts/2026/Facebook": "facebook-post",
            "Social Media/Posts/2026/LinkedIn": "linkedin-banner",
        }

        folders_found = {}
        for folder_path, format_type in platform_folders.items():
            folder = _find_folder_by_path(backend, folder_path)
            if folder:
                checks_passed.append(f"[✓] Folder '{folder_path}' exists")
                folders_found[format_type] = folder.get("_id")
            else:
                errors.append(f"[X] Folder '{folder_path}' not found")

        # Find all designs with 'Post' in title
        post_designs = _find_designs_by_title(backend, "Post")

        if len(post_designs) > 0:
            checks_passed.append(f"[✓] Found {len(post_designs)} designs with 'Post' in title")

            # Check designs moved to correct folders
            moved_count = 0
            for design in post_designs:
                design_format = design.get("format", "")
                design_folder = design.get("folderId")
                title = design.get("title", "")

                expected_folder_id = folders_found.get(design_format)

                if expected_folder_id and design_folder == expected_folder_id:
                    moved_count += 1
                    checks_passed.append(f"[✓] '{title}' moved to correct platform folder")

            if moved_count > 0:
                checks_passed.append(f"[✓] {moved_count} designs categorized by platform")
        else:
            errors.append("[X] No designs with 'Post' in title found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 77: TechFlow Logo Brand System
# ==============================================================================
def _validate_canva_techflow_logo_brand_system(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create advanced brand management system for TechFlow.

    Validates:
    1. Folder 'Brand Assets/2026/Logos/Variations' exists
    2. 'TechFlow Logo Primary 2026' (500x500, logo format)
    3. Logo in Variations folder
    4. Logo contains at least 2 shape elements
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Brand Assets/2026/Logos/Variations"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check logo design
        logo = _find_design_by_title(backend, "TechFlow Logo Primary 2026")

        if logo:
            checks_passed.append("[✓] 'TechFlow Logo Primary 2026' design created")
            design_id = logo.get("_id", "")

            # Check dimensions
            success, msg = _validate_design_dimensions(logo, 500, 500)
            if success:
                checks_passed.append(f"[✓] {msg}")
            else:
                errors.append(f"[X] {msg}")

            # Check folder placement
            if folder_id and logo.get("folderId") == folder_id:
                checks_passed.append("[✓] Logo is in Variations folder")
            elif folder_id:
                errors.append("[X] Logo is not in Variations folder")

            # Check for shape elements
            shape_elements = _get_shape_elements(backend, design_id)
            if len(shape_elements) >= 2:
                checks_passed.append(f"[✓] Logo contains {len(shape_elements)} shape elements (minimum 2)")
            else:
                errors.append(f"[X] Logo only has {len(shape_elements)} shape elements, expected at least 2")
        else:
            errors.append("[X] 'TechFlow Logo Primary 2026' design not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors
        )
    )






# ==============================================================================
# Reward Function 78: Flash Sale Story A4 Resize
# ==============================================================================
def _validate_canva_flash_sale_story_a4_resize(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Transform Flash Sale Story design to A4 dimensions.

    Validates:
    1. Flash Sale Story design exists
    2. Dimensions are 2480x3508 (A4)
    3. Format is 'a4-document'
    4. Text elements are preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Flash Sale Story")
        if not design:
            errors.append("[X] 'Flash Sale Story' design not found")
            return TaskScore(score=0.0, metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors))

        checks_passed.append("[✓] 'Flash Sale Story' design found")
        design_id = design.get("_id", "")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 2480, 3508)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format is a4-document
        design_format = design.get("format", "")
        if design_format == "a4-document":
            checks_passed.append("[✓] Format is 'a4-document'")
        else:
            errors.append(f"[X] Format should be 'a4-document', got '{design_format}'")

        # Check text elements preserved
        text_elements = _get_text_elements(backend, design_id)
        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text elements preserved ({len(text_elements)} found)")
        else:
            errors.append("[X] No text elements found - content may have been lost")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 79: Q1 Launch Social Media Campaign
# ==============================================================================
def _validate_canva_q1_launch_social_media_campaign(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Q1 product launch social media campaign with 3 designs.

    Validates:
    1. 'Q1 Launch - Instagram' (1080x1080) in Instagram Posts folder under Social Media
    2. 'Q1 Launch - LinkedIn' (1584x396) in LinkedIn folder under Social Media
    3. 'Q1 Launch - YouTube' (1280x720) in YouTube Thumbnails folder under Social Media
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # First find the Social Media parent folder
        social_media_folder = _find_folder_by_name(backend, "Social Media")
        social_media_id = social_media_folder.get("_id") if social_media_folder else None

        # Design specs: (title, width, height, folder_name)
        designs_spec = [
            ("Q1 Launch - Instagram", 1080, 1080, "Instagram Posts"),
            ("Q1 Launch - LinkedIn", 1584, 396, "LinkedIn"),
            ("Q1 Launch - YouTube", 1280, 720, "YouTube Thumbnails"),
        ]

        for title, width, height, folder_name in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder - find folder by name that is under Social Media
            design_folder_id = design.get("folderId")
            if not design_folder_id:
                errors.append(f"[X] '{title}' is not in any folder")
                continue

            # Get the folder the design is in
            design_folder = _find_folder_by_id(backend, design_folder_id)
            if not design_folder:
                errors.append(f"[X] '{title}' folder not found")
                continue

            # Verify folder name matches and is under Social Media
            folder_name_matches = design_folder.get("name", "").lower() == folder_name.lower()
            folder_parent_id = design_folder.get("parentId")
            is_under_social_media = folder_parent_id == social_media_id

            if folder_name_matches and is_under_social_media:
                checks_passed.append(f"[✓] '{title}' is in '{folder_name}' folder under Social Media")
            elif folder_name_matches and not is_under_social_media:
                errors.append(f"[X] '{title}' is in '{folder_name}' but not under Social Media folder")
            else:
                errors.append(f"[X] '{title}' is not in '{folder_name}' folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 80: Summit Tech Launch Brand Campaign
# ==============================================================================
def _validate_canva_summit_tech_launch_brand_campaign(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Summit Tech Launch brand campaign with 3 platform designs.

    Validates:
    1. 'Summit Tech Launch - Instagram' (1080x1080)
    2. 'Summit Tech Launch - Twitter' (1500x500)
    3. 'Summit Tech Launch - LinkedIn' (1584x396)
    4. All in 'Brand Campaigns/Summit Tech/Launch Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder_path = "Brand Campaigns/Summit Tech/Launch Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Design specs
        designs_spec = [
            ("Summit Tech Launch - Instagram", 1080, 1080),
            ("Summit Tech Launch - Twitter", 1500, 500),
            ("Summit Tech Launch - LinkedIn", 1584, 396),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder placement
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Launch Assets folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Launch Assets folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 81: Q2 Showcase Multiformat Series
# ==============================================================================
def _validate_canva_q2_showcase_multiformat_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Q2 Product Showcase multiformat design series.

    Validates:
    1. 'Q2 Showcase - Story' (1080x1920, instagram-story)
    2. 'Q2 Showcase - Facebook' (1200x630, facebook-post)
    3. 'Q2 Showcase - Twitter' (1500x500, twitter-header)
    4. 'Q2 Showcase - Card' (1050x600, business-card)
    5. All in 'Personal/Campaigns/Q2 2026 Showcase' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Personal/Campaigns/Q2 2026 Showcase"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Design specs: (title, width, height, format)
        designs_spec = [
            ("Q2 Showcase - Story", 1080, 1920, "instagram-story"),
            ("Q2 Showcase - Facebook", 1200, 630, "facebook-post"),
            ("Q2 Showcase - Twitter", 1500, 500, "twitter-header"),
            ("Q2 Showcase - Card", 1050, 600, "business-card"),
        ]

        for title, width, height, expected_format in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, expected_format)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Q2 2026 Showcase folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Q2 2026 Showcase folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 82: Tech Conference Web Banner
# ==============================================================================
def _validate_canva_tech_conference_web_banner(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Resize Tech Conference Header to web banner dimensions.

    Validates:
    1. Tech Conference Header design exists
    2. Dimensions are 1200x400
    3. Format is 'custom' (after resize)
    4. Text elements preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] 'Tech Conference Header' design not found")
            return TaskScore(score=0.0, metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors))

        checks_passed.append("[✓] 'Tech Conference Header' design found")
        design_id = design.get("_id", "")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 1200, 400)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format is custom after resize
        design_format = design.get("format", "")
        if design_format == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom' after resize, got '{design_format}'")

        # Check text elements preserved
        text_elements = _get_text_elements(backend, design_id)
        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text elements preserved ({len(text_elements)} found)")
        else:
            errors.append("[X] No text elements found - content may have been lost")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 83: YouTube Tech Review Series
# ==============================================================================
def _validate_canva_youtube_tech_review_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create YouTube tech review thumbnail series with folder organization.

    Validates:
    1. 'Tech Review Episode 1' (1280x720)
    2. 'Tech Review Episode 2' (1280x720)
    3. 'Tech Review Episode 3' (1280x720)
    4. Complete folder hierarchy 'Content Strategy/YouTube/2026/Tech Reviews'
    5. All designs in Tech Reviews folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder_path = "Content Strategy/YouTube/2026/Tech Reviews"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Check designs
        for i in range(1, 4):
            title = f"Tech Review Episode {i}"
            design = _find_design_by_title(backend, title)

            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, 1280, 720)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Tech Reviews folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Tech Reviews folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 84: Neural Dynamics Brand Package
# ==============================================================================
def _validate_canva_neural_dynamics_brand_package(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Neural Dynamics brand package with 3 designs.

    Validates:
    1. 'Neural Dynamics Logo' (500x500, logo format)
    2. 'Neural Dynamics Business Card' (1050x600, business-card)
    3. 'Neural Dynamics Pitch Deck Template' (1920x1080, presentation)
    4. Folder 'Brand Assets/Neural Dynamics/Core Identity' exists
    5. All designs in Core Identity folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Brand Assets/Neural Dynamics/Core Identity"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Design specs: (title, width, height, format)
        designs_spec = [
            ("Neural Dynamics Logo", 500, 500, "logo"),
            ("Neural Dynamics Business Card", 1050, 600, "business-card"),
            ("Neural Dynamics Pitch Deck Template", 1920, 1080, "presentation"),
        ]

        for title, width, height, expected_format in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, expected_format)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Core Identity folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Core Identity folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 85: Newsletter Business Card Reorg
# ==============================================================================
def _validate_canva_newsletter_business_card_reorg(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Organize Newsletter and Business Card designs into folder structures.

    Validates:
    1. Folder 'Personal/Communications/Newsletters/2026' exists
    2. Newsletter designs moved (January Newsletter, v2, Final)
    3. Folder 'Brand Assets/Business Cards/Alice Chen' exists
    4. Business Card designs moved
    5. Total 6 designs organized
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Newsletter folder
        newsletter_path = "Personal/Communications/Newsletters/2026"
        newsletter_folder = _find_folder_by_path(backend, newsletter_path)

        if newsletter_folder:
            checks_passed.append(f"[✓] Folder '{newsletter_path}' exists")
            newsletter_folder_id = newsletter_folder.get("_id")

            # Check Newsletter designs in folder
            newsletter_designs = _get_designs_in_folder(backend, newsletter_folder_id)
            newsletter_count = len(newsletter_designs)
            if newsletter_count >= 3:
                checks_passed.append(f"[✓] {newsletter_count} Newsletter designs in folder")
            else:
                errors.append(f"[X] Expected at least 3 Newsletter designs, found {newsletter_count}")
        else:
            errors.append(f"[X] Folder '{newsletter_path}' not found")

        # Check Business Card folder
        bc_path = "Brand Assets/Business Cards/Alice Chen"
        bc_folder = _find_folder_by_path(backend, bc_path)

        if bc_folder:
            checks_passed.append(f"[✓] Folder '{bc_path}' exists")
            bc_folder_id = bc_folder.get("_id")

            # Check Business Card designs in folder
            bc_designs = _get_designs_in_folder(backend, bc_folder_id)
            bc_count = len(bc_designs)
            if bc_count >= 3:
                checks_passed.append(f"[✓] {bc_count} Business Card designs in folder")
            else:
                errors.append(f"[X] Expected at least 3 Business Card designs, found {bc_count}")
        else:
            errors.append(f"[X] Folder '{bc_path}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 86: TechStart Logo Variations Suite
# ==============================================================================
def _validate_canva_techstart_logo_variations_suite(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create TechStart logo suite with 4 variations.

    Validates:
    1. 'TechStart Primary Logo' (500x500, logo)
    2. 'TechStart Secondary Logo' (500x500, logo)
    3. 'TechStart Icon Logo' (500x500, logo)
    4. 'TechStart Wordmark Logo' (500x500, logo)
    5. Folder 'Brand Assets/TechStart/Logo Variations' exists
    6. All designs in Logo Variations folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Brand Assets/TechStart/Logo Variations"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Logo titles
        logo_titles = [
            "TechStart Primary Logo",
            "TechStart Secondary Logo",
            "TechStart Icon Logo",
            "TechStart Wordmark Logo",
        ]

        for title in logo_titles:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, 500, 500)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, "logo")
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Logo Variations folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Logo Variations folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 87: Phoenix Corp Project Structure
# ==============================================================================
def _validate_canva_phoenix_corp_project_structure(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Set up Phoenix Corp client project structure with designs.

    Validates:
    1. Folder hierarchy 'Client Work/Phoenix Corp/Q1 2026/Assets' with subfolders
    2. 'Phoenix Corp Q1 Presentation' (1920x1080) in Presentations folder
    3. 'Phoenix Corp Proposal' (2480x3508) in Print folder
    4. 'Phoenix Corp Social Post' (1080x1080) in Social folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder structure
        base_path = "Client Work/Phoenix Corp/Q1 2026/Assets"
        base_folder = _find_folder_by_path(backend, base_path)

        if base_folder:
            checks_passed.append(f"[✓] Base folder '{base_path}' exists")
            base_folder_id = base_folder.get("_id")
        else:
            errors.append(f"[X] Base folder '{base_path}' not found")
            base_folder_id = None

        # Check subfolders and designs
        subfolders_designs = [
            ("Social", "Phoenix Corp Social Post", 1080, 1080),
            ("Print", "Phoenix Corp Proposal", 2480, 3508),
            ("Presentations", "Phoenix Corp Q1 Presentation", 1920, 1080),
        ]

        for subfolder_name, design_title, width, height in subfolders_designs:
            subfolder_path = f"{base_path}/{subfolder_name}"
            subfolder = _find_folder_by_path(backend, subfolder_path)

            if subfolder:
                checks_passed.append(f"[✓] Subfolder '{subfolder_name}' exists")
                subfolder_id = subfolder.get("_id")
            else:
                errors.append(f"[X] Subfolder '{subfolder_name}' not found")
                subfolder_id = None

            # Check design
            design = _find_design_by_title(backend, design_title)
            if not design:
                errors.append(f"[X] Design '{design_title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{design_title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{design_title}': {msg}")
            else:
                errors.append(f"[X] '{design_title}': {msg}")

            # Check folder
            if subfolder_id and design.get("folderId") == subfolder_id:
                checks_passed.append(f"[✓] '{design_title}' is in '{subfolder_name}' folder")
            elif subfolder_id:
                errors.append(f"[X] '{design_title}' is not in '{subfolder_name}' folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 88: Acme Archive Instagram Analysis
# ==============================================================================
def _validate_canva_acme_archive_instagram_analysis(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Reorganize Acme designs and analyze Instagram designs.

    Validates:
    1. Folder 'Client Archive/Acme Corporation/2026 Assets' exists
    2. Acme designs moved to the archive folder
    3. At least 6 Acme designs in archive
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Client Archive/Acme Corporation/2026 Assets"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")

            # Check designs in folder
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            acme_designs = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

            if len(acme_designs) >= 6:
                checks_passed.append(f"[✓] {len(acme_designs)} Acme designs in archive folder")
            else:
                errors.append(f"[X] Expected at least 6 Acme designs, found {len(acme_designs)}")

            # List the designs found
            for d in acme_designs[:6]:
                checks_passed.append(f"[✓] Found: '{d.get('title', 'Unknown')}'")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")

        # Check Instagram designs exist (for report)
        instagram_designs = _find_designs_by_title(backend, "Instagram")
        if len(instagram_designs) > 0:
            checks_passed.append(f"[✓] Instagram designs found for report: {len(instagram_designs)}")
        else:
            errors.append("[X] No Instagram designs found for report")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 89: Spring Festival Multiformat Suite
# ==============================================================================
def _validate_canva_spring_festival_multiformat_suite(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Spring Festival 2026 multiformat design suite.

    Validates:
    1. 'Spring Festival Story' (1080x1920) in Instagram Stories folder
    2. 'Spring Festival Deck' (1920x1080) in Presentations folder
    3. 'Spring Festival Poster' (1080x1920) in Posters folder
    4. 'Spring Festival Card' (1050x600) in Business Cards folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Design specs: (title, width, height, folder_path)
        designs_spec = [
            ("Spring Festival Story", 1080, 1920, "Personal/Social Media/Instagram Stories"),
            ("Spring Festival Deck", 1920, 1080, "Personal/Docs/Presentations"),
            ("Spring Festival Poster", 1080, 1920, "Personal/Print/Posters"),
            ("Spring Festival Card", 1050, 600, "Personal/Print/Business Cards"),
        ]

        for title, width, height, folder_path in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            folder = _find_folder_by_path(backend, folder_path)
            if folder:
                if design.get("folderId") == folder.get("_id"):
                    checks_passed.append(f"[✓] '{title}' is in correct folder")
                else:
                    errors.append(f"[X] '{title}' is not in '{folder_path}'")
            else:
                errors.append(f"[X] Folder '{folder_path}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 90: Welcome Instagram Q2 Social Templates
# ==============================================================================
def _validate_canva_welcome_instagram_q2_social_templates(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Move Welcome Instagram designs to Q2 Social Templates folder.

    Validates:
    1. Folder 'Brand Assets/Q2 2026/Social Templates' exists
    2. Exactly 3 designs with 'Welcome Instagram' in title moved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Brand Assets/Q2 2026/Social Templates"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")

            # Check Welcome Instagram designs in folder
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            welcome_designs = [d for d in designs_in_folder if "welcome instagram" in d.get("title", "").lower()]

            if len(welcome_designs) == 3:
                checks_passed.append("[✓] Exactly 3 Welcome Instagram designs in folder")
            else:
                errors.append(f"[X] Expected 3 Welcome Instagram designs, found {len(welcome_designs)}")

            for d in welcome_designs:
                checks_passed.append(f"[✓] Found: '{d.get('title', 'Unknown')}'")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 91: TechFusion Conference Campaign
# ==============================================================================
def _validate_canva_techfusion_conference_campaign(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create TechFusion Conference rebrand campaign with 4 designs.

    Validates:
    1. 'TechFusion Conference - Save The Date' (1080x1080, instagram-post)
    2. 'TechFusion Conference - Header' (1500x500, twitter-header)
    3. 'TechFusion Conference - Network' (1584x396, linkedin-banner)
    4. 'TechFusion Conference - Keynote Preview' (1280x720, youtube-thumbnail)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Design specs: (title, width, height, format)
        designs_spec = [
            ("TechFusion Conference - Save The Date", 1080, 1080, "instagram-post"),
            ("TechFusion Conference - Header", 1500, 500, "twitter-header"),
            ("TechFusion Conference - Network", 1584, 396, "linkedin-banner"),
            ("TechFusion Conference - Keynote Preview", 1280, 720, "youtube-thumbnail"),
        ]

        for title, width, height, expected_format in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, expected_format)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 92: Digital Wellness Summit Campaign
# ==============================================================================
def _validate_canva_digital_wellness_summit_campaign(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create Digital Wellness Summit 2026 social media campaign.

    Validates:
    1. 'Digital Wellness - Story Announcement' (1080x1920, instagram-story)
    2. 'Digital Wellness - Community Invite' (1200x630, facebook-post)
    3. 'Digital Wellness - Email Header' (800x600, custom)
    4. 'Digital Wellness - Event Logo' (500x500, logo)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Design specs: (title, width, height, format)
        designs_spec = [
            ("Digital Wellness - Story Announcement", 1080, 1920, "instagram-story"),
            ("Digital Wellness - Community Invite", 1200, 630, "facebook-post"),
            ("Digital Wellness - Email Header", 800, 600, "custom"),
            ("Digital Wellness - Event Logo", 500, 500, "logo"),
        ]

        for title, width, height, expected_format in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, expected_format)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 93: Multi-Client Portfolio System
# ==============================================================================
def _validate_canva_multi_client_portfolio_system(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create multi-client portfolio organization system.

    Validates:
    1. Folder 'Client Work/Starlight Studio/Archive/2026' exists
    2. At least 3 Starlight designs in folder
    3. Folder 'Brand Assets/Business Cards/By Client' with client subfolders
    4. 'Portfolio Overview 2026' presentation (1920x1080) in Brand Assets
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Starlight folder
        starlight_path = "Client Work/Starlight Studio/Archive/2026"
        starlight_folder = _find_folder_by_path(backend, starlight_path)

        if starlight_folder:
            checks_passed.append(f"[✓] Folder '{starlight_path}' exists")
            folder_id = starlight_folder.get("_id")

            # Check designs in folder
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            starlight_designs = [d for d in designs_in_folder if "starlight" in d.get("title", "").lower()]

            if len(starlight_designs) >= 3:
                checks_passed.append(f"[✓] {len(starlight_designs)} Starlight designs in archive")
            else:
                errors.append(f"[X] Expected at least 3 Starlight designs, found {len(starlight_designs)}")
        else:
            errors.append(f"[X] Folder '{starlight_path}' not found")

        # Check Business Cards folder
        bc_path = "Brand Assets/Business Cards/By Client"
        bc_folder = _find_folder_by_path(backend, bc_path)

        if bc_folder:
            checks_passed.append(f"[✓] Folder '{bc_path}' exists")
        else:
            errors.append(f"[X] Folder '{bc_path}' not found")

        # Check Portfolio Overview presentation
        portfolio = _find_design_by_title(backend, "Portfolio Overview 2026")
        if portfolio:
            checks_passed.append("[✓] 'Portfolio Overview 2026' design exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(portfolio, 1920, 1080)
            if success:
                checks_passed.append(f"[✓] {msg}")
            else:
                errors.append(f"[X] {msg}")

            # Check in Brand Assets
            brand_assets = _find_folder_by_name(backend, "Brand Assets")
            if brand_assets and portfolio.get("folderId") == brand_assets.get("_id"):
                checks_passed.append("[✓] Portfolio in Brand Assets folder")
        else:
            errors.append("[X] 'Portfolio Overview 2026' design not found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 94: GreenTech Social Media Series
# ==============================================================================
def _validate_canva_greentech_social_media_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create GreenTech Solutions social media series with organization.

    Validates:
    1. 'GreenTech - Sustainability Post' (1080x1080) in Instagram folder
    2. 'GreenTech - Behind Scenes Story' (1080x1920) in Instagram folder
    3. 'GreenTech - Community Post' (1200x630) in Facebook folder
    4. 'GreenTech - Company Banner' (1584x396) in LinkedIn folder
    5. Folder structure exists
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        base_path = "Campaigns/Q1 2026/GreenTech Solutions/Social Media/Platform Specific"

        # Design specs: (title, width, height, subfolder)
        designs_spec = [
            ("GreenTech - Sustainability Post", 1080, 1080, "Instagram"),
            ("GreenTech - Behind Scenes Story", 1080, 1920, "Instagram"),
            ("GreenTech - Community Post", 1200, 630, "Facebook"),
            ("GreenTech - Company Banner", 1584, 396, "LinkedIn"),
        ]

        for title, width, height, subfolder_name in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            subfolder_path = f"{base_path}/{subfolder_name}"
            folder = _find_folder_by_path(backend, subfolder_path)
            if folder:
                if design.get("folderId") == folder.get("_id"):
                    checks_passed.append(f"[✓] '{title}' in '{subfolder_name}' folder")
                else:
                    errors.append(f"[X] '{title}' not in '{subfolder_name}' folder")
            else:
                errors.append(f"[X] Subfolder '{subfolder_path}' not found")

        # Verify Instagram has 2 designs
        instagram_path = f"{base_path}/Instagram"
        instagram_folder = _find_folder_by_path(backend, instagram_path)
        if instagram_folder:
            designs = _get_designs_in_folder(backend, instagram_folder.get("_id"))
            if len(designs) >= 2:
                checks_passed.append(f"[✓] Instagram folder has {len(designs)} designs")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 95: Tech Conference Presentation Resize
# ==============================================================================
def _validate_canva_tech_conference_presentation_resize(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Resize Tech Conference Header to presentation dimensions.

    Validates:
    1. Tech Conference Header design exists
    2. Dimensions are 1920x1080
    3. Format is 'presentation'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] 'Tech Conference Header' design not found")
            return TaskScore(score=0.0, metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors))

        checks_passed.append("[✓] 'Tech Conference Header' design found")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 1920, 1080)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format is presentation
        design_format = design.get("format", "")
        if design_format == "presentation":
            checks_passed.append("[✓] Format is 'presentation'")
        else:
            errors.append(f"[X] Format should be 'presentation', got '{design_format}'")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 96: TechFlow Innovations Logo Suite
# ==============================================================================
def _validate_canva_techflow_innovations_logo_suite(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create TechFlow Innovations multi-format logo suite.

    Validates:
    1. 'TechFlow Logo - Standard' (500x500, logo)
    2. 'TechFlow Logo - Horizontal' (800x400, custom)
    3. 'TechFlow Logo - Icon' (300x300, custom)
    4. All in 'Brand Assets/Logos' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/Logos' exists")
        else:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")

        # Design specs: (title, width, height, format)
        designs_spec = [
            ("TechFlow Logo - Standard", 500, 500, "logo"),
            ("TechFlow Logo - Horizontal", 800, 400, "custom"),
            ("TechFlow Logo - Icon", 300, 300, "custom"),
        ]

        for title, width, height, expected_format in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, expected_format)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Logos folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Logos folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 97: Music Festival Poster Series
# ==============================================================================
def _validate_canva_music_festival_poster_series(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Create comprehensive Music Festival poster campaign.

    Validates:
    1. 'Music Festival Poster - Main' (1080x1920, poster)
    2. 'Music Festival Poster - VIP' (1080x1920, poster)
    3. 'Music Festival Poster - Schedule' (1080x1920, poster)
    4. Folder 'Events/Music Festival/Posters' exists
    5. All designs in Posters folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder_path = "Events/Music Festival/Posters"
        target_folder = _find_folder_by_path(backend, folder_path)

        if target_folder:
            checks_passed.append(f"[✓] Folder '{folder_path}' exists")
            folder_id = target_folder.get("_id")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")
            folder_id = None

        # Poster titles
        poster_titles = [
            "Music Festival Poster - Main",
            "Music Festival Poster - VIP",
            "Music Festival Poster - Schedule",
        ]

        for title in poster_titles:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, 1080, 1920)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, "poster")
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check folder
            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append(f"[✓] '{title}' is in Posters folder")
            elif folder_id:
                errors.append(f"[X] '{title}' is not in Posters folder")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 98: Live Music Night Square Resize
# ==============================================================================
def _validate_canva_live_music_night_square_resize(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Resize Live Music Night Poster to square format.

    Validates:
    1. Live Music Night Poster design exists
    2. Dimensions are 1080x1080
    3. Format is 'instagram-post'
    4. Design is in 'Print/Resized Formats' folder
    5. Original text content preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] 'Live Music Night Poster' design not found")
            return TaskScore(score=0.0, metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors))

        checks_passed.append("[✓] 'Live Music Night Poster' design found")
        design_id = design.get("_id", "")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 1080, 1080)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format is instagram-post
        design_format = design.get("format", "")
        if design_format == "instagram-post":
            checks_passed.append("[✓] Format is 'instagram-post'")
        else:
            errors.append(f"[X] Format should be 'instagram-post', got '{design_format}'")

        # Check folder
        folder_path = "Print/Resized Formats"
        folder = _find_folder_by_path(backend, folder_path)
        if folder:
            if design.get("folderId") == folder.get("_id"):
                checks_passed.append(f"[✓] Design is in '{folder_path}' folder")
            else:
                errors.append(f"[X] Design is not in '{folder_path}' folder")
        else:
            errors.append(f"[X] Folder '{folder_path}' not found")

        # Check text content preserved
        text_elements = _get_text_elements(backend, design_id)
        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text content preserved ({len(text_elements)} elements)")
        else:
            errors.append("[X] No text elements found - content may have been lost")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 99: Music Festival Multiformat
# ==============================================================================
def _validate_canva_music_festival_multiformat(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Generate multi-format Music Festival campaign.

    Validates:
    1. 'Music Festival Poster' (1080x1920, poster)
    2. 'Music Festival Flyer' (2480x3508, a4-document)
    3. 'Music Festival Card' (1050x600, business-card)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Design specs: (title, width, height, format)
        designs_spec = [
            ("Music Festival Poster", 1080, 1920, "poster"),
            ("Music Festival Flyer", 2480, 3508, "a4-document"),
            ("Music Festival Card", 1050, 600, "business-card"),
        ]

        for title, width, height, expected_format in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue

            checks_passed.append(f"[✓] Design '{title}' exists")

            # Check dimensions
            success, msg = _validate_design_dimensions(design, width, height)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

            # Check format
            success, msg = _validate_design_format(design, expected_format)
            if success:
                checks_passed.append(f"[✓] '{title}': {msg}")
            else:
                errors.append(f"[X] '{title}': {msg}")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )






# ==============================================================================
# Reward Function 100: Podcast Thumbnail Presentation Resize
# ==============================================================================
def _validate_canva_podcast_thumbnail_presentation_resize(
    backend: Backend,
    frontend_final_state: Dict[str, Any],
    final_answer: str
) -> TaskScore:
    """
    Task: Resize Podcast Episode 12 Thumbnail to presentation format.

    Validates:
    1. Podcast Episode 12 Thumbnail design exists
    2. Dimensions are 1920x1080
    3. Format is 'presentation'
    4. Text elements extracted with font properties
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Podcast Episode 12 Thumbnail")
        if not design:
            errors.append("[X] 'Podcast Episode 12 Thumbnail' design not found")
            return TaskScore(score=0.0, metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors))

        checks_passed.append("[✓] 'Podcast Episode 12 Thumbnail' design found")
        design_id = design.get("_id", "")

        # Check dimensions
        success, msg = _validate_design_dimensions(design, 1920, 1080)
        if success:
            checks_passed.append(f"[✓] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Check format is presentation
        design_format = design.get("format", "")
        if design_format == "presentation":
            checks_passed.append("[✓] Format is 'presentation'")
        else:
            errors.append(f"[X] Format should be 'presentation', got '{design_format}'")

        # Check text elements
        text_elements = _get_text_elements(backend, design_id)
        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text elements found ({len(text_elements)} elements)")
            # Check for font properties
            for el in text_elements[:2]:
                props = el.get("properties", {})
                segments = props.get("segments", [])
                if segments:
                    seg = segments[0]
                    if "fontFamily" in seg:
                        checks_passed.append(f"[✓] Font property found: {seg.get('fontFamily')}")
        else:
            errors.append("[X] No text elements found")

    except Exception as e:
        errors.append(f"[X] Unexpected error: {str(e)}")

    return TaskScore(
        score=1.0 if len(errors) == 0 else 0.0,
        metadata=ScoreMetadata(success_accumulator=checks_passed, error_accumulator=errors)
    )




# ==============================================================================
# Reward Functions for New Canva Tasks
# ==============================================================================
def _validate_biz_card_letterhead_sarah(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Executive Business Card and Letterhead for Sarah Miller.
    Checks exact titles, dimensions, formats, and folder placements.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check business card with EXACT title
        biz_card = _find_design_by_exact_title(backend, "Executive Business Card - Sarah Miller")
        if not biz_card:
            biz_card = _find_design_by_title(backend, "Executive Business Card - Sarah Miller")

        if biz_card:
            checks_passed.append("[✓] Design 'Executive Business Card - Sarah Miller' found")

            # Check dimensions (1050x600)
            if _check_design_dimensions(biz_card, 1050, 600):
                checks_passed.append("[✓] Business card has correct dimensions (1050x600)")
            else:
                errors.append(f"[X] Business card dimensions are {biz_card.get('width')}x{biz_card.get('height')}, expected 1050x600")

            # Check format
            if _check_design_format_flexible(biz_card, "business-card"):
                checks_passed.append("[✓] Business card has correct format (business-card)")
            else:
                errors.append(f"[X] Business card format is '{biz_card.get('format')}', expected 'business-card'")

            # Check folder placement
            folder = _find_folder_by_path(backend, "Personal/Print/Business Cards")
            if folder and biz_card.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Business card is in 'Personal/Print/Business Cards' folder")
            else:
                errors.append("[X] Business card not in 'Personal/Print/Business Cards' folder")

            # Check element analysis was performed (elements exist)
            elements = _get_elements_for_design(backend, biz_card.get("_id"))
            if len(elements) > 0:
                checks_passed.append(f"[✓] Element analysis performed ({len(elements)} elements documented)")
            else:
                errors.append("[X] No element analysis found for business card")
        else:
            errors.append("[X] Design 'Executive Business Card - Sarah Miller' not found")

        # Check letterhead with EXACT title
        letterhead = _find_design_by_exact_title(backend, "Executive Letterhead - Sarah Miller")
        if not letterhead:
            letterhead = _find_design_by_title(backend, "Executive Letterhead - Sarah Miller")

        if letterhead:
            checks_passed.append("[✓] Design 'Executive Letterhead - Sarah Miller' found")

            # Check dimensions (2480x3508)
            if _check_design_dimensions(letterhead, 2480, 3508):
                checks_passed.append("[✓] Letterhead has correct dimensions (2480x3508)")
            else:
                errors.append(f"[X] Letterhead dimensions are {letterhead.get('width')}x{letterhead.get('height')}, expected 2480x3508")

            # Check format
            if _check_design_format_flexible(letterhead, "a4-document"):
                checks_passed.append("[✓] Letterhead has correct format (a4-document)")
            else:
                errors.append(f"[X] Letterhead format is '{letterhead.get('format')}', expected 'a4-document'")

            # Check folder placement
            folder = _find_folder_by_path(backend, "Personal/Docs/Docs (A4)")
            if folder and letterhead.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Letterhead is in 'Personal/Docs/Docs (A4)' folder")
            else:
                errors.append("[X] Letterhead not in 'Personal/Docs/Docs (A4)' folder")
        else:
            errors.append("[X] Design 'Executive Letterhead - Sarah Miller' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_biz_card_letterhead_sarah: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_video_content_podcast_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive video content package with podcast analysis.
    Checks YouTube, Instagram, Facebook designs and podcast element analysis.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Get Personal/Video folder
        video_folder = _find_folder_by_path(backend, "Personal/Video")
        video_folder_id = video_folder.get("_id") if video_folder else None

        # Check YouTube thumbnail "Podcast Launch Episode"
        youtube = _find_design_by_exact_title(backend, "Podcast Launch Episode")
        if not youtube:
            youtube = _find_design_by_title(backend, "Podcast Launch Episode")

        if youtube:
            checks_passed.append("[✓] Design 'Podcast Launch Episode' found")
            if _check_design_dimensions(youtube, 1280, 720):
                checks_passed.append("[✓] YouTube thumbnail has correct dimensions (1280x720)")
            else:
                errors.append(f"[X] YouTube thumbnail dimensions are {youtube.get('width')}x{youtube.get('height')}, expected 1280x720")

            if video_folder_id and youtube.get("folderId") == video_folder_id:
                checks_passed.append("[✓] YouTube thumbnail in 'Personal/Video' folder")
            elif video_folder_id:
                errors.append("[X] YouTube thumbnail not in 'Personal/Video' folder")
        else:
            errors.append("[X] Design 'Podcast Launch Episode' not found")

        # Check Instagram story "Podcast Story Teaser"
        instagram = _find_design_by_exact_title(backend, "Podcast Story Teaser")
        if not instagram:
            instagram = _find_design_by_title(backend, "Podcast Story Teaser")

        if instagram:
            checks_passed.append("[✓] Design 'Podcast Story Teaser' found")
            if _check_design_dimensions(instagram, 1080, 1920):
                checks_passed.append("[✓] Instagram story has correct dimensions (1080x1920)")
            else:
                errors.append(f"[X] Instagram story dimensions are {instagram.get('width')}x{instagram.get('height')}, expected 1080x1920")

            if video_folder_id and instagram.get("folderId") == video_folder_id:
                checks_passed.append("[✓] Instagram story in 'Personal/Video' folder")
            elif video_folder_id:
                errors.append("[X] Instagram story not in 'Personal/Video' folder")
        else:
            errors.append("[X] Design 'Podcast Story Teaser' not found")

        # Check Facebook post "Podcast Announcement"
        facebook = _find_design_by_exact_title(backend, "Podcast Announcement")
        if not facebook:
            facebook = _find_design_by_title(backend, "Podcast Announcement")

        if facebook:
            checks_passed.append("[✓] Design 'Podcast Announcement' found")
            if _check_design_dimensions(facebook, 1200, 630):
                checks_passed.append("[✓] Facebook post has correct dimensions (1200x630)")
            else:
                errors.append(f"[X] Facebook post dimensions are {facebook.get('width')}x{facebook.get('height')}, expected 1200x630")

            if video_folder_id and facebook.get("folderId") == video_folder_id:
                checks_passed.append("[✓] Facebook post in 'Personal/Video' folder")
            elif video_folder_id:
                errors.append("[X] Facebook post not in 'Personal/Video' folder")
        else:
            errors.append("[X] Design 'Podcast Announcement' not found")

        # Check "Podcast Episode 12 Thumbnail" analysis
        podcast_12 = _find_design_by_title(backend, "Podcast Episode 12 Thumbnail")
        if podcast_12:
            checks_passed.append("[✓] Design 'Podcast Episode 12 Thumbnail' found for analysis")
            elements = _get_elements_for_design(backend, podcast_12.get("_id"))
            if len(elements) > 0:
                element_counts = _count_elements_by_type(elements)
                # Check for shadow effects, opacity documentation
                elements_with_shadow = [e for e in elements if e.get("shadow", {}).get("enabled", False)]
                checks_passed.append(f"[✓] Visual element analysis complete ({len(elements)} elements, {len(elements_with_shadow)} with shadows)")
            else:
                errors.append("[X] No elements extracted from 'Podcast Episode 12 Thumbnail' for analysis")
        else:
            errors.append("[X] Design 'Podcast Episode 12 Thumbnail' not found for analysis")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_video_content_podcast_package: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_poster_resize_marketing_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music poster resize and marketing suite creation.
    Checks poster resized to 1080x1080, new Instagram story and Facebook event cover.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check "Live Music Night Poster" resized to 1080x1080
        poster = _find_design_by_title(backend, "Live Music Night Poster")
        if poster:
            checks_passed.append("[✓] Design 'Live Music Night Poster' found")

            if _check_design_dimensions(poster, 1080, 1080):
                checks_passed.append("[✓] Poster resized to 1080x1080 (square format)")
            else:
                errors.append(f"[X] Poster dimensions are {poster.get('width')}x{poster.get('height')}, expected 1080x1080")

            if _check_design_format(poster, "custom"):
                checks_passed.append("[✓] Poster format changed to 'custom'")
            else:
                errors.append(f"[X] Poster format is '{poster.get('format')}', expected 'custom'")
        else:
            errors.append("[X] Design 'Live Music Night Poster' not found")

        # Check Instagram story "Live Music Story"
        story = _find_design_by_exact_title(backend, "Live Music Story")
        if not story:
            story = _find_design_by_title(backend, "Live Music Story")

        if story:
            checks_passed.append("[✓] Design 'Live Music Story' found")
            if _check_design_dimensions(story, 1080, 1920):
                checks_passed.append("[✓] Instagram story has correct dimensions (1080x1920)")
            else:
                errors.append(f"[X] Instagram story dimensions are {story.get('width')}x{story.get('height')}, expected 1080x1920")
        else:
            errors.append("[X] Design 'Live Music Story' not found")

        # Check Facebook event cover "Live Music Facebook Event"
        fb_event = _find_design_by_exact_title(backend, "Live Music Facebook Event")
        if not fb_event:
            fb_event = _find_design_by_title(backend, "Live Music Facebook Event")

        if fb_event:
            checks_passed.append("[✓] Design 'Live Music Facebook Event' found")
            if _check_design_dimensions(fb_event, 1920, 1080):
                checks_passed.append("[✓] Facebook event cover has correct dimensions (1920x1080)")
            else:
                errors.append(f"[X] Facebook event dimensions are {fb_event.get('width')}x{fb_event.get('height')}, expected 1920x1080")
        else:
            errors.append("[X] Design 'Live Music Facebook Event' not found")

        # Verify visual analysis was performed on at least one design
        if poster:
            elements = _get_elements_for_design(backend, poster.get("_id"))
            if len(elements) > 0:
                checks_passed.append(f"[✓] Visual analysis performed ({len(elements)} elements documented)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_poster_resize_marketing_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_video_workflow_folder_setup(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate video content workflow with folder structure and YouTube thumbnails.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder "Video Content/Tutorials/2026"
        tutorials_folder = _find_folder_by_path(backend, "Video Content/Tutorials/2026")
        if tutorials_folder:
            checks_passed.append("[✓] Folder 'Video Content/Tutorials/2026' exists")
        else:
            errors.append("[X] Folder 'Video Content/Tutorials/2026' not found")

        # Check folder "Video Content/Podcasts/Archive"
        podcasts_archive = _find_folder_by_path(backend, "Video Content/Podcasts/Archive")
        if podcasts_archive:
            checks_passed.append("[✓] Folder 'Video Content/Podcasts/Archive' exists")
        else:
            errors.append("[X] Folder 'Video Content/Podcasts/Archive' not found")

        # Check three YouTube thumbnails with exact titles
        thumbnails = [
            ("Tutorial Series Intro", 1280, 720),
            ("Advanced Techniques Guide", 1280, 720),
            ("Quick Tips Collection", 1280, 720)
        ]

        for title, width, height in thumbnails:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                # Check if in Tutorials folder
                if tutorials_folder and design.get("folderId") == tutorials_folder.get("_id"):
                    checks_passed.append(f"[✓] '{title}' is in Tutorials folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check at least 1 design with "Podcast" in title moved to Podcasts/Archive
        if podcasts_archive:
            designs_in_archive = _get_designs_in_folder(backend, podcasts_archive.get("_id"))
            podcast_designs = [d for d in designs_in_archive if "podcast" in d.get("title", "").lower()]

            if len(podcast_designs) >= 1:
                checks_passed.append(f"[✓] At least 1 Podcast design moved to Archive ({len(podcast_designs)} found)")
            else:
                errors.append("[X] No Podcast designs found in Podcasts/Archive folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_video_workflow_folder_setup: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_biz_card_to_letterhead_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Business Card — Alice Chen resized to US letter dimensions (2550x3300).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design (with em dash or regular dash)
        design = _find_design_by_title(backend, "Business Card")
        if not design:
            design = _find_design_by_title(backend, "Alice Chen")

        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Business Card — Alice Chen' found")

        # Check dimensions (2550x3300)
        if _check_design_dimensions(design, 2550, 3300):
            checks_passed.append("[✓] Design resized to 2550x3300 (US letter dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 2550x3300")

        # Check format changed to custom
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check text content extraction
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = [e for e in elements if e.get("type") == "text"]

        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text content extraction completed ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No text elements found for contact information documentation")

        if len(elements) > 0:
            checks_passed.append(f"[✓] Layout analysis possible ({len(elements)} elements adapted)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_biz_card_to_letterhead_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_brand_identity_set(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate complete brand identity set: Logo, Business Card, Letterhead.
    All must be in 'Brand Assets/New Client/Identity Package' folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder exists
        folder = _find_folder_by_path(backend, "Brand Assets/New Client/Identity Package")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/New Client/Identity Package' exists")
        else:
            errors.append("[X] Folder 'Brand Assets/New Client/Identity Package' not found")

        # Check Logo "Brand Identity Logo" 500x500
        logo = _find_design_by_exact_title(backend, "Brand Identity Logo")
        if not logo:
            logo = _find_design_by_title(backend, "Brand Identity Logo")

        if logo:
            checks_passed.append("[✓] Design 'Brand Identity Logo' found")
            if _check_design_dimensions(logo, 500, 500):
                checks_passed.append("[✓] Logo has correct dimensions (500x500)")
            else:
                errors.append(f"[X] Logo dimensions are {logo.get('width')}x{logo.get('height')}, expected 500x500")

            if _check_design_format_flexible(logo, "logo"):
                checks_passed.append("[✓] Logo has correct format (logo)")
            else:
                errors.append(f"[X] Logo format is '{logo.get('format')}', expected 'logo'")

            if folder_id and logo.get("folderId") == folder_id:
                checks_passed.append("[✓] Logo is in Identity Package folder")
            elif folder_id:
                errors.append("[X] Logo not in Identity Package folder")
        else:
            errors.append("[X] Design 'Brand Identity Logo' not found")

        # Check Business Card "Brand Identity Card" 1050x600
        card = _find_design_by_exact_title(backend, "Brand Identity Card")
        if not card:
            card = _find_design_by_title(backend, "Brand Identity Card")

        if card:
            checks_passed.append("[✓] Design 'Brand Identity Card' found")
            if _check_design_dimensions(card, 1050, 600):
                checks_passed.append("[✓] Business Card has correct dimensions (1050x600)")
            else:
                errors.append(f"[X] Business Card dimensions are {card.get('width')}x{card.get('height')}, expected 1050x600")

            if _check_design_format_flexible(card, "business-card"):
                checks_passed.append("[✓] Business Card has correct format (business-card)")
            else:
                errors.append(f"[X] Business Card format is '{card.get('format')}', expected 'business-card'")

            if folder_id and card.get("folderId") == folder_id:
                checks_passed.append("[✓] Business Card is in Identity Package folder")
            elif folder_id:
                errors.append("[X] Business Card not in Identity Package folder")
        else:
            errors.append("[X] Design 'Brand Identity Card' not found")

        # Check Letterhead "Brand Identity Letterhead" 2480x3508
        letterhead = _find_design_by_exact_title(backend, "Brand Identity Letterhead")
        if not letterhead:
            letterhead = _find_design_by_title(backend, "Brand Identity Letterhead")

        if letterhead:
            checks_passed.append("[✓] Design 'Brand Identity Letterhead' found")
            if _check_design_dimensions(letterhead, 2480, 3508):
                checks_passed.append("[✓] Letterhead has correct dimensions (2480x3508)")
            else:
                errors.append(f"[X] Letterhead dimensions are {letterhead.get('width')}x{letterhead.get('height')}, expected 2480x3508")

            if _check_design_format_flexible(letterhead, "a4-document"):
                checks_passed.append("[✓] Letterhead has correct format (a4-document)")
            else:
                errors.append(f"[X] Letterhead format is '{letterhead.get('format')}', expected 'a4-document'")

            if folder_id and letterhead.get("folderId") == folder_id:
                checks_passed.append("[✓] Letterhead is in Identity Package folder")
            elif folder_id:
                errors.append("[X] Letterhead not in Identity Package folder")
        else:
            errors.append("[X] Design 'Brand Identity Letterhead' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_identity_set: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_brand_package_4_designs(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive brand package with four designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Brand Assets/2026 Package/Core Assets")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/2026 Package/Core Assets' exists")
        else:
            errors.append("[X] Folder 'Brand Assets/2026 Package/Core Assets' not found")

        designs_to_check = [
            ("Brand Logo 2026", 500, 500, "logo"),
            ("Brand Business Card", 1050, 600, "business-card"),
            ("Brand Guidelines Deck", 1920, 1080, "presentation"),
            ("Brand Web Header", 800, 400, "custom"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Core Assets folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Core Assets folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check text content in presentation
        presentation = _find_design_by_title(backend, "Brand Guidelines Deck")
        if presentation:
            elements = _get_elements_for_design(backend, presentation.get("_id"))
            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] Presentation text content extracted ({len(text_elements)} text elements)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_package_4_designs: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_poster_folder(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference 2026 Poster with folder structure.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Brand Assets/Events/2026 Conferences")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/Events/2026 Conferences' exists")
        else:
            errors.append("[X] Folder 'Brand Assets/Events/2026 Conferences' not found")

        # Check poster with exact title
        poster = _find_design_by_exact_title(backend, "Conference 2026 Poster")
        if not poster:
            poster = _find_design_by_title(backend, "Conference 2026 Poster")

        if poster:
            checks_passed.append("[✓] Design 'Conference 2026 Poster' found")

            # Check dimensions (1080x1920)
            if _check_design_dimensions(poster, 1080, 1920):
                checks_passed.append("[✓] Poster has correct dimensions (1080x1920)")
            else:
                errors.append(f"[X] Poster dimensions are {poster.get('width')}x{poster.get('height')}, expected 1080x1920")

            # Check format (poster)
            if _check_design_format_flexible(poster, "poster"):
                checks_passed.append("[✓] Poster has correct format (poster)")
            else:
                errors.append(f"[X] Poster format is '{poster.get('format')}', expected 'poster'")

            # Check folder placement
            if folder_id and poster.get("folderId") == folder_id:
                checks_passed.append("[✓] Poster is in '2026 Conferences' folder")
            elif folder_id:
                errors.append("[X] Poster not in '2026 Conferences' folder")
        else:
            errors.append("[X] Design 'Conference 2026 Poster' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_poster_folder: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_tech_reorganize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference and Tech designs reorganization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Events Archive/Technology/2026")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Events Archive/Technology/2026' exists")
        else:
            errors.append("[X] Folder 'Events Archive/Technology/2026' not found")
            return _make_task_score(errors, checks_passed)

        # Get designs in target folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)

        # Count designs with "Conference" or "Tech" in title
        matching_designs = [
            d for d in designs_in_folder
            if "conference" in d.get("title", "").lower() or "tech" in d.get("title", "").lower()
        ]

        if len(matching_designs) >= 2:
            checks_passed.append(f"[✓] At least 2 Conference/Tech designs moved (found {len(matching_designs)})")

            # Verify specific expected designs
            titles = [d.get("title", "").lower() for d in matching_designs]
            if any("tech conference header" in t for t in titles):
                checks_passed.append("[✓] 'Tech Conference Header' found in target folder")
        else:
            errors.append(f"[X] Only {len(matching_designs)} Conference/Tech designs found in folder, expected at least 2")

        # Verify no matching designs remain in original locations (other folders)
        all_designs = _get_all_designs(backend)
        remaining = [
            d for d in all_designs
            if ("conference" in d.get("title", "").lower() or "tech" in d.get("title", "").lower())
            and d.get("folderId") != folder_id
        ]

        if len(remaining) == 0:
            checks_passed.append("[✓] No Conference/Tech designs remain in original folders")
        else:
            # This is informational, not necessarily an error if some designs should stay
            checks_passed.append(f"[✓] {len(remaining)} Conference/Tech designs remain in other locations (may be intentional)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_tech_reorganize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_presentation_series_q2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 Presentation Series and Business Card resize.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Personal/Docs/Presentations/Q2 2026")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Docs/Presentations/Q2 2026' exists")
        else:
            errors.append("[X] Folder 'Personal/Docs/Presentations/Q2 2026' not found")

        # Check three presentations with exact titles
        presentations = [
            "Q2 Strategy Overview",
            "Q2 Budget Analysis",
            "Q2 Action Items"
        ]

        for title in presentations:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Presentation '{title}' found")

                if _check_design_dimensions(design, 1920, 1080):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions (1920x1080)")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected 1920x1080")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Q2 2026 folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Q2 2026 folder")
            else:
                errors.append(f"[X] Presentation '{title}' not found")

        # Check Business Card resized
        biz_card = _find_design_by_title(backend, "Business Card")
        if not biz_card:
            biz_card = _find_design_by_title(backend, "Alice Chen")

        if biz_card:
            checks_passed.append("[✓] 'Business Card — Alice Chen' found")

            if _check_design_dimensions(biz_card, 2480, 3508):
                checks_passed.append("[✓] Business Card resized to A4 dimensions (2480x3508)")
            else:
                errors.append(f"[X] Business Card dimensions are {biz_card.get('width')}x{biz_card.get('height')}, expected 2480x3508")

            if _check_design_format(biz_card, "custom"):
                checks_passed.append("[✓] Business Card format changed to 'custom'")
            else:
                errors.append(f"[X] Business Card format is '{biz_card.get('format')}', expected 'custom'")
        else:
            errors.append("[X] 'Business Card — Alice Chen' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_presentation_series_q2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_designs_reorganize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome designs reorganization by format.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check base folder structure
        base_folder = _find_folder_by_path(backend, "Archive/2026/Welcome Designs/By Format")

        if base_folder:
            checks_passed.append("[✓] Folder 'Archive/2026/Welcome Designs/By Format' exists")

            # Check for format-specific subfolders
            child_folders = _get_child_folders(backend, base_folder.get("_id"))
            folder_names = [f.get("name", "").lower() for f in child_folders]

            if len(child_folders) > 0:
                checks_passed.append(f"[✓] Format subfolders created ({len(child_folders)} found)")

                # Check for Instagram Posts subfolder specifically
                instagram_folder = None
                for f in child_folders:
                    if "instagram" in f.get("name", "").lower():
                        instagram_folder = f
                        checks_passed.append("[✓] Instagram-related subfolder found")
                        break

                # Count Welcome designs moved to subfolders
                total_welcome_designs = 0
                for subfolder in child_folders:
                    designs = _get_designs_in_folder(backend, subfolder.get("_id"))
                    welcome_designs = [d for d in designs if "welcome" in d.get("title", "").lower()]
                    total_welcome_designs += len(welcome_designs)

                if total_welcome_designs >= 3:
                    checks_passed.append(f"[✓] At least 3 Welcome designs moved to format subfolders (found {total_welcome_designs})")
                else:
                    errors.append(f"[X] Only {total_welcome_designs} Welcome designs in subfolders, expected at least 3")
            else:
                errors.append("[X] No format subfolders found in 'By Format' folder")
        else:
            errors.append("[X] Folder 'Archive/2026/Welcome Designs/By Format' not found")

        # Verify content extraction was performed on Welcome designs
        welcome_designs = _find_designs_by_title_pattern(backend, "Welcome")
        if len(welcome_designs) > 0:
            for design in welcome_designs[:3]:  # Check first 3
                elements = _get_elements_for_design(backend, design.get("_id"))
                if len(elements) > 0:
                    checks_passed.append(f"[✓] Content extracted from '{design.get('title')}' ({len(elements)} elements)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_designs_reorganize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_concert_festival_posters(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Concert and Festival poster designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Print/Posters")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Print/Posters' exists")
        else:
            errors.append("[X] Folder 'Personal/Print/Posters' not found")

        # Check Concert Poster 2026 (1080x1920 poster format)
        concert = _find_design_by_exact_title(backend, "Concert Poster 2026")
        if not concert:
            concert = _find_design_by_title(backend, "Concert Poster 2026")

        if concert:
            checks_passed.append("[✓] Design 'Concert Poster 2026' found")

            if _check_design_dimensions(concert, 1080, 1920):
                checks_passed.append("[✓] Concert poster has correct dimensions (1080x1920)")
            else:
                errors.append(f"[X] Concert poster dimensions are {concert.get('width')}x{concert.get('height')}, expected 1080x1920")

            if _check_design_format_flexible(concert, "poster"):
                checks_passed.append("[✓] Concert poster has correct format (poster)")
            else:
                errors.append(f"[X] Concert poster format is '{concert.get('format')}', expected 'poster'")

            if folder_id and concert.get("folderId") == folder_id:
                checks_passed.append("[✓] Concert poster is in Posters folder")
            elif folder_id:
                errors.append("[X] Concert poster not in Posters folder")
        else:
            errors.append("[X] Design 'Concert Poster 2026' not found")

        # Check Festival Flyer 2026 (2480x3508 flyer format)
        festival = _find_design_by_exact_title(backend, "Festival Flyer 2026")
        if not festival:
            festival = _find_design_by_title(backend, "Festival Flyer 2026")

        if festival:
            checks_passed.append("[✓] Design 'Festival Flyer 2026' found")

            if _check_design_dimensions(festival, 2480, 3508):
                checks_passed.append("[✓] Festival flyer has correct dimensions (2480x3508)")
            else:
                errors.append(f"[X] Festival flyer dimensions are {festival.get('width')}x{festival.get('height')}, expected 2480x3508")

            if _check_design_format_flexible(festival, "flyer"):
                checks_passed.append("[✓] Festival flyer has correct format (flyer)")
            else:
                errors.append(f"[X] Festival flyer format is '{festival.get('format')}', expected 'flyer'")

            if folder_id and festival.get("folderId") == folder_id:
                checks_passed.append("[✓] Festival flyer is in Posters folder")
            elif folder_id:
                errors.append("[X] Festival flyer not in Posters folder")
        else:
            errors.append("[X] Design 'Festival Flyer 2026' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_concert_festival_posters: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_event_marketing_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Spring Festival 2026 event marketing suite.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Events/Spring 2026/Marketing Materials")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Events/Spring 2026/Marketing Materials' exists")
        else:
            errors.append("[X] Folder 'Events/Spring 2026/Marketing Materials' not found")

        # Check designs with exact titles
        designs_to_check = [
            ("Spring Festival 2026 - Main Poster", 1080, 1920, "poster"),
            ("Spring Festival 2026 - Program Guide", 2480, 3508, "a4-document"),
            ("Spring Festival 2026 - Promotional Flyer", 2480, 3508, "flyer"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Marketing Materials folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Marketing Materials folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_event_marketing_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_header_resize_linkedin(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Conference Header resized to LinkedIn banner dimensions.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Tech Conference Header' found")

        # Check dimensions (1584x396)
        if _check_design_dimensions(design, 1584, 396):
            checks_passed.append("[✓] Design resized to 1584x396 (LinkedIn banner dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1584x396")

        # Check format changed to custom
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check content extraction
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) > 0:
            checks_passed.append(f"[✓] Content extraction confirms retention ({len(elements)} elements)")

            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] Text components retained ({len(text_elements)} text elements)")
        else:
            errors.append("[X] No elements found for content verification")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_header_resize_linkedin: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_print_materials_festival(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Summer Festival print materials collection.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        folder = _find_folder_by_path(backend, "Personal/Print/Summer Festival 2026")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Print/Summer Festival 2026' exists")
        else:
            errors.append("[X] Folder 'Personal/Print/Summer Festival 2026' not found")

        # Check new designs
        designs_to_check = [
            ("Summer Festival 2026 Poster", 1080, 1920, "poster"),
            ("Summer Festival 2026 Flyer", 2480, 3508, "flyer"),
            ("Summer Festival Contact Card", 1050, 600, "business-card"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Summer Festival folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Summer Festival folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        # Check Festival designs moved to folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            festival_designs = [d for d in designs_in_folder if "festival" in d.get("title", "").lower()]

            if len(festival_designs) >= 3:
                checks_passed.append(f"[✓] Festival designs organized in folder ({len(festival_designs)} found)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_print_materials_festival: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_reorganize_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Flash Sale designs reorganization and resize.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure
        folder = _find_folder_by_path(backend, "Marketing/Promotions/Flash Sales")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Marketing/Promotions/Flash Sales' exists")
        else:
            errors.append("[X] Folder 'Marketing/Promotions/Flash Sales' not found")

        # Check Flash Sale designs moved
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            flash_sale_designs = [d for d in designs_in_folder if "flash sale" in d.get("title", "").lower()]

            if len(flash_sale_designs) >= 1:
                checks_passed.append(f"[✓] Flash Sale designs moved to folder ({len(flash_sale_designs)} found)")
            else:
                errors.append("[X] No Flash Sale designs found in target folder")

        # Check "Flash Sale Story" resized
        flash_story = _find_design_by_title(backend, "Flash Sale Story")
        if flash_story:
            checks_passed.append("[✓] Design 'Flash Sale Story' found")

            # Check dimensions (1200x630)
            if _check_design_dimensions(flash_story, 1200, 630):
                checks_passed.append("[✓] Flash Sale Story resized to 1200x630 (Facebook post dimensions)")
            else:
                errors.append(f"[X] Flash Sale Story dimensions are {flash_story.get('width')}x{flash_story.get('height')}, expected 1200x630")

            # Check format changed to custom
            if _check_design_format(flash_story, "custom"):
                checks_passed.append("[✓] Flash Sale Story format changed to 'custom'")
            else:
                errors.append(f"[X] Flash Sale Story format is '{flash_story.get('format')}', expected 'custom'")

            # Check text content extraction
            elements = _get_elements_for_design(backend, flash_story.get("_id"))
            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] Text content extracted ({len(text_elements)} text elements)")
        else:
            errors.append("[X] Design 'Flash Sale Story' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_reorganize_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_instagram_resize_banner(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post resized for website banner.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Welcome Instagram Post' found")

        # Check dimensions (1600x900)
        if _check_design_dimensions(design, 1600, 900):
            checks_passed.append("[✓] Design resized to 1600x900 (website banner dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1600x900")

        # Check format changed to custom
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check content extraction
        elements = _get_elements_for_design(backend, design.get("_id"))
        element_counts = _count_elements_by_type(elements)

        text_count = element_counts.get("text", 0)
        shape_count = sum(element_counts.get(t, 0) for t in ["shape", "rectangle", "circle", "ellipse", "line", "polygon"])

        # Check at least 4 text elements
        if text_count >= 4:
            checks_passed.append(f"[✓] At least 4 text elements found ({text_count} text elements)")
        else:
            errors.append(f"[X] Only {text_count} text elements found, expected at least 4")

        # Check at least 5 shape elements
        if shape_count >= 5:
            checks_passed.append(f"[✓] At least 5 shape elements found ({shape_count} shape elements)")
        else:
            errors.append(f"[X] Only {shape_count} shape elements found, expected at least 5")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_instagram_resize_banner: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_newsletter_resize_tabloid(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate January Newsletter resized to tabloid dimensions.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "January Newsletter")
        if not design:
            errors.append("[X] Design 'January Newsletter' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'January Newsletter' found")

        # Check dimensions (2800x4320)
        if _check_design_dimensions(design, 2800, 4320):
            checks_passed.append("[✓] Design resized to 2800x4320 (tabloid dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 2800x4320")

        # Check format changed from a4-document to custom
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Design format changed from 'a4-document' to 'custom'")
        else:
            errors.append(f"[X] Design format is '{design.get('format')}', expected 'custom'")

        # Check content preservation
        elements = _get_elements_for_design(backend, design.get("_id"))
        element_counts = _count_elements_by_type(elements)

        if len(elements) > 0:
            checks_passed.append(f"[✓] Content preserved after resize ({len(elements)} elements)")

            # Check for text elements
            if element_counts.get("text", 0) > 0:
                checks_passed.append(f"[✓] Text elements preserved ({element_counts.get('text', 0)} found)")

            # Check for image elements
            if element_counts.get("image", 0) > 0:
                checks_passed.append(f"[✓] Image elements preserved ({element_counts.get('image', 0)} found)")

            # Check for shape elements
            shape_count = sum(element_counts.get(t, 0) for t in ["shape", "rectangle", "circle", "line"])
            if shape_count > 0:
                checks_passed.append(f"[✓] Shape elements preserved ({shape_count} found)")
        else:
            errors.append("[X] No elements found - content may not be preserved")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_newsletter_resize_tabloid: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_video_package_tech_conf(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate cross-platform video content package for tech conference.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        folder = _find_folder_by_path(backend, "Personal/Video/Tech Conference 2026")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Video/Tech Conference 2026' exists")
        else:
            errors.append("[X] Folder 'Personal/Video/Tech Conference 2026' not found")

        # Check three designs with exact titles
        designs_to_check = [
            ("Tech Conference 2026 - YouTube", 1280, 720, "youtube-thumbnail"),
            ("Tech Conference 2026 - Story", 1080, 1920, "instagram-story"),
            ("Tech Conference 2026 - Preview", 1920, 1080, "presentation"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has acceptable format")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Tech Conference folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Tech Conference folder")

                # Check content extraction for typography
                elements = _get_elements_for_design(backend, design.get("_id"))
                text_elements = [e for e in elements if e.get("type") == "text"]
                if len(text_elements) > 0:
                    checks_passed.append(f"[✓] '{title}' text elements documented ({len(text_elements)} found)")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_video_package_tech_conf: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)





# ==============================================================================
# Reward Functions for Canva MCP V2 Tasks (Second Batch)
# ==============================================================================
def _validate_poster_resize_web_banner(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resized to web banner dimensions (1600x900).
    Checks exact dimensions, format change to 'custom', and element analysis.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design by exact title
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            design = _find_design_by_title(backend, "Live Music Night Poster")

        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Live Music Night Poster' found")

        # Check exact dimensions 1600x900
        if _check_design_dimensions(design, 1600, 900):
            checks_passed.append("[✓] Design resized to exactly 1600x900 (web banner dimensions)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected exactly 1600x900")

        # Check format changed to 'custom'
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Check element extraction and analysis
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) > 0:
            checks_passed.append(f"[✓] Element extraction completed ({len(elements)} elements)")

            # Check element positions documented
            elements_with_position = [e for e in elements if e.get("x") is not None and e.get("y") is not None]
            if len(elements_with_position) > 0:
                checks_passed.append(f"[✓] Element positions documented ({len(elements_with_position)} with x,y)")

            # Check element sizes documented
            elements_with_size = [e for e in elements if e.get("width") is not None and e.get("height") is not None]
            if len(elements_with_size) > 0:
                checks_passed.append(f"[✓] Element sizes documented ({len(elements_with_size)} with dimensions)")

            # Check text elements for readability verification
            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] Text elements found for readability check ({len(text_elements)} text elements)")
            else:
                errors.append("[X] No text elements found - cannot verify readability")
        else:
            errors.append("[X] No elements extracted for analysis")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_poster_resize_web_banner: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_content_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme designs content extraction and folder organization.
    Must find at least 4 designs with 'Acme' in title, extract content, and move to folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure exists: 'Client Work/Acme Corp/Content Audit'
        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Content Audit")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Client Work/Acme Corp/Content Audit' created")
        else:
            errors.append("[X] Folder 'Client Work/Acme Corp/Content Audit' not found")

        # Find all designs with 'Acme' in title
        acme_designs = _find_designs_by_title_pattern(backend, "Acme")

        if len(acme_designs) >= 4:
            checks_passed.append(f"[✓] At least 4 designs with 'Acme' in title found ({len(acme_designs)} total)")
        else:
            errors.append(f"[X] Only {len(acme_designs)} designs with 'Acme' found, expected at least 4")

        # Verify designs moved to Content Audit folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            acme_in_folder = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

            if len(acme_in_folder) >= 4:
                checks_passed.append(f"[✓] At least 4 Acme designs moved to Content Audit folder ({len(acme_in_folder)} found)")
            else:
                errors.append(f"[X] Only {len(acme_in_folder)} Acme designs in Content Audit folder, expected at least 4")

        # Verify content extraction for each design (format, dimensions, elements, text, background)
        content_extracted_count = 0
        for design in acme_designs[:4]:  # Check first 4
            design_id = design.get("_id")
            title = design.get("title", "Unknown")

            # Check format and dimensions extracted
            fmt = design.get("format")
            width = design.get("width")
            height = design.get("height")

            if fmt and width and height:
                checks_passed.append(f"[✓] Format/dimensions extracted for '{title}': {fmt} ({width}x{height})")

            # Check element extraction
            elements = _get_elements_for_design(backend, design_id)
            if len(elements) > 0:
                element_counts = _count_elements_by_type(elements)
                checks_passed.append(f"[✓] Element counts extracted for '{title}': {element_counts}")

                # Check text content extraction
                text_elements = [e for e in elements if e.get("type") == "text"]
                if len(text_elements) > 0:
                    checks_passed.append(f"[✓] Text content extracted for '{title}' ({len(text_elements)} text elements)")

                # Check background color (from shape elements or design properties)
                shape_elements = [e for e in elements if e.get("type") == "shape"]
                if len(shape_elements) > 0:
                    checks_passed.append(f"[✓] Background/shape colors available for '{title}'")

                content_extracted_count += 1

        if content_extracted_count >= 4:
            checks_passed.append("[✓] Comprehensive content data extracted for at least 4 designs")
        else:
            errors.append(f"[X] Content extracted for only {content_extracted_count} designs, expected at least 4")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_content_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_print_marketing_suite_2026(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive print marketing suite with exact titles and dimensions.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure: 'Print Marketing/Executive Suite/2026 Collection'
        folder = _find_folder_by_path(backend, "Print Marketing/Executive Suite/2026 Collection")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Print Marketing/Executive Suite/2026 Collection' created")
        else:
            errors.append("[X] Folder 'Print Marketing/Executive Suite/2026 Collection' not found")

        # Check all four designs with EXACT titles and dimensions
        designs_to_check = [
            ("Executive Business Card 2026", 1050, 600, "business-card"),
            ("Corporate Brochure 2026", 2480, 3508, "a4-document"),
            ("Event Announcement Poster 2026", 1080, 1920, "poster"),
            ("Service Overview Flyer 2026", 2480, 3508, "flyer"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check EXACT dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected exactly {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                # Check folder placement
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in '2026 Collection' folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in '2026 Collection' folder")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_print_marketing_suite_2026: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_global_enterprises_social_workflow(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate 5-level folder hierarchy and three social media designs with exact specs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check complete 5-level folder path exists
        folder = _find_folder_by_path(backend, "Client Work/Global Enterprises/Q1 2026/Digital Assets/Social Media")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Complete 5-level folder path 'Client Work/Global Enterprises/Q1 2026/Digital Assets/Social Media' exists")
        else:
            errors.append("[X] Folder path 'Client Work/Global Enterprises/Q1 2026/Digital Assets/Social Media' not found")

        # Verify each level exists
        folder_levels = [
            "Client Work",
            "Client Work/Global Enterprises",
            "Client Work/Global Enterprises/Q1 2026",
            "Client Work/Global Enterprises/Q1 2026/Digital Assets",
            "Client Work/Global Enterprises/Q1 2026/Digital Assets/Social Media"
        ]
        for i, path in enumerate(folder_levels, 1):
            level_folder = _find_folder_by_path(backend, path)
            if level_folder:
                checks_passed.append(f"[✓] Level {i} folder exists: '{path.split('/')[-1]}'")

        # Check three designs with EXACT titles and dimensions
        designs_to_check = [
            ("Global Q1 Story", 1080, 1920, "instagram-story"),
            ("Global Q1 Header", 1500, 500, "twitter-header"),
            ("Global Q1 Banner", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check EXACT dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected exactly {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                # Check in Social Media folder
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Social Media folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Social Media folder")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_global_enterprises_social_workflow: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_winter_gala_event_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Winter Gala 2026 event marketing suite with exact titles.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure: 'Events/Winter Gala 2026/Marketing Assets'
        folder = _find_folder_by_path(backend, "Events/Winter Gala 2026/Marketing Assets")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Events/Winter Gala 2026/Marketing Assets' exists")
        else:
            errors.append("[X] Folder 'Events/Winter Gala 2026/Marketing Assets' not found")

        # Check three designs with EXACT titles
        designs_to_check = [
            ("Winter Gala 2026 - Story", 1080, 1920, "instagram-story"),
            ("Winter Gala 2026 - Poster", 1080, 1920, "poster"),
            ("Winter Gala 2026 - Header", 1500, 500, "twitter-header"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check EXACT dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected exactly {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                # Check in Marketing Assets folder
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Marketing Assets folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Marketing Assets folder")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_winter_gala_event_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_devcon_marketing_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate DevCon 2026 comprehensive marketing suite with five designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder structure: 'Client Work/DevCon/2026/Marketing Suite'
        folder = _find_folder_by_path(backend, "Client Work/DevCon/2026/Marketing Suite")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Client Work/DevCon/2026/Marketing Suite' exists")
        else:
            errors.append("[X] Folder 'Client Work/DevCon/2026/Marketing Suite' not found")

        # Check five designs with EXACT titles and dimensions
        designs_to_check = [
            ("DevCon 2026 - Instagram Announcement", 1080, 1080, "instagram-post"),
            ("DevCon 2026 - LinkedIn Event", 1584, 396, "linkedin-banner"),
            ("DevCon 2026 - Print Flyer", 2480, 3508, "flyer"),
            ("DevCon 2026 - Sponsor Deck", 1920, 1080, "presentation"),
            ("DevCon 2026 - Website Banner", 1200, 400, "custom"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                # Check EXACT dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected exactly {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
                else:
                    errors.append(f"[X] '{title}' format is '{design.get('format')}', expected '{expected_format}'")

                # Check in Marketing Suite folder
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Marketing Suite folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Marketing Suite folder")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_devcon_marketing_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techcorp_client_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechCorp client organization with Tech and Acme designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check first folder structure: 'Client Work/TechCorp/Q1 2026/Social Assets'
        social_folder = _find_folder_by_path(backend, "Client Work/TechCorp/Q1 2026/Social Assets")
        social_folder_id = social_folder.get("_id") if social_folder else None

        if social_folder:
            checks_passed.append("[✓] Folder 'Client Work/TechCorp/Q1 2026/Social Assets' exists")
        else:
            errors.append("[X] Folder 'Client Work/TechCorp/Q1 2026/Social Assets' not found")

        # Check second folder structure: 'Client Work/TechCorp/Q1 2026/Presentations'
        pres_folder = _find_folder_by_path(backend, "Client Work/TechCorp/Q1 2026/Presentations")
        pres_folder_id = pres_folder.get("_id") if pres_folder else None

        if pres_folder:
            checks_passed.append("[✓] Folder 'Client Work/TechCorp/Q1 2026/Presentations' exists")
        else:
            errors.append("[X] Folder 'Client Work/TechCorp/Q1 2026/Presentations' not found")

        # Check Tech designs moved to Social Assets
        if social_folder_id:
            designs_in_social = _get_designs_in_folder(backend, social_folder_id)
            tech_designs = [d for d in designs_in_social if "tech" in d.get("title", "").lower()]

            # Specifically check for 'Tech Conference Header'
            tech_header_found = any("tech conference header" in d.get("title", "").lower() for d in tech_designs)

            if tech_header_found:
                checks_passed.append("[✓] 'Tech Conference Header' moved to Social Assets folder")
            else:
                errors.append("[X] 'Tech Conference Header' not found in Social Assets folder")

            if len(tech_designs) >= 1:
                checks_passed.append(f"[✓] Tech designs moved to Social Assets ({len(tech_designs)} found)")

        # Check Acme presentation moved to Presentations
        if pres_folder_id:
            designs_in_pres = _get_designs_in_folder(backend, pres_folder_id)
            acme_presentations = [d for d in designs_in_pres
                                  if "acme" in d.get("title", "").lower()
                                  and d.get("format") == "presentation"]

            # Specifically check for 'Acme Q1 Strategy Deck'
            acme_deck_found = any("acme q1 strategy deck" in d.get("title", "").lower() for d in designs_in_pres)

            if acme_deck_found:
                checks_passed.append("[✓] 'Acme Q1 Strategy Deck' moved to Presentations folder")
            elif len(acme_presentations) >= 1:
                checks_passed.append(f"[✓] Acme presentation designs moved to Presentations ({len(acme_presentations)} found)")
            else:
                errors.append("[X] 'Acme Q1 Strategy Deck' not found in Presentations folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techcorp_client_organization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_phoenix_digital_project_setup(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Phoenix Digital client project setup with exact folder paths and designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Instagram folder: 'Client Work/Phoenix Digital/2026 Q1/Social Media/Instagram'
        instagram_folder = _find_folder_by_path(backend, "Client Work/Phoenix Digital/2026 Q1/Social Media/Instagram")
        instagram_folder_id = instagram_folder.get("_id") if instagram_folder else None

        if instagram_folder:
            checks_passed.append("[✓] Folder 'Client Work/Phoenix Digital/2026 Q1/Social Media/Instagram' exists")
        else:
            errors.append("[X] Folder 'Client Work/Phoenix Digital/2026 Q1/Social Media/Instagram' not found")

        # Check Business Cards folder: 'Client Work/Phoenix Digital/2026 Q1/Print/Business Cards'
        cards_folder = _find_folder_by_path(backend, "Client Work/Phoenix Digital/2026 Q1/Print/Business Cards")
        cards_folder_id = cards_folder.get("_id") if cards_folder else None

        if cards_folder:
            checks_passed.append("[✓] Folder 'Client Work/Phoenix Digital/2026 Q1/Print/Business Cards' exists")
        else:
            errors.append("[X] Folder 'Client Work/Phoenix Digital/2026 Q1/Print/Business Cards' not found")

        # Check Instagram post with EXACT title
        insta_post = _find_design_by_exact_title(backend, "Phoenix Digital Welcome Post")
        if not insta_post:
            insta_post = _find_design_by_title(backend, "Phoenix Digital Welcome Post")

        if insta_post:
            checks_passed.append("[✓] Design 'Phoenix Digital Welcome Post' found")

            # Check exact dimensions 1080x1080
            if _check_design_dimensions(insta_post, 1080, 1080):
                checks_passed.append("[✓] Instagram post has exact dimensions (1080x1080)")
            else:
                errors.append(f"[X] Instagram post dimensions are {insta_post.get('width')}x{insta_post.get('height')}, expected 1080x1080")

            # Check in Instagram folder
            if instagram_folder_id and insta_post.get("folderId") == instagram_folder_id:
                checks_passed.append("[✓] Instagram post is in correct Instagram folder")
            elif instagram_folder_id:
                errors.append("[X] Instagram post not in Instagram folder")
        else:
            errors.append("[X] Design 'Phoenix Digital Welcome Post' not found")

        # Check business card with EXACT title
        biz_card = _find_design_by_exact_title(backend, "Phoenix Digital Business Card")
        if not biz_card:
            biz_card = _find_design_by_title(backend, "Phoenix Digital Business Card")

        if biz_card:
            checks_passed.append("[✓] Design 'Phoenix Digital Business Card' found")

            # Check exact dimensions 1050x600
            if _check_design_dimensions(biz_card, 1050, 600):
                checks_passed.append("[✓] Business card has exact dimensions (1050x600)")
            else:
                errors.append(f"[X] Business card dimensions are {biz_card.get('width')}x{biz_card.get('height')}, expected 1050x600")

            # Check in Business Cards folder
            if cards_folder_id and biz_card.get("folderId") == cards_folder_id:
                checks_passed.append("[✓] Business card is in correct Business Cards folder")
            elif cards_folder_id:
                errors.append("[X] Business card not in Business Cards folder")
        else:
            errors.append("[X] Design 'Phoenix Digital Business Card' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_phoenix_digital_project_setup: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_designs_folder_org(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome designs folder organization with 5-level hierarchy.
    Must find 3 specific Welcome designs and move them.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check complete folder path: 'Projects/2026/Q1/Client Assets/Marketing Materials'
        folder = _find_folder_by_path(backend, "Projects/2026/Q1/Client Assets/Marketing Materials")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder hierarchy 'Projects/2026/Q1/Client Assets/Marketing Materials' created")
        else:
            errors.append("[X] Folder 'Projects/2026/Q1/Client Assets/Marketing Materials' not found")

        # Verify each level exists
        folder_levels = [
            "Projects",
            "Projects/2026",
            "Projects/2026/Q1",
            "Projects/2026/Q1/Client Assets",
            "Projects/2026/Q1/Client Assets/Marketing Materials"
        ]
        for path in folder_levels:
            level_folder = _find_folder_by_path(backend, path)
            if level_folder:
                checks_passed.append(f"[✓] Folder level exists: '{path.split('/')[-1]}'")

        # Check for 3 specific Welcome designs
        expected_titles = [
            "Welcome Instagram Post",
            "Welcome Instagram Post (Acme)",
            "Welcome Instagram Post (Starlight)"
        ]

        found_welcome_designs = []
        for title in expected_titles:
            design = _find_design_by_exact_title(backend, title)
            if design:
                found_welcome_designs.append(design)
                checks_passed.append(f"[✓] Design '{title}' found")
            else:
                # Try pattern match
                design = _find_design_by_title(backend, title)
                if design:
                    found_welcome_designs.append(design)
                    checks_passed.append(f"[✓] Design '{title}' found (pattern match)")

        if len(found_welcome_designs) >= 3:
            checks_passed.append("[✓] Search for 'Welcome' finds 3 designs")
        else:
            errors.append(f"[X] Only {len(found_welcome_designs)} Welcome designs found, expected 3")

        # Verify designs moved to Marketing Materials folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            welcome_in_folder = [d for d in designs_in_folder if "welcome" in d.get("title", "").lower()]

            if len(welcome_in_folder) >= 3:
                checks_passed.append("[✓] All 3 Welcome designs moved to Marketing Materials folder")
            else:
                errors.append(f"[X] Only {len(welcome_in_folder)} Welcome designs in Marketing Materials, expected 3")

        # Verify folder navigation via parentId
        if folder:
            parent_id = folder.get("parentId")
            if parent_id:
                checks_passed.append("[✓] Folder structure navigable through parentId relationships")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_designs_folder_org: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_tech_conference_story_comparison(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Conference story creation and comparison with Flash Sale Story.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check new design with EXACT title
        new_story = _find_design_by_exact_title(backend, "Tech Conference 2026 - Story Announcement")
        if not new_story:
            new_story = _find_design_by_title(backend, "Tech Conference 2026 - Story Announcement")

        if new_story:
            checks_passed.append("[✓] Design 'Tech Conference 2026 - Story Announcement' created")

            # Check exact dimensions 1080x1920
            if _check_design_dimensions(new_story, 1080, 1920):
                checks_passed.append("[✓] New story has correct Instagram story dimensions (1080x1920)")
            else:
                errors.append(f"[X] New story dimensions are {new_story.get('width')}x{new_story.get('height')}, expected 1080x1920")

            # Check folder placement: 'Personal/Social Media/Instagram Stories'
            folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Stories")
            if folder and new_story.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] New story placed in 'Personal/Social Media/Instagram Stories' folder")
            else:
                errors.append("[X] New story not in correct 'Personal/Social Media/Instagram Stories' folder")
        else:
            errors.append("[X] Design 'Tech Conference 2026 - Story Announcement' not found")

        # Check Flash Sale Story exists
        flash_story = _find_design_by_title(backend, "Flash Sale Story")
        if flash_story:
            checks_passed.append("[✓] Existing 'Flash Sale Story' found for comparison")

            # Check Flash Sale has correct dimensions
            if _check_design_dimensions(flash_story, 1080, 1920):
                checks_passed.append("[✓] Flash Sale Story has correct dimensions (1080x1920)")
            else:
                errors.append(f"[X] Flash Sale Story dimensions are {flash_story.get('width')}x{flash_story.get('height')}, expected 1080x1920")
        else:
            errors.append("[X] 'Flash Sale Story' not found for comparison")

        # Perform comparative analysis
        if new_story and flash_story:
            # Get elements for both designs
            new_elements = _get_elements_for_design(backend, new_story.get("_id"))
            flash_elements = _get_elements_for_design(backend, flash_story.get("_id"))

            # Compare element counts
            checks_passed.append(f"[✓] Element count comparison: New story ({len(new_elements)}), Flash Sale ({len(flash_elements)})")

            # Compare text element counts
            new_text = len([e for e in new_elements if e.get("type") == "text"])
            flash_text = len([e for e in flash_elements if e.get("type") == "text"])
            checks_passed.append(f"[✓] Text element comparison: New story ({new_text}), Flash Sale ({flash_text})")

            # Background color analysis
            new_shapes = [e for e in new_elements if e.get("type") == "shape"]
            flash_shapes = [e for e in flash_elements if e.get("type") == "shape"]
            checks_passed.append(f"[✓] Background/shape comparison available: New ({len(new_shapes)}), Flash ({len(flash_shapes)})")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_tech_conference_story_comparison: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q3_marketing_campaign_workspace(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q3 2026 Marketing Campaign workspace with three subfolders and designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder: 'Client Work/Marketing Campaigns/Q3 2026/Assets'
        assets_folder = _find_folder_by_path(backend, "Client Work/Marketing Campaigns/Q3 2026/Assets")

        if assets_folder:
            checks_passed.append("[✓] Folder 'Client Work/Marketing Campaigns/Q3 2026/Assets' created")
        else:
            errors.append("[X] Folder 'Client Work/Marketing Campaigns/Q3 2026/Assets' not found")

        # Check three subfolders
        subfolders = [
            ("Client Work/Marketing Campaigns/Q3 2026/Assets/Social Media", "Q3 Campaign Story", 1080, 1920, "instagram-story"),
            ("Client Work/Marketing Campaigns/Q3 2026/Assets/Print Materials", "Q3 Campaign Flyer", 2480, 3508, "flyer"),
            ("Client Work/Marketing Campaigns/Q3 2026/Assets/Digital Assets", "Q3 Digital Banner", 1600, 400, "custom"),
        ]

        for folder_path, design_title, width, height, expected_format in subfolders:
            folder = _find_folder_by_path(backend, folder_path)
            folder_id = folder.get("_id") if folder else None
            folder_name = folder_path.split("/")[-1]

            if folder:
                checks_passed.append(f"[✓] Subfolder '{folder_name}' exists")
            else:
                errors.append(f"[X] Subfolder '{folder_name}' not found")

            # Check design with EXACT title
            design = _find_design_by_exact_title(backend, design_title)
            if not design:
                design = _find_design_by_title(backend, design_title)

            if design:
                checks_passed.append(f"[✓] Design '{design_title}' created")

                # Check exact dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{design_title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{design_title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{design_title}' has correct format ({expected_format})")

                # Check in correct subfolder
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{design_title}' is in '{folder_name}' subfolder")
                elif folder_id:
                    errors.append(f"[X] '{design_title}' not in correct '{folder_name}' subfolder")
            else:
                errors.append(f"[X] Design '{design_title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q3_marketing_campaign_workspace: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_youtube_series_podcast_archive(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate YouTube episode series and Podcast archive organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check YouTube folder: 'Personal/Video/YouTube Series/Season 1'
        youtube_folder = _find_folder_by_path(backend, "Personal/Video/YouTube Series/Season 1")
        youtube_folder_id = youtube_folder.get("_id") if youtube_folder else None

        if youtube_folder:
            checks_passed.append("[✓] Folder 'Personal/Video/YouTube Series/Season 1' created")
        else:
            errors.append("[X] Folder 'Personal/Video/YouTube Series/Season 1' not found")

        # Check three YouTube thumbnails with EXACT titles
        youtube_thumbnails = [
            "Episode 101 - Getting Started",
            "Episode 102 - Advanced Tips",
            "Episode 103 - Expert Strategies",
        ]

        for title in youtube_thumbnails:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] YouTube thumbnail '{title}' created")

                # Check exact dimensions 1280x720
                if _check_design_dimensions(design, 1280, 720):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions (1280x720)")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected 1280x720")

                # Check in YouTube folder
                if youtube_folder_id and design.get("folderId") == youtube_folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Season 1 folder")
                elif youtube_folder_id:
                    errors.append(f"[X] '{title}' not in Season 1 folder")
            else:
                errors.append(f"[X] YouTube thumbnail '{title}' not found")

        # Check Podcast Archive folder: 'Personal/Video/Podcast Archive'
        podcast_folder = _find_folder_by_path(backend, "Personal/Video/Podcast Archive")
        podcast_folder_id = podcast_folder.get("_id") if podcast_folder else None

        if podcast_folder:
            checks_passed.append("[✓] Folder 'Personal/Video/Podcast Archive' created")

            # Check podcast designs moved to archive
            designs_in_archive = _get_designs_in_folder(backend, podcast_folder_id)
            podcast_designs = [d for d in designs_in_archive if "podcast" in d.get("title", "").lower()]

            if len(podcast_designs) >= 1:
                checks_passed.append(f"[✓] Podcast designs moved to archive ({len(podcast_designs)} found)")
            else:
                errors.append("[X] No Podcast designs found in Podcast Archive folder")
        else:
            errors.append("[X] Folder 'Personal/Video/Podcast Archive' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_youtube_series_podcast_archive: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_winter_collection_social_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Winter Collection 2026 social media campaign with exact titles.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check target folder: 'Personal > Social Media > Instagram Posts' (ID: 10000000-0000-4000-8000-000000000003)
        # Try to find by path first
        folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Posts")
        folder_id = folder.get("_id") if folder else "10000000-0000-4000-8000-000000000003"

        if folder:
            checks_passed.append("[✓] Target folder 'Personal/Social Media/Instagram Posts' found")
        else:
            # Try direct ID lookup
            result = backend.query({"collection": "folders", "filter": {"_id": "10000000-0000-4000-8000-000000000003"}})
            if result:
                checks_passed.append("[✓] Target folder found by ID (10000000-0000-4000-8000-000000000003)")

        # Check three designs with EXACT titles
        designs_to_check = [
            ("Winter Collection - Instagram", 1080, 1080, "instagram-post"),
            ("Winter Collection - Story", 1080, 1920, "instagram-story"),
            ("Winter Collection - Facebook", 1200, 630, "facebook-post"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found (exact title match)")

                # Check exact dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                # Check folder placement
                if design.get("folderId") == folder_id or (folder and design.get("folderId") == folder.get("_id")):
                    checks_passed.append(f"[✓] '{title}' is in Instagram Posts folder")
                else:
                    errors.append(f"[X] '{title}' not in correct folder")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_winter_collection_social_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_ai_podcast_branding_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate AI Podcast branding suite with text content verification.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Media Projects/AI Podcast/Assets'
        folder = _find_folder_by_path(backend, "Media Projects/AI Podcast/Assets")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Media Projects/AI Podcast/Assets' created")
        else:
            errors.append("[X] Folder 'Media Projects/AI Podcast/Assets' not found")

        # Check three designs with EXACT titles
        designs_to_check = [
            ("AI Podcast Series - Episode 1", 1280, 720, "youtube-thumbnail"),
            ("AI Podcast - Story Promo", 1080, 1920, "instagram-story"),
            ("AI Podcast - Host Banner", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found (exact title match)")

                # Check exact dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format")

                # Check in Assets folder
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Assets folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Assets folder")

                # Check text content extraction for podcast branding
                elements = _get_elements_for_design(backend, design.get("_id"))
                text_elements = [e for e in elements if e.get("type") == "text"]
                if len(text_elements) > 0:
                    # Look for podcast-related text
                    has_podcast_text = False
                    for text_elem in text_elements:
                        if _check_element_has_content(text_elem, "podcast") or _check_element_has_content(text_elem, "AI"):
                            has_podcast_text = True
                            break

                    if has_podcast_text:
                        checks_passed.append(f"[✓] '{title}' contains podcast branding text")
                    else:
                        checks_passed.append(f"[✓] '{title}' text content extracted ({len(text_elements)} elements)")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_ai_podcast_branding_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_post_youtube_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post resized to YouTube thumbnail (1280x720).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Welcome Instagram Post' found")

        # Check exact dimensions 1280x720
        if _check_design_dimensions(design, 1280, 720):
            checks_passed.append("[✓] Design resized to exactly 1280x720 (YouTube thumbnail)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 1280x720")

        # Check format changed to 'custom'
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Format changed to 'custom' after resize")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Get elements for analysis
        elements = _get_elements_for_design(backend, design.get("_id"))
        element_counts = _count_elements_by_type(elements)

        # Document element counts by type
        checks_passed.append(f"[✓] Element analysis complete: {len(elements)} total elements")

        for elem_type, count in element_counts.items():
            checks_passed.append(f"[✓] {elem_type}: {count}")

        # Document unique font families
        text_elements = [e for e in elements if e.get("type") == "text"]
        font_families = set()
        for text_elem in text_elements:
            properties = text_elem.get("properties", {})
            font = properties.get("fontFamily", "unknown")
            font_families.add(font)

        if len(font_families) > 0:
            checks_passed.append(f"[✓] Font families documented: {', '.join(font_families)}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_post_youtube_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_brand_asset_management(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive brand asset management system.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Brand Assets/2026 Rebrand/Core Elements'
        folder = _find_folder_by_path(backend, "Brand Assets/2026 Rebrand/Core Elements")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/2026 Rebrand/Core Elements' created")
        else:
            errors.append("[X] Folder 'Brand Assets/2026 Rebrand/Core Elements' not found")

        # Check three brand assets with EXACT titles and dimensions
        designs_to_check = [
            ("Brand Logo Primary", 500, 500, "logo"),
            ("Executive Business Card", 1050, 600, "business-card"),
            ("Company LinkedIn Header", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found (exact title match)")

                # Check exact dimensions
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                # Check format
                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                # Check in Core Elements folder
                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Core Elements folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Core Elements folder")
            else:
                errors.append(f"[X] Design '{title}' not found (exact title required)")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_asset_management: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_content_migration(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference designs content migration to archive folder.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Events/Conference Archive/Content Backup'
        folder = _find_folder_by_path(backend, "Events/Conference Archive/Content Backup")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Events/Conference Archive/Content Backup' created")
        else:
            errors.append("[X] Folder 'Events/Conference Archive/Content Backup' not found")

        # Find all designs with 'Conference' in title
        conference_designs = _find_designs_by_title_pattern(backend, "Conference")

        if len(conference_designs) >= 1:
            checks_passed.append(f"[✓] Conference designs found ({len(conference_designs)} total)")
        else:
            errors.append("[X] No designs with 'Conference' in title found")

        # Verify content extraction for each Conference design
        content_extracted = 0
        for design in conference_designs:
            design_id = design.get("_id")
            title = design.get("title", "Unknown")

            # Extract elements
            elements = _get_elements_for_design(backend, design_id)

            if len(elements) > 0:
                # Extract text content
                text_elements = [e for e in elements if e.get("type") == "text"]

                # Document font families
                font_families = set()
                for text_elem in text_elements:
                    properties = text_elem.get("properties", {})
                    font = properties.get("fontFamily", "")
                    if font:
                        font_families.add(font)

                # Document element counts
                element_counts = _count_elements_by_type(elements)

                # Document dimensions and format
                fmt = design.get("format")
                width = design.get("width")
                height = design.get("height")

                checks_passed.append(f"[✓] Content extracted for '{title}': {len(elements)} elements, {len(text_elements)} text, format: {fmt} ({width}x{height})")
                content_extracted += 1

        if content_extracted >= 1:
            checks_passed.append(f"[✓] Complete content extraction performed for {content_extracted} Conference designs")

        # Verify designs moved to Content Backup folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            conference_in_folder = [d for d in designs_in_folder if "conference" in d.get("title", "").lower()]

            if len(conference_in_folder) >= 1:
                checks_passed.append(f"[✓] Conference designs moved to Content Backup ({len(conference_in_folder)} found)")
            else:
                errors.append("[X] No Conference designs found in Content Backup folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_content_migration: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_post_element_validation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate element-level composition of Welcome Instagram Post.
    Must have 4+ element types, 8+ total elements, 3+ text with varied fonts, 2+ shapes with different colors.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Welcome Instagram Post' found")

        # Get all elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        element_counts = _count_elements_by_type(elements)

        # Check at least 4 different element types
        element_types = list(element_counts.keys())
        if len(element_types) >= 4:
            checks_passed.append(f"[✓] Design contains 4+ element types ({len(element_types)} found: {', '.join(element_types)})")
        else:
            errors.append(f"[X] Only {len(element_types)} element types found, expected at least 4")

        # Check minimum 8 total elements
        total_elements = len(elements)
        if total_elements >= 8:
            checks_passed.append(f"[✓] Design contains 8+ total elements ({total_elements} found)")
        else:
            errors.append(f"[X] Only {total_elements} total elements, expected at least 8")

        # Check at least 3 text elements with different font properties
        text_elements = [e for e in elements if e.get("type") == "text"]
        if len(text_elements) >= 3:
            checks_passed.append(f"[✓] Design contains 3+ text elements ({len(text_elements)} found)")

            # Check for varied font properties
            font_variations = set()
            for text_elem in text_elements:
                properties = text_elem.get("properties", {})
                font_family = properties.get("fontFamily", "unknown")
                font_size = properties.get("fontSize", 0)
                font_weight = properties.get("fontWeight", "normal")
                font_key = f"{font_family}-{font_size}-{font_weight}"
                font_variations.add(font_key)

            if len(font_variations) >= 3:
                checks_passed.append(f"[✓] Text elements have varied font properties ({len(font_variations)} variations)")
            else:
                checks_passed.append(f"[✓] Text elements found with {len(font_variations)} font variations")
        else:
            errors.append(f"[X] Only {len(text_elements)} text elements, expected at least 3")

        # Check at least 2 shape elements with different colors
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        if len(shape_elements) >= 2:
            checks_passed.append(f"[✓] Design contains 2+ shape elements ({len(shape_elements)} found)")

            # Check for different colors
            colors = set()
            for shape_elem in shape_elements:
                fill = shape_elem.get("fill") or shape_elem.get("properties", {}).get("fill")
                if fill:
                    colors.add(str(fill))

            if len(colors) >= 2:
                checks_passed.append(f"[✓] Shapes have different colors ({len(colors)} unique colors)")
            else:
                checks_passed.append(f"[✓] Shape colors documented ({len(colors)} unique)")
        else:
            errors.append(f"[X] Only {len(shape_elements)} shape elements, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_post_element_validation: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_post_banner_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post resized to YouTube banner (2560x1440).
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Welcome Instagram Post' found")

        # Check exact dimensions 2560x1440
        if _check_design_dimensions(design, 2560, 1440):
            checks_passed.append("[✓] Design resized to exactly 2560x1440 (YouTube banner)")
        else:
            errors.append(f"[X] Design dimensions are {design.get('width')}x{design.get('height')}, expected 2560x1440")

        # Check format changed to 'custom'
        if _check_design_format(design, "custom"):
            checks_passed.append("[✓] Format type is 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Check content extraction and text elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = [e for e in elements if e.get("type") == "text"]

        if len(text_elements) > 0:
            checks_passed.append(f"[✓] Text elements remain intact ({len(text_elements)} found)")

            # Verify text elements are positioned within canvas bounds
            out_of_bounds = 0
            for text_elem in text_elements:
                x = text_elem.get("x", 0)
                y = text_elem.get("y", 0)
                width = text_elem.get("width", 0)
                height = text_elem.get("height", 0)

                # Check if element is within 2560x1440 canvas
                if x < 0 or y < 0 or (x + width) > 2560 or (y + height) > 1440:
                    out_of_bounds += 1

            if out_of_bounds == 0:
                checks_passed.append("[✓] All text elements positioned within new canvas bounds")
            else:
                checks_passed.append(f"[✓] Text elements verified ({out_of_bounds} may extend beyond canvas)")
        else:
            errors.append("[X] No text elements found - content may not be preserved")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_post_banner_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)





# ==============================================================================
# Reward Functions for Canva MCP V3 Tasks (Third Batch)
# ==============================================================================
def _validate_archive_story_flash_sale_org(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Story and Flash Sale designs organized into separate folder hierarchies.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check first folder: 'Archive/2026/Instagram Stories/Backup'
        story_folder = _find_folder_by_path(backend, "Archive/2026/Instagram Stories/Backup")
        story_folder_id = story_folder.get("_id") if story_folder else None

        if story_folder:
            checks_passed.append("[✓] Folder 'Archive/2026/Instagram Stories/Backup' created")
        else:
            errors.append("[X] Folder 'Archive/2026/Instagram Stories/Backup' not found")

        # Check second folder: 'Marketing/Promotions/Flash Sales'
        flash_folder = _find_folder_by_path(backend, "Marketing/Promotions/Flash Sales")
        flash_folder_id = flash_folder.get("_id") if flash_folder else None

        if flash_folder:
            checks_passed.append("[✓] Folder 'Marketing/Promotions/Flash Sales' created")
        else:
            errors.append("[X] Folder 'Marketing/Promotions/Flash Sales' not found")

        # Check Story designs moved to Backup folder
        total_moved = 0
        if story_folder_id:
            designs_in_story = _get_designs_in_folder(backend, story_folder_id)
            story_designs = [d for d in designs_in_story if "story" in d.get("title", "").lower()]
            if len(story_designs) >= 1:
                checks_passed.append(f"[✓] Designs with 'Story' in title moved to Backup ({len(story_designs)} found)")
                total_moved += len(story_designs)
            else:
                errors.append("[X] No Story designs found in Backup folder")

        # Check Flash Sale designs moved to Flash Sales folder
        if flash_folder_id:
            designs_in_flash = _get_designs_in_folder(backend, flash_folder_id)
            flash_designs = [d for d in designs_in_flash if "flash sale" in d.get("title", "").lower()]
            if len(flash_designs) >= 1:
                checks_passed.append(f"[✓] Designs with 'Flash Sale' in title moved to Flash Sales ({len(flash_designs)} found)")
                total_moved += len(flash_designs)
            else:
                errors.append("[X] No Flash Sale designs found in Flash Sales folder")

        # Verify at least 3 total designs moved
        if total_moved >= 3:
            checks_passed.append(f"[✓] At least 3 designs total moved across both folders ({total_moved} total)")
        else:
            errors.append(f"[X] Only {total_moved} designs moved, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_archive_story_flash_sale_org: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_campaign_reorganize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome designs moved to Client Work folder with exactly 3 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Client Work/Welcome Campaign/Social Assets'
        folder = _find_folder_by_path(backend, "Client Work/Welcome Campaign/Social Assets")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Client Work/Welcome Campaign/Social Assets' created")
        else:
            errors.append("[X] Folder 'Client Work/Welcome Campaign/Social Assets' not found")

        # Check exactly 3 Welcome designs moved
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            welcome_designs = [d for d in designs_in_folder if "welcome" in d.get("title", "").lower()]

            if len(welcome_designs) == 3:
                checks_passed.append("[✓] Exactly 3 designs with 'Welcome' in title moved to folder")
            elif len(welcome_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Welcome designs in folder ({len(welcome_designs)} found)")
            else:
                errors.append(f"[X] Only {len(welcome_designs)} Welcome designs in folder, expected exactly 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_campaign_reorganize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_quantum_dynamics_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Quantum Dynamics brand identity with 3 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Brand Assets/Quantum Dynamics'
        folder = _find_folder_by_path(backend, "Brand Assets/Quantum Dynamics")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/Quantum Dynamics' created")
        else:
            errors.append("[X] Folder 'Brand Assets/Quantum Dynamics' not found")

        # Check three designs with exact titles and dimensions
        designs_to_check = [
            ("Quantum Logo Primary", 500, 500, "logo"),
            ("Quantum Business Card - CEO", 1050, 600, "business-card"),
            ("Quantum LinkedIn Banner", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Quantum Dynamics folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Quantum Dynamics folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_quantum_dynamics_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_nexus_technologies_identity_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Nexus Technologies brand suite with 4 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Brand Assets/Nexus Technologies/Identity Suite'
        folder = _find_folder_by_path(backend, "Brand Assets/Nexus Technologies/Identity Suite")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/Nexus Technologies/Identity Suite' created")
        else:
            errors.append("[X] Folder 'Brand Assets/Nexus Technologies/Identity Suite' not found")

        # Check four designs with exact titles and dimensions
        designs_to_check = [
            ("Nexus Logo Concept", 500, 500, "logo"),
            ("Nexus Business Card", 1050, 600, "business-card"),
            ("Nexus Letterhead", 2480, 3508, "a4-document"),
            ("Nexus Website Banner", 1920, 600, "custom"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Identity Suite folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Identity Suite folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_nexus_technologies_identity_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_design_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive analysis of Conference designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find all designs with 'Conference' in title
        conference_designs = _find_designs_by_title_pattern(backend, "Conference")

        if len(conference_designs) >= 1:
            checks_passed.append(f"[✓] Conference designs found ({len(conference_designs)} total)")
        else:
            errors.append("[X] No designs with 'Conference' in title found")
            return _make_task_score(errors, checks_passed)

        # Analyze each design
        for design in conference_designs:
            title = design.get("title", "Unknown")
            design_id = design.get("_id")

            # Check format and dimensions
            fmt = design.get("format")
            width = design.get("width")
            height = design.get("height")
            checks_passed.append(f"[✓] '{title}': format {fmt}, dimensions {width}x{height}")

            # Get elements
            elements = _get_elements_for_design(backend, design_id)
            element_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[✓] '{title}': element counts {element_counts}")

            # Extract text content
            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] '{title}': {len(text_elements)} text elements extracted")

            # Extract colors from shapes
            shape_elements = [e for e in elements if e.get("type") == "shape"]
            colors = set()
            for shape in shape_elements:
                fill = shape.get("fill") or shape.get("properties", {}).get("fill")
                if fill:
                    colors.add(str(fill))
            if len(colors) > 0:
                checks_passed.append(f"[✓] '{title}': {len(colors)} colors in palette")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_design_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_social_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Flash Sale social campaign with 3 platform-specific designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Marketing Campaigns/Flash Sales/Social Assets'
        folder = _find_folder_by_path(backend, "Marketing Campaigns/Flash Sales/Social Assets")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Marketing Campaigns/Flash Sales/Social Assets' created")
        else:
            errors.append("[X] Folder 'Marketing Campaigns/Flash Sales/Social Assets' not found")

        # Check three designs with exact titles
        designs_to_check = [
            ("Flash Sale - Instagram Promo", 1080, 1080, "instagram-post"),
            ("Flash Sale - Twitter Header", 1500, 500, "twitter-header"),
            ("Flash Sale - Facebook Promo", 1200, 630, "facebook-post"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Social Assets folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Social Assets folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_social_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_dataviz_workshop_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate DataViz Workshop suite with 3 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_to_check = [
            ("DataViz Workshop - Main Presentation", 1920, 1080, "presentation"),
            ("DataViz Workshop - Event Poster", 1080, 1920, "poster"),
            ("DataViz Workshop - Speaker Card", 1050, 600, "business-card"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_dataviz_workshop_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_tech_summit_event_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Tech Summit 2026 event package with 5 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder: 'Personal/Print/Event Promotion'
        folder = _find_folder_by_path(backend, "Personal/Print/Event Promotion")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Print/Event Promotion' created")
        else:
            errors.append("[X] Folder 'Personal/Print/Event Promotion' not found")

        designs_to_check = [
            ("Tech Summit 2026 Poster", 1080, 1920, "poster"),
            ("Tech Summit Story", 1080, 1920, "instagram-story"),
            ("Tech Summit Facebook", 1200, 630, "facebook-post"),
            ("Tech Summit Header", 1500, 500, "twitter-header"),
            ("Tech Summit Flyer", 2480, 3508, "flyer"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions are {design.get('width')}x{design.get('height')}, expected {width}x{height}")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' is in Event Promotion folder")
                elif folder_id:
                    errors.append(f"[X] '{title}' not in Event Promotion folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_tech_summit_event_package: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_phoenix_studios_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Phoenix Studios brand identity with 4 designs in subfolders.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder and subfolders
        main_folder = _find_folder_by_path(backend, "Client Work/Phoenix Studios/Brand Identity")
        if main_folder:
            checks_passed.append("[✓] Main folder 'Client Work/Phoenix Studios/Brand Identity' created")
        else:
            errors.append("[X] Main folder not found")

        logo_folder = _find_folder_by_path(backend, "Client Work/Phoenix Studios/Brand Identity/Logo Files")
        biz_folder = _find_folder_by_path(backend, "Client Work/Phoenix Studios/Brand Identity/Business Materials")
        social_folder = _find_folder_by_path(backend, "Client Work/Phoenix Studios/Brand Identity/Social Assets")

        if logo_folder:
            checks_passed.append("[✓] Subfolder 'Logo Files' created")
        if biz_folder:
            checks_passed.append("[✓] Subfolder 'Business Materials' created")
        if social_folder:
            checks_passed.append("[✓] Subfolder 'Social Assets' created")

        # Check designs with subfolder placement
        designs_to_check = [
            ("Phoenix Studios - Primary Logo", 500, 500, "logo", logo_folder),
            ("Phoenix Studios - Business Card", 1050, 600, "business-card", biz_folder),
            ("Phoenix Studios - Brand Announcement", 1080, 1080, "instagram-post", social_folder),
            ("Phoenix Studios - Company Banner", 1584, 396, "linkedin-banner", social_folder),
        ]

        for title, width, height, expected_format, expected_folder in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions incorrect")

                if expected_folder and design.get("folderId") == expected_folder.get("_id"):
                    checks_passed.append(f"[✓] '{title}' in correct subfolder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_phoenix_studios_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_fitness_challenge_q2_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Fitness Challenge Q2 campaign with 3 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Q2 2026/Fitness Campaign")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Brand Assets/Q2 2026/Fitness Campaign' created")
        else:
            errors.append("[X] Folder not found")

        designs_to_check = [
            ("Fitness Challenge - Instagram", 1080, 1080, "instagram-post"),
            ("Fitness Challenge - Twitter", 1500, 500, "twitter-header"),
            ("Fitness Challenge - LinkedIn", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions incorrect")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' in Fitness Campaign folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_fitness_challenge_q2_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q1_2026_archive_reorganize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q1 2026 Archive with categorized subfolders and summary presentation.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder and subfolders
        main_folder = _find_folder_by_path(backend, "Q1 2026 Archive")
        if main_folder:
            checks_passed.append("[✓] Main folder 'Q1 2026 Archive' created")
        else:
            errors.append("[X] Main folder 'Q1 2026 Archive' not found")

        social_folder = _find_folder_by_path(backend, "Q1 2026 Archive/Social Media")
        pres_folder = _find_folder_by_path(backend, "Q1 2026 Archive/Presentations")
        print_folder = _find_folder_by_path(backend, "Q1 2026 Archive/Print Materials")

        if social_folder:
            checks_passed.append("[✓] Subfolder 'Social Media' created")
        if pres_folder:
            checks_passed.append("[✓] Subfolder 'Presentations' created")
        if print_folder:
            checks_passed.append("[✓] Subfolder 'Print Materials' created")

        # Check Q1 designs moved to appropriate subfolders
        q1_designs = _find_designs_by_title_pattern(backend, "Q1")
        if len(q1_designs) >= 2:
            checks_passed.append(f"[✓] At least 2 designs with 'Q1' in title found ({len(q1_designs)} total)")
        else:
            errors.append(f"[X] Only {len(q1_designs)} Q1 designs found, expected at least 2")

        # Check summary presentation
        summary = _find_design_by_exact_title(backend, "Q1 2026 Archive Summary")
        if not summary:
            summary = _find_design_by_title(backend, "Q1 2026 Archive Summary")

        if summary:
            checks_passed.append("[✓] 'Q1 2026 Archive Summary' presentation created")
            if _check_design_dimensions(summary, 1920, 1080):
                checks_passed.append("[✓] Summary has presentation dimensions (1920x1080)")
            else:
                errors.append("[X] Summary dimensions incorrect")

            if main_folder and summary.get("folderId") == main_folder.get("_id"):
                checks_passed.append("[✓] Summary in main archive folder")
        else:
            errors.append("[X] 'Q1 2026 Archive Summary' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q1_2026_archive_reorganize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q1_newsletter_series(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q1 Newsletter series with 3 multi-format designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Communications/2026/Q1 Newsletter")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Communications/2026/Q1 Newsletter' created")
        else:
            errors.append("[X] Folder not found")

        designs_to_check = [
            ("Q1 Newsletter - A4 Print", 2480, 3508, "a4-document"),
            ("Q1 Newsletter - Email Header", 600, 200, "custom"),
            ("Q1 Newsletter - Social Teaser", 1080, 1080, "instagram-post"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions incorrect")

                if _check_design_format_flexible(design, expected_format):
                    checks_passed.append(f"[✓] '{title}' has correct format ({expected_format})")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' in Q1 Newsletter folder")

                # Check for text elements
                elements = _get_elements_for_design(backend, design.get("_id"))
                text_elements = [e for e in elements if e.get("type") == "text"]
                if len(text_elements) > 0:
                    checks_passed.append(f"[✓] '{title}' contains text elements")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q1_newsletter_series: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_studio_archive(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight Studio archive with project summary document.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check full folder hierarchy exists (including 2026 subfolder)
        folder_2026 = _find_folder_by_path(backend, "Client Work/Starlight Studio/Archive/2026")
        if folder_2026:
            checks_passed.append("[✓] Folder 'Client Work/Starlight Studio/Archive/2026' created")
        else:
            errors.append("[X] Folder hierarchy not found")

        # Check Archive folder for designs (task says "move to Archive folder", not 2026)
        archive_folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/Archive")
        archive_folder_id = archive_folder.get("_id") if archive_folder else None

        # Check Starlight designs moved to archive (can be in Archive or 2026 subfolder)
        starlight_designs_found = 0
        if archive_folder_id:
            designs_in_archive = _get_designs_in_folder(backend, archive_folder_id)
            starlight_designs_found += len([d for d in designs_in_archive if "starlight" in d.get("title", "").lower()])

        # Also check 2026 folder in case agent moved there
        if folder_2026:
            folder_2026_id = folder_2026.get("_id")
            if folder_2026_id:
                designs_in_2026 = _get_designs_in_folder(backend, folder_2026_id)
                starlight_designs_found += len([d for d in designs_in_2026 if "starlight" in d.get("title", "").lower()])

        if starlight_designs_found >= 1:
            checks_passed.append(f"[✓] Starlight designs moved to Archive ({starlight_designs_found} found)")
        else:
            errors.append("[X] No Starlight designs in Archive folder")

        # Check project summary document
        summary = _find_design_by_exact_title(backend, "Starlight Studio - Project Summary 2026")
        if not summary:
            summary = _find_design_by_title(backend, "Starlight Studio - Project Summary 2026")

        if summary:
            checks_passed.append("[✓] 'Starlight Studio - Project Summary 2026' created")
            if _check_design_dimensions(summary, 2480, 3508):
                checks_passed.append("[✓] Summary has A4 dimensions (2480x3508)")
            else:
                errors.append("[X] Summary dimensions incorrect")

            # Summary can be in either Archive or 2026 folder
            summary_folder_id = summary.get("folderId")
            folder_2026_id = folder_2026.get("_id") if folder_2026 else None
            if summary_folder_id and (summary_folder_id == archive_folder_id or summary_folder_id == folder_2026_id):
                checks_passed.append("[✓] Summary in Archive folder")
        else:
            errors.append("[X] Project summary document not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_studio_archive: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_client_portfolio_organize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate client portfolio organization with Acme and Starlight separation.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Acme folder
        acme_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q1 2026/Social")
        if acme_folder:
            checks_passed.append("[✓] Folder 'Client Work/Acme Corp/Q1 2026/Social' exists")
            designs_in_acme = _get_designs_in_folder(backend, acme_folder.get("_id"))
            acme_designs = [d for d in designs_in_acme if "acme" in d.get("title", "").lower()]
            if len(acme_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Acme designs in folder ({len(acme_designs)} found)")
            else:
                errors.append(f"[X] Only {len(acme_designs)} Acme designs, expected minimum 3")
        else:
            errors.append("[X] Acme folder not found")

        # Check Starlight folder
        starlight_folder = _find_folder_by_path(backend, "Client Work/Starlight Studio")
        if starlight_folder:
            checks_passed.append("[✓] Folder 'Client Work/Starlight Studio' exists")
        else:
            errors.append("[X] Starlight folder not found")

        # Check new YouTube thumbnail
        thumbnail = _find_design_by_exact_title(backend, "Client Portfolio Showcase")
        if not thumbnail:
            thumbnail = _find_design_by_title(backend, "Client Portfolio Showcase")

        if thumbnail:
            checks_passed.append("[✓] 'Client Portfolio Showcase' created")
            if _check_design_dimensions(thumbnail, 1280, 720):
                checks_passed.append("[✓] Thumbnail has correct dimensions (1280x720)")
            if _check_design_format_flexible(thumbnail, "youtube-thumbnail"):
                checks_passed.append("[✓] Thumbnail has youtube-thumbnail format")

            yt_folder = _find_folder_by_path(backend, "Personal/Video/YouTube Thumbnails")
            if yt_folder and thumbnail.get("folderId") == yt_folder.get("_id"):
                checks_passed.append("[✓] Thumbnail in YouTube Thumbnails folder")
        else:
            errors.append("[X] 'Client Portfolio Showcase' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_client_portfolio_organize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstart_project_setup(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStart project folder setup with Story designs moved.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/TechStart Inc/Q1 2026/Marketing/Digital Assets")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Complete folder path 'Client Work/TechStart Inc/Q1 2026/Marketing/Digital Assets' exists")
        else:
            errors.append("[X] Folder hierarchy not found")

        # Check Story designs moved
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            story_designs = [d for d in designs_in_folder if "story" in d.get("title", "").lower()]
            if len(story_designs) >= 2:
                checks_passed.append(f"[✓] At least 2 Story designs moved ({len(story_designs)} found)")
            else:
                errors.append(f"[X] Only {len(story_designs)} Story designs, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_project_setup: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_reorganize_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference designs reorganization and header resize.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Events/Tech Conferences")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Events/Tech Conferences' created")
        else:
            errors.append("[X] Tech Conferences folder not found")

        # Check Conference designs moved
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            conf_designs = [d for d in designs_in_folder if "conference" in d.get("title", "").lower()]
            if len(conf_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Conference designs moved ({len(conf_designs)} found)")
            else:
                errors.append(f"[X] Only {len(conf_designs)} Conference designs, expected at least 3")

        # Check Tech Conference Header resized
        header = _find_design_by_title(backend, "Tech Conference Header")
        if header:
            checks_passed.append("[✓] 'Tech Conference Header' found")
            if _check_design_dimensions(header, 1280, 720):
                checks_passed.append("[✓] Header resized to 1280x720")
            else:
                errors.append(f"[X] Header dimensions are {header.get('width')}x{header.get('height')}, expected 1280x720")

            if _check_design_format(header, "custom"):
                checks_passed.append("[✓] Header format is 'custom'")
            else:
                errors.append(f"[X] Header format is '{header.get('format')}', expected 'custom'")
        else:
            errors.append("[X] 'Tech Conference Header' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_reorganize_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_kit_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome kit audit with inventory document.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        templates_folder = _find_folder_by_path(backend, "Personal/Welcome Kit/Templates")
        kit_folder = _find_folder_by_path(backend, "Personal/Welcome Kit")

        if templates_folder:
            checks_passed.append("[✓] Folder 'Personal/Welcome Kit/Templates' created")
        else:
            errors.append("[X] Templates folder not found")

        # Check Welcome designs moved
        if templates_folder:
            folder_id = templates_folder.get("_id")
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            welcome_designs = [d for d in designs_in_folder if "welcome" in d.get("title", "").lower()]
            if len(welcome_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Welcome designs moved ({len(welcome_designs)} found)")
            else:
                errors.append(f"[X] Only {len(welcome_designs)} Welcome designs, expected at least 3")

        # Check inventory document
        inventory = _find_design_by_exact_title(backend, "Welcome Design Inventory")
        if not inventory:
            inventory = _find_design_by_title(backend, "Welcome Design Inventory")

        if inventory:
            checks_passed.append("[✓] 'Welcome Design Inventory' created")
            if _check_design_dimensions(inventory, 2480, 3508):
                checks_passed.append("[✓] Inventory has A4 dimensions (2480x3508)")
            else:
                errors.append("[X] Inventory dimensions incorrect")

            if kit_folder and inventory.get("folderId") == kit_folder.get("_id"):
                checks_passed.append("[✓] Inventory in Welcome Kit folder")
        else:
            errors.append("[X] 'Welcome Design Inventory' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_kit_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_brand_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight brand consistency audit.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find specific Starlight designs
        expected_designs = [
            "Welcome Instagram Post (Starlight)",
            "Flash Sale Story (Starlight)",
            "Community Event Promo (Starlight)",
        ]

        for title in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] '{title}' found for audit")

                # Get elements for analysis
                elements = _get_elements_for_design(backend, design.get("_id"))

                # Typography analysis
                text_elements = [e for e in elements if e.get("type") == "text"]
                if len(text_elements) > 0:
                    checks_passed.append(f"[✓] '{title}': typography analysis ({len(text_elements)} text elements)")

                # Element counts
                element_counts = _count_elements_by_type(elements)
                checks_passed.append(f"[✓] '{title}': element counts {element_counts}")

                # Background color
                shape_elements = [e for e in elements if e.get("type") == "shape"]
                if len(shape_elements) > 0:
                    checks_passed.append(f"[✓] '{title}': background/colors analyzed")

                # Dimension verification
                fmt = design.get("format")
                width = design.get("width")
                height = design.get("height")
                checks_passed.append(f"[✓] '{title}': dimensions {width}x{height}, format {fmt}")
            else:
                errors.append(f"[X] '{title}' not found for audit")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_brand_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_summer_product_launch_insta(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Summer Product Launch Instagram post.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Summer Product Launch 2026")
        if not design:
            design = _find_design_by_title(backend, "Summer Product Launch 2026")

        if design:
            checks_passed.append("[✓] Design 'Summer Product Launch 2026' found")

            if _check_design_dimensions(design, 1080, 1080):
                checks_passed.append("[✓] Design has correct dimensions (1080x1080)")
            else:
                errors.append(f"[X] Dimensions are {design.get('width')}x{design.get('height')}, expected 1080x1080")

            if _check_design_format_flexible(design, "instagram-post"):
                checks_passed.append("[✓] Design has instagram-post format")
            else:
                errors.append(f"[X] Format is '{design.get('format')}', expected 'instagram-post'")

            folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Posts")
            if folder and design.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Design in 'Personal/Social Media/Instagram Posts' folder")
            else:
                errors.append("[X] Design not in correct folder")
        else:
            errors.append("[X] Design 'Summer Product Launch 2026' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_summer_product_launch_insta: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_folder_org(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Flash Sale folder organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Marketing/Promotions/Flash Sales")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Marketing/Promotions/Flash Sales' exists")
        else:
            errors.append("[X] Folder not found")

        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            flash_designs = [d for d in designs_in_folder if "flash sale" in d.get("title", "").lower()]
            if len(flash_designs) >= 3:
                checks_passed.append(f"[✓] At least 3 Flash Sale designs in folder ({len(flash_designs)} found)")
            else:
                errors.append(f"[X] Only {len(flash_designs)} Flash Sale designs, expected minimum 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_folder_org: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_podcast_thumbnail_resize_fb(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Podcast Episode 12 Thumbnail resized to Facebook format.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Podcast Episode 12 Thumbnail")
        if design:
            checks_passed.append("[✓] Design 'Podcast Episode 12 Thumbnail' found")

            if _check_design_dimensions(design, 1200, 630):
                checks_passed.append("[✓] Design resized to 1200x630 (Facebook post)")
            else:
                errors.append(f"[X] Dimensions are {design.get('width')}x{design.get('height')}, expected 1200x630")

            if _check_design_format(design, "custom"):
                checks_passed.append("[✓] Format changed to 'custom'")
            else:
                errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")
        else:
            errors.append("[X] Design 'Podcast Episode 12 Thumbnail' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_podcast_thumbnail_resize_fb: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_global_corp_project_org(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Global Corp complex project organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder and platform subfolders
        main_folder = _find_folder_by_path(backend, "Client Work/Global Corp/2026/Q1/Social Media/Platform Specific")
        if main_folder:
            checks_passed.append("[✓] Main folder hierarchy exists")

        platforms = ["Instagram", "Facebook", "LinkedIn", "YouTube"]
        for platform in platforms:
            platform_folder = _find_folder_by_path(backend, f"Client Work/Global Corp/2026/Q1/Social Media/Platform Specific/{platform}")
            if platform_folder:
                checks_passed.append(f"[✓] '{platform}' subfolder exists")
            else:
                errors.append(f"[X] '{platform}' subfolder not found")

        # Check Q1 folder and inventory document
        q1_folder = _find_folder_by_path(backend, "Client Work/Global Corp/2026/Q1")
        inventory = _find_design_by_exact_title(backend, "Global Corp Asset Inventory")
        if not inventory:
            inventory = _find_design_by_title(backend, "Global Corp Asset Inventory")

        if inventory:
            checks_passed.append("[✓] 'Global Corp Asset Inventory' created")
            if _check_design_dimensions(inventory, 2480, 3508):
                checks_passed.append("[✓] Inventory has A4 dimensions")
            if q1_folder and inventory.get("folderId") == q1_folder.get("_id"):
                checks_passed.append("[✓] Inventory in Q1 folder")
        else:
            errors.append("[X] 'Global Corp Asset Inventory' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_global_corp_project_org: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_insta_resize_fb(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post resized to Facebook format.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if design:
            checks_passed.append("[✓] Design 'Welcome Instagram Post' found")

            if _check_design_dimensions(design, 1200, 630):
                checks_passed.append("[✓] Design resized to 1200x630")
            else:
                errors.append(f"[X] Dimensions are {design.get('width')}x{design.get('height')}, expected 1200x630")

            if _check_design_format(design, "custom"):
                checks_passed.append("[✓] Format is 'custom'")
            else:
                errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

            # Check elements preserved
            elements = _get_elements_for_design(backend, design.get("_id"))
            if len(elements) > 0:
                checks_passed.append(f"[✓] Elements preserved ({len(elements)} elements)")
        else:
            errors.append("[X] Design 'Welcome Instagram Post' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_insta_resize_fb: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_winter_2026_collection_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Winter 2026 Collection suite with 5 designs.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Winter 2026 Campaign")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Winter 2026 Campaign' exists")
        else:
            errors.append("[X] Folder not found")

        designs_to_check = [
            ("Winter Collection - Story", 1080, 1920, "instagram-story"),
            ("Winter Collection - Post", 1080, 1080, "instagram-post"),
            ("Winter Collection - Header", 1500, 500, "twitter-header"),
            ("Winter Collection - Poster", 1080, 1920, "poster"),
            ("Winter Collection - Flyer", 2480, 3508, "flyer"),
        ]

        for title, width, height, expected_format in designs_to_check:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                design = _find_design_by_title(backend, title)

            if design:
                checks_passed.append(f"[✓] Design '{title}' found")

                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has exact dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' dimensions incorrect")

                if folder_id and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' in Winter 2026 Campaign folder")
            else:
                errors.append(f"[X] Design '{title}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_winter_2026_collection_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_youtube_tutorial_thumbnail(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate YouTube tutorial thumbnail with content analysis.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Advanced Design Techniques Tutorial")
        if not design:
            design = _find_design_by_title(backend, "Advanced Design Techniques Tutorial")

        if design:
            checks_passed.append("[✓] Design 'Advanced Design Techniques Tutorial' found")

            if _check_design_dimensions(design, 1280, 720):
                checks_passed.append("[✓] Design has correct dimensions (1280x720)")
            else:
                errors.append("[X] Dimensions incorrect")

            if _check_design_format_flexible(design, "youtube-thumbnail"):
                checks_passed.append("[✓] Design has youtube-thumbnail format")

            folder = _find_folder_by_path(backend, "Personal/Video/YouTube Thumbnails")
            if folder and design.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Design in YouTube Thumbnails folder")

            # Check for text elements
            elements = _get_elements_for_design(backend, design.get("_id"))
            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) >= 1:
                checks_passed.append("[✓] Design contains text elements for educational content")
            else:
                errors.append("[X] No text elements found")
        else:
            errors.append("[X] Design 'Advanced Design Techniques Tutorial' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_youtube_tutorial_thumbnail: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q2_strategy_presentation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 Strategy presentation with element analysis.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Q2 Strategy Overview")
        if not design:
            design = _find_design_by_title(backend, "Q2 Strategy Overview")

        if design:
            checks_passed.append("[✓] Design 'Q2 Strategy Overview' found")

            if _check_design_dimensions(design, 1920, 1080):
                checks_passed.append("[✓] Design has presentation dimensions (1920x1080)")
            else:
                errors.append("[X] Dimensions incorrect")

            if _check_design_format_flexible(design, "presentation"):
                checks_passed.append("[✓] Design has presentation format")

            # Element analysis
            elements = _get_elements_for_design(backend, design.get("_id"))
            if len(elements) >= 2:
                checks_passed.append(f"[✓] Design contains at least 2 elements ({len(elements)} found)")

            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) >= 1:
                checks_passed.append(f"[✓] Design contains text elements ({len(text_elements)} found)")

            shape_elements = [e for e in elements if e.get("type") == "shape"]
            colors = set()
            for shape in shape_elements:
                fill = shape.get("fill") or shape.get("properties", {}).get("fill")
                if fill:
                    colors.add(str(fill))
            if len(colors) > 0:
                checks_passed.append(f"[✓] Color analysis: {len(colors)} unique colors in shapes")
        else:
            errors.append("[X] Design 'Q2 Strategy Overview' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q2_strategy_presentation: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_welcome_insta_resize_custom(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Welcome Instagram Post resized to 1200x800 with text verification.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if design:
            checks_passed.append("[✓] Design 'Welcome Instagram Post' found")

            if _check_design_dimensions(design, 1200, 800):
                checks_passed.append("[✓] Design resized to 1200x800")
            else:
                errors.append(f"[X] Dimensions are {design.get('width')}x{design.get('height')}, expected 1200x800")

            if _check_design_format(design, "custom"):
                checks_passed.append("[✓] Format is 'custom'")
            else:
                errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

            # Check for Welcome text
            elements = _get_elements_for_design(backend, design.get("_id"))
            text_elements = [e for e in elements if e.get("type") == "text"]
            welcome_text_found = False
            for text_elem in text_elements:
                if _check_element_has_content(text_elem, "Welcome"):
                    welcome_text_found = True
                    break

            if welcome_text_found:
                checks_passed.append("[✓] Text element containing 'Welcome' found")
            else:
                checks_passed.append(f"[✓] {len(text_elements)} text elements extracted")
        else:
            errors.append("[X] Design 'Welcome Instagram Post' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_welcome_insta_resize_custom: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techcorp_logo_folder_setup(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechCorp logo with folder hierarchy.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/TechCorp/Q1 2026/Brand Assets/Logos")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Complete folder hierarchy 'Client Work/TechCorp/Q1 2026/Brand Assets/Logos' exists")
        else:
            errors.append("[X] Folder hierarchy not found")

        design = _find_design_by_exact_title(backend, "TechCorp Primary Logo")
        if not design:
            design = _find_design_by_title(backend, "TechCorp Primary Logo")

        if design:
            checks_passed.append("[✓] Design 'TechCorp Primary Logo' found")

            if _check_design_dimensions(design, 500, 500):
                checks_passed.append("[✓] Logo has correct dimensions (500x500)")
            else:
                errors.append("[X] Dimensions incorrect")

            if _check_design_format_flexible(design, "logo"):
                checks_passed.append("[✓] Design has logo format")

            if folder_id and design.get("folderId") == folder_id:
                checks_passed.append("[✓] Logo in correct Logos folder")
            elif folder_id:
                errors.append("[X] Logo not in Logos folder")
        else:
            errors.append("[X] Design 'TechCorp Primary Logo' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techcorp_logo_folder_setup: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_analytics_workflow(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Flash Sale analytics workflow with presentation and organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Marketing/Sales Campaigns/Flash Sales/2026")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Marketing/Sales Campaigns/Flash Sales/2026' exists")
        else:
            errors.append("[X] Folder not found")

        # Check Analytics Deck
        deck = _find_design_by_exact_title(backend, "Flash Sale Analytics Deck")
        if not deck:
            deck = _find_design_by_title(backend, "Flash Sale Analytics Deck")

        if deck:
            checks_passed.append("[✓] 'Flash Sale Analytics Deck' created")
            if _check_design_dimensions(deck, 1920, 1080):
                checks_passed.append("[✓] Deck has presentation dimensions (1920x1080)")
            if _check_design_format_flexible(deck, "presentation"):
                checks_passed.append("[✓] Deck has presentation format")

            # Text analysis
            elements = _get_elements_for_design(backend, deck.get("_id"))
            text_elements = [e for e in elements if e.get("type") == "text"]
            if len(text_elements) > 0:
                checks_passed.append(f"[✓] Text analysis: {len(text_elements)} text elements")
        else:
            errors.append("[X] 'Flash Sale Analytics Deck' not found")

        # Check at least 3 designs in folder
        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            if len(designs_in_folder) >= 3:
                checks_passed.append(f"[✓] At least 3 designs in folder ({len(designs_in_folder)} found)")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} designs, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_analytics_workflow: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_podcast_content_organize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Podcast and Episode designs organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Video/Podcasts/Thumbnails")
        folder_id = folder.get("_id") if folder else None

        if folder:
            checks_passed.append("[✓] Folder 'Personal/Video/Podcasts/Thumbnails' created")
        else:
            errors.append("[X] Folder not found")

        if folder_id:
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            # Count designs with Podcast or Episode in title
            podcast_designs = [d for d in designs_in_folder
                              if "podcast" in d.get("title", "").lower()
                              or "episode" in d.get("title", "").lower()]

            if len(podcast_designs) >= 4:
                checks_passed.append(f"[✓] At least 4 Podcast/Episode designs moved ({len(podcast_designs)} found)")
            else:
                errors.append(f"[X] Only {len(podcast_designs)} Podcast/Episode designs, expected at least 4")

            # Text extraction from one design
            if len(podcast_designs) > 0:
                first_design = podcast_designs[0]
                elements = _get_elements_for_design(backend, first_design.get("_id"))
                text_elements = [e for e in elements if e.get("type") == "text"]
                if len(text_elements) > 0:
                    checks_passed.append(f"[✓] Text content extracted from '{first_design.get('title')}'")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_podcast_content_organize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)



# ============================================================================
# REWARD FUNCTIONS
# ============================================================================
def _validate_techfusion_social_media_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 1: Create TechFusion 2026 social media campaign with 3 designs in folder hierarchy."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Instagram post
        ig_design = _find_design_by_title(backend, "TechFusion - Instagram Launch")
        if not ig_design:
            errors.append("[X] Instagram design 'TechFusion - Instagram Launch' not found")
        else:
            checks_passed.append("[✓] Instagram design found")
            if not _check_design_dimensions(ig_design, 1080, 1080):
                errors.append(f"[X] Instagram design has wrong dimensions: {ig_design.get('width')}x{ig_design.get('height')}, expected 1080x1080")
            else:
                checks_passed.append("[✓] Instagram design has correct dimensions (1080x1080)")

        # Check Facebook post
        fb_design = _find_design_by_title(backend, "TechFusion - Facebook Launch")
        if not fb_design:
            errors.append("[X] Facebook design 'TechFusion - Facebook Launch' not found")
        else:
            checks_passed.append("[✓] Facebook design found")
            if not _check_design_dimensions(fb_design, 1200, 630):
                errors.append(f"[X] Facebook design has wrong dimensions: {fb_design.get('width')}x{fb_design.get('height')}, expected 1200x630")
            else:
                checks_passed.append("[✓] Facebook design has correct dimensions (1200x630)")

        # Check LinkedIn banner
        li_design = _find_design_by_title(backend, "TechFusion - LinkedIn Launch")
        if not li_design:
            errors.append("[X] LinkedIn design 'TechFusion - LinkedIn Launch' not found")
        else:
            checks_passed.append("[✓] LinkedIn design found")
            if not _check_design_dimensions(li_design, 1584, 396):
                errors.append(f"[X] LinkedIn design has wrong dimensions: {li_design.get('width')}x{li_design.get('height')}, expected 1584x396")
            else:
                checks_passed.append("[✓] LinkedIn design has correct dimensions (1584x396)")

        # Check folder hierarchy
        target_folder = _find_folder_by_path(backend, "Personal/Social Media/TechFusion Campaign")
        if not target_folder:
            errors.append("[X] Folder hierarchy 'Personal/Social Media/TechFusion Campaign' not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = target_folder.get("_id")

            # Check designs are in folder
            for design, name in [(ig_design, "Instagram"), (fb_design, "Facebook"), (li_design, "LinkedIn")]:
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] {name} design is not in the TechFusion Campaign folder")
                elif design:
                    checks_passed.append(f"[✓] {name} design is in the correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error in _validate_techfusion_social_media_campaign: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_product_launch_social_campaign_2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 3: Create product launch social media campaign with 3 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Product Launch - Instagram Post", 1080, 1080),
            ("Product Launch - Facebook Post", 1200, 630),
            ("Product Launch - Twitter Header", 1500, 500),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions: {design.get('width')}x{design.get('height')}, expected {width}x{height}")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Posts")
        if not folder:
            errors.append("[X] Folder 'Personal/Social Media/Instagram Posts' not found")
        else:
            checks_passed.append("[✓] Target folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' is not in the target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' is in the correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error in _validate_product_launch_social_campaign_2: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_acme_brand_unified_system(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 4: Create unified design system for Acme Corp with 5 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Acme Brand - Instagram", 1080, 1080),
            ("Acme Brand - Story", 1080, 1920),
            ("Acme Brand - Facebook", 1200, 630),
            ("Acme Brand - LinkedIn", 1584, 396),
            ("Acme Brand - YouTube", 1280, 720),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q1 2026")
        if not folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q1 2026' not found")
        else:
            checks_passed.append("[✓] Target folder hierarchy exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' is not in the target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' is in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_welcome_designs_reorganization_2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 5: Reorganize Welcome designs into folder hierarchy."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder hierarchy
        base_folder = _find_folder_by_path(backend, "Archive/2026/Welcome Campaign/Platform Specific")
        if not base_folder:
            errors.append("[X] Folder hierarchy 'Archive/2026/Welcome Campaign/Platform Specific' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Base folder hierarchy exists")

        base_id = base_folder.get("_id")

        # Check subfolders
        for subfolder_name in ["Instagram", "Facebook", "Other Platforms"]:
            subfolder = _find_folder_by_name(backend, subfolder_name, base_id)
            if not subfolder:
                errors.append(f"[X] Subfolder '{subfolder_name}' not found")
            else:
                checks_passed.append(f"[✓] Subfolder '{subfolder_name}' exists")

        # Check that at least 3 Welcome designs are in the structure
        welcome_designs = _find_designs_by_title(backend, "Welcome")
        moved_count = 0

        # Get all folder IDs in the hierarchy
        folder_ids = set()
        folder_ids.add(base_id)
        for subfolder_name in ["Instagram", "Facebook", "Other Platforms"]:
            subfolder = _find_folder_by_name(backend, subfolder_name, base_id)
            if subfolder:
                folder_ids.add(subfolder.get("_id"))

        for design in welcome_designs:
            if design.get("folderId") in folder_ids:
                moved_count += 1

        if moved_count >= 3:
            checks_passed.append(f"[✓] At least 3 Welcome designs moved ({moved_count} found)")
        else:
            errors.append(f"[X] Only {moved_count} Welcome designs in target folders, need at least 3")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_starlight_brand_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 7: Create Starlight Studio brand package with 3 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Starlight Studio Logo", 500, 500, "logo"),
            ("Starlight Studio Business Card", 1050, 600, "business-card"),
            ("Starlight Studio Flyer", 2480, 3508, "flyer"),
        ]

        for title, width, height, format_type in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Client Work/Starlight Studio")
        if not folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio' not found")
        else:
            checks_passed.append("[✓] Target folder exists")
            folder_id = folder.get("_id")
            for title, _, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_social_campaign_with_folder_hierarchy(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 8: Create 3 designs and organize in folder hierarchy."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Product Launch - Instagram", 1080, 1080),
            ("Product Launch - Facebook", 1200, 630),
            ("Product Launch - LinkedIn", 1584, 396),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Campaigns/2026/Product Launch/Social Media")
        if not folder:
            errors.append("[X] Folder 'Campaigns/2026/Product Launch/Social Media' not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_quarterly_presentations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 9: Create 3 presentation designs, organize in folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            "Q1 Review Presentation",
            "Q2 Planning Presentation",
            "Annual Summary Presentation",
        ]

        for title in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, 1920, 1080):
                    errors.append(f"[X] '{title}' has wrong dimensions, expected 1920x1080")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct presentation dimensions")

        folder = _find_folder_by_path(backend, "Business/2026/Quarterly Reviews/Presentations")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_tech_conference_presentations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 10: Create conference presentation package with 3 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            "Tech Conference 2026 - Main Deck",
            "Tech Conference 2026 - Speaker Intro",
            "Tech Conference 2026 - Thank You",
        ]

        for title in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, 1920, 1080):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Events/Tech Conference 2026/Presentations")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_acme_folder_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 11: Create folder hierarchy and move Acme designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Phoenix Industries/Q2 2026/Brand Assets")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Folder hierarchy exists")

        folder_id = folder.get("_id")
        acme_designs = _find_designs_by_title(backend, "Acme")
        moved_count = sum(1 for d in acme_designs if d.get("folderId") == folder_id)

        if moved_count >= 5:
            checks_passed.append(f"[✓] At least 5 Acme designs moved ({moved_count} found)")
        else:
            errors.append(f"[X] Only {moved_count} Acme designs in folder, need at least 5")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_spring_collection_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 12: Create Spring Collection social media campaign."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Spring Collection - Instagram Launch", 1080, 1080, "instagram-post"),
            ("Spring Collection - Twitter Header", 1500, 500, "twitter-header"),
            ("Spring Collection - LinkedIn Banner", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, format_type in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Personal/Social Media")
        if folder:
            checks_passed.append("[✓] Social Media folder exists")
            folder_id = folder.get("_id")
            for title, _, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' in Social Media folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_devsummit_marketing_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 15: Create DevSummit 2026 marketing suite with 4 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("DevSummit Story", 1080, 1920),
            ("DevSummit Header", 1500, 500),
            ("DevSummit Program", 2480, 3508),
            ("DevSummit Keynote", 1280, 720),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Brand Assets/Events/DevSummit 2026")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_techcorp_presentation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 17: Create TechCorp presentation and place in folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "TechCorp Q1 Review 2026")
        if not design:
            errors.append("[X] Design 'TechCorp Q1 Review 2026' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        if _check_design_dimensions(design, 1920, 1080):
            checks_passed.append("[✓] Correct presentation dimensions")
        else:
            errors.append("[X] Wrong dimensions")

        # Check elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        if len(elements) >= 2:
            checks_passed.append(f"[✓] Design has {len(elements)} elements")
        else:
            errors.append(f"[X] Design has only {len(elements)} elements, expected at least 2")

        # Check folder - more flexible path matching
        folder = _find_folder_by_path(backend, "Personal/Docs/Presentations")
        if not folder:
            # Try alternative paths
            folder = _find_folder_by_name(backend, "Presentations")

        if folder:
            checks_passed.append("[✓] Presentations folder exists")
            if design.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Design in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_welcome_campaign_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 18: Create folder hierarchy and move Welcome designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/2026 Campaign/Digital Assets/Social Media")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Folder hierarchy exists")
        folder_id = folder.get("_id")

        welcome_designs = _find_designs_by_title(backend, "Welcome")
        moved_count = sum(1 for d in welcome_designs if d.get("folderId") == folder_id)

        if moved_count >= 3:
            checks_passed.append(f"[✓] At least 3 Welcome designs moved ({moved_count})")
        else:
            errors.append(f"[X] Only {moved_count} Welcome designs moved, need 3")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_starbright_rebrand_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 19: Create StarBright Studio rebrand package with 4 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("StarBright - Instagram Brand", 1080, 1080),
            ("StarBright - Story Template", 1080, 1920),
            ("StarBright - Facebook Brand", 1200, 630),
            ("StarBright - YouTube Template", 1280, 720),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_print_marketing_suite_2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 20: Create print marketing suite with 3 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Corporate Brochure 2026", 2480, 3508),
            ("Executive Business Card - Sarah Johnson", 1050, 600),
            ("Annual Conference Poster 2026", 1080, 1920),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Print Marketing/2026 Campaign/Collateral")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_starlight_logo_variations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 21: Create 3 Starlight logo variations."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            "Starlight Primary Logo",
            "Starlight Icon Version",
            "Starlight Wordmark",
        ]

        for title in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, 500, 500):
                    errors.append(f"[X] '{title}' has wrong dimensions, expected 500x500")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct logo dimensions")

        folder = _find_folder_by_path(backend, "Brand Assets/Starlight Studio/Logos/2026 Refresh")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_product_reveal_social_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 26: Create product reveal social media suite."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Product Reveal - Instagram", 1080, 1080),
            ("Product Reveal - Story", 1080, 1920),
            ("Product Reveal - Facebook", 1200, 630),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Product Launch/Social Suite")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_techflow_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 27: Create TechFlow Solutions brand identity package."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("TechFlow Logo", 500, 500),
            ("TechFlow Business Card", 1050, 600),
            ("TechFlow LinkedIn Banner", 1584, 396),
            ("TechFlow Letterhead", 2480, 3508),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Client Work/TechFlow Solutions/Brand Identity")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_executive_summary_presentation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 28: Create Executive Summary presentation."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Executive Summary 2026")
        if not design:
            errors.append("[X] Design 'Executive Summary 2026' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        if _check_design_dimensions(design, 1920, 1080):
            checks_passed.append("[✓] Correct presentation dimensions")
        else:
            errors.append("[X] Wrong dimensions")

        folder = _find_folder_by_path(backend, "Personal/Docs/Presentations")
        if folder and design.get("folderId") == folder.get("_id"):
            checks_passed.append("[✓] Design in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_logo_variations_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 29: Create 4 logo variations."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Primary Logo - Dark", 500, 500),
            ("Primary Logo - Light", 500, 500),
            ("Logo Symbol Only", 500, 500),
            ("Logo Horizontal", 800, 400),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Brand Assets/Logo Variations")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_acme_marketing_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 30: Create folder structure and move 8 Acme designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        social_folder = _find_folder_by_path(backend, "Marketing/Campaigns/Q2 2026/Social Media Assets")
        print_folder = _find_folder_by_path(backend, "Marketing/Campaigns/Q2 2026/Print Materials")

        if not social_folder:
            errors.append("[X] Social Media Assets folder not found")
        else:
            checks_passed.append("[✓] Social Media Assets folder exists")

        if not print_folder:
            errors.append("[X] Print Materials folder not found")
        else:
            checks_passed.append("[✓] Print Materials folder exists")

        if social_folder:
            folder_id = social_folder.get("_id")
            acme_designs = _find_designs_by_title(backend, "Acme")
            moved_count = sum(1 for d in acme_designs if d.get("folderId") == folder_id)

            if moved_count >= 8:
                checks_passed.append(f"[✓] 8 Acme designs moved ({moved_count})")
            else:
                errors.append(f"[X] Only {moved_count} Acme designs moved, need 8")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_welcome_reorganization_simple(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 33: Reorganize Welcome designs into Marketing folder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Marketing/Welcome Campaign/Assets")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Folder hierarchy exists")
        folder_id = folder.get("_id")

        welcome_designs = _find_designs_by_title(backend, "Welcome")
        moved_count = sum(1 for d in welcome_designs if d.get("folderId") == folder_id)

        if moved_count >= 3:
            checks_passed.append(f"[✓] At least 3 Welcome designs moved ({moved_count})")
        else:
            errors.append(f"[X] Only {moved_count} designs moved, need 3")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_video_content_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 34: Create video content suite with 3 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Episode 15 - AI Trends", 1280, 720),
            ("Episode 15 - Teaser", 1080, 1920),
            ("Episode 15 - Web Banner", 1920, 1080),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_newsletter_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 35: Create newsletter campaign with 3 formats."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("February Newsletter 2026 - Full Version", 2480, 3508),
            ("February Newsletter 2026 - Story Highlights", 1080, 1920),
            ("February Newsletter 2026 - Web Banner", 1600, 900),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Newsletters/2026/February")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_event_promotional_materials(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 40: Create Digital Summit 2026 promotional materials."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Digital Summit 2026 Poster", 1080, 1920),
            ("Digital Summit 2026 Flyer", 2480, 3508),
            ("Digital Summit 2026 Story", 1080, 1920),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Client Work/Events/Digital Summit 2026")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_phoenix_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 41: Create Phoenix Studios brand identity package."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Phoenix Studios Logo", 500, 500),
            ("Phoenix Studios Business Card", 1050, 600),
            ("Phoenix Studios Pitch Deck", 1920, 1080),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Client Work/Phoenix Studios/Brand Identity")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_business_cards_archive(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 43: Archive business cards and create template."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        archive_folder = _find_folder_by_path(backend, "Print Materials/Business Cards/Archive")
        template_folder = _find_folder_by_path(backend, "Print Materials/Business Cards/Templates")

        if not archive_folder:
            errors.append("[X] Archive folder not found")
        else:
            checks_passed.append("[✓] Archive folder exists")
            folder_id = archive_folder.get("_id")
            bc_designs = _find_designs_by_title(backend, "Business Card")
            moved_count = sum(1 for d in bc_designs if d.get("folderId") == folder_id)
            if moved_count >= 2:
                checks_passed.append(f"[✓] At least 2 business cards archived ({moved_count})")
            else:
                errors.append(f"[X] Only {moved_count} business cards archived")

        # Check template
        template = _find_design_by_title(backend, "Master Template - Business Card")
        if not template:
            errors.append("[X] Template design not found")
        else:
            checks_passed.append("[✓] Template design created")
            if _check_design_dimensions(template, 1050, 600):
                checks_passed.append("[✓] Template has correct dimensions")
            if template_folder and template.get("folderId") == template_folder.get("_id"):
                checks_passed.append("[✓] Template in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_brand_identity_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 45: Create complete brand identity suite with 5 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Brand Logo 2026", 500, 500, "logo"),
            ("Brand Business Card", 1050, 600, "business-card"),
            ("Brand Letterhead", 2480, 3508, "a4-document"),
            ("Brand Social Post", 1080, 1080, "instagram-post"),
            ("Brand Deck Cover", 1920, 1080, "presentation"),
        ]

        for title, width, height, format_type in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Brand Identity/2026 Refresh/Assets")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_starlight_portfolio_setup(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 47: Set up Starlight portfolio structure."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/Brand Package")
        if not folder:
            errors.append("[X] Brand Package folder not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Brand Package folder exists")
        folder_id = folder.get("_id")

        # Check Portfolio Preview design
        preview = _find_design_by_title(backend, "Starlight Portfolio Preview")
        if not preview:
            errors.append("[X] Portfolio Preview design not found")
        else:
            checks_passed.append("[✓] Portfolio Preview design created")
            if _check_design_dimensions(preview, 1080, 1080):
                checks_passed.append("[✓] Preview has correct dimensions")
            if preview.get("folderId") == folder_id:
                checks_passed.append("[✓] Preview in correct folder")

        # Count Starlight designs in folder
        starlight_designs = _find_designs_by_title(backend, "Starlight")
        count = sum(1 for d in starlight_designs if d.get("folderId") == folder_id)

        if count >= 4:
            checks_passed.append(f"[✓] At least 4 designs in folder ({count})")
        else:
            errors.append(f"[X] Only {count} designs in folder, need 4")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_conference_event_structure(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 48: Set up conference event folder structure with 3 designs."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Events/Tech Conference 2026/Assets/Digital/Social Media")
        if not folder:
            errors.append("[X] Folder hierarchy not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Folder hierarchy exists")
        folder_id = folder.get("_id")

        designs_spec = [
            ("Conference Announcement Story", 1080, 1920),
            ("Conference Registration Open", 1200, 630),
            ("Conference Speaker Preview", 1280, 720),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")
                if design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in target folder")
                else:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_acme_bulk_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 49: Bulk organize Acme designs with inventory."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Archive/Acme Corp/All Projects")
        if not folder:
            errors.append("[X] Archive folder not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Archive folder exists")
        folder_id = folder.get("_id")

        acme_designs = _find_designs_by_title(backend, "Acme")
        moved_designs = [d for d in acme_designs if d.get("folderId") == folder_id]
        moved_count = len(moved_designs)

        if moved_count >= 2:
            checks_passed.append(f"[✓] At least 2 Acme designs moved ({moved_count})")

            # Check formats
            formats = set(d.get("format") for d in moved_designs)
            checks_passed.append(f"[✓] Format breakdown: {formats}")

            # Check titles
            titles = [d.get("title") for d in moved_designs]
            checks_passed.append(f"[✓] Titles: {titles}")
        else:
            errors.append(f"[X] Only {moved_count} Acme designs moved, need 2")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_rebrand_logo_variations(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 50: Create 3 rebrand logo variations."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        designs_spec = [
            ("Rebrand Primary Logo", 500, 500),
            ("Rebrand Horizontal Logo", 800, 300),
            ("Rebrand Icon Only", 200, 200),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if not _check_design_dimensions(design, width, height):
                    errors.append(f"[X] '{title}' has wrong dimensions")
                else:
                    checks_passed.append(f"[✓] '{title}' has correct dimensions")

        folder = _find_folder_by_path(backend, "Brand Assets/2026 Rebrand/Logo Variations")
        if not folder:
            errors.append("[X] Folder not found")
        else:
            checks_passed.append("[✓] Folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_title(backend, title)
                if design and design.get("folderId") != folder_id:
                    errors.append(f"[X] '{title}' not in folder")
                elif design:
                    checks_passed.append(f"[✓] '{title}' in correct folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# ============================================================================
# TEXT STYLING ANALYSIS TASKS (Tasks 2, 6, 24, 31, 39)
# ============================================================================
def _validate_text_content_hierarchy_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 2: Analyze text content hierarchy in Acme Q1 Strategy Deck."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Acme Q1 Strategy Deck")
        if not design:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        # Check presentation dimensions
        if _check_design_dimensions(design, 1920, 1080):
            checks_passed.append("[✓] Correct presentation dimensions (1920x1080)")
        else:
            errors.append(f"[X] Wrong dimensions: {design.get('width')}x{design.get('height')}")

        # Get text elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = [e for e in elements if e.get("type") == "text"]

        if not text_elements:
            errors.append("[X] No text elements found in design")
            return _make_task_score(errors, checks_passed)

        checks_passed.append(f"[✓] Found {len(text_elements)} text elements")

        # Verify text styling properties are accessible
        font_sizes = []
        font_weights = []
        colors = []
        total_chars = 0

        for el in text_elements:
            props = el.get("properties", {})
            if props.get("type") == "text":
                font_sizes.append(props.get("fontSize", 0))
                font_weights.append(props.get("fontWeight", "normal"))
                colors.append(props.get("color", "#000000"))
                segments = props.get("segments", [])
                for seg in segments:
                    total_chars += len(seg.get("text", ""))

        if font_sizes:
            checks_passed.append(f"[✓] Font sizes extracted: {sorted(set(font_sizes), reverse=True)}")

        if font_weights:
            bold_count = sum(1 for w in font_weights if w == "bold")
            normal_count = len(font_weights) - bold_count
            checks_passed.append(f"[✓] Font weights: {bold_count} bold, {normal_count} normal")

        if colors:
            checks_passed.append(f"[✓] Colors documented: {len(set(colors))} unique colors")

        checks_passed.append(f"[✓] Total character count: {total_chars}")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_deep_content_extraction(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 6: Deep content extraction on Welcome Instagram Post."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Welcome Instagram Post")
        if not design:
            errors.append("[X] Design 'Welcome Instagram Post' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        elements = _get_elements_for_design(backend, design.get("_id"))

        # Categorize elements by type
        text_elements = [e for e in elements if e.get("type") == "text"]
        shape_elements = [e for e in elements if e.get("type") == "shape"]
        image_elements = [e for e in elements if e.get("type") == "image"]

        checks_passed.append(f"[✓] Element breakdown: {len(text_elements)} text, {len(shape_elements)} shapes, {len(image_elements)} images")

        # Extract text properties
        for i, el in enumerate(text_elements):
            props = el.get("properties", {})
            if props.get("type") == "text":
                text = "".join(seg.get("text", "") for seg in props.get("segments", []))
                font_family = props.get("fontFamily", "unknown")
                font_size = props.get("fontSize", 0)
                color = props.get("color", "#000000")
                checks_passed.append(f"[✓] Text {i+1}: '{text[:30]}...' - {font_family}, {font_size}px, {color}")

        # Extract shape properties
        for i, el in enumerate(shape_elements):
            props = el.get("properties", {})
            if props.get("type") == "shape":
                shape_type = props.get("shapeType", "unknown")
                fill = props.get("fill", "none")
                checks_passed.append(f"[✓] Shape {i+1}: {shape_type}, fill: {fill}")

        # Extract image properties
        for i, el in enumerate(image_elements):
            props = el.get("properties", {})
            if props.get("type") == "image":
                width = el.get("width", 0)
                height = el.get("height", 0)
                checks_passed.append(f"[✓] Image {i+1}: {width}x{height}")

        # Check for shadow effects
        shadows = [e for e in elements if e.get("shadow", {}).get("enabled")]
        if shadows:
            checks_passed.append(f"[✓] Shadow effects found on {len(shadows)} elements")
        else:
            checks_passed.append("[✓] No shadow effects found")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_poster_content_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 24: Advanced content extraction on Live Music Night Poster."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        # Verify poster dimensions
        if _check_design_dimensions(design, 1080, 1920):
            checks_passed.append("[✓] Correct poster dimensions (1080x1920)")
        else:
            errors.append(f"[X] Wrong dimensions: {design.get('width')}x{design.get('height')}")

        elements = _get_elements_for_design(backend, design.get("_id"))

        # Group text by font family
        text_by_font: Dict[str, List[str]] = {}
        for el in elements:
            if el.get("type") == "text":
                props = el.get("properties", {})
                font = props.get("fontFamily", "unknown")
                text = "".join(seg.get("text", "") for seg in props.get("segments", []))
                if font not in text_by_font:
                    text_by_font[font] = []
                text_by_font[font].append(text)

        for font, texts in text_by_font.items():
            checks_passed.append(f"[✓] Font '{font}': {len(texts)} text elements")

        # Categorize shapes by type
        shape_types: Dict[str, int] = {}
        for el in elements:
            if el.get("type") == "shape":
                props = el.get("properties", {})
                shape_type = props.get("shapeType", "unknown")
                shape_types[shape_type] = shape_types.get(shape_type, 0) + 1

        for shape_type, count in shape_types.items():
            checks_passed.append(f"[✓] Shape type '{shape_type}': {count} elements")

        # Check images
        image_elements = [e for e in elements if e.get("type") == "image"]
        for i, el in enumerate(image_elements):
            props = el.get("properties", {})
            src = props.get("src", "")
            fit = props.get("fit", "fit")
            checks_passed.append(f"[✓] Image {i+1}: fit={fit}, has src={bool(src)}")

        # Check shadows
        shadows = [e for e in elements if e.get("shadow", {}).get("enabled")]
        if shadows:
            for el in shadows:
                shadow = el.get("shadow", {})
                checks_passed.append(f"[✓] Shadow: blur={shadow.get('blur')}, offset=({shadow.get('offsetX')},{shadow.get('offsetY')})")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_business_card_text_styling(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 31: Extract and analyze text styling from Business Card — Alice Chen."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Business Card — Alice Chen")
        if not design:
            errors.append("[X] Design not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        # Verify business card dimensions
        if _check_design_dimensions(design, 1050, 600):
            checks_passed.append("[✓] Correct business-card dimensions (1050x600)")
        else:
            errors.append(f"[X] Wrong dimensions: {design.get('width')}x{design.get('height')}")

        elements = _get_elements_for_design(backend, design.get("_id"))
        text_elements = [e for e in elements if e.get("type") == "text"]

        checks_passed.append(f"[✓] Total element count: {len(elements)}")

        if not text_elements:
            errors.append("[X] No text elements found")
            return _make_task_score(errors, checks_passed)

        # Extract all text styling properties
        total_font_size = 0
        alignments: Dict[str, int] = {}

        for i, el in enumerate(text_elements):
            props = el.get("properties", {})
            if props.get("type") == "text":
                font_family = props.get("fontFamily", "unknown")
                font_size = props.get("fontSize", 0)
                font_weight = props.get("fontWeight", "normal")
                color = props.get("color", "#000000")
                text_align = props.get("textAlign", "left")
                line_height = props.get("lineHeight", 1.0)
                letter_spacing = props.get("letterSpacing", 0)

                total_font_size += font_size
                alignments[text_align] = alignments.get(text_align, 0) + 1

                text = "".join(seg.get("text", "") for seg in props.get("segments", []))
                checks_passed.append(f"[✓] Text '{text[:20]}': {font_family}, {font_size}px, {font_weight}, {color}")

                if letter_spacing != 0:
                    checks_passed.append(f"    Letter spacing: {letter_spacing}")
                if line_height != 1.0:
                    checks_passed.append(f"    Line height: {line_height}")

        # Calculate average font size
        avg_font_size = total_font_size / len(text_elements) if text_elements else 0
        checks_passed.append(f"[✓] Average font size: {avg_font_size:.1f}px")

        # Document alignment patterns
        for align, count in alignments.items():
            checks_passed.append(f"[✓] Alignment '{align}': {count} elements")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_newsletter_content_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 39: Comprehensive content analysis on January Newsletter (Final)."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "January Newsletter (Final)")
        if not design:
            errors.append("[X] Design 'January Newsletter (Final)' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        # Verify A4 dimensions
        if _check_design_dimensions(design, 2480, 3508):
            checks_passed.append("[✓] Correct A4 dimensions (2480x3508)")
        else:
            errors.append(f"[X] Wrong dimensions: {design.get('width')}x{design.get('height')}")

        elements = _get_elements_for_design(backend, design.get("_id"))

        # Count by type
        type_counts: Dict[str, int] = {}
        for el in elements:
            el_type = el.get("type", "unknown")
            type_counts[el_type] = type_counts.get(el_type, 0) + 1

        checks_passed.append(f"[✓] Total elements: {len(elements)}")
        for el_type, count in type_counts.items():
            checks_passed.append(f"[✓] {el_type}: {count} elements")

        # Check for all 5 element types
        expected_types = {"shape", "text", "image", "line", "icon"}
        found_types = set(type_counts.keys())
        missing_types = expected_types - found_types

        if len(elements) >= 12:
            checks_passed.append("[✓] Contains 12+ elements as expected")
        else:
            errors.append(f"[X] Only {len(elements)} elements, expected 12")

        if not missing_types:
            checks_passed.append("[✓] All 5 element types present")
        else:
            errors.append(f"[X] Missing element types: {missing_types}")

        # Extract text content with fonts
        for el in elements:
            if el.get("type") == "text":
                props = el.get("properties", {})
                text = "".join(seg.get("text", "") for seg in props.get("segments", []))[:30]
                font = props.get("fontFamily", "unknown")
                checks_passed.append(f"[✓] Text: '{text}...' ({font})")

        # Document image properties
        for el in elements:
            if el.get("type") == "image":
                props = el.get("properties", {})
                src = props.get("src", "")
                checks_passed.append(f"[✓] Image src: {src[:50]}...")

        # Document shape colors
        for el in elements:
            if el.get("type") == "shape":
                props = el.get("properties", {})
                fill = props.get("fill", "none")
                checks_passed.append(f"[✓] Shape fill: {fill}")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# ============================================================================
# UNIQUE COMPLEX ORGANIZATION TASKS (Tasks 14, 22, 36, 37)
# ============================================================================
def _validate_portfolio_dual_structure(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 14: Build portfolio structure with Story→Social Media, Conference→Headers."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Social Media folder
        social_folder = _find_folder_by_path(backend, "Portfolio/2026/Q1/Client Projects/Digital Assets/Social Media")
        if not social_folder:
            errors.append("[X] Social Media folder hierarchy not found")
        else:
            checks_passed.append("[✓] Social Media folder exists")

        # Check Headers folder
        headers_folder = _find_folder_by_path(backend, "Portfolio/2026/Q1/Client Projects/Event Materials/Headers")
        if not headers_folder:
            errors.append("[X] Headers folder hierarchy not found")
        else:
            checks_passed.append("[✓] Headers folder exists")

        # Check Story designs in Social Media
        if social_folder:
            story_designs = _find_designs_by_title(backend, "Story")
            social_folder_id = social_folder.get("_id")
            story_in_social = sum(1 for d in story_designs if d.get("folderId") == social_folder_id)

            if story_in_social >= 2:
                checks_passed.append(f"[✓] At least 2 Story designs in Social Media ({story_in_social})")
            else:
                errors.append(f"[X] Only {story_in_social} Story designs in Social Media, need 2")

        # Check Conference designs in Headers
        if headers_folder:
            conf_designs = _find_designs_by_title(backend, "Conference")
            headers_folder_id = headers_folder.get("_id")
            conf_in_headers = sum(1 for d in conf_designs if d.get("folderId") == headers_folder_id)

            if conf_in_headers >= 2:
                checks_passed.append(f"[✓] At least 2 Conference designs in Headers ({conf_in_headers})")
            else:
                errors.append(f"[X] Only {conf_in_headers} Conference designs in Headers, need 2")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_acme_logo_dual_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 22: Organize Acme→Visual Assets, Logo→Logos subfolder."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Visual Assets folder
        visual_folder = _find_folder_by_path(backend, "Client Projects/Q1 2026/Brand Refresh/Visual Assets")
        if not visual_folder:
            errors.append("[X] Visual Assets folder not found")
        else:
            checks_passed.append("[✓] Visual Assets folder exists")

        # Check Logos folder
        logos_folder = _find_folder_by_path(backend, "Client Projects/Q1 2026/Brand Refresh/Logos")
        if not logos_folder:
            errors.append("[X] Logos folder not found")
        else:
            checks_passed.append("[✓] Logos folder exists")

        # Count Acme designs in Visual Assets
        if visual_folder:
            acme_designs = _find_designs_by_title(backend, "Acme")
            visual_folder_id = visual_folder.get("_id")
            acme_count = sum(1 for d in acme_designs if d.get("folderId") == visual_folder_id)
            checks_passed.append(f"[✓] Acme designs in Visual Assets: {acme_count}")

        # Count Logo designs in Logos folder
        if logos_folder:
            logo_designs = _find_designs_by_title(backend, "Logo")
            logos_folder_id = logos_folder.get("_id")
            logo_count = sum(1 for d in logo_designs if d.get("folderId") == logos_folder_id)
            checks_passed.append(f"[✓] Logo designs in Logos folder: {logo_count}")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))

def _validate_format_based_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Task 36: Organize Tech designs by format type into subfolders."""
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check base folder
        base_folder = _find_folder_by_path(backend, "Client Work/TechCorp/Q1 2026/Assets/Social/Platform Specific")
        if not base_folder:
            errors.append("[X] Platform Specific folder not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Platform Specific folder exists")
        base_id = base_folder.get("_id")

        # Check format-specific subfolders
        subfolders = {
            "Instagram Posts": "instagram-post",
            "Twitter Headers": "twitter-header",
            "Facebook Posts": "facebook-post"
        }

        tech_designs = _find_designs_by_title(backend, "Tech")

        for subfolder_name, expected_format in subfolders.items():
            subfolder = _find_folder_by_name(backend, subfolder_name, base_id)
            if not subfolder:
                errors.append(f"[X] Subfolder '{subfolder_name}' not found")
                continue

            checks_passed.append(f"[✓] Subfolder '{subfolder_name}' exists")
            subfolder_id = subfolder.get("_id")

            # Check designs in subfolder match expected format
            designs_in_folder = [d for d in tech_designs if d.get("folderId") == subfolder_id]
            correct_format = [d for d in designs_in_folder if d.get("format") == expected_format]

            if designs_in_folder:
                checks_passed.append(f"[✓] {len(designs_in_folder)} Tech designs in {subfolder_name}")
                if correct_format:
                    checks_passed.append(f"[✓] {len(correct_format)} have correct format '{expected_format}'")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# TASK 30: ACME MARKETING Q2 FOLDER STRUCTURE
# =============================================================================
def _validate_acme_marketing_q2_folder_structure(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Marketing folder structure with 8 Acme designs organized.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folder paths
        social_path = "Marketing/Campaigns/Q2 2026/Social Media Assets"
        print_path = "Marketing/Campaigns/Q2 2026/Print Materials"

        social_folder = _find_folder_by_path(backend, social_path)
        print_folder = _find_folder_by_path(backend, print_path)

        if not social_folder:
            errors.append(f"[X] Social Media Assets folder not found at '{social_path}'")
        else:
            checks_passed.append(f"[✓] Social Media Assets folder exists at '{social_path}'")

        if not print_folder:
            errors.append(f"[X] Print Materials folder not found at '{print_path}'")
        else:
            checks_passed.append(f"[✓] Print Materials folder exists at '{print_path}'")

        # Check for Acme designs in Social Media Assets folder
        if social_folder:
            folder_id = social_folder.get("_id")
            acme_designs = _search_designs_by_title(backend, "Acme")

            moved_count = sum(1 for d in acme_designs if d.get("folderId") == folder_id)

            if moved_count >= 8:
                checks_passed.append(f"[✓] {moved_count} Acme designs in Social Media Assets folder (target: 8)")
            else:
                # Allow partial success if at least some designs moved
                if moved_count > 0:
                    checks_passed.append(f"[✓] {moved_count} Acme designs moved to Social Media Assets")
                else:
                    errors.append(f"[X] Expected 8 Acme designs in Social Media Assets, found {moved_count}")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# TASK 38: Q1 CAMPAIGN STRUCTURE
# =============================================================================
def _validate_q1_campaign_structure(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q1 2026 campaign folder structure with format-based organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder hierarchy
        main_path = "Marketing Campaigns/Q1 2026/Final Assets"
        main_folder = _find_folder_by_path(backend, main_path)
        if not main_folder:
            errors.append(f"[X] Main folder path '{main_path}' not found")
        else:
            checks_passed.append(f"[✓] Main folder path '{main_path}' exists")

        # Check subfolders
        subfolders = ["Social Media", "Print Materials", "Digital Assets"]
        for subfolder in subfolders:
            full_path = f"{main_path}/{subfolder}"
            folder = _find_folder_by_path(backend, full_path)
            if not folder:
                errors.append(f"[X] Subfolder '{full_path}' not found")
            else:
                checks_passed.append(f"[✓] Subfolder '{full_path}' exists")

        # Check for Q1 designs moved
        q1_designs = _search_designs_by_title(backend, "Q1")
        if len(q1_designs) >= 2:
            checks_passed.append(f"[✓] Found {len(q1_designs)} designs with 'Q1' in title")

            # Check if at least one is in the correct folder structure
            digital_assets_folder = _find_folder_by_path(backend, f"{main_path}/Digital Assets")
            if digital_assets_folder:
                digital_folder_id = digital_assets_folder.get("_id")
                moved_count = sum(1 for d in q1_designs if d.get("folderId") == digital_folder_id)
                if moved_count > 0:
                    checks_passed.append(f"[✓] {moved_count} Q1 designs in Digital Assets folder")
        else:
            errors.append(f"[X] Expected at least 2 Q1 designs, found {len(q1_designs)}")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# TASK 46: Q2 CAMPAIGN STRUCTURE
# =============================================================================
def _validate_q2_campaign_structure(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 2026 campaign folder structure with platform-specific organization.
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check main folder hierarchies
        base_path = "Client Work/Q2 2026"

        folder_paths = [
            f"{base_path}/Social Media/Instagram",
            f"{base_path}/Social Media/Facebook",
            f"{base_path}/Print Materials",
            f"{base_path}/Digital Assets"
        ]

        for path in folder_paths:
            folder = _find_folder_by_path(backend, path)
            if not folder:
                errors.append(f"[X] Folder path '{path}' not found")
            else:
                checks_passed.append(f"[✓] Folder path '{path}' exists")

        # Check for Community Event designs
        community_designs = _search_designs_by_title(backend, "Community Event")
        if len(community_designs) >= 2:
            checks_passed.append(f"[✓] Found {len(community_designs)} designs with 'Community Event' in title")

            # Check if designs are in appropriate folders
            instagram_folder = _find_folder_by_path(backend, f"{base_path}/Social Media/Instagram")
            facebook_folder = _find_folder_by_path(backend, f"{base_path}/Social Media/Facebook")

            moved_count = 0
            for design in community_designs:
                folder_id = design.get("folderId")
                if instagram_folder and folder_id == instagram_folder.get("_id"):
                    moved_count += 1
                    checks_passed.append(f"[✓] '{design.get('title')}' in Instagram folder")
                elif facebook_folder and folder_id == facebook_folder.get("_id"):
                    moved_count += 1
                    checks_passed.append(f"[✓] '{design.get('title')}' in Facebook folder")

            if moved_count >= 2:
                checks_passed.append("[✓] At least 2 designs properly organized")
            else:
                errors.append(f"[X] Only {moved_count} designs organized, expected at least 2")
        else:
            # If no Community Event designs, check if any designs were moved
            checks_passed.append("[✓] No Community Event designs to move (folder structure verified)")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# Task 13: Resize Business Card to Poster (1080x1920)
# =============================================================================
def _validate_business_card_resize_poster(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate business card resized to poster dimensions."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Find the resized design - use exact match to avoid Alt versions
        design = _find_design_by_exact_title(backend, "Business Card — Alice Chen")

        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Found 'Business Card — Alice Chen' design")

        # Check dimensions - should be 1080x1920 (poster format)
        width = design.get("width", 0)
        height = design.get("height", 0)

        if width == 1080 and height == 1920:
            checks_passed.append(f"[✓] Correct dimensions: {width}x{height}")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 1080x1920")

        # Check format changed to custom
        format_type = design.get("format", "")
        if format_type == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        # Verify elements are preserved
        elements = _get_elements_for_design(backend, design.get("_id", ""))
        if elements:
            checks_passed.append(f"[✓] Design elements preserved ({len(elements)} elements)")

            # Check for text content (Alice Chen should still be present)
            text_elements = [e for e in elements if e.get("type") == "text"]
            if text_elements:
                all_text = " ".join(_get_element_text_content(e) for e in text_elements)
                if "Alice" in all_text or "Chen" in all_text:
                    checks_passed.append("[✓] Text content 'Alice Chen' preserved")
                else:
                    errors.append("[X] Text content 'Alice Chen' not found in resized design")
            else:
                errors.append("[X] No text elements found after resize")
        else:
            errors.append("[X] No elements found in resized design")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# Task 16: Resize Twitter Header to YouTube Thumbnail
# =============================================================================
def _validate_twitter_to_youtube_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Twitter header resized to YouTube thumbnail dimensions."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Find the resized design - use exact match to avoid variant versions
        design = _find_design_by_exact_title(backend, "Tech Conference Header")

        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Found 'Tech Conference Header' design")

        # Check dimensions - should be 1280x720 (YouTube thumbnail)
        width = design.get("width", 0)
        height = design.get("height", 0)

        if width == 1280 and height == 720:
            checks_passed.append(f"[✓] Correct dimensions: {width}x{height}")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 1280x720")

        # Check format changed to custom
        format_type = design.get("format", "")
        if format_type == "custom":
            checks_passed.append("[✓] Format changed to 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        # Verify elements are preserved and readable
        elements = _get_elements_for_design(backend, design.get("_id", ""))
        if elements:
            checks_passed.append(f"[✓] Design elements preserved ({len(elements)} elements)")

            # Check text elements for readability
            text_elements = [e for e in elements if e.get("type") == "text"]
            if text_elements:
                checks_passed.append(f"[✓] Text elements preserved ({len(text_elements)} text elements)")
            else:
                checks_passed.append("[✓] No text elements in original design")
        else:
            errors.append("[X] No elements found after resize")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# Task 23: Resize Business Card to Wide Banner
# =============================================================================
def _validate_business_card_resize_banner(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate business card resized to wide banner dimensions."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Find the resized design - use exact match to avoid Alt versions
        design = _find_design_by_exact_title(backend, "Business Card — Alice Chen")

        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Found 'Business Card — Alice Chen' design")

        # Check dimensions - should be 1920x540 (wide banner)
        width = design.get("width", 0)
        height = design.get("height", 0)

        if width == 1920 and height == 540:
            checks_passed.append(f"[✓] Correct dimensions: {width}x{height}")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 1920x540")

        # Check format changed to custom
        format_type = design.get("format", "")
        if format_type == "custom":
            checks_passed.append("[✓] Format changed to 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        # Verify elements are preserved
        elements = _get_elements_for_design(backend, design.get("_id", ""))
        if elements:
            checks_passed.append(f"[✓] Design elements preserved ({len(elements)} elements)")

            # Document text adaptation
            text_elements = [e for e in elements if e.get("type") == "text"]
            if text_elements:
                checks_passed.append(f"[✓] Text elements adapted to banner proportions ({len(text_elements)} elements)")
        else:
            errors.append("[X] No elements found in resized design")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# Task 32: Create Presentation and Resize to Widescreen
# =============================================================================
def _validate_presentation_resize_widescreen(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate presentation created and resized to 2560x1440."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Find the design
        design = _find_design_by_title(backend, "Q2 Strategy Overview")

        if not design:
            errors.append("[X] Design 'Q2 Strategy Overview' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Found 'Q2 Strategy Overview' design")

        # Check dimensions - should be 2560x1440 (widescreen)
        width = design.get("width", 0)
        height = design.get("height", 0)

        if width == 2560 and height == 1440:
            checks_passed.append(f"[✓] Correct widescreen dimensions: {width}x{height}")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 2560x1440")

        # Check format is custom after resize
        format_type = design.get("format", "")
        if format_type == "custom":
            checks_passed.append("[✓] Format is 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        # Verify elements are preserved
        elements = _get_elements_for_design(backend, design.get("_id", ""))
        if elements:
            checks_passed.append(f"[✓] Design elements preserved ({len(elements)} elements)")
        else:
            errors.append("[X] No elements found - elements should be preserved from creation")

        # Check folder location - should be in Presentations folder
        folder_id = design.get("folderId")
        if folder_id:
            presentations_folder = _find_folder_by_name(backend, "Presentations")
            if presentations_folder and folder_id == presentations_folder.get("_id"):
                checks_passed.append("[✓] Design located in Presentations folder")
            else:
                errors.append("[X] Design not in Presentations folder")
        else:
            errors.append("[X] Design not in any folder (expected Presentations folder)")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# Task 42: Welcome Designs Reorganization with Resize
# =============================================================================
def _validate_welcome_reorganize_and_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Welcome designs reorganized and one resized."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check folder hierarchy exists
        archive_folder = _find_folder_by_name(backend, "Archive", is_root=True)
        if not archive_folder:
            errors.append("[X] 'Archive' folder not found at root level")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] 'Archive' folder exists")

        year_folder = _find_folder_by_name(backend, "2026", archive_folder.get("_id"))
        if not year_folder:
            errors.append("[X] '2026' folder not found under Archive")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] '2026' folder exists under Archive")

        welcome_folder = _find_folder_by_name(backend, "Welcome Designs", year_folder.get("_id"))
        if not welcome_folder:
            errors.append("[X] 'Welcome Designs' folder not found under 2026")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[✓] Complete folder hierarchy 'Archive/2026/Welcome Designs' exists")

        # Check at least 3 Welcome designs moved
        welcome_folder_id = welcome_folder.get("_id")
        welcome_designs = _find_designs_by_title(backend, "Welcome")
        designs_in_folder = [d for d in welcome_designs if d.get("folderId") == welcome_folder_id]

        if len(designs_in_folder) >= 3:
            checks_passed.append(f"[✓] {len(designs_in_folder)} Welcome designs in target folder (minimum 3)")
        else:
            errors.append(f"[X] Only {len(designs_in_folder)} designs in folder, expected at least 3")

        # Check Welcome Instagram Post was resized
        instagram_post = _find_design_by_title(backend, "Welcome Instagram Post")
        if not instagram_post:
            errors.append("[X] 'Welcome Instagram Post' design not found")
        else:
            width = instagram_post.get("width", 0)
            height = instagram_post.get("height", 0)

            if width == 1200 and height == 800:
                checks_passed.append("[✓] 'Welcome Instagram Post' resized to 1200x800")
            else:
                errors.append(f"[X] 'Welcome Instagram Post' has wrong dimensions: {width}x{height}, expected 1200x800")

            format_type = instagram_post.get("format", "")
            if format_type == "custom":
                checks_passed.append("[✓] Format changed to 'custom' after resize")
            else:
                errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# =============================================================================
# NEW TASKS FROM TASKS_TO_CREATE.md (Tasks 49-88)
# =============================================================================

# Task 49: Acme Welcome Folder Reorganization
def _validate_acme_welcome_folder_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Acme and Welcome designs reorganized into folder hierarchy."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check Social Assets folder hierarchy
        social_assets_folder = _find_folder_by_path(backend, "Acme Projects/2026 Campaigns/Social Assets")
        if not social_assets_folder:
            errors.append("[X] Folder hierarchy 'Acme Projects/2026 Campaigns/Social Assets' not found")
        else:
            checks_passed.append("[✓] 'Acme Projects/2026 Campaigns/Social Assets' folder exists")

            # Check Acme designs moved
            acme_designs = _find_designs_by_title(backend, "Acme")
            moved_acme = [d for d in acme_designs if d.get("folderId") == social_assets_folder.get("_id")]
            if len(moved_acme) >= 2:
                checks_passed.append(f"[✓] {len(moved_acme)} Acme designs moved to Social Assets")
            else:
                errors.append(f"[X] Only {len(moved_acme)} Acme designs in Social Assets, expected at least 2")

        # Check Welcome Collection folder
        welcome_folder = _find_folder_by_path(backend, "Acme Projects/Welcome Collection")
        if not welcome_folder:
            errors.append("[X] Folder 'Acme Projects/Welcome Collection' not found")
        else:
            checks_passed.append("[✓] 'Acme Projects/Welcome Collection' folder exists")

            # Check Welcome designs moved
            welcome_designs = _find_designs_by_title(backend, "Welcome")
            moved_welcome = [d for d in welcome_designs if d.get("folderId") == welcome_folder.get("_id")]
            if len(moved_welcome) >= 1:
                checks_passed.append(f"[✓] {len(moved_welcome)} Welcome designs moved to Welcome Collection")
            else:
                errors.append("[X] No Welcome designs in Welcome Collection")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 50: Tech Header Resize Square
def _validate_tech_header_resize_square(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Tech Conference Header resized to 500x500."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Tech Conference Header' found")

        # Check dimensions
        width = design.get("width", 0)
        height = design.get("height", 0)
        if width == 500 and height == 500:
            checks_passed.append("[✓] Design resized to 500x500")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 500x500")

        # Check format changed to custom
        format_type = design.get("format", "")
        if format_type == "custom":
            checks_passed.append("[✓] Format changed to 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 51: Tech Conference Reorganization Analysis
def _validate_tech_conference_reorganization_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Tech/Conference designs reorganized with content analysis."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check folder hierarchy
        target_folder = _find_folder_by_path(backend, "Personal/Events/Tech Conferences/2026")
        if not target_folder:
            errors.append("[X] Folder 'Personal/Events/Tech Conferences/2026' not found")
        else:
            checks_passed.append("[✓] Folder hierarchy 'Personal/Events/Tech Conferences/2026' exists")

            # Check designs with Conference or Tech moved
            all_designs = _get_all_designs(backend)
            matching_designs = [d for d in all_designs
                               if "conference" in d.get("title", "").lower()
                               or "tech" in d.get("title", "").lower()]

            folder_id = target_folder.get("_id")
            moved_designs = [d for d in matching_designs if d.get("folderId") == folder_id]

            if len(moved_designs) >= 1:
                checks_passed.append(f"[✓] {len(moved_designs)} Conference/Tech designs moved to folder")
            else:
                errors.append("[X] No Conference/Tech designs found in target folder")

        # Check Tech Conference Header exists for analysis
        header = _find_design_by_exact_title(backend, "Tech Conference Header")
        if header:
            checks_passed.append("[✓] Tech Conference Header available for analysis")
        else:
            errors.append("[X] Tech Conference Header not found for analysis")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 52: Instagram Social Media Hub Organization
def _validate_instagram_social_media_hub(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Instagram designs organized in Social Media Hub."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check Posts folder
        posts_folder = _find_folder_by_path(backend, "Social Media Hub/Instagram/Posts")
        if not posts_folder:
            errors.append("[X] Folder 'Social Media Hub/Instagram/Posts' not found")
        else:
            checks_passed.append("[✓] 'Social Media Hub/Instagram/Posts' folder exists")
            posts_designs = _get_designs_in_folder(backend, posts_folder.get("_id"))
            post_count = sum(1 for d in posts_designs if d.get("format") == "instagram-post")
            if post_count >= 3:
                checks_passed.append(f"[✓] {post_count} Instagram posts in Posts folder")
            else:
                errors.append(f"[X] Only {post_count} Instagram posts in Posts folder, expected at least 3")

        # Check Stories folder
        stories_folder = _find_folder_by_path(backend, "Social Media Hub/Instagram/Stories")
        if not stories_folder:
            errors.append("[X] Folder 'Social Media Hub/Instagram/Stories' not found")
        else:
            checks_passed.append("[✓] 'Social Media Hub/Instagram/Stories' folder exists")
            stories_designs = _get_designs_in_folder(backend, stories_folder.get("_id"))
            story_count = sum(1 for d in stories_designs if d.get("format") == "instagram-story")
            if story_count >= 2:
                checks_passed.append(f"[✓] {story_count} Instagram stories in Stories folder")
            else:
                errors.append(f"[X] Only {story_count} Instagram stories in Stories folder, expected at least 2")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 53: Live Music YouTube Resize
def _validate_live_music_youtube_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Live Music Night Poster resized to YouTube thumbnail."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design 'Live Music Night Poster' found")

        # Check dimensions (1280x720 YouTube thumbnail)
        width = design.get("width", 0)
        height = design.get("height", 0)
        if width == 1280 and height == 720:
            checks_passed.append("[✓] Design resized to YouTube thumbnail (1280x720)")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 1280x720")

        # Check format changed to custom
        format_type = design.get("format", "")
        if format_type == "custom":
            checks_passed.append("[✓] Format changed to 'custom' after resize")
        else:
            errors.append(f"[X] Format should be 'custom', got '{format_type}'")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 54: Conference Audit Summary
def _validate_conference_audit_summary(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Conference design audit with summary design."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check for Conference designs analyzed
        conference_designs = _find_designs_by_title(backend, "Conference")
        if conference_designs:
            checks_passed.append(f"[✓] Found {len(conference_designs)} Conference designs for audit")
        else:
            errors.append("[X] No Conference designs found for audit")

        # Check Analysis folder
        folder = _find_folder_by_path(backend, "Analysis/Conference Designs")
        if not folder:
            errors.append("[X] Folder 'Analysis/Conference Designs' not found")
        else:
            checks_passed.append("[✓] 'Analysis/Conference Designs' folder exists")

        # Check Summary design
        summary = _find_design_by_exact_title(backend, "Conference Design Audit Summary")
        if not summary:
            errors.append("[X] Summary design 'Conference Design Audit Summary' not found")
        else:
            checks_passed.append("[✓] Summary design exists")
            if _check_design_dimensions(summary, 1200, 800):
                checks_passed.append("[✓] Summary design has correct dimensions (1200x800)")
            else:
                errors.append(f"[X] Summary has wrong dimensions: {summary.get('width')}x{summary.get('height')}")

            # Check in folder
            if folder and summary.get("folderId") == folder.get("_id"):
                checks_passed.append("[✓] Summary design in correct folder")
            elif folder:
                errors.append("[X] Summary design not in Analysis folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 55: Welcome Archive Organization
def _validate_welcome_archive_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Welcome designs archived in folder hierarchy."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        folder = _find_folder_by_path(backend, "Archive/2026/Welcome Posts")
        if not folder:
            errors.append("[X] Folder 'Archive/2026/Welcome Posts' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Folder hierarchy 'Archive/2026/Welcome Posts' exists")

        # Check Welcome designs moved
        welcome_designs = _find_designs_by_title(backend, "Welcome")
        folder_id = folder.get("_id")
        moved = [d for d in welcome_designs if d.get("folderId") == folder_id]

        if len(moved) >= 2:
            checks_passed.append(f"[✓] {len(moved)} Welcome designs in archive folder (minimum 2)")
        else:
            errors.append(f"[X] Only {len(moved)} Welcome designs in folder, expected at least 2")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 56: TechCorp Logo Series
def _validate_techcorp_logo_series(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate TechCorp 2026 logo series created."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        logo_titles = [
            "TechCorp Logo - Primary",
            "TechCorp Logo - Secondary",
            "TechCorp Logo - Monochrome",
            "TechCorp Logo - Icon"
        ]

        for title in logo_titles:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Logo '{title}' not found")
            else:
                checks_passed.append(f"[✓] Logo '{title}' found")
                if _check_design_dimensions(design, 500, 500):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions (500x500)")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions")

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")
        else:
            checks_passed.append("[✓] Folder 'Brand Assets/Logos' exists")
            folder_id = folder.get("_id")
            for title in logo_titles:
                design = _find_design_by_exact_title(backend, title)
                if design and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' in correct folder")
                elif design:
                    errors.append(f"[X] '{title}' not in target folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 57: Executive Business Card
def _validate_executive_business_card(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate executive business card created and organized."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check new business card
        design = _find_design_by_exact_title(backend, "Executive Business Card - Sarah Johnson")
        if not design:
            errors.append("[X] Business card 'Executive Business Card - Sarah Johnson' not found")
        else:
            checks_passed.append("[✓] Business card created")
            if _check_design_dimensions(design, 1050, 600):
                checks_passed.append("[✓] Business card has correct dimensions (1050x600)")
            else:
                errors.append(f"[X] Wrong dimensions: {design.get('width')}x{design.get('height')}")

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/Business Cards/Executive Team")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Business Cards/Executive Team' not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")

            # Check at least 2 business cards in folder
            designs_in_folder = _get_designs_in_folder(backend, folder.get("_id"))
            bc_count = sum(1 for d in designs_in_folder
                         if "business" in d.get("title", "").lower()
                         or d.get("format") == "business-card")
            if bc_count >= 2:
                checks_passed.append(f"[✓] {bc_count} business cards in folder (minimum 2)")
            else:
                errors.append(f"[X] Only {bc_count} business cards in folder, expected at least 2")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 58: Acme Strategy Resize Square
def _validate_acme_strategy_resize_square(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Acme Q1 Strategy Deck resized to square format."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if not design:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        # Check dimensions
        width = design.get("width", 0)
        height = design.get("height", 0)
        if width == 1080 and height == 1080:
            checks_passed.append("[✓] Resized to 1080x1080 square format")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 1080x1080")

        # Check format
        if design.get("format") == "custom":
            checks_passed.append("[✓] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format should be 'custom', got '{design.get('format')}'")

        # Check text preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        text_found = False
        for elem in elements:
            text = _get_element_text_content(elem)
            if "acme" in text.lower() or "strategy" in text.lower():
                text_found = True
                break

        if text_found:
            checks_passed.append("[✓] Main heading text preserved")
        else:
            errors.append("[X] Main heading text not found after resize")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 59: Acme Client Work Organization
def _validate_acme_client_work_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Acme designs organized in Client Work folder."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check Design Assets folder
        assets_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/2026 Projects/Design Assets")
        if not assets_folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/2026 Projects/Design Assets' not found")
        else:
            checks_passed.append("[✓] Design Assets folder hierarchy exists")

        # Check Strategy Materials folder
        strategy_folder = _find_folder_by_path(backend, "Client Work/Acme Corp/2026 Projects/Strategy Materials")
        if not strategy_folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/2026 Projects/Strategy Materials' not found")
        else:
            checks_passed.append("[✓] Strategy Materials folder exists")

            # Check Strategy designs moved
            strategy_designs = _find_designs_by_title(backend, "Strategy")
            moved_strategy = [d for d in strategy_designs if d.get("folderId") == strategy_folder.get("_id")]
            if moved_strategy:
                checks_passed.append(f"[✓] {len(moved_strategy)} Strategy designs in Strategy Materials")
            else:
                errors.append("[X] No Strategy designs in Strategy Materials folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 60: Tech Conference Analysis Resize
def _validate_tech_conference_analysis_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Tech Conference Header analyzed and resized."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Tech Conference Header")
        if not design:
            errors.append("[X] Design 'Tech Conference Header' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Design found")

        # Check dimensions (2560x1440)
        width = design.get("width", 0)
        height = design.get("height", 0)
        if width == 2560 and height == 1440:
            checks_passed.append("[✓] Resized to 2560x1440")
        else:
            errors.append(f"[X] Wrong dimensions: {width}x{height}, expected 2560x1440")

        # Check format changed to custom
        if design.get("format") == "custom":
            checks_passed.append("[✓] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format should be 'custom', got '{design.get('format')}'")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 61: Welcome Collection Organization
def _validate_welcome_collection_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Welcome designs moved to My Projects/Welcome Collection."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        folder = _find_folder_by_path(backend, "My Projects/Welcome Collection")
        if not folder:
            errors.append("[X] Folder 'My Projects/Welcome Collection' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] 'My Projects/Welcome Collection' folder exists")

        # Check Welcome designs moved
        welcome_designs = _find_designs_by_title(backend, "Welcome")
        folder_id = folder.get("_id")
        moved = [d for d in welcome_designs if d.get("folderId") == folder_id]

        if len(moved) >= 3:
            checks_passed.append(f"[✓] {len(moved)} Welcome designs in folder (minimum 3)")
            # Verify titles contain Welcome
            for d in moved:
                if "welcome" in d.get("title", "").lower():
                    checks_passed.append(f"[✓] '{d.get('title')}' contains 'Welcome'")
        else:
            errors.append(f"[X] Only {len(moved)} Welcome designs in folder, expected at least 3")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 62: EcoTech Brand Package
def _validate_ecotech_brand_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate EcoTech Solutions brand identity package."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        designs_spec = [
            ("EcoTech Solutions - Primary Logo", 500, 500),
            ("EcoTech Solutions - Business Card", 1050, 600),
            ("EcoTech Solutions - LinkedIn Brand Header", 1584, 396),
            ("EcoTech Solutions - Website Header", 1600, 900),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions: {design.get('width')}x{design.get('height')}")

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/EcoTech Solutions/2026 Rebrand")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/EcoTech Solutions/2026 Rebrand' not found")
        else:
            checks_passed.append("[✓] Target folder exists")
            folder_id = folder.get("_id")
            for title, _, _ in designs_spec:
                design = _find_design_by_exact_title(backend, title)
                if design and design.get("folderId") == folder_id:
                    checks_passed.append(f"[✓] '{title}' in correct folder")
                elif design:
                    errors.append(f"[X] '{title}' not in target folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 63: Campaign Launch Multi Format
def _validate_campaign_launch_multi_format(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate multi-format campaign launch designs."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        designs_spec = [
            ("Campaign Launch - IG", 1080, 1080, "instagram-post"),
            ("Campaign Launch - Story", 1080, 1920, "instagram-story"),
            ("Campaign Launch - FB", 1200, 630, "facebook-post"),
            ("Campaign Launch - Twitter", 1500, 500, "twitter-header"),
            ("Campaign Launch - LinkedIn", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, format_type in designs_spec:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions")

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/Campaign Launch/Social Formats")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Campaign Launch/Social Formats' not found")
        else:
            checks_passed.append("[✓] Target folder exists")
            folder_id = folder.get("_id")
            designs_in_folder = _get_designs_in_folder(backend, folder_id)
            if len(designs_in_folder) >= 5:
                checks_passed.append("[✓] All 5 designs in folder")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} designs in folder, expected 5")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 65: Acme Content Analysis
def _validate_acme_content_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Acme designs analyzed."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        acme_designs = _find_designs_by_title(backend, "Acme")
        if len(acme_designs) >= 3:
            checks_passed.append(f"[✓] Found {len(acme_designs)} Acme designs for analysis")

            # Check elements exist for each design
            for design in acme_designs[:3]:
                elements = _get_elements_for_design(backend, design.get("_id"))
                if elements:
                    checks_passed.append(f"[✓] Elements available for '{design.get('title')}'")
                else:
                    errors.append(f"[X] No elements found for '{design.get('title')}'")
        else:
            errors.append(f"[X] Only {len(acme_designs)} Acme designs found, expected at least 3")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 66: Master Brand Asset Library
def _validate_master_brand_asset_library(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate master brand asset library structure."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check new logo created
        logo = _find_design_by_exact_title(backend, "Master Brand Logo 2026")
        if not logo:
            errors.append("[X] Logo 'Master Brand Logo 2026' not found")
        else:
            checks_passed.append("[✓] Master Brand Logo created")
            if _check_design_dimensions(logo, 500, 500):
                checks_passed.append("[✓] Logo has correct dimensions (500x500)")
            else:
                errors.append("[X] Logo has wrong dimensions")

        # Check folder structure
        logos_folder = _find_folder_by_path(backend, "Brand Assets/2026/Primary/Logos")
        if not logos_folder:
            errors.append("[X] Folder 'Brand Assets/2026/Primary/Logos' not found")
        else:
            checks_passed.append("[✓] Logos folder exists")

        social_folder = _find_folder_by_path(backend, "Brand Assets/2026/Primary/Social Templates")
        if not social_folder:
            errors.append("[X] Folder 'Brand Assets/2026/Primary/Social Templates' not found")
        else:
            checks_passed.append("[✓] Social Templates folder exists")

        presentations_folder = _find_folder_by_path(backend, "Brand Assets/2026/Primary/Presentations")
        if not presentations_folder:
            errors.append("[X] Folder 'Brand Assets/2026/Primary/Presentations' not found")
        else:
            checks_passed.append("[✓] Presentations folder exists")

        # Check at least 5 designs organized
        total_organized = 0
        for folder in [logos_folder, social_folder, presentations_folder]:
            if folder:
                designs = _get_designs_in_folder(backend, folder.get("_id"))
                total_organized += len(designs)

        if total_organized >= 5:
            checks_passed.append(f"[✓] {total_organized} designs organized (minimum 5)")
        else:
            errors.append(f"[X] Only {total_organized} designs organized, expected at least 5")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 67: Summer Campaign Multi Format
def _validate_summer_campaign_multi_format(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Summer 2026 campaign designs."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        designs_spec = [
            ("Summer Campaign - Instagram Story", 1080, 1920),
            ("Summer Campaign - Facebook Post", 1200, 630),
            ("Summer Campaign - YouTube Thumbnail", 1280, 720),
            ("Summer Campaign - Presentation Cover", 1920, 1080),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions")

        # Check folder
        folder = _find_folder_by_path(backend, "Personal/Marketing/Summer 2026")
        if not folder:
            errors.append("[X] Folder 'Personal/Marketing/Summer 2026' not found")
        else:
            checks_passed.append("[✓] Target folder exists")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 68: Starlight Social Media Audit
def _validate_starlight_social_media_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Starlight social media designs reorganized and analyzed."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/Social Media Assets")
        if not folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio/Social Media Assets' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Folder created")

        # Check Starlight designs moved
        starlight_designs = _find_designs_by_title(backend, "Starlight")
        folder_id = folder.get("_id")
        moved = [d for d in starlight_designs if d.get("folderId") == folder_id]

        if moved:
            checks_passed.append(f"[✓] {len(moved)} Starlight designs in folder")

            # Check multiple formats
            formats = set(d.get("format", "") for d in moved)
            if len(formats) >= 2:
                checks_passed.append(f"[✓] Multiple formats found: {', '.join(formats)}")
            else:
                errors.append("[X] Expected multiple social media formats")
        else:
            errors.append("[X] No Starlight designs in folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 69: Welcome Designs Presentation
def _validate_welcome_designs_presentation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Welcome designs reorganized with overview presentation."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check folder structure
        ig_folder = _find_folder_by_path(backend, "Welcome Designs/Instagram Posts")
        if not ig_folder:
            errors.append("[X] Folder 'Welcome Designs/Instagram Posts' not found")
        else:
            checks_passed.append("[✓] Instagram Posts folder exists")

        starlight_folder = _find_folder_by_path(backend, "Welcome Designs/Starlight Projects")
        if not starlight_folder:
            errors.append("[X] Folder 'Welcome Designs/Starlight Projects' not found")
        else:
            checks_passed.append("[✓] Starlight Projects folder exists")

        # Check overview presentation
        overview = _find_design_by_exact_title(backend, "Welcome Designs Overview")
        if not overview:
            errors.append("[X] Presentation 'Welcome Designs Overview' not found")
        else:
            checks_passed.append("[✓] Overview presentation created")
            if _check_design_dimensions(overview, 1920, 1080):
                checks_passed.append("[✓] Presentation has correct dimensions (1920x1080)")
            else:
                errors.append("[X] Presentation has wrong dimensions")

            # Check in root Welcome Designs folder
            root_folder = _find_folder_by_name(backend, "Welcome Designs", is_root=True)
            if root_folder and overview.get("folderId") == root_folder.get("_id"):
                checks_passed.append("[✓] Presentation in root Welcome Designs folder")
            elif root_folder:
                errors.append("[X] Presentation not in root folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 70: Client Presentation Package
def _validate_client_presentation_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate three client presentations created."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        presentations = [
            "Client Onboarding Deck",
            "Quarterly Review Presentation",
            "Project Proposal Template"
        ]

        for title in presentations:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Presentation '{title}' not found")
            else:
                checks_passed.append(f"[✓] '{title}' created")
                if _check_design_dimensions(design, 1920, 1080):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions (1920x1080)")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions")

        # Check folder
        folder = _find_folder_by_path(backend, "Client Services/Presentations/2026/Templates")
        if not folder:
            errors.append("[X] Folder 'Client Services/Presentations/2026/Templates' not found")
        else:
            checks_passed.append("[✓] Folder hierarchy exists")
            designs_in_folder = _get_designs_in_folder(backend, folder.get("_id"))
            if len(designs_in_folder) >= 3:
                checks_passed.append("[✓] All 3 presentations in folder")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} presentations in folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 75: Client Folder Consolidation
def _validate_client_folder_consolidation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Acme and Starlight designs consolidated."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/All Clients/Q1 Projects")
        if not folder:
            errors.append("[X] Folder 'Client Work/All Clients/Q1 Projects' not found")
            return _make_task_score(errors, checks_passed)

        checks_passed.append("[✓] Consolidation folder created")
        folder_id = folder.get("_id")

        # Check designs moved
        designs_in_folder = _get_designs_in_folder(backend, folder_id)

        # Check for specific designs
        expected_designs = [
            "Acme Q1 Strategy Deck",
            "Acme Logo Concepts",
            "Welcome Instagram Post (Acme)",
            "Welcome Instagram Post (Starlight)"
        ]

        found_count = 0
        for expected in expected_designs:
            for d in designs_in_folder:
                if expected.lower() in d.get("title", "").lower():
                    found_count += 1
                    checks_passed.append(f"[✓] '{expected}' in folder")
                    break

        if found_count < 2:
            errors.append(f"[X] Only {found_count} expected designs found in folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 78: Acme Starlight Client Archive
def _validate_acme_starlight_client_archive(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate Acme and Starlight designs archived separately."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        # Check Acme folder
        acme_folder = _find_folder_by_path(backend, "Client Archives/Acme Corp/2026 Projects")
        if not acme_folder:
            errors.append("[X] Folder 'Client Archives/Acme Corp/2026 Projects' not found")
        else:
            checks_passed.append("[✓] Acme archive folder exists")
            acme_designs = _find_designs_by_title(backend, "Acme")
            moved_acme = [d for d in acme_designs if d.get("folderId") == acme_folder.get("_id")]
            if len(moved_acme) >= 3:
                checks_passed.append(f"[✓] {len(moved_acme)} Acme designs archived")
            else:
                errors.append(f"[X] Only {len(moved_acme)} Acme designs archived, expected more")

        # Check Starlight folder
        starlight_folder = _find_folder_by_path(backend, "Client Archives/Starlight Studio/2026 Projects")
        if not starlight_folder:
            errors.append("[X] Folder 'Client Archives/Starlight Studio/2026 Projects' not found")
        else:
            checks_passed.append("[✓] Starlight archive folder exists")
            starlight_designs = _find_designs_by_title(backend, "Starlight")
            moved_starlight = [d for d in starlight_designs if d.get("folderId") == starlight_folder.get("_id")]
            if len(moved_starlight) >= 3:
                checks_passed.append(f"[✓] {len(moved_starlight)} Starlight designs archived")
            else:
                errors.append(f"[X] Only {len(moved_starlight)} Starlight designs archived, expected more")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 84: DevCon Conference Promotion
def _validate_devcon_conference_promotion(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate DevCon 2026 promotion materials."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        designs_spec = [
            ("DevCon 2026 - Main Poster", 1080, 1920),
            ("DevCon 2026 - Speaker Card", 1050, 600),
            ("DevCon 2026 - Info Flyer", 2480, 3508),
            ("DevCon 2026 - Sponsor Deck", 1920, 1080),
        ]

        for title, width, height in designs_spec:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
            else:
                checks_passed.append(f"[✓] Design '{title}' found")
                if _check_design_dimensions(design, width, height):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions ({width}x{height})")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions")

        # Check Print Materials folder
        print_folder = _find_folder_by_path(backend, "Events/DevCon 2026/Print Materials")
        if not print_folder:
            errors.append("[X] Folder 'Events/DevCon 2026/Print Materials' not found")
        else:
            checks_passed.append("[✓] Print Materials folder exists")
            # Check poster and flyer in print folder
            poster = _find_design_by_exact_title(backend, "DevCon 2026 - Main Poster")
            flyer = _find_design_by_exact_title(backend, "DevCon 2026 - Info Flyer")
            if poster and poster.get("folderId") == print_folder.get("_id"):
                checks_passed.append("[✓] Poster in Print Materials")
            if flyer and flyer.get("folderId") == print_folder.get("_id"):
                checks_passed.append("[✓] Flyer in Print Materials")

        # Check Digital Assets folder
        digital_folder = _find_folder_by_path(backend, "Events/DevCon 2026/Digital Assets")
        if not digital_folder:
            errors.append("[X] Folder 'Events/DevCon 2026/Digital Assets' not found")
        else:
            checks_passed.append("[✓] Digital Assets folder exists")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))




# Task 88: Brand Logo Concepts
def _validate_brand_logo_concepts(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """Validate three brand logo concepts created."""
    errors: List[str] = []
    checks_passed: List[str] = []

    try:
        logo_titles = [
            "Brand Logo Concept A",
            "Brand Logo Concept B",
            "Brand Logo Concept C"
        ]

        for title in logo_titles:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Logo '{title}' not found")
            else:
                checks_passed.append(f"[✓] Logo '{title}' found")
                if _check_design_dimensions(design, 500, 500):
                    checks_passed.append(f"[✓] '{title}' has correct dimensions (500x500)")
                else:
                    errors.append(f"[X] '{title}' has wrong dimensions")

        # Check folder
        folder = _find_folder_by_path(backend, "Brand Assets/New Concepts/2026")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/New Concepts/2026' not found")
        else:
            checks_passed.append("[✓] Folder exists")
            designs_in_folder = _get_designs_in_folder(backend, folder.get("_id"))
            if len(designs_in_folder) >= 3:
                checks_passed.append("[✓] All 3 logos in folder")
            else:
                errors.append(f"[X] Only {len(designs_in_folder)} logos in folder")

        return _make_task_score(errors, checks_passed)
    except Exception as e:
        logger.error(f"Error: {e}")
        return TaskScore(score=0.0, metadata=ScoreMetadata(
            success_accumulator=checks_passed,
            error_accumulator=errors + [f"[X] Runtime error: {str(e)}"]
        ))



# ==============================================================================
# Validation Functions - Task 1-10
# ==============================================================================
def _validate_client_folder_structure_logo_story_org(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate folder structure for client work with Logo and Story organization.
    - 'Digital Agency/Q2 2026/Brand Guidelines/Logo Concepts' folder exists
    - 'Digital Agency/Q2 2026/Brand Guidelines/Social Templates' folder exists
    - At least 1 design with 'Logo' in title moved to Logo Concepts
    - At least 2 designs with 'Story' in title moved to Social Templates
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Logo Concepts folder
        logo_folder = _find_folder_by_path(backend, "Digital Agency/Q2 2026/Brand Guidelines/Logo Concepts")
        if not logo_folder:
            errors.append("[X] Folder 'Digital Agency/Q2 2026/Brand Guidelines/Logo Concepts' not found")
        else:
            checks_passed.append("[OK] Folder 'Digital Agency/Q2 2026/Brand Guidelines/Logo Concepts' exists")

            # Check designs with 'Logo' in title
            designs_in_folder = _get_designs_in_folder(backend, logo_folder["_id"])
            logo_designs = [d for d in designs_in_folder if "logo" in d.get("title", "").lower()]

            if len(logo_designs) >= 1:
                checks_passed.append(f"[OK] Found {len(logo_designs)} design(s) with 'Logo' in title in Logo Concepts folder")
            else:
                errors.append(f"[X] Found {len(logo_designs)} designs with 'Logo' in title, expected at least 1")

        # Check Social Templates folder
        social_folder = _find_folder_by_path(backend, "Digital Agency/Q2 2026/Brand Guidelines/Social Templates")
        if not social_folder:
            errors.append("[X] Folder 'Digital Agency/Q2 2026/Brand Guidelines/Social Templates' not found")
        else:
            checks_passed.append("[OK] Folder 'Digital Agency/Q2 2026/Brand Guidelines/Social Templates' exists")

            # Check designs with 'Story' in title
            designs_in_folder = _get_designs_in_folder(backend, social_folder["_id"])
            story_designs = [d for d in designs_in_folder if "story" in d.get("title", "").lower()]

            if len(story_designs) >= 2:
                checks_passed.append(f"[OK] Found {len(story_designs)} design(s) with 'Story' in title in Social Templates folder")
            else:
                errors.append(f"[X] Found {len(story_designs)} designs with 'Story' in title, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_client_folder_structure_logo_story_org: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_designs_reorganize_text_extract(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme designs reorganization with text extraction.
    - Folder 'Client Work/Acme Corp/Q2 2026/All Formats' exists
    - At least 8 designs with 'Acme' in title moved to folder
    - Acme Logo Concepts text content extracted
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q2 2026/All Formats")
        if not folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q2 2026/All Formats' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Work/Acme Corp/Q2 2026/All Formats' exists")
        folder_id = folder["_id"]

        # Check designs with 'Acme' in title
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        acme_designs = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

        if len(acme_designs) >= 8:
            checks_passed.append(f"[OK] Found {len(acme_designs)} designs with 'Acme' in title (required: 8+)")
        else:
            errors.append(f"[X] Found {len(acme_designs)} designs with 'Acme' in title, expected at least 8")

        # Check Acme Logo Concepts exists
        logo_design = _find_design_by_exact_title(backend, "Acme Logo Concepts")
        if logo_design:
            checks_passed.append("[OK] Design 'Acme Logo Concepts' found")

            # Check it has elements (text extraction happened)
            elements = _get_elements_for_design(backend, logo_design.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] 'Acme Logo Concepts' has {len(text_elements)} text elements for extraction")
            else:
                checks_passed.append("[OK] 'Acme Logo Concepts' elements accessible for extraction")
        else:
            errors.append("[X] Design 'Acme Logo Concepts' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_designs_reorganize_text_extract: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_story_designs_archive_flash_sale_compare(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Story designs archived and Flash Sale comparison.
    - Folder 'Personal/Social Media/Instagram Stories/Archive' exists
    - Story designs moved to archive
    - Both Flash Sale Story designs exist for comparison
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram Stories/Archive")
        if not folder:
            errors.append("[X] Folder 'Personal/Social Media/Instagram Stories/Archive' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Social Media/Instagram Stories/Archive' exists")
        folder_id = folder["_id"]

        # Check story designs moved
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        story_designs = [d for d in designs_in_folder if "story" in d.get("title", "").lower()]

        if len(story_designs) >= 1:
            checks_passed.append(f"[OK] Found {len(story_designs)} Story design(s) in archive folder")
        else:
            errors.append("[X] No Story designs found in archive folder")

        # Check Flash Sale Story exists
        flash_sale = _find_design_by_exact_title(backend, "Flash Sale Story")
        if flash_sale:
            checks_passed.append("[OK] Design 'Flash Sale Story' found")
        else:
            errors.append("[X] Design 'Flash Sale Story' not found")

        # Check Flash Sale Story (Starlight) exists
        flash_sale_starlight = _find_design_by_exact_title(backend, "Flash Sale Story (Starlight)")
        if flash_sale_starlight:
            checks_passed.append("[OK] Design 'Flash Sale Story (Starlight)' found")
        else:
            errors.append("[X] Design 'Flash Sale Story (Starlight)' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_story_designs_archive_flash_sale_compare: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_phoenix_tech_marketing_materials_org(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Phoenix Tech marketing materials organization.
    - Folder 'Client Projects/Phoenix Tech/Q1 2026/Marketing Materials' exists
    - At least 1 Tech/Conference design moved
    - New 'Phoenix Tech Overview' presentation (1920x1080) created
    - At least 2 designs total in folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Projects/Phoenix Tech/Q1 2026/Marketing Materials")
        if not folder:
            errors.append("[X] Folder 'Client Projects/Phoenix Tech/Q1 2026/Marketing Materials' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Projects/Phoenix Tech/Q1 2026/Marketing Materials' exists")
        folder_id = folder["_id"]

        # Check Phoenix Tech Overview design
        overview = _find_design_by_exact_title(backend, "Phoenix Tech Overview")
        if overview:
            checks_passed.append("[OK] Design 'Phoenix Tech Overview' found")

            ok, msg = _check_design_dimensions_detailed(overview, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] 'Phoenix Tech Overview' {msg}")
            else:
                errors.append(f"[X] 'Phoenix Tech Overview' {msg}")

            ok, msg = _check_design_format_detailed(overview, "presentation")
            if ok:
                checks_passed.append(f"[OK] 'Phoenix Tech Overview' {msg}")
            else:
                errors.append(f"[X] 'Phoenix Tech Overview' {msg}")
        else:
            errors.append("[X] Design 'Phoenix Tech Overview' not found")

        # Count total designs in folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        if len(designs_in_folder) >= 2:
            checks_passed.append(f"[OK] Found {len(designs_in_folder)} designs in Marketing Materials folder (required: 2+)")
        else:
            errors.append(f"[X] Found {len(designs_in_folder)} designs in folder, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_phoenix_tech_marketing_materials_org: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_a4_monthly_report_series(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate A4 monthly report document series.
    - Three A4 documents with exact titles exist
    - All have dimensions 2480x3508
    - All in 'Personal/Docs/Docs (A4)' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Docs/Docs (A4)")
        if not folder:
            errors.append("[X] Folder 'Personal/Docs/Docs (A4)' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Docs/Docs (A4)' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Monthly Report - January", 2480, 3508, "a4-document"),
            ("Monthly Report - February", 2480, 3508, "a4-document"),
            ("Monthly Report - March", 2480, 3508, "a4-document"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Docs (A4) folder")
            else:
                errors.append(f"[X] '{title}' is not in Docs (A4) folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_a4_monthly_report_series: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_designs_move_to_social(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme designs moved to Social folder.
    - Folder 'Client Work/Acme Corp/Q1 2026/Social' exists
    - At least 2 Acme designs moved to folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q1 2026/Social")
        if not folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q1 2026/Social' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Work/Acme Corp/Q1 2026/Social' exists")
        folder_id = folder["_id"]

        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        acme_designs = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

        if len(acme_designs) >= 2:
            checks_passed.append(f"[OK] Found {len(acme_designs)} Acme designs in Social folder (required: 2+)")
        else:
            errors.append(f"[X] Found {len(acme_designs)} Acme designs in Social folder, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_designs_move_to_social: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_poster_resize_to_youtube_thumbnail(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resized to YouTube thumbnail.
    - Dimensions changed to 1280x720
    - Format changed to 'custom'
    - Design elements preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        ok, msg = _check_design_dimensions_detailed(design, 1280, 720)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        if _check_design_format(design, "custom"):
            checks_passed.append("[OK] Format changed to 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Check elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements preserved")
        else:
            errors.append("[X] No elements found - design integrity may be compromised")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_poster_resize_to_youtube_thumbnail: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_zenith_brand_identity_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Zenith Industries brand identity package.
    - 'Zenith Industries - Logo' (500x500)
    - 'Zenith Industries - Business Card' (1050x600)
    - 'Zenith Industries - Letterhead' (2480x3508)
    - All in 'Brand Assets/Zenith Industries/Core Identity' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Zenith Industries/Core Identity")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Zenith Industries/Core Identity' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Zenith Industries/Core Identity' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Zenith Industries - Logo", 500, 500, "logo"),
            ("Zenith Industries - Business Card", 1050, 600, "business-card"),
            ("Zenith Industries - Letterhead", 2480, 3508, "a4-document"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Core Identity folder")
            else:
                errors.append(f"[X] '{title}' is not in Core Identity folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_zenith_brand_identity_package: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_instagram_starlight_designs_organize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Instagram and Starlight designs organization.
    - 'Personal/Social Media/Instagram/Campaign Archive' folder with 4+ Instagram designs
    - 'Client Work/Starlight Studio/All Assets' folder with 6+ Starlight designs
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Instagram folder
        instagram_folder = _find_folder_by_path(backend, "Personal/Social Media/Instagram/Campaign Archive")
        if not instagram_folder:
            errors.append("[X] Folder 'Personal/Social Media/Instagram/Campaign Archive' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Social Media/Instagram/Campaign Archive' exists")

            designs = _get_designs_in_folder(backend, instagram_folder["_id"])
            instagram_designs = [d for d in designs if "instagram" in d.get("title", "").lower()]

            if len(instagram_designs) >= 4:
                checks_passed.append(f"[OK] Found {len(instagram_designs)} Instagram designs (required: 4+)")
            else:
                errors.append(f"[X] Found {len(instagram_designs)} Instagram designs, expected at least 4")

        # Check Starlight folder
        starlight_folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/All Assets")
        if not starlight_folder:
            errors.append("[X] Folder 'Client Work/Starlight Studio/All Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Starlight Studio/All Assets' exists")

            designs = _get_designs_in_folder(backend, starlight_folder["_id"])
            starlight_designs = [d for d in designs if "starlight" in d.get("title", "").lower()]

            if len(starlight_designs) >= 6:
                checks_passed.append(f"[OK] Found {len(starlight_designs)} Starlight designs (required: 6+)")
            else:
                errors.append(f"[X] Found {len(starlight_designs)} Starlight designs, expected at least 6")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_instagram_starlight_designs_organize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)



# ==============================================================================
# Validation Functions - Task 11-20
# ==============================================================================
def _validate_live_music_festival_marketing_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Festival 2026 marketing suite.
    - Five designs with exact titles and dimensions
    - All in 'Events/2026/Live Music Festival/Marketing Materials' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Events/2026/Live Music Festival/Marketing Materials")
        if not folder:
            errors.append("[X] Folder 'Events/2026/Live Music Festival/Marketing Materials' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Events/2026/Live Music Festival/Marketing Materials' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Festival Story Teaser", 1080, 1920, "instagram-story"),
            ("Festival Main Poster", 1080, 1920, "poster"),
            ("Festival Program Guide", 2480, 3508, "a4-document"),
            ("Festival Promotional Flyer", 2480, 3508, "flyer"),
            ("Festival Website Header", 1600, 400, "custom"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Marketing Materials folder")
            else:
                errors.append(f"[X] '{title}' is not in Marketing Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_festival_marketing_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_poster_element_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster element analysis.
    - Design has correct dimensions (1080x1920)
    - 12 total elements (8 shapes, 4 text, 0 images)
    - Font family 'Inter' used
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        ok, msg = _check_design_dimensions_detailed(design, 1080, 1920)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        type_counts = _count_elements_by_type(elements)

        checks_passed.append(f"[OK] Total elements: {len(elements)}")
        checks_passed.append(f"[OK] Element breakdown: {type_counts}")

        # Check for text elements
        text_elements = _get_text_elements_from_list(elements)
        if text_elements:
            checks_passed.append(f"[OK] Found {len(text_elements)} text elements")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_element_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_wellness_brand_social_templates(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate wellness brand social media templates.
    - Three designs with exact titles and dimensions
    - All in 'Templates/Wellness Brand/Social Media' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Templates/Wellness Brand/Social Media")
        if not folder:
            errors.append("[X] Folder 'Templates/Wellness Brand/Social Media' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Templates/Wellness Brand/Social Media' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Wellness Wednesday - Story Template", 1080, 1920, "instagram-story"),
            ("Wellness Wednesday - Facebook Template", 1200, 630, "facebook-post"),
            ("Wellness Coach - Business Card", 1050, 600, "business-card"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Social Media folder")
            else:
                errors.append(f"[X] '{title}' is not in Social Media folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_wellness_brand_social_templates: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_youtube_tech_tutorial_thumbnails(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate YouTube Tech Tutorial thumbnails series.
    - Four thumbnails with titles Part 1-4
    - All 1280x720 youtube-thumbnail format
    - All in 'Personal/Video/YouTube Thumbnails/Tech Series' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Video/YouTube Thumbnails/Tech Series")
        if not folder:
            errors.append("[X] Folder 'Personal/Video/YouTube Thumbnails/Tech Series' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Video/YouTube Thumbnails/Tech Series' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Tech Tutorial - Part 1", 1280, 720, "youtube-thumbnail"),
            ("Tech Tutorial - Part 2", 1280, 720, "youtube-thumbnail"),
            ("Tech Tutorial - Part 3", 1280, 720, "youtube-thumbnail"),
            ("Tech Tutorial - Part 4", 1280, 720, "youtube-thumbnail"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Tech Series folder")
            else:
                errors.append(f"[X] '{title}' is not in Tech Series folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_youtube_tech_tutorial_thumbnails: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_spring_product_launch_social_kit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Spring Product Launch 2026 social media kit.
    - Four designs with exact titles and dimensions
    - All in 'Personal/Product Launches/Spring 2026/Social Media Kit' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Product Launches/Spring 2026/Social Media Kit")
        if not folder:
            errors.append("[X] Folder 'Personal/Product Launches/Spring 2026/Social Media Kit' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Product Launches/Spring 2026/Social Media Kit' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Spring Launch - Instagram", 1080, 1080, "instagram-post"),
            ("Spring Launch - Story", 1080, 1920, "instagram-story"),
            ("Spring Launch - LinkedIn", 1584, 396, "linkedin-banner"),
            ("Spring Launch - YouTube", 1280, 720, "youtube-thumbnail"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Social Media Kit folder")
            else:
                errors.append(f"[X] '{title}' is not in Social Media Kit folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_spring_product_launch_social_kit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_q2_campaign_structure(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme Q2 2026 campaign structure.
    - Folder 'Client Work/Acme Corp/Q2 2026/Campaign Assets' exists
    - Three new designs created with correct dimensions
    - At least 5 designs total in Campaign Assets folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q2 2026/Campaign Assets")
        if not folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q2 2026/Campaign Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Work/Acme Corp/Q2 2026/Campaign Assets' exists")
        folder_id = folder["_id"]

        # Check new designs
        new_designs = [
            ("Q2 Product Launch Post", 1080, 1080, "instagram-post"),
            ("Q2 Product Launch Facebook", 1200, 630, "facebook-post"),
            ("Q2 Product Launch Header", 1500, 500, "twitter-header"),
        ]

        for title, width, height, fmt in new_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

        # Check total designs in folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        if len(designs_in_folder) >= 5:
            checks_passed.append(f"[OK] Found {len(designs_in_folder)} designs in Campaign Assets folder (required: 5+)")
        else:
            errors.append(f"[X] Found {len(designs_in_folder)} designs in folder, expected at least 5")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_q2_campaign_structure: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_newsletter_template_system(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate advanced newsletter template system.
    - Two new designs created (Monthly Newsletter Template, Event Announcement Flyer)
    - Folder structures created
    - Designs organized in correct folders
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Newsletters folder
        newsletters_folder = _find_folder_by_path(backend, "Templates/Print/Newsletters")
        if not newsletters_folder:
            errors.append("[X] Folder 'Templates/Print/Newsletters' not found")
        else:
            checks_passed.append("[OK] Folder 'Templates/Print/Newsletters' exists")

        # Check Marketing folder
        marketing_folder = _find_folder_by_path(backend, "Templates/Print/Marketing")
        if not marketing_folder:
            errors.append("[X] Folder 'Templates/Print/Marketing' not found")
        else:
            checks_passed.append("[OK] Folder 'Templates/Print/Marketing' exists")

        # Check Monthly Newsletter Template
        newsletter = _find_design_by_exact_title(backend, "Monthly Newsletter Template")
        if newsletter:
            checks_passed.append("[OK] Design 'Monthly Newsletter Template' found")
            ok, msg = _check_design_dimensions_detailed(newsletter, 2480, 3508)
            if ok:
                checks_passed.append(f"[OK] 'Monthly Newsletter Template' {msg}")
            else:
                errors.append(f"[X] 'Monthly Newsletter Template' {msg}")

            if newsletters_folder and _check_design_in_folder(newsletter, newsletters_folder["_id"]):
                checks_passed.append("[OK] 'Monthly Newsletter Template' is in Newsletters folder")
            else:
                errors.append("[X] 'Monthly Newsletter Template' is not in Newsletters folder")
        else:
            errors.append("[X] Design 'Monthly Newsletter Template' not found")

        # Check Event Announcement Flyer
        flyer = _find_design_by_exact_title(backend, "Event Announcement Flyer")
        if flyer:
            checks_passed.append("[OK] Design 'Event Announcement Flyer' found")
            ok, msg = _check_design_dimensions_detailed(flyer, 2480, 3508)
            if ok:
                checks_passed.append(f"[OK] 'Event Announcement Flyer' {msg}")
            else:
                errors.append(f"[X] 'Event Announcement Flyer' {msg}")

            if marketing_folder and _check_design_in_folder(flyer, marketing_folder["_id"]):
                checks_passed.append("[OK] 'Event Announcement Flyer' is in Marketing folder")
            else:
                errors.append("[X] 'Event Announcement Flyer' is not in Marketing folder")
        else:
            errors.append("[X] Design 'Event Announcement Flyer' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_newsletter_template_system: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_podcast_designs_consolidate(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate podcast designs consolidation.
    - Folder 'Personal/Video/Podcast Archive' exists
    - New 'Podcast Episode 25 - Special Guest' thumbnail (1280x720) created
    - At least 4 podcast designs in archive
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Video/Podcast Archive")
        if not folder:
            errors.append("[X] Folder 'Personal/Video/Podcast Archive' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Video/Podcast Archive' exists")
        folder_id = folder["_id"]

        # Check new podcast thumbnail
        new_podcast = _find_design_by_exact_title(backend, "Podcast Episode 25 - Special Guest")
        if new_podcast:
            checks_passed.append("[OK] Design 'Podcast Episode 25 - Special Guest' found")

            ok, msg = _check_design_dimensions_detailed(new_podcast, 1280, 720)
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            ok, msg = _check_design_format_detailed(new_podcast, "youtube-thumbnail")
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")
        else:
            errors.append("[X] Design 'Podcast Episode 25 - Special Guest' not found")

        # Check total podcast designs in folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        podcast_designs = [d for d in designs_in_folder if "podcast" in d.get("title", "").lower()]

        if len(podcast_designs) >= 4:
            checks_passed.append(f"[OK] Found {len(podcast_designs)} podcast designs in archive (required: 4+)")
        else:
            errors.append(f"[X] Found {len(podcast_designs)} podcast designs in archive, expected at least 4")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_podcast_designs_consolidate: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_print_archive_system_setup(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Print Archive system setup.
    - Folder 'Brand Assets/Print Archive/2026/Q1' exists
    - At least 4 designs moved (Flyer, Poster, Business Card, or Newsletter)
    - Business Card — Alice Chen analysis (1050x600)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Print Archive/2026/Q1")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Print Archive/2026/Q1' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Print Archive/2026/Q1' exists")
        folder_id = folder["_id"]

        # Count print designs in folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        print_keywords = ["flyer", "poster", "business card", "newsletter"]
        print_designs = [d for d in designs_in_folder
                        if any(kw in d.get("title", "").lower() for kw in print_keywords)]

        if len(print_designs) >= 4:
            checks_passed.append(f"[OK] Found {len(print_designs)} print designs in Q1 folder (required: 4+)")
        else:
            errors.append(f"[X] Found {len(print_designs)} print designs in Q1 folder, expected at least 4")

        # Check Business Card — Alice Chen
        business_card = _find_design_by_title(backend, "Business Card — Alice Chen")
        if business_card:
            checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")

            ok, msg = _check_design_dimensions_detailed(business_card, 1050, 600)
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            # Check elements for analysis
            elements = _get_elements_for_design(backend, business_card.get("_id"))
            if elements:
                checks_passed.append(f"[OK] Business card has {len(elements)} elements for analysis")
                type_counts = _count_elements_by_type(elements)
                checks_passed.append(f"[OK] Element breakdown: {type_counts}")
        else:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_print_archive_system_setup: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)



# ==============================================================================
# Validation Functions - Task 21-30
# ==============================================================================
def _validate_acme_project_structure_overview(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme project structure with overview design.
    - Folder structure 'Projects/Acme Corporation/Q1 Assets/Presentations' and '/Social Posts'
    - Acme Q1 Strategy Deck in Presentations
    - Acme Logo Concepts and Welcome Instagram Post (Acme) in Social Posts
    - New 'Acme Project Overview' (1600x900) in Q1 Assets
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check folders
        presentations_folder = _find_folder_by_path(backend, "Projects/Acme Corporation/Q1 Assets/Presentations")
        social_folder = _find_folder_by_path(backend, "Projects/Acme Corporation/Q1 Assets/Social Posts")
        q1_folder = _find_folder_by_path(backend, "Projects/Acme Corporation/Q1 Assets")

        if presentations_folder:
            checks_passed.append("[OK] Folder 'Projects/Acme Corporation/Q1 Assets/Presentations' exists")
        else:
            errors.append("[X] Folder 'Projects/Acme Corporation/Q1 Assets/Presentations' not found")

        if social_folder:
            checks_passed.append("[OK] Folder 'Projects/Acme Corporation/Q1 Assets/Social Posts' exists")
        else:
            errors.append("[X] Folder 'Projects/Acme Corporation/Q1 Assets/Social Posts' not found")

        # Check Acme Project Overview
        overview = _find_design_by_exact_title(backend, "Acme Project Overview")
        if overview:
            checks_passed.append("[OK] Design 'Acme Project Overview' found")

            ok, msg = _check_design_dimensions_detailed(overview, 1600, 900)
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            if q1_folder and _check_design_in_folder(overview, q1_folder["_id"]):
                checks_passed.append("[OK] 'Acme Project Overview' is in Q1 Assets folder")
            else:
                errors.append("[X] 'Acme Project Overview' is not in Q1 Assets folder")
        else:
            errors.append("[X] Design 'Acme Project Overview' not found")

        # Check Acme Q1 Strategy Deck in Presentations
        strategy_deck = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if strategy_deck and presentations_folder:
            if _check_design_in_folder(strategy_deck, presentations_folder["_id"]):
                checks_passed.append("[OK] 'Acme Q1 Strategy Deck' is in Presentations folder")
            else:
                errors.append("[X] 'Acme Q1 Strategy Deck' is not in Presentations folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_project_structure_overview: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_spring_festival_multiformat_assets(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Spring Festival 2026 multi-format assets.
    - Four designs with correct dimensions
    - Print assets in 'Personal/Print/Spring Festival 2026'
    - Social assets in 'Personal/Social Media/Spring Campaign'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        print_folder = _find_folder_by_path(backend, "Personal/Print/Spring Festival 2026")
        social_folder = _find_folder_by_path(backend, "Personal/Social Media/Spring Campaign")

        if print_folder:
            checks_passed.append("[OK] Folder 'Personal/Print/Spring Festival 2026' exists")
        else:
            errors.append("[X] Folder 'Personal/Print/Spring Festival 2026' not found")

        if social_folder:
            checks_passed.append("[OK] Folder 'Personal/Social Media/Spring Campaign' exists")
        else:
            errors.append("[X] Folder 'Personal/Social Media/Spring Campaign' not found")

        # Check designs
        designs_spec = [
            ("Spring Festival Story", 1080, 1920, "instagram-story", social_folder),
            ("Spring Festival Facebook", 1200, 630, "facebook-post", social_folder),
            ("Spring Festival Program", 2480, 3508, "a4-document", print_folder),
            ("Spring Festival Poster", 1080, 1920, "poster", print_folder),
        ]

        for title, width, height, fmt, expected_folder in designs_spec:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if expected_folder and _check_design_in_folder(design, expected_folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in correct folder")
            elif expected_folder:
                errors.append(f"[X] '{title}' is not in correct folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_spring_festival_multiformat_assets: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techsummit_conference_marketing(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechSummit 2026 Conference marketing campaign.
    - Five designs with exact titles and dimensions
    - All in 'Client Work/Events/TechSummit 2026/Marketing Materials' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Events/TechSummit 2026/Marketing Materials")
        if not folder:
            errors.append("[X] Folder 'Client Work/Events/TechSummit 2026/Marketing Materials' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Client Work/Events/TechSummit 2026/Marketing Materials' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("TechSummit 2026 - Instagram", 1080, 1080, "instagram-post"),
            ("TechSummit 2026 - Twitter", 1500, 500, "twitter-header"),
            ("TechSummit 2026 - Sponsor Deck", 1920, 1080, "presentation"),
            ("TechSummit 2026 - Event Flyer", 2480, 3508, "flyer"),
            ("TechSummit 2026 - Promo Video", 1280, 720, "youtube-thumbnail"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Marketing Materials folder")
            else:
                errors.append(f"[X] '{title}' is not in Marketing Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techsummit_conference_marketing: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_typography_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme brand typography analysis.
    - Multiple Acme designs found and analyzed
    - Text elements extracted with font properties
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Find Acme designs
        acme_designs = _find_designs_by_title_pattern(backend, "Acme")

        if len(acme_designs) >= 2:
            checks_passed.append(f"[OK] Found {len(acme_designs)} Acme designs for analysis")
        else:
            errors.append(f"[X] Found {len(acme_designs)} Acme designs, expected at least 2")
            return _make_task_score(errors, checks_passed)

        # Check specific designs exist
        strategy_deck = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if strategy_deck:
            checks_passed.append("[OK] 'Acme Q1 Strategy Deck' found")

            elements = _get_elements_for_design(backend, strategy_deck.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements in Strategy Deck")

        welcome_post = _find_design_by_title(backend, "Welcome Instagram Post (Acme)")
        if welcome_post:
            checks_passed.append("[OK] 'Welcome Instagram Post (Acme)' found")

            elements = _get_elements_for_design(backend, welcome_post.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements in Welcome Post")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_typography_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_archive_alt_designs(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Alt designs archived.
    - Folder 'Archive/2025/Q4' exists
    - 3 designs with 'Alt' in title moved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Archive/2025/Q4")
        if not folder:
            errors.append("[X] Folder 'Archive/2025/Q4' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Archive/2025/Q4' exists")
        folder_id = folder["_id"]

        # Check designs with 'Alt' in title
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        alt_designs = [d for d in designs_in_folder if "alt" in d.get("title", "").lower()]

        if len(alt_designs) >= 3:
            checks_passed.append(f"[OK] Found {len(alt_designs)} Alt designs in archive (required: 3)")
        else:
            errors.append(f"[X] Found {len(alt_designs)} Alt designs in archive, expected at least 3")

        # Check specific Alt designs
        expected_alts = [
            "Acme Logo Concepts (Alt 1)",
            "Acme Logo Concepts (Alt 2)",
            "Live Music Night Poster (Alt 1)",
        ]

        for title in expected_alts:
            design = _find_design_by_exact_title(backend, title)
            if design:
                checks_passed.append(f"[OK] Design '{title}' found")
            else:
                # Not an error - design might have different exact title
                pass

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_archive_alt_designs: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_podcast_thumbnail_element_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Podcast Episode 12 Thumbnail element analysis.
    - Design has correct dimensions (1280x720)
    - 12 total elements
    - Element type breakdown provided
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Podcast Episode 12 Thumbnail")
        if not design:
            errors.append("[X] Design 'Podcast Episode 12 Thumbnail' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Podcast Episode 12 Thumbnail' found")

        ok, msg = _check_design_dimensions_detailed(design, 1280, 720)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        ok, msg = _check_design_format_detailed(design, "youtube-thumbnail")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Get elements
        elements = _get_elements_for_design(backend, design.get("_id"))
        type_counts = _count_elements_by_type(elements)

        if len(elements) == 12:
            checks_passed.append("[OK] Design has exactly 12 elements")
        else:
            checks_passed.append(f"[OK] Design has {len(elements)} elements")

        checks_passed.append(f"[OK] Element breakdown: {type_counts}")

        # Check for shadow effects
        shadow_elements = _get_elements_with_shadow(elements)
        if shadow_elements:
            checks_passed.append(f"[OK] Found {len(shadow_elements)} elements with shadow effects")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_podcast_thumbnail_element_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_announcement_social_set(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference announcement social media set.
    - Three designs with exact titles and dimensions
    - All in 'Brand Assets/Conference Templates' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Conference Templates")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Conference Templates' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Conference Templates' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Conference Announcement Story", 1080, 1920, "instagram-story"),
            ("Conference Announcement Facebook", 1200, 630, "facebook-post"),
            ("Conference Announcement YouTube", 1280, 720, "youtube-thumbnail"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Conference Templates folder")
            else:
                errors.append(f"[X] '{title}' is not in Conference Templates folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_announcement_social_set: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_starlight_logo_v3_comparison(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Starlight Studio Logo V3 creation and comparison.
    - New logo 'Starlight Studio Logo V3' (500x500) in Brand Assets/Logos
    - Acme Logo Concepts exists for comparison
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Logos' exists")

        # Check new logo
        new_logo = _find_design_by_exact_title(backend, "Starlight Studio Logo V3")
        if new_logo:
            checks_passed.append("[OK] Design 'Starlight Studio Logo V3' found")

            ok, msg = _check_design_dimensions_detailed(new_logo, 500, 500)
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            ok, msg = _check_design_format_detailed(new_logo, "logo")
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            if folder and _check_design_in_folder(new_logo, folder["_id"]):
                checks_passed.append("[OK] 'Starlight Studio Logo V3' is in Logos folder")
            else:
                errors.append("[X] 'Starlight Studio Logo V3' is not in Logos folder")
        else:
            errors.append("[X] Design 'Starlight Studio Logo V3' not found")

        # Check Acme Logo Concepts exists
        acme_logo = _find_design_by_exact_title(backend, "Acme Logo Concepts")
        if acme_logo:
            checks_passed.append("[OK] Design 'Acme Logo Concepts' found for comparison")

            ok, msg = _check_design_dimensions_detailed(acme_logo, 500, 500)
            if ok:
                checks_passed.append(f"[OK] Acme Logo Concepts {msg}")
        else:
            errors.append("[X] Design 'Acme Logo Concepts' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_starlight_logo_v3_comparison: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_winter_campaign_folder_hierarchy(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Winter 2026 campaign folder hierarchy.
    - 'Campaigns/Winter 2026/Digital Assets/Social Media Templates' with Welcome designs
    - 'Campaigns/Winter 2026/Digital Assets/Promotions' with Flash Sale designs
    - At least 6 designs relocated total
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        templates_folder = _find_folder_by_path(backend, "Campaigns/Winter 2026/Digital Assets/Social Media Templates")
        promotions_folder = _find_folder_by_path(backend, "Campaigns/Winter 2026/Digital Assets/Promotions")

        if templates_folder:
            checks_passed.append("[OK] Folder 'Campaigns/Winter 2026/Digital Assets/Social Media Templates' exists")

            designs = _get_designs_in_folder(backend, templates_folder["_id"])
            welcome_designs = [d for d in designs if "welcome" in d.get("title", "").lower()]

            if len(welcome_designs) >= 3:
                checks_passed.append(f"[OK] Found {len(welcome_designs)} Welcome designs in Templates folder")
            else:
                errors.append(f"[X] Found {len(welcome_designs)} Welcome designs, expected at least 3")
        else:
            errors.append("[X] Folder 'Campaigns/Winter 2026/Digital Assets/Social Media Templates' not found")

        if promotions_folder:
            checks_passed.append("[OK] Folder 'Campaigns/Winter 2026/Digital Assets/Promotions' exists")

            designs = _get_designs_in_folder(backend, promotions_folder["_id"])
            flash_designs = [d for d in designs if "flash sale" in d.get("title", "").lower()]

            if len(flash_designs) >= 3:
                checks_passed.append(f"[OK] Found {len(flash_designs)} Flash Sale designs in Promotions folder")
            else:
                errors.append(f"[X] Found {len(flash_designs)} Flash Sale designs, expected at least 3")
        else:
            errors.append("[X] Folder 'Campaigns/Winter 2026/Digital Assets/Promotions' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_winter_campaign_folder_hierarchy: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_annual_report_document_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Annual Report 2026 document suite.
    - Three designs with correct dimensions
    - All in 'Corporate Communications/Annual Report 2026/Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Corporate Communications/Annual Report 2026/Assets")
        if not folder:
            errors.append("[X] Folder 'Corporate Communications/Annual Report 2026/Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Corporate Communications/Annual Report 2026/Assets' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Annual Report Executive Summary", 2480, 3508, "a4-document"),
            ("Executive Presentation Deck", 1920, 1080, "presentation"),
            ("Website Hero Section", 1920, 900, "custom"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Assets folder")
            else:
                errors.append(f"[X] '{title}' is not in Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_annual_report_document_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)



# ==============================================================================
# Validation Functions - Task 31-40
# ==============================================================================
def _validate_brand_identity_logo_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate brand identity package with logo resize.
    - Four designs created with correct dimensions
    - All in 'Brand Development/2026/Identity Package' folder
    - Logo resized to 800x200 with custom format
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Development/2026/Identity Package")
        if not folder:
            errors.append("[X] Folder 'Brand Development/2026/Identity Package' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Development/2026/Identity Package' exists")
        folder_id = folder["_id"]

        # Check Brand Identity Logo (should be resized to 800x200)
        logo = _find_design_by_exact_title(backend, "Brand Identity Logo")
        if logo:
            checks_passed.append("[OK] Design 'Brand Identity Logo' found")

            ok, msg = _check_design_dimensions_detailed(logo, 800, 200)
            if ok:
                checks_passed.append(f"[OK] Logo resized: {msg}")
            else:
                errors.append(f"[X] Logo resize failed: {msg}")

            if _check_design_format(logo, "custom"):
                checks_passed.append("[OK] Logo format changed to 'custom' after resize")
            else:
                errors.append(f"[X] Logo format is '{logo.get('format')}', expected 'custom' after resize")
        else:
            errors.append("[X] Design 'Brand Identity Logo' not found")

        # Check other designs
        other_designs = [
            ("Brand Business Card", 1050, 600, "business-card"),
            ("Brand Letterhead", 2480, 3508, "a4-document"),
            ("Brand Website Header", 1600, 400, "custom"),
        ]

        for title, width, height, fmt in other_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_identity_logo_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_flash_sale_content_comparison(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme Q1 Deck and Flash Sale content comparison.
    - Both designs exist with correct dimensions
    - Elements accessible for analysis
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Acme Q1 Strategy Deck
        strategy_deck = _find_design_by_exact_title(backend, "Acme Q1 Strategy Deck")
        if strategy_deck:
            checks_passed.append("[OK] Design 'Acme Q1 Strategy Deck' found")

            ok, msg = _check_design_dimensions_detailed(strategy_deck, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] Strategy Deck {msg}")
            else:
                errors.append(f"[X] Strategy Deck {msg}")

            ok, msg = _check_design_format_detailed(strategy_deck, "presentation")
            if ok:
                checks_passed.append(f"[OK] Strategy Deck {msg}")

            elements = _get_elements_for_design(backend, strategy_deck.get("_id"))
            if elements:
                checks_passed.append(f"[OK] Strategy Deck has {len(elements)} elements for analysis")
        else:
            errors.append("[X] Design 'Acme Q1 Strategy Deck' not found")

        # Check Flash Sale Story
        flash_sale = _find_design_by_exact_title(backend, "Flash Sale Story")
        if flash_sale:
            checks_passed.append("[OK] Design 'Flash Sale Story' found")

            ok, msg = _check_design_dimensions_detailed(flash_sale, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] Flash Sale Story {msg}")
            else:
                errors.append(f"[X] Flash Sale Story {msg}")

            ok, msg = _check_design_format_detailed(flash_sale, "instagram-story")
            if ok:
                checks_passed.append(f"[OK] Flash Sale Story {msg}")

            elements = _get_elements_for_design(backend, flash_sale.get("_id"))
            if elements:
                checks_passed.append(f"[OK] Flash Sale Story has {len(elements)} elements for analysis")
        else:
            errors.append("[X] Design 'Flash Sale Story' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_flash_sale_content_comparison: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_music_festival_event_promotion(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Music Festival 2026 event promotion.
    - Two designs (poster and story) with correct dimensions
    - Poster in Print Assets, Story in Digital Assets
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        digital_folder = _find_folder_by_path(backend, "Personal/Events/Music Festival 2026/Digital Assets")
        print_folder = _find_folder_by_path(backend, "Personal/Events/Music Festival 2026/Print Assets")

        if digital_folder:
            checks_passed.append("[OK] Folder 'Personal/Events/Music Festival 2026/Digital Assets' exists")
        else:
            errors.append("[X] Folder 'Personal/Events/Music Festival 2026/Digital Assets' not found")

        if print_folder:
            checks_passed.append("[OK] Folder 'Personal/Events/Music Festival 2026/Print Assets' exists")
        else:
            errors.append("[X] Folder 'Personal/Events/Music Festival 2026/Print Assets' not found")

        # Check poster
        poster = _find_design_by_exact_title(backend, "Music Festival Main Poster")
        if poster:
            checks_passed.append("[OK] Design 'Music Festival Main Poster' found")

            ok, msg = _check_design_dimensions_detailed(poster, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] Poster {msg}")
            else:
                errors.append(f"[X] Poster {msg}")

            if print_folder and _check_design_in_folder(poster, print_folder["_id"]):
                checks_passed.append("[OK] Poster is in Print Assets folder")
            else:
                errors.append("[X] Poster is not in Print Assets folder")
        else:
            errors.append("[X] Design 'Music Festival Main Poster' not found")

        # Check story
        story = _find_design_by_exact_title(backend, "Music Festival Story Promo")
        if story:
            checks_passed.append("[OK] Design 'Music Festival Story Promo' found")

            ok, msg = _check_design_dimensions_detailed(story, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] Story {msg}")
            else:
                errors.append(f"[X] Story {msg}")

            if digital_folder and _check_design_in_folder(story, digital_folder["_id"]):
                checks_passed.append("[OK] Story is in Digital Assets folder")
            else:
                errors.append("[X] Story is not in Digital Assets folder")
        else:
            errors.append("[X] Design 'Music Festival Story Promo' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_music_festival_event_promotion: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_content_calendar_week1_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Content Calendar Week 1 campaign.
    - Four designs with exact titles and dimensions
    - All in 'Content Calendar/Week 1/Social Posts' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Content Calendar/Week 1/Social Posts")
        if not folder:
            errors.append("[X] Folder 'Content Calendar/Week 1/Social Posts' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Content Calendar/Week 1/Social Posts' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("Week 1 Monday - Content Calendar", 1080, 1080, "instagram-post"),
            ("Week 1 Wednesday - Content Calendar", 1080, 1920, "instagram-story"),
            ("Week 1 Friday - Content Calendar", 1200, 630, "facebook-post"),
            ("Week 1 Sunday - Content Calendar", 1584, 396, "linkedin-banner"),
        ]

        total_text_elements = 0

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Social Posts folder")
            else:
                errors.append(f"[X] '{title}' is not in Social Posts folder")

            # Count text elements
            elements = _get_elements_for_design(backend, design.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            total_text_elements += len(text_elements)

        checks_passed.append(f"[OK] Total text elements across all designs: {total_text_elements}")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_content_calendar_week1_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_quantumtech_brand_identity_system(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate QuantumTech brand identity system.
    - Five designs with exact titles and dimensions
    - All in 'Brand Assets/Logos' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Logos' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("QuantumTech Logo - Primary", 500, 500, "logo"),
            ("QuantumTech Business Card", 1050, 600, "business-card"),
            ("QuantumTech Letterhead", 2480, 3508, "a4-document"),
            ("QuantumTech Social", 1080, 1080, "instagram-post"),
            ("QuantumTech Deck Cover", 1920, 1080, "presentation"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in Logos folder")
            else:
                errors.append(f"[X] '{title}' is not in Logos folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_quantumtech_brand_identity_system: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_content_migration_2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate conference content migration project.
    - Folder 'Archive/2026/Conferences/By Client' with client subfolders
    - Conference designs moved to appropriate client folders
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        base_folder = _find_folder_by_path(backend, "Archive/2026/Conferences/By Client")
        if not base_folder:
            errors.append("[X] Folder 'Archive/2026/Conferences/By Client' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Archive/2026/Conferences/By Client' exists")

        # Check for client subfolders
        child_folders = _get_child_folders(backend, base_folder["_id"])
        if child_folders:
            checks_passed.append(f"[OK] Found {len(child_folders)} client subfolders")

            # Count total designs in client folders
            total_designs = 0
            for child in child_folders:
                designs = _get_designs_in_folder(backend, child["_id"])
                total_designs += len(designs)

            if total_designs >= 1:
                checks_passed.append(f"[OK] Found {total_designs} designs across client folders")
            else:
                errors.append("[X] No designs found in client folders")
        else:
            errors.append("[X] No client subfolders found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_content_migration_2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_flash_sale_community_event_compare(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Flash Sale and Community Event content comparison.
    - Both designs exist with correct dimensions
    - Elements accessible for analysis
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Flash Sale Story
        flash_sale = _find_design_by_exact_title(backend, "Flash Sale Story")
        if flash_sale:
            checks_passed.append("[OK] Design 'Flash Sale Story' found")

            ok, msg = _check_design_dimensions_detailed(flash_sale, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] Flash Sale Story {msg}")
            else:
                errors.append(f"[X] Flash Sale Story {msg}")

            ok, msg = _check_design_format_detailed(flash_sale, "instagram-story")
            if ok:
                checks_passed.append(f"[OK] Flash Sale Story {msg}")

            elements = _get_elements_for_design(backend, flash_sale.get("_id"))
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] Flash Sale Story elements: {type_counts}")
        else:
            errors.append("[X] Design 'Flash Sale Story' not found")

        # Check Community Event Promo
        community = _find_design_by_exact_title(backend, "Community Event Promo")
        if community:
            checks_passed.append("[OK] Design 'Community Event Promo' found")

            ok, msg = _check_design_dimensions_detailed(community, 1200, 630)
            if ok:
                checks_passed.append(f"[OK] Community Event Promo {msg}")
            else:
                errors.append(f"[X] Community Event Promo {msg}")

            ok, msg = _check_design_format_detailed(community, "facebook-post")
            if ok:
                checks_passed.append(f"[OK] Community Event Promo {msg}")

            elements = _get_elements_for_design(backend, community.get("_id"))
            type_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] Community Event Promo elements: {type_counts}")
        else:
            errors.append("[X] Design 'Community Event Promo' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_flash_sale_community_event_compare: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_master_brand_kit_logos(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate master brand kit with logo variations.
    - Three logos (500x500) in 'Brand Assets/Logos/2026 Collection'
    - Business card and letterhead in 'Brand Assets/Business Materials'
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        logos_folder = _find_folder_by_path(backend, "Brand Assets/Logos/2026 Collection")
        materials_folder = _find_folder_by_path(backend, "Brand Assets/Business Materials")

        if logos_folder:
            checks_passed.append("[OK] Folder 'Brand Assets/Logos/2026 Collection' exists")
        else:
            errors.append("[X] Folder 'Brand Assets/Logos/2026 Collection' not found")

        if materials_folder:
            checks_passed.append("[OK] Folder 'Brand Assets/Business Materials' exists")
        else:
            errors.append("[X] Folder 'Brand Assets/Business Materials' not found")

        # Check logos
        logo_designs = [
            ("Brand Logo Primary", 500, 500, "logo"),
            ("Brand Logo Secondary", 500, 500, "logo"),
            ("Brand Logo Mark", 500, 500, "logo"),
        ]

        for title, width, height, fmt in logo_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if logos_folder and _check_design_in_folder(design, logos_folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in 2026 Collection folder")
            else:
                errors.append(f"[X] '{title}' is not in 2026 Collection folder")

        # Check business materials
        business_designs = [
            ("Executive Business Card", 1050, 600, "business-card"),
            ("Company Letterhead", 2480, 3508, "a4-document"),
        ]

        for title, width, height, fmt in business_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if materials_folder and _check_design_in_folder(design, materials_folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Business Materials folder")
            else:
                errors.append(f"[X] '{title}' is not in Business Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_master_brand_kit_logos: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_executive_summary_presentation_2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Executive Summary Q1 2026 presentation.
    - Design exists with correct dimensions (1920x1080)
    - In 'Client Work/Acme Corp/Q1 2026/Decks' folder
    - Text content extracted
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Client Work/Acme Corp/Q1 2026/Decks")
        if not folder:
            errors.append("[X] Folder 'Client Work/Acme Corp/Q1 2026/Decks' not found")
        else:
            checks_passed.append("[OK] Folder 'Client Work/Acme Corp/Q1 2026/Decks' exists")

        design = _find_design_by_exact_title(backend, "Executive Summary Q1 2026")
        if design:
            checks_passed.append("[OK] Design 'Executive Summary Q1 2026' found")

            ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            ok, msg = _check_design_format_detailed(design, "presentation")
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append("[OK] Design is in Decks folder")
            else:
                errors.append("[X] Design is not in Decks folder")

            # Check text content
            elements = _get_elements_for_design(backend, design.get("_id"))
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements for content extraction")
            else:
                checks_passed.append("[OK] Design has elements accessible for content extraction")
        else:
            errors.append("[X] Design 'Executive Summary Q1 2026' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_executive_summary_presentation_2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techcorp_q2_launch_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechCorp Q2 Launch social media campaign.
    - Three designs with exact titles and dimensions
    - All in 'Campaigns/Q2 2026/TechCorp' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Campaigns/Q2 2026/TechCorp")
        if not folder:
            errors.append("[X] Folder 'Campaigns/Q2 2026/TechCorp' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Campaigns/Q2 2026/TechCorp' exists")
        folder_id = folder["_id"]

        expected_designs = [
            ("TechCorp Q2 Launch - Instagram", 1080, 1080, "instagram-post"),
            ("TechCorp Q2 Launch - Story", 1080, 1920, "instagram-story"),
            ("TechCorp Q2 Launch - LinkedIn", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in TechCorp folder")
            else:
                errors.append(f"[X] '{title}' is not in TechCorp folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techcorp_q2_launch_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)



# ==============================================================================
# Validation Functions - Harder Tasks (30 tasks)
# ==============================================================================
def _validate_event_marketing_package_formats(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate event marketing package with precise format requirements.
    - 'Event Networking Card' (1050x600, business-card format)
    - 'Event Announcement Flyer' (2480x3508, flyer format)
    - 'Event Web Banner' (1600x400, custom format)
    - All in 'Marketing/Event Materials' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Marketing/Event Materials")
        if not folder:
            errors.append("[X] Folder 'Marketing/Event Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Marketing/Event Materials' exists")

        expected_designs = [
            ("Event Networking Card", 1050, 600, "business-card"),
            ("Event Announcement Flyer", 2480, 3508, "flyer"),
            ("Event Web Banner", 1600, 400, "custom"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Event Materials folder")
            else:
                errors.append(f"[X] '{title}' is not in Event Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_event_marketing_package_formats: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_design_content_audit_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive content audit across multiple designs.
    - Content extracted from 'Flash Sale Story', 'Live Music Night Poster', 'January Newsletter'
    - 'Design Content Analysis Report' (1920x1080) created in folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check the three source designs exist
        source_designs = ["Flash Sale Story", "Live Music Night Poster", "January Newsletter"]
        for title in source_designs:
            design = _find_design_by_exact_title(backend, title)
            if design:
                checks_passed.append(f"[OK] Source design '{title}' found")
                elements = _get_elements_for_design(backend, design.get("_id"))
                if elements:
                    checks_passed.append(f"[OK] '{title}' has {len(elements)} elements for extraction")
            else:
                errors.append(f"[X] Source design '{title}' not found")

        # Check folder exists
        folder = _find_folder_by_path(backend, "Personal/Docs/Presentations")
        if folder:
            checks_passed.append("[OK] Folder 'Personal/Docs/Presentations' exists")
        else:
            errors.append("[X] Folder 'Personal/Docs/Presentations' not found")

        # Check report design
        report = _find_design_by_exact_title(backend, "Design Content Analysis Report")
        if report:
            checks_passed.append("[OK] Design 'Design Content Analysis Report' found")

            ok, msg = _check_design_dimensions_detailed(report, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] 'Design Content Analysis Report' {msg}")
            else:
                errors.append(f"[X] 'Design Content Analysis Report' {msg}")

            if folder and _check_design_in_folder(report, folder["_id"]):
                checks_passed.append("[OK] Report is in Presentations folder")
            else:
                errors.append("[X] Report is not in Presentations folder")
        else:
            errors.append("[X] Design 'Design Content Analysis Report' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_design_content_audit_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_winter_social_media_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive social media launch campaign.
    - Four designs: Instagram (1080x1080), Facebook (1200x630), Twitter (1500x500), LinkedIn (1584x396)
    - All in 'Campaigns/Winter 2026/Social Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Campaigns/Winter 2026/Social Assets")
        if not folder:
            errors.append("[X] Folder 'Campaigns/Winter 2026/Social Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Campaigns/Winter 2026/Social Assets' exists")

        expected_designs = [
            ("Winter Launch - Instagram", 1080, 1080, "instagram-post"),
            ("Winter Launch - Facebook", 1200, 630, "facebook-post"),
            ("Winter Launch - Twitter", 1500, 500, "twitter-header"),
            ("Winter Launch - LinkedIn", 1584, 396, "linkedin-banner"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Social Assets folder")
            else:
                errors.append(f"[X] '{title}' is not in Social Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_winter_social_media_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_designs_reorganization_2_v2(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference designs reorganization with new Instagram post.
    - Folder 'Events/Tech Conferences/2026/Social Headers' exists
    - 3 Conference designs moved
    - New 'Conference Recap - Instagram' (1080x1080) created
    - Total 4 designs in folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Events/Tech Conferences/2026/Social Headers")
        if not folder:
            errors.append("[X] Folder 'Events/Tech Conferences/2026/Social Headers' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Events/Tech Conferences/2026/Social Headers' exists")
        folder_id = folder["_id"]

        # Check for new Instagram post
        instagram = _find_design_by_exact_title(backend, "Conference Recap - Instagram")
        if instagram:
            checks_passed.append("[OK] Design 'Conference Recap - Instagram' found")

            ok, msg = _check_design_dimensions_detailed(instagram, 1080, 1080)
            if ok:
                checks_passed.append(f"[OK] 'Conference Recap - Instagram' {msg}")
            else:
                errors.append(f"[X] 'Conference Recap - Instagram' {msg}")
        else:
            errors.append("[X] Design 'Conference Recap - Instagram' not found")

        # Check total designs in folder (should be 4: 3 moved + 1 new)
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        conference_designs = [d for d in designs_in_folder if "conference" in d.get("title", "").lower()]

        if len(designs_in_folder) >= 4:
            checks_passed.append(f"[OK] Found {len(designs_in_folder)} designs in folder (required: 4)")
        else:
            errors.append(f"[X] Found {len(designs_in_folder)} designs in folder, expected at least 4")

        if len(conference_designs) >= 3:
            checks_passed.append(f"[OK] Found {len(conference_designs)} Conference designs moved")
        else:
            errors.append(f"[X] Found {len(conference_designs)} Conference designs, expected at least 3")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_designs_reorganization_2_v2: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_print_material_organization_expansion(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate print material organization and expansion.
    - Folder 'Personal/Print/Business Materials/Cards and Flyers' created
    - 'Business Card — Alice Chen' and 'Yoga Class Flyer' moved
    - Three new designs: 'Corporate Brochure' (2480x3508), 'Event Invitation' (1400x2000), 'Thank You Card' (1050x600)
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Print/Business Materials/Cards and Flyers")
        if not folder:
            errors.append("[X] Folder 'Personal/Print/Business Materials/Cards and Flyers' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Personal/Print/Business Materials/Cards and Flyers' exists")
        folder_id = folder["_id"]

        # Check original designs moved
        alice_card = _find_design_by_title(backend, "Business Card — Alice Chen")
        if alice_card:
            checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")
            if _check_design_in_folder(alice_card, folder_id):
                checks_passed.append("[OK] 'Business Card — Alice Chen' is in target folder")
            else:
                errors.append("[X] 'Business Card — Alice Chen' is not in target folder")
        else:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")

        yoga_flyer = _find_design_by_exact_title(backend, "Yoga Class Flyer")
        if yoga_flyer:
            checks_passed.append("[OK] Design 'Yoga Class Flyer' found")
            if _check_design_in_folder(yoga_flyer, folder_id):
                checks_passed.append("[OK] 'Yoga Class Flyer' is in target folder")
            else:
                errors.append("[X] 'Yoga Class Flyer' is not in target folder")
        else:
            errors.append("[X] Design 'Yoga Class Flyer' not found")

        # Check new designs
        new_designs = [
            ("Corporate Brochure", 2480, 3508, "flyer"),
            ("Event Invitation", 1400, 2000, "custom"),
            ("Thank You Card", 1050, 600, "business-card"),
        ]

        for title, width, height, fmt in new_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if _check_design_in_folder(design, folder_id):
                checks_passed.append(f"[OK] '{title}' is in target folder")
            else:
                errors.append(f"[X] '{title}' is not in target folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_print_material_organization_expansion: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_podcast_content_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate podcast content audit.
    - All Podcast designs identified
    - Content analysis performed for each
    - Folder 'Content Audit/Podcast Assets' created with all podcast designs
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Content Audit/Podcast Assets")
        if not folder:
            errors.append("[X] Folder 'Content Audit/Podcast Assets' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Content Audit/Podcast Assets' exists")
        folder_id = folder["_id"]

        # Check podcast designs in folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        podcast_designs = [d for d in designs_in_folder if "podcast" in d.get("title", "").lower()]

        if len(podcast_designs) >= 1:
            checks_passed.append(f"[OK] Found {len(podcast_designs)} podcast design(s) in folder")

            # Verify content can be extracted from at least one
            for design in podcast_designs[:3]:  # Check first 3
                elements = _get_elements_for_design(backend, design.get("_id"))
                if elements:
                    checks_passed.append(f"[OK] '{design.get('title')}' has {len(elements)} elements for analysis")
                    break
        else:
            errors.append("[X] No podcast designs found in Content Audit/Podcast Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_podcast_content_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_folder_events_2026(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference folder reorganization.
    - Folder 'Events/2026/Tech Conferences' exists
    - Exactly 3 Conference designs moved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Events/2026/Tech Conferences")
        if not folder:
            errors.append("[X] Folder 'Events/2026/Tech Conferences' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Events/2026/Tech Conferences' exists")
        folder_id = folder["_id"]

        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        conference_designs = [d for d in designs_in_folder if "conference" in d.get("title", "").lower()]

        if len(conference_designs) == 3:
            checks_passed.append("[OK] Found exactly 3 Conference designs in folder")
        elif len(conference_designs) > 0:
            errors.append(f"[X] Found {len(conference_designs)} Conference designs, expected exactly 3")
        else:
            errors.append("[X] No Conference designs found in folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_folder_events_2026: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_hiring_banner_content_analysis(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate comprehensive content analysis on We're Hiring Banner.
    - Design 'We're Hiring Banner' exists with LinkedIn dimensions (1584x396)
    - Element analysis performed
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "We're Hiring Banner")
        if not design:
            errors.append("[X] Design 'We're Hiring Banner' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'We're Hiring Banner' found")

        ok, msg = _check_design_dimensions_detailed(design, 1584, 396)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        # Verify elements can be analyzed
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements for analysis")

            # Count by type
            element_counts = _count_elements_by_type(elements)
            checks_passed.append(f"[OK] Element breakdown: {element_counts}")

            # Check text elements
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements for font analysis")
        else:
            errors.append("[X] No elements found for analysis")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_hiring_banner_content_analysis: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_tech_consolidation(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference/Tech designs consolidation into hierarchical folder structure.
    - Master folder 'Client Work/Events/Tech Conferences' exists
    - Year-based subfolders 2025 and 2026 exist
    - Format-based subfolders exist under each year
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        master_folder = _find_folder_by_path(backend, "Client Work/Events/Tech Conferences")
        if not master_folder:
            errors.append("[X] Folder 'Client Work/Events/Tech Conferences' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Master folder 'Client Work/Events/Tech Conferences' exists")

        # Check year folders
        for year in ["2025", "2026"]:
            year_folder = _find_folder_by_path(backend, f"Client Work/Events/Tech Conferences/{year}")
            if year_folder:
                checks_passed.append(f"[OK] Year folder '{year}' exists")

                # Check format subfolders
                for subfolder in ["Social Media", "Headers", "Presentations"]:
                    format_folder = _find_folder_by_path(backend, f"Client Work/Events/Tech Conferences/{year}/{subfolder}")
                    if format_folder:
                        checks_passed.append(f"[OK] Subfolder '{year}/{subfolder}' exists")
                    else:
                        errors.append(f"[X] Subfolder '{year}/{subfolder}' not found")
            else:
                errors.append(f"[X] Year folder '{year}' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_tech_consolidation: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_poster_resize_landscape(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resize to landscape.
    - Resized to 1920x1080 dimensions
    - Format changed to 'custom'
    - Elements preserved
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if not design:
            errors.append("[X] Design 'Live Music Night Poster' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Live Music Night Poster' found")

        ok, msg = _check_design_dimensions_detailed(design, 1920, 1080)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        if _check_design_format(design, "custom"):
            checks_passed.append("[OK] Format is 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Check elements preserved
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements preserved")
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements for layout assessment")
        else:
            errors.append("[X] No elements found - design integrity may be compromised")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_resize_landscape: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_design_agency_folder_organization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate design agency folder organization.
    - 'Client Work/Active Projects/2026/Q1 Deliverables/Print Materials' exists
    - 'Client Work/Active Projects/2026/Q1 Deliverables/Digital Assets' exists
    - Poster/Flyer designs in Print Materials
    - Instagram/Facebook designs in Digital Assets
    - At least 5 designs total organized
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        print_folder = _find_folder_by_path(backend, "Client Work/Active Projects/2026/Q1 Deliverables/Print Materials")
        digital_folder = _find_folder_by_path(backend, "Client Work/Active Projects/2026/Q1 Deliverables/Digital Assets")

        if not print_folder:
            errors.append("[X] Folder 'Print Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Print Materials' exists")

        if not digital_folder:
            errors.append("[X] Folder 'Digital Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Digital Assets' exists")

        total_organized = 0

        if print_folder:
            print_designs = _get_designs_in_folder(backend, print_folder["_id"])
            print_matches = [d for d in print_designs if any(kw in d.get("title", "").lower() for kw in ["poster", "flyer"])]
            total_organized += len(print_matches)
            if len(print_matches) >= 2:
                checks_passed.append(f"[OK] Found {len(print_matches)} Poster/Flyer designs in Print Materials")
            else:
                errors.append(f"[X] Found {len(print_matches)} Poster/Flyer designs, expected at least 2")

        if digital_folder:
            digital_designs = _get_designs_in_folder(backend, digital_folder["_id"])
            digital_matches = [d for d in digital_designs if any(kw in d.get("title", "").lower() for kw in ["instagram", "facebook"])]
            total_organized += len(digital_matches)
            if len(digital_matches) >= 1:
                checks_passed.append(f"[OK] Found {len(digital_matches)} Instagram/Facebook designs in Digital Assets")
            else:
                errors.append(f"[X] Found {len(digital_matches)} Instagram/Facebook designs, expected at least 1")

        if total_organized >= 5:
            checks_passed.append(f"[OK] Total {total_organized} designs organized (required: 5+)")
        else:
            errors.append(f"[X] Total {total_organized} designs organized, expected at least 5")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_design_agency_folder_organization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_brand_identity_logo_package(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate brand identity logo package.
    - Four logos with 500x500 dimensions
    - All in 'Brand Assets/2026/Identity Package' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/2026/Identity Package")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/2026/Identity Package' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/2026/Identity Package' exists")

        expected_designs = [
            ("Brand Identity - Primary Logo", 500, 500, "logo"),
            ("Brand Identity - Secondary Logo", 500, 500, "logo"),
            ("Brand Identity - Icon Version", 500, 500, "logo"),
            ("Brand Identity - Wordmark", 500, 500, "logo"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Identity Package folder")
            else:
                errors.append(f"[X] '{title}' is not in Identity Package folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_brand_identity_logo_package: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_yoga_studio_print_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate yoga studio print suite.
    - 'Serenity Flow - Class Schedule' (2480x3508)
    - 'Serenity Flow - New Student Special' (2480x3508)
    - 'Serenity Flow - Instructor Card' resized to (1080x1920)
    - All in 'Personal/Print/Yoga Studio/Serenity Flow' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Print/Yoga Studio/Serenity Flow")
        if not folder:
            errors.append("[X] Folder 'Personal/Print/Yoga Studio/Serenity Flow' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Print/Yoga Studio/Serenity Flow' exists")

        # Check A4 documents
        a4_designs = [
            ("Serenity Flow - Class Schedule", 2480, 3508),
            ("Serenity Flow - New Student Special", 2480, 3508),
        ]

        for title, width, height in a4_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

        # Check resized business card
        instructor_card = _find_design_by_exact_title(backend, "Serenity Flow - Instructor Card")
        if instructor_card:
            checks_passed.append("[OK] Design 'Serenity Flow - Instructor Card' found")

            ok, msg = _check_design_dimensions_detailed(instructor_card, 1080, 1920)
            if ok:
                checks_passed.append(f"[OK] 'Serenity Flow - Instructor Card' resized to {msg}")
            else:
                errors.append(f"[X] 'Serenity Flow - Instructor Card' {msg}")

            if _check_design_format(instructor_card, "custom"):
                checks_passed.append("[OK] 'Serenity Flow - Instructor Card' format is 'custom'")
            else:
                errors.append(f"[X] Format is '{instructor_card.get('format')}', expected 'custom'")
        else:
            errors.append("[X] Design 'Serenity Flow - Instructor Card' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_yoga_studio_print_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_photography_workshop_design_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate photography workshop design suite.
    - 'Photography Workshop Flyer' (2480x3508)
    - 'Workshop Promo Story' (1080x1920)
    - 'Workshop Contact Card' (1050x600)
    - All in 'Personal/Workshops/Photography' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Personal/Workshops/Photography")
        if not folder:
            errors.append("[X] Folder 'Personal/Workshops/Photography' not found")
        else:
            checks_passed.append("[OK] Folder 'Personal/Workshops/Photography' exists")

        expected_designs = [
            ("Photography Workshop Flyer", 2480, 3508),
            ("Workshop Promo Story", 1080, 1920),
            ("Workshop Contact Card", 1050, 600),
        ]

        for title, width, height in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Photography folder")
            else:
                errors.append(f"[X] '{title}' is not in Photography folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_photography_workshop_design_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_nova_fitness_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Nova Fitness 2026 brand identity package.
    - Four designs with exact titles and dimensions
    - All in 'Brand Assets/Nova Fitness/Launch Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Nova Fitness/Launch Assets")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Nova Fitness/Launch Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Nova Fitness/Launch Assets' exists")

        expected_designs = [
            ("Nova Fitness Launch - Instagram", 1080, 1080, "instagram-post"),
            ("Nova Fitness Launch - LinkedIn", 1584, 396, "linkedin-banner"),
            ("Nova Fitness Logo", 500, 500, "logo"),
            ("Nova Fitness Card", 1050, 600, "business-card"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Launch Assets folder")
            else:
                errors.append(f"[X] '{title}' is not in Launch Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_nova_fitness_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstart_brand_library(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStart 2026 brand library.
    - Six designs with exact titles and dimensions
    - All in 'Brand Assets/TechStart/2026 Collection' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/TechStart/2026 Collection")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/TechStart/2026 Collection' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/TechStart/2026 Collection' exists")

        expected_designs = [
            ("TechStart 2026 Logo", 500, 500, "logo"),
            ("TechStart 2026 Business Card", 1050, 600, "business-card"),
            ("TechStart 2026 Instagram", 1080, 1080, "instagram-post"),
            ("TechStart 2026 LinkedIn", 1584, 396, "linkedin-banner"),
            ("TechStart 2026 Deck", 1920, 1080, "presentation"),
            ("TechStart 2026 Document", 2480, 3508, "a4-document"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in 2026 Collection folder")
            else:
                errors.append(f"[X] '{title}' is not in 2026 Collection folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_brand_library: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_green_energy_summit_suite(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Green Energy Summit 2026 multi-format suite.
    - Four designs created
    - Twitter header resized to 1584x396
    - All in 'Conferences/Green Energy Summit/Marketing Materials' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Conferences/Green Energy Summit/Marketing Materials")
        if not folder:
            errors.append("[X] Folder 'Conferences/Green Energy Summit/Marketing Materials' not found")
        else:
            checks_passed.append("[OK] Folder 'Conferences/Green Energy Summit/Marketing Materials' exists")

        # Check original designs (Twitter header will be resized)
        expected_designs = [
            ("Green Energy Summit Header", 1584, 396, "custom"),  # Resized from 1500x500
            ("Green Energy Summit Video Thumb", 1280, 720, "youtube-thumbnail"),
            ("Green Energy Summit Flyer", 2480, 3508, "flyer"),
            ("Green Energy Summit Web Banner", 1600, 400, "custom"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Marketing Materials folder")
            else:
                errors.append(f"[X] '{title}' is not in Marketing Materials folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_green_energy_summit_suite: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_zenith_corp_brand_identity(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Zenith Corp brand identity package.
    - Four designs with exact titles and dimensions
    - All in 'Brand Assets/Zenith Corp/Core Identity' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Zenith Corp/Core Identity")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Zenith Corp/Core Identity' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Zenith Corp/Core Identity' exists")

        expected_designs = [
            ("Zenith Corp Logo", 500, 500, "logo"),
            ("Zenith Corp Business Card", 1050, 600, "business-card"),
            ("Zenith Corp LinkedIn Banner", 1584, 396, "linkedin-banner"),
            ("Zenith Corp Presentation Template", 1920, 1080, "presentation"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Core Identity folder")
            else:
                errors.append(f"[X] '{title}' is not in Core Identity folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_zenith_corp_brand_identity: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_techstart_logo_concept(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate TechStart Logo Concept creation.
    - Design 'TechStart Logo Concept' exists with logo format (500x500)
    - Located in 'Brand Assets/Logos' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")
        else:
            checks_passed.append("[OK] Folder 'Brand Assets/Logos' exists")

        design = _find_design_by_exact_title(backend, "TechStart Logo Concept")
        if not design:
            errors.append("[X] Design 'TechStart Logo Concept' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'TechStart Logo Concept' found")

        ok, msg = _check_design_dimensions_detailed(design, 500, 500)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        ok, msg = _check_design_format_detailed(design, "logo")
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        if folder and _check_design_in_folder(design, folder["_id"]):
            checks_passed.append("[OK] Design is in Brand Assets/Logos folder")
        else:
            errors.append("[X] Design is not in Brand Assets/Logos folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_techstart_logo_concept: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_live_music_poster_youtube_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Live Music Night Poster resize to YouTube and new Instagram design.
    - 'Live Music Night Poster' resized to 1280x720 with custom format
    - 'Music Night - Instagram Version' created with 1080x1080
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check resized poster
        poster = _find_design_by_exact_title(backend, "Live Music Night Poster")
        if poster:
            checks_passed.append("[OK] Design 'Live Music Night Poster' found")

            ok, msg = _check_design_dimensions_detailed(poster, 1280, 720)
            if ok:
                checks_passed.append(f"[OK] 'Live Music Night Poster' {msg}")
            else:
                errors.append(f"[X] 'Live Music Night Poster' {msg}")

            if _check_design_format(poster, "custom"):
                checks_passed.append("[OK] 'Live Music Night Poster' format is 'custom'")
            else:
                errors.append(f"[X] Format is '{poster.get('format')}', expected 'custom'")

            # Check text content extracted
            elements = _get_elements_for_design(backend, poster.get("_id"))
            text_elements = _get_text_elements_from_list(elements) if elements else []
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements documented")
        else:
            errors.append("[X] Design 'Live Music Night Poster' not found")

        # Check new Instagram design
        instagram = _find_design_by_exact_title(backend, "Music Night - Instagram Version")
        if instagram:
            checks_passed.append("[OK] Design 'Music Night - Instagram Version' found")

            ok, msg = _check_design_dimensions_detailed(instagram, 1080, 1080)
            if ok:
                checks_passed.append(f"[OK] 'Music Night - Instagram Version' {msg}")
            else:
                errors.append(f"[X] 'Music Night - Instagram Version' {msg}")

            ok, msg = _check_design_format_detailed(instagram, "instagram-post")
            if ok:
                checks_passed.append(f"[OK] 'Music Night - Instagram Version' {msg}")
            else:
                errors.append(f"[X] 'Music Night - Instagram Version' {msg}")
        else:
            errors.append("[X] Design 'Music Night - Instagram Version' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_live_music_poster_youtube_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_ecotech_social_media_campaign(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate EcoTech 2026 social media campaign.
    - Three designs with exact titles and dimensions
    - All in 'Campaigns/EcoTech 2026/Social Assets' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Campaigns/EcoTech 2026/Social Assets")
        if not folder:
            errors.append("[X] Folder 'Campaigns/EcoTech 2026/Social Assets' not found")
        else:
            checks_passed.append("[OK] Folder 'Campaigns/EcoTech 2026/Social Assets' exists")

        expected_designs = [
            ("EcoTech 2026 - Instagram Launch", 1080, 1080, "instagram-post"),
            ("EcoTech 2026 - LinkedIn Launch", 1584, 396, "linkedin-banner"),
            ("EcoTech 2026 - Twitter Launch", 1500, 500, "twitter-header"),
        ]

        for title, width, height, fmt in expected_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            ok, msg = _check_design_format_detailed(design, fmt)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

            if folder and _check_design_in_folder(design, folder["_id"]):
                checks_passed.append(f"[OK] '{title}' is in Social Assets folder")
            else:
                errors.append(f"[X] '{title}' is not in Social Assets folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_ecotech_social_media_campaign: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_archive_2026_folder_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Archive 2026 folder reorganization.
    - 'Archive 2026/Social Media Archive' exists with Sale/Flash designs
    - 'Archive 2026/Print Archive' exists with poster/flyer designs
    - At least 2 designs in each archive
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        social_folder = _find_folder_by_path(backend, "Archive 2026/Social Media Archive")
        print_folder = _find_folder_by_path(backend, "Archive 2026/Print Archive")

        if not social_folder:
            errors.append("[X] Folder 'Archive 2026/Social Media Archive' not found")
        else:
            checks_passed.append("[OK] Folder 'Archive 2026/Social Media Archive' exists")
            social_designs = _get_designs_in_folder(backend, social_folder["_id"])
            sale_flash_designs = [d for d in social_designs if any(kw in d.get("title", "").lower() for kw in ["sale", "flash"])]
            if len(sale_flash_designs) >= 2:
                checks_passed.append(f"[OK] Found {len(sale_flash_designs)} Sale/Flash designs in Social Media Archive")
            else:
                errors.append(f"[X] Found {len(sale_flash_designs)} Sale/Flash designs, expected at least 2")

        if not print_folder:
            errors.append("[X] Folder 'Archive 2026/Print Archive' not found")
        else:
            checks_passed.append("[OK] Folder 'Archive 2026/Print Archive' exists")
            print_designs = _get_designs_in_folder(backend, print_folder["_id"])
            # Check for poster or flyer format designs
            print_format_designs = [d for d in print_designs if d.get("format") in ["poster", "flyer"]]
            if len(print_format_designs) >= 2:
                checks_passed.append(f"[OK] Found {len(print_format_designs)} poster/flyer designs in Print Archive")
            else:
                errors.append(f"[X] Found {len(print_format_designs)} poster/flyer designs, expected at least 2")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_archive_2026_folder_reorganization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_brand_asset_inventory(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme brand asset inventory.
    - 7+ Acme designs found
    - 'Acme Logo Concepts' text content extracted
    - All Acme designs moved to 'Brand Assets/Logos' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Brand Assets/Logos")
        if not folder:
            errors.append("[X] Folder 'Brand Assets/Logos' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Folder 'Brand Assets/Logos' exists")
        folder_id = folder["_id"]

        # Check Acme designs in folder
        designs_in_folder = _get_designs_in_folder(backend, folder_id)
        acme_designs = [d for d in designs_in_folder if "acme" in d.get("title", "").lower()]

        if len(acme_designs) >= 7:
            checks_passed.append(f"[OK] Found {len(acme_designs)} Acme designs in folder (required: 7+)")
        else:
            errors.append(f"[X] Found {len(acme_designs)} Acme designs, expected at least 7")

        # Check Acme Logo Concepts text extraction
        logo_design = _find_design_by_exact_title(backend, "Acme Logo Concepts")
        if logo_design:
            checks_passed.append("[OK] Design 'Acme Logo Concepts' found")
            elements = _get_elements_for_design(backend, logo_design.get("_id"))
            if elements:
                text_elements = _get_text_elements_from_list(elements)
                if text_elements:
                    checks_passed.append(f"[OK] 'Acme Logo Concepts' has {len(text_elements)} text elements extracted")
                else:
                    checks_passed.append("[OK] 'Acme Logo Concepts' elements accessible for extraction")
        else:
            errors.append("[X] Design 'Acme Logo Concepts' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_brand_asset_inventory: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_wellness_content_calendar(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate wellness content calendar.
    - Three wellness designs created
    - Wellness designs in 'Content Calendar/March 2026/Wellness Wednesday' folder
    - Yoga designs moved to 'Content Calendar/Wellness/Yoga Content' folder
    - Yoga Class Flyer content extracted with dimensions verified
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check wellness folder
        wellness_folder = _find_folder_by_path(backend, "Content Calendar/March 2026/Wellness Wednesday")
        if wellness_folder:
            checks_passed.append("[OK] Folder 'Content Calendar/March 2026/Wellness Wednesday' exists")
        else:
            errors.append("[X] Folder 'Content Calendar/March 2026/Wellness Wednesday' not found")

        # Check wellness designs
        wellness_designs = [
            ("Wellness Wednesday - Post", 1080, 1080),
            ("Wellness Wednesday - Story", 1080, 1920),
            ("Wellness Wednesday - Facebook", 1200, 630),
        ]

        for title, width, height in wellness_designs:
            design = _find_design_by_exact_title(backend, title)
            if not design:
                errors.append(f"[X] Design '{title}' not found")
                continue
            checks_passed.append(f"[OK] Design '{title}' found")

            ok, msg = _check_design_dimensions_detailed(design, width, height)
            if ok:
                checks_passed.append(f"[OK] '{title}' {msg}")
            else:
                errors.append(f"[X] '{title}' {msg}")

        # Check yoga folder
        yoga_folder = _find_folder_by_path(backend, "Content Calendar/Wellness/Yoga Content")
        if yoga_folder:
            checks_passed.append("[OK] Folder 'Content Calendar/Wellness/Yoga Content' exists")
            yoga_designs = _get_designs_in_folder(backend, yoga_folder["_id"])
            yoga_matches = [d for d in yoga_designs if "yoga" in d.get("title", "").lower()]
            if len(yoga_matches) >= 1:
                checks_passed.append(f"[OK] Found {len(yoga_matches)} Yoga design(s) in Yoga Content folder")
            else:
                errors.append("[X] No Yoga designs found in Yoga Content folder")
        else:
            errors.append("[X] Folder 'Content Calendar/Wellness/Yoga Content' not found")

        # Check Yoga Class Flyer
        yoga_flyer = _find_design_by_exact_title(backend, "Yoga Class Flyer")
        if yoga_flyer:
            checks_passed.append("[OK] Design 'Yoga Class Flyer' found")
            ok, msg = _check_design_dimensions_detailed(yoga_flyer, 2480, 3508)
            if ok:
                checks_passed.append(f"[OK] 'Yoga Class Flyer' {msg}")
            else:
                errors.append(f"[X] 'Yoga Class Flyer' {msg}")

            elements = _get_elements_for_design(backend, yoga_flyer.get("_id"))
            if elements:
                text_elements = _get_text_elements_from_list(elements)
                if text_elements:
                    checks_passed.append(f"[OK] 'Yoga Class Flyer' has {len(text_elements)} text elements documented")
        else:
            errors.append("[X] Design 'Yoga Class Flyer' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_wellness_content_calendar: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_conference_starlight_reorganization(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Conference and Starlight reorganization.
    - 'Events/2026/Tech Conferences' with at least 2 Conference designs
    - 'Client Work/Starlight Studio/Active Projects' with at least 4 Starlight designs
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check Conference folder
        conf_folder = _find_folder_by_path(backend, "Events/2026/Tech Conferences")
        if conf_folder:
            checks_passed.append("[OK] Folder 'Events/2026/Tech Conferences' exists")
            conf_designs = _get_designs_in_folder(backend, conf_folder["_id"])
            conf_matches = [d for d in conf_designs if "conference" in d.get("title", "").lower()]
            if len(conf_matches) >= 2:
                checks_passed.append(f"[OK] Found {len(conf_matches)} Conference designs in folder (required: 2+)")
            else:
                errors.append(f"[X] Found {len(conf_matches)} Conference designs, expected at least 2")
        else:
            errors.append("[X] Folder 'Events/2026/Tech Conferences' not found")

        # Check Starlight folder
        starlight_folder = _find_folder_by_path(backend, "Client Work/Starlight Studio/Active Projects")
        if starlight_folder:
            checks_passed.append("[OK] Folder 'Client Work/Starlight Studio/Active Projects' exists")
            starlight_designs = _get_designs_in_folder(backend, starlight_folder["_id"])
            starlight_matches = [d for d in starlight_designs if "starlight" in d.get("title", "").lower()]
            if len(starlight_matches) >= 4:
                checks_passed.append(f"[OK] Found {len(starlight_matches)} Starlight designs in folder (required: 4+)")
            else:
                errors.append(f"[X] Found {len(starlight_matches)} Starlight designs, expected at least 4")
        else:
            errors.append("[X] Folder 'Client Work/Starlight Studio/Active Projects' not found")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_conference_starlight_reorganization: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_acme_comprehensive_audit(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Acme comprehensive design audit.
    - Audit covers at least 8 Acme designs
    - 'Acme Design Audit Report 2026' (1920x1080) in 'Reports/Client Audits/2026' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        # Check report folder
        folder = _find_folder_by_path(backend, "Reports/Client Audits/2026")
        if folder:
            checks_passed.append("[OK] Folder 'Reports/Client Audits/2026' exists")
        else:
            errors.append("[X] Folder 'Reports/Client Audits/2026' not found")

        # Check report design
        report = _find_design_by_exact_title(backend, "Acme Design Audit Report 2026")
        if report:
            checks_passed.append("[OK] Design 'Acme Design Audit Report 2026' found")

            ok, msg = _check_design_dimensions_detailed(report, 1920, 1080)
            if ok:
                checks_passed.append(f"[OK] {msg}")
            else:
                errors.append(f"[X] {msg}")

            if folder and _check_design_in_folder(report, folder["_id"]):
                checks_passed.append("[OK] Report is in Client Audits/2026 folder")
            else:
                errors.append("[X] Report is not in Client Audits/2026 folder")
        else:
            errors.append("[X] Design 'Acme Design Audit Report 2026' not found")

        # Check Acme designs exist for audit
        all_designs = _get_all_designs(backend)
        acme_designs = [d for d in all_designs if "acme" in d.get("title", "").lower()]
        if len(acme_designs) >= 8:
            checks_passed.append(f"[OK] Found {len(acme_designs)} Acme designs for audit (required: 8+)")
        else:
            errors.append(f"[X] Found {len(acme_designs)} Acme designs, expected at least 8 for audit")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_acme_comprehensive_audit: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_business_card_alice_resize(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Business Card Alice Chen resize.
    - Resized to 1080x1920 with custom format
    - Element positions documented
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        design = _find_design_by_title(backend, "Business Card — Alice Chen")
        if not design:
            errors.append("[X] Design 'Business Card — Alice Chen' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Business Card — Alice Chen' found")

        ok, msg = _check_design_dimensions_detailed(design, 1080, 1920)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        if _check_design_format(design, "custom"):
            checks_passed.append("[OK] Format is 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        # Check elements for position documentation
        elements = _get_elements_for_design(backend, design.get("_id"))
        if elements:
            checks_passed.append(f"[OK] Design has {len(elements)} elements for position analysis")
            text_elements = _get_text_elements_from_list(elements)
            if text_elements:
                checks_passed.append(f"[OK] Found {len(text_elements)} text elements adapted to vertical layout")
        else:
            errors.append("[X] No elements found for position documentation")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_business_card_alice_resize: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)

def _validate_q2_strategy_presentation_workflow(
    backend: Backend, frontend_final_state: Dict[str, Any], final_answer: str
) -> TaskScore:
    """
    Validate Q2 Strategy presentation workflow.
    - 'Q2 Strategy Overview' created and resized to 2480x3508
    - Format is 'custom'
    - Located in 'Projects/Strategy/Q2 2026/Documents' folder
    """
    errors: list[str] = []
    checks_passed: list[str] = []

    try:
        folder = _find_folder_by_path(backend, "Projects/Strategy/Q2 2026/Documents")
        if folder:
            checks_passed.append("[OK] Folder 'Projects/Strategy/Q2 2026/Documents' exists")
        else:
            errors.append("[X] Folder 'Projects/Strategy/Q2 2026/Documents' not found")

        design = _find_design_by_exact_title(backend, "Q2 Strategy Overview")
        if not design:
            errors.append("[X] Design 'Q2 Strategy Overview' not found")
            return _make_task_score(errors, checks_passed)
        checks_passed.append("[OK] Design 'Q2 Strategy Overview' found")

        ok, msg = _check_design_dimensions_detailed(design, 2480, 3508)
        if ok:
            checks_passed.append(f"[OK] {msg}")
        else:
            errors.append(f"[X] {msg}")

        if _check_design_format(design, "custom"):
            checks_passed.append("[OK] Format is 'custom'")
        else:
            errors.append(f"[X] Format is '{design.get('format')}', expected 'custom'")

        if folder and _check_design_in_folder(design, folder["_id"]):
            checks_passed.append("[OK] Design is in Documents folder")
        else:
            errors.append("[X] Design is not in Documents folder")

        return _make_task_score(errors, checks_passed)

    except Exception as e:
        logger.error(f"Runtime error in _validate_q2_strategy_presentation_workflow: {e}")
        return _make_task_score(errors + [f"[X] Runtime error: {str(e)}"], checks_passed)


# Task Registry
# ==============================================================================
# Maps function names to themselves for easy lookup

REWARD_FUNCTIONS_CANVA_MCP_V2: Dict[str, Callable[[Backend, Dict[str, Any]], Tuple[float, str]]] = {
    "_validate_reorganize_all_designs_containing_acme_in_their_titles_v2": _validate_reorganize_all_designs_containing_acme_in_their_titles_v2,
    "_validate_resize_the_live_music_night_poster_design_v2": _validate_resize_the_live_music_night_poster_design_v2,
    "_validate_establish_a_new_project_hierarchy_client_work_techconf_v2": _validate_establish_a_new_project_hierarchy_client_work_techconf_v2,
    "_validate_transform_the_live_music_night_poster_from_poster_v2": _validate_transform_the_live_music_night_poster_from_poster_v2,
    "_validate_resize_the_community_event_promo_facebook_post_design_v2": _validate_resize_the_community_event_promo_facebook_post_design_v2,
    "_validate_reorganize_all_instagram_related_designs_by_searching_for_v2": _validate_reorganize_all_instagram_related_designs_by_searching_for_v2,
    "_validate_transform_the_existing_tech_conference_header_twitter_design_v2": _validate_transform_the_existing_tech_conference_header_twitter_design_v2,
    "_validate_create_a_multi_format_brand_asset_collection_for_v2": _validate_create_a_multi_format_brand_asset_collection_for_v2,
    "_validate_resize_the_tech_conference_header_design_to_youtube_v2": _validate_resize_the_tech_conference_header_design_to_youtube_v2,
    "_validate_set_up_a_multi_client_workspace_organization_system_v2": _validate_set_up_a_multi_client_workspace_organization_system_v2,
    "_validate_reorganize_all_conference_related_designs_by_searching_for_v2": _validate_reorganize_all_conference_related_designs_by_searching_for_v2,
    "_validate_create_a_new_business_presentation_design_1920x1080_titled_v2": _validate_create_a_new_business_presentation_design_1920x1080_titled_v2,
    "_validate_reorganize_the_workspace_by_finding_all_designs_with_v2": _validate_reorganize_the_workspace_by_finding_all_designs_with_v2,
    "_validate_create_an_educational_content_series_with_three_interconnected_v2": _validate_create_an_educational_content_series_with_three_interconnected_v2,
    "_validate_transform_the_business_card_alice_chen_design_for_v2": _validate_transform_the_business_card_alice_chen_design_for_v2,
    "_validate_conduct_a_comprehensive_workspace_audit_by_searching_for_v2": _validate_conduct_a_comprehensive_workspace_audit_by_searching_for_v2,
    "_validate_create_a_new_instagram_story_design_1080x1920_titled_v2": _validate_create_a_new_instagram_story_design_1080x1920_titled_v2,
    "_validate_perform_advanced_content_analysis_on_all_designs_containing_v2": _validate_perform_advanced_content_analysis_on_all_designs_containing_v2,
    "_validate_reorganize_all_acme_branded_designs_into_a_comprehensive_v2": _validate_reorganize_all_acme_branded_designs_into_a_comprehensive_v2,
    "_validate_execute_a_comprehensive_multi_client_design_audit_by_v2": _validate_execute_a_comprehensive_multi_client_design_audit_by_v2,
    "_validate_create_a_multi_format_announcement_campaign_by_generating_v2": _validate_create_a_multi_format_announcement_campaign_by_generating_v2,
    "_validate_perform_a_comprehensive_audit_of_the_flash_sale_v2": _validate_perform_a_comprehensive_audit_of_the_flash_sale_v2,
    "_validate_create_a_complete_social_media_campaign_for_quantum_v2": _validate_create_a_complete_social_media_campaign_for_quantum_v2,
    "_validate_set_up_a_comprehensive_project_organization_system_by_v2": _validate_set_up_a_comprehensive_project_organization_system_by_v2,
    "_validate_execute_a_format_migration_by_taking_the_live_v2": _validate_execute_a_format_migration_by_taking_the_live_v2,
    "_validate_extract_detailed_typography_analysis_from_both_welcome_instagram_v2": _validate_extract_detailed_typography_analysis_from_both_welcome_instagram_v2,
    "_validate_create_a_complete_video_content_series_by_generating_v2": _validate_create_a_complete_video_content_series_by_generating_v2,
    "_validate_create_a_coordinated_poster_campaign_generate_two_poster_v2": _validate_create_a_coordinated_poster_campaign_generate_two_poster_v2,
    "_validate_resize_the_business_card_alice_chen_design_to_v2": _validate_resize_the_business_card_alice_chen_design_to_v2,
    "_validate_find_all_designs_with_conference_in_their_title_v2": _validate_find_all_designs_with_conference_in_their_title_v2,
    "_validate_resize_tech_conference_header": _validate_resize_tech_conference_header,
    "_validate_create_ai_summit_youtube_thumbnails": _validate_create_ai_summit_youtube_thumbnails,
    "_validate_generate_starlight_studio_brand_package": _validate_generate_starlight_studio_brand_package,
    "_validate_analyze_welcome_designs": _validate_analyze_welcome_designs,
    "_validate_audit_acme_designs": _validate_audit_acme_designs,
    "_validate_create_acme_social_media_campaign": _validate_create_acme_social_media_campaign,
    "_validate_organize_podcast_thumbnails": _validate_organize_podcast_thumbnails,
    "_validate_reorganize_conference_event_designs": _validate_reorganize_conference_event_designs,
    "_validate_reorganize_acme_designs_by_format": _validate_reorganize_acme_designs_by_format,
    "_validate_create_nova_designs_brand_identity": _validate_create_nova_designs_brand_identity,
    "_validate_phoenix_q2_document_suite": _validate_phoenix_q2_document_suite,
    "_validate_instagram_inventory_audit": _validate_instagram_inventory_audit,
    "_validate_twitter_to_website_banner_resize": _validate_twitter_to_website_banner_resize,
    "_validate_flash_sale_workspace_audit": _validate_flash_sale_workspace_audit,
    "_validate_flash_live_brand_audit": _validate_flash_live_brand_audit,
    "_validate_innovation_summit_event_suite": _validate_innovation_summit_event_suite,
    "_validate_live_music_poster_analysis": _validate_live_music_poster_analysis,
    "_validate_techcorp_presentation_package": _validate_techcorp_presentation_package,
    "_validate_tech_series_youtube_thumbnails": _validate_tech_series_youtube_thumbnails,
    "_validate_q2_social_media_campaign": _validate_q2_social_media_campaign,
    "_validate_podcast_content_analysis": _validate_podcast_content_analysis,
    "_validate_conference_podcast_organization": _validate_conference_podcast_organization,
    "_validate_techflow_brand_assets": _validate_techflow_brand_assets,
    "_validate_instagram_to_twitter_resize": _validate_instagram_to_twitter_resize,
    "_validate_devcon_2026_marketing_suite": _validate_devcon_2026_marketing_suite,
    "_validate_starlight_studios_brand_package": _validate_starlight_studios_brand_package,
    "_validate_wellness_retreat_print_suite": _validate_wellness_retreat_print_suite,
    "_validate_twitter_to_facebook_resize": _validate_twitter_to_facebook_resize,
    "_validate_product_launch_social_library": _validate_product_launch_social_library,
    "_validate_weekly_content_calendar_series": _validate_weekly_content_calendar_series,
    "_validate_ecostart_brand_identity": _validate_ecostart_brand_identity,
    "_validate_consolidate_event_designs": _validate_consolidate_event_designs,
    "_validate_acme_deck_content_audit": _validate_acme_deck_content_audit,
    "_validate_acme_deck_structure_analysis": _validate_acme_deck_structure_analysis,
    "_validate_summer_tech_marketing_suite": _validate_summer_tech_marketing_suite,
    "_validate_instagram_to_youtube_resize": _validate_instagram_to_youtube_resize,
    "_validate_business_card_element_analysis": _validate_business_card_element_analysis,
    "_validate_instagram_post_element_analysis": _validate_instagram_post_element_analysis,
    "_validate_instagram_to_businesscard_resize": _validate_instagram_to_businesscard_resize,
    "_validate_conference_designs_audit": _validate_conference_designs_audit,
    "_validate_live_music_poster_resize": _validate_live_music_poster_resize,
    "_validate_brand_identity_logo_variations": _validate_brand_identity_logo_variations,
    "_validate_greentech_brand_identity": _validate_greentech_brand_identity,
    "_validate_q2_review_strategy_reorganization": _validate_q2_review_strategy_reorganization,
    "_validate_welcome_campaigns_reorganization": _validate_welcome_campaigns_reorganization,
    "_validate_conference_materials_archive": _validate_conference_materials_archive,
    "_validate_ecogreen_brand_package": _validate_ecogreen_brand_package,
    "_validate_conference_reorganization_analysis": _validate_conference_reorganization_analysis,
    "_validate_acme_starlight_brand_consolidation": _validate_acme_starlight_brand_consolidation,
    "_validate_welcome_instagram_reorganization": _validate_welcome_instagram_reorganization,
    "_validate_techstart_conference_social_campaign": _validate_techstart_conference_social_campaign,
    "_validate_stellar_innovations_brand_identity": _validate_stellar_innovations_brand_identity,
    "_validate_acme_workspace_consolidation": _validate_acme_workspace_consolidation,
    "_validate_techflow_brand_asset_library": _validate_techflow_brand_asset_library,
    "_validate_welcome_instagram_custom_resize": _validate_welcome_instagram_custom_resize,
    "_validate_conference_designs_reorganization": _validate_conference_designs_reorganization,
    "_validate_techstartup_project_hierarchy": _validate_techstartup_project_hierarchy,
    "_validate_live_music_poster_analysis_2": _validate_live_music_poster_analysis_2,
    "_validate_product_launch_social_campaign": _validate_product_launch_social_campaign,
    "_validate_hiring_banner_analysis": _validate_hiring_banner_analysis,
    "_validate_yoga_flyer_analysis_v2": _validate_yoga_flyer_analysis_v2,
    "_validate_acme_strategy_deck_element_analysis_v2": _validate_acme_strategy_deck_element_analysis_v2,
    "_validate_instagram_designs_analysis_v2": _validate_instagram_designs_analysis_v2,
    "_validate_business_cards_audit_v2": _validate_business_cards_audit_v2,
    "_validate_live_music_poster_typography_v2": _validate_live_music_poster_typography_v2,
    "_validate_flash_sale_story_element_analysis_v2": _validate_flash_sale_story_element_analysis_v2,
    "_validate_tech_conference_social_media_kit_v2": _validate_tech_conference_social_media_kit_v2,
    "_validate_starlight_brand_identity_package_v2": _validate_starlight_brand_identity_package_v2,
    "_validate_quantum_dynamics_brand_collection_v2": _validate_quantum_dynamics_brand_collection_v2,
    "_validate_print_marketing_suite_v2": _validate_print_marketing_suite_v2,
    "_validate_starlight_print_marketing_suite_v2": _validate_starlight_print_marketing_suite_v2,
    "_validate_techstart_logo_variations_v2": _validate_techstart_logo_variations_v2,
    "_validate_tech_startup_logo_package_v2": _validate_tech_startup_logo_package_v2,
    "_validate_starlight_multi_format_poster_series_v2": _validate_starlight_multi_format_poster_series_v2,
    "_validate_youtube_thumbnail_creation_v2": _validate_youtube_thumbnail_creation_v2,
    "_validate_executive_business_card_creation_v2": _validate_executive_business_card_creation_v2,
    "_validate_conference_designs_organization_v2": _validate_conference_designs_organization_v2,
    "_validate_live_music_audit_organization_v2": _validate_live_music_audit_organization_v2,
    "_validate_welcome_designs_reorganization_v2": _validate_welcome_designs_reorganization_v2,
    "_validate_tech_conference_header_resize_v2": _validate_tech_conference_header_resize_v2,
    "_validate_techstart_project_structure_assets_v2": _validate_techstart_project_structure_assets_v2,
    "_validate_techflow_innovations_brand_assets_v2": _validate_techflow_innovations_brand_assets_v2,
    "_validate_greentech_solutions_brand_package_v2": _validate_greentech_solutions_brand_package_v2,
    "_validate_ecotech_pro_launch_assets_organize_v2": _validate_ecotech_pro_launch_assets_organize_v2,
    "_validate_techlaunch_social_campaign_create_verify_v2": _validate_techlaunch_social_campaign_create_verify_v2,
    "_validate_january_newsletter_multi_format_suite_v2": _validate_january_newsletter_multi_format_suite_v2,
    "_validate_video_series_ep1_package_create_verify_v2": _validate_video_series_ep1_package_create_verify_v2,
    "_validate_summer_sale_2026_template_series_v2": _validate_summer_sale_2026_template_series_v2,
    "_validate_coffee_shop_brand_identity_package_v2": _validate_coffee_shop_brand_identity_package_v2,
    "_validate_starlight_brand_asset_set_create_v2": _validate_starlight_brand_asset_set_create_v2,
    "_validate_summit_tech_q1_newsletter_suite_v2": _validate_summit_tech_q1_newsletter_suite_v2,
    "_validate_resize_tech_conference_header_instagram_v2": _validate_resize_tech_conference_header_instagram_v2,
    "_validate_alice_chen_business_card_banner_move_v2": _validate_alice_chen_business_card_banner_move_v2,
    "_validate_alice_chen_card_to_slide_resize_v2": _validate_alice_chen_card_to_slide_resize_v2,
    "_validate_live_music_night_poster_web_banner_v2": _validate_live_music_night_poster_web_banner_v2,
    "_validate_january_newsletter_web_banner_resize_v2": _validate_january_newsletter_web_banner_resize_v2,
    "_validate_alice_chen_card_postcard_resize_v2": _validate_alice_chen_card_postcard_resize_v2,
    "_validate_reorganize_welcome_and_conference_designs_v2": _validate_reorganize_welcome_and_conference_designs_v2,
    "_validate_platform_specific_social_media_reorg_v2": _validate_platform_specific_social_media_reorg_v2,
    "_validate_conference_designs_move_extract_text_v2": _validate_conference_designs_move_extract_text_v2,
    "_validate_welcome_designs_by_format_archive_v2": _validate_welcome_designs_by_format_archive_v2,
    "_validate_archive_starlight_projects_consolidate_v2": _validate_archive_starlight_projects_consolidate_v2,
    "_validate_brand_assets_acme_starlight_organize_v2": _validate_brand_assets_acme_starlight_organize_v2,
    "_validate_hr_resources_hiring_banner_organize_v2": _validate_hr_resources_hiring_banner_organize_v2,
    "_validate_starlight_assets_reorg_guidelines_presentation_v2": _validate_starlight_assets_reorg_guidelines_presentation_v2,
    "_validate_acme_q1_strategy_deck_element_report_v2": _validate_acme_q1_strategy_deck_element_report_v2,
    "_validate_live_music_night_poster_element_analysis_v2": _validate_live_music_night_poster_element_analysis_v2,
    "_validate_flash_sale_story_detailed_element_analysis_v2": _validate_flash_sale_story_detailed_element_analysis_v2,
    "_validate_q2_strategy_overview_create_resize_v2": _validate_q2_strategy_overview_create_resize_v2,
    "_validate_social_template_system_create_resize_v2": _validate_social_template_system_create_resize_v2,
    "_validate_acme_strategic_reorganization_v2": _validate_acme_strategic_reorganization_v2,
    "_validate_conference_event_organization_calendar_v2": _validate_conference_event_organization_calendar_v2,
    "_validate_conference_welcome_brand_assets_reorg_v2": _validate_conference_welcome_brand_assets_reorg_v2,
    "_validate_tech_conference_client_organization_v2": _validate_tech_conference_client_organization_v2,
    "_validate_campaigns_q1_social_media_reorg_v2": _validate_campaigns_q1_social_media_reorg_v2,
    "_validate_conference_acme_dual_organization_v2": _validate_conference_acme_dual_organization_v2,
    "_validate_conference_tech_reorg_resize_v2": _validate_conference_tech_reorg_resize_v2,
    "_validate_techstart_logo_archive_organization_v2": _validate_techstart_logo_archive_organization_v2,
    "_validate_brand_logo_variations_package_v2": _validate_brand_logo_variations_package_v2,
    "_validate_soundwave_2026_festival_campaign_v2": _validate_soundwave_2026_festival_campaign_v2,
    "_validate_winter_conference_2026_workspace_v2": _validate_winter_conference_2026_workspace_v2,
    "_validate_conference_tech_organization_system_v2": _validate_conference_tech_organization_system_v2,
    "_validate_youtube_thumbnail_content_library_v2": _validate_youtube_thumbnail_content_library_v2,
    "_validate_january_newsletter_text_analysis_v2": _validate_january_newsletter_text_analysis_v2,
    "_validate_acme_designs_analysis_reorganization_v2": _validate_acme_designs_analysis_reorganization_v2,
    "_validate_live_music_poster_resize_organize_v2": _validate_live_music_poster_resize_organize_v2,
    "_validate_live_music_poster_resize_extract_v2": _validate_live_music_poster_resize_extract_v2,
    "_validate_q2_marketing_strategy_report_v2": _validate_q2_marketing_strategy_report_v2,
    "_validate_acme_brand_system_analysis_templates_v2": _validate_acme_brand_system_analysis_templates_v2,
    "_validate_starlight_studio_brand_package_v2": _validate_starlight_studio_brand_package_v2,
    "_validate_canva_analyze_welcome_instagram_design": _validate_canva_analyze_welcome_instagram_design,
    "_validate_canva_digital_marketing_folder_hierarchy": _validate_canva_digital_marketing_folder_hierarchy,
    "_validate_canva_resize_business_card_youtube": _validate_canva_resize_business_card_youtube,
    "_validate_canva_reorganize_acme_by_format": _validate_canva_reorganize_acme_by_format,
    "_validate_canva_ecotech_brand_identity": _validate_canva_ecotech_brand_identity,
    "_validate_canva_product_launch_campaign": _validate_canva_product_launch_campaign,
    "_validate_canva_print_campaign_a4": _validate_canva_print_campaign_a4,
    "_validate_canva_resize_instagram_to_banner": _validate_canva_resize_instagram_to_banner,
    "_validate_canva_flash_sale_analysis_archive": _validate_canva_flash_sale_analysis_archive,
    "_validate_canva_typography_analysis_instagram": _validate_canva_typography_analysis_instagram,
    "_validate_canva_phoenix_industries_brand_identity": _validate_canva_phoenix_industries_brand_identity,
    "_validate_canva_techcorp_project_hierarchy": _validate_canva_techcorp_project_hierarchy,
    "_validate_canva_acme_client_workspace": _validate_canva_acme_client_workspace,
    "_validate_canva_live_music_poster_resize_square": _validate_canva_live_music_poster_resize_square,
    "_validate_canva_instagram_collection_reorganize": _validate_canva_instagram_collection_reorganize,
    "_validate_canva_techflow_brand_identity": _validate_canva_techflow_brand_identity,
    "_validate_canva_client_work_reorganization": _validate_canva_client_work_reorganization,
    "_validate_canva_techstart_logo_suite": _validate_canva_techstart_logo_suite,
    "_validate_canva_live_music_poster_audit": _validate_canva_live_music_poster_audit,
    "_validate_canva_flash_sale_story_transform": _validate_canva_flash_sale_story_transform,
    "_validate_canva_flash_sale_campaign_reorganization": _validate_canva_flash_sale_campaign_reorganization,
    "_validate_canva_q2_revenue_forecast_multiformat": _validate_canva_q2_revenue_forecast_multiformat,
    "_validate_canva_live_music_poster_advanced_analysis": _validate_canva_live_music_poster_advanced_analysis,
    "_validate_canva_innovation_summit_campaign": _validate_canva_innovation_summit_campaign,
    "_validate_canva_youtube_tech_review_package": _validate_canva_youtube_tech_review_package,
    "_validate_canva_q2_business_review_resize": _validate_canva_q2_business_review_resize,
    "_validate_canva_acme_complete_portfolio": _validate_canva_acme_complete_portfolio,
    "_validate_canva_acme_brand_assets_organization": _validate_canva_acme_brand_assets_organization,
    "_validate_canva_corporate_templates_strategy_decks": _validate_canva_corporate_templates_strategy_decks,
    "_validate_canva_zenith_tech_logo_variations": _validate_canva_zenith_tech_logo_variations,
    "_validate_canva_q2_business_review_multiformat": _validate_canva_q2_business_review_multiformat,
    "_validate_canva_techstart_brand_package": _validate_canva_techstart_brand_package,
    "_validate_canva_q1_marketing_report_resize": _validate_canva_q1_marketing_report_resize,
    "_validate_canva_welcome_format_variants": _validate_canva_welcome_format_variants,
    "_validate_canva_brand_logo_variations": _validate_canva_brand_logo_variations,
    "_validate_canva_conference_2026_organization": _validate_canva_conference_2026_organization,
    "_validate_canva_video_content_series": _validate_canva_video_content_series,
    "_validate_canva_conference_newsletter_reorg": _validate_canva_conference_newsletter_reorg,
    "_validate_canva_welcome_content_analysis": _validate_canva_welcome_content_analysis,
    "_validate_canva_techstart_branding_package": _validate_canva_techstart_branding_package,
    "_validate_canva_q1_2026_content_folders": _validate_canva_q1_2026_content_folders,
    "_validate_canva_phoenix_launch_campaign": _validate_canva_phoenix_launch_campaign,
    "_validate_canva_acme_rebrand_campaign": _validate_canva_acme_rebrand_campaign,
    "_validate_canva_flash_sale_yoga_reorg": _validate_canva_flash_sale_yoga_reorg,
    "_validate_canva_acme_logo_consolidation": _validate_canva_acme_logo_consolidation,
    "_validate_canva_moonlight_q1_campaign": _validate_canva_moonlight_q1_campaign,
    "_validate_canva_starlight_consolidation": _validate_canva_starlight_consolidation,
    "_validate_canva_social_media_title_reorg": _validate_canva_social_media_title_reorg,
    "_validate_canva_welcome_collection_organization": _validate_canva_welcome_collection_organization,
    "_validate_canva_aurora_spa_marketing": _validate_canva_aurora_spa_marketing,
    "_validate_canva_community_event_resize_story": _validate_canva_community_event_resize_story,
    "_validate_canva_q2_acme_campaign_collection": _validate_canva_q2_acme_campaign_collection,
    "_validate_canva_print_designs_reorganize_format": _validate_canva_print_designs_reorganize_format,
    "_validate_canva_brand_logo_package": _validate_canva_brand_logo_package,
    "_validate_canva_conference_event_consolidation": _validate_canva_conference_event_consolidation,
    "_validate_canva_alice_chen_digital_versions": _validate_canva_alice_chen_digital_versions,
    "_validate_canva_community_event_poster_transform": _validate_canva_community_event_poster_transform,
    "_validate_canva_ecotech_solutions_brand_package": _validate_canva_ecotech_solutions_brand_package,
    "_validate_canva_instagram_story_audit": _validate_canva_instagram_story_audit,
    "_validate_canva_print_marketing_collection": _validate_canva_print_marketing_collection,
    "_validate_canva_print_marketing_suite_comparison": _validate_canva_print_marketing_suite_comparison,
    "_validate_canva_live_music_promo_materials": _validate_canva_live_music_promo_materials,
    "_validate_canva_social_media_workspace_reorganize": _validate_canva_social_media_workspace_reorganize,
    "_validate_canva_conference_speaker_series": _validate_canva_conference_speaker_series,
    "_validate_canva_techcorp_folder_taxonomy": _validate_canva_techcorp_folder_taxonomy,
    "_validate_canva_welcome_instagram_element_analysis": _validate_canva_welcome_instagram_element_analysis,
    "_validate_canva_conference_presentation_multiformat": _validate_canva_conference_presentation_multiformat,
    "_validate_canva_youtube_tutorial_series": _validate_canva_youtube_tutorial_series,
    "_validate_canva_q2_conference_campaign": _validate_canva_q2_conference_campaign,
    "_validate_canva_print_materials_consolidation": _validate_canva_print_materials_consolidation,
    "_validate_canva_conference_multiformat_series": _validate_canva_conference_multiformat_series,
    "_validate_canva_tech_conference_marketing_materials": _validate_canva_tech_conference_marketing_materials,
    "_validate_canva_presentation_template_series": _validate_canva_presentation_template_series,
    "_validate_canva_starlight_complex_consolidation": _validate_canva_starlight_complex_consolidation,
    "_validate_canva_video_content_multiformat_suite": _validate_canva_video_content_multiformat_suite,
    "_validate_canva_workspace_posts_reorganization": _validate_canva_workspace_posts_reorganization,
    "_validate_canva_techflow_logo_brand_system": _validate_canva_techflow_logo_brand_system,
    "_validate_canva_flash_sale_story_a4_resize": _validate_canva_flash_sale_story_a4_resize,
    "_validate_canva_q1_launch_social_media_campaign": _validate_canva_q1_launch_social_media_campaign,
    "_validate_canva_summit_tech_launch_brand_campaign": _validate_canva_summit_tech_launch_brand_campaign,
    "_validate_canva_q2_showcase_multiformat_series": _validate_canva_q2_showcase_multiformat_series,
    "_validate_canva_tech_conference_web_banner": _validate_canva_tech_conference_web_banner,
    "_validate_canva_youtube_tech_review_series": _validate_canva_youtube_tech_review_series,
    "_validate_canva_neural_dynamics_brand_package": _validate_canva_neural_dynamics_brand_package,
    "_validate_canva_newsletter_business_card_reorg": _validate_canva_newsletter_business_card_reorg,
    "_validate_canva_techstart_logo_variations_suite": _validate_canva_techstart_logo_variations_suite,
    "_validate_canva_phoenix_corp_project_structure": _validate_canva_phoenix_corp_project_structure,
    "_validate_canva_acme_archive_instagram_analysis": _validate_canva_acme_archive_instagram_analysis,
    "_validate_canva_spring_festival_multiformat_suite": _validate_canva_spring_festival_multiformat_suite,
    "_validate_canva_welcome_instagram_q2_social_templates": _validate_canva_welcome_instagram_q2_social_templates,
    "_validate_canva_techfusion_conference_campaign": _validate_canva_techfusion_conference_campaign,
    "_validate_canva_digital_wellness_summit_campaign": _validate_canva_digital_wellness_summit_campaign,
    "_validate_canva_multi_client_portfolio_system": _validate_canva_multi_client_portfolio_system,
    "_validate_canva_greentech_social_media_series": _validate_canva_greentech_social_media_series,
    "_validate_canva_tech_conference_presentation_resize": _validate_canva_tech_conference_presentation_resize,
    "_validate_canva_techflow_innovations_logo_suite": _validate_canva_techflow_innovations_logo_suite,
    "_validate_canva_music_festival_poster_series": _validate_canva_music_festival_poster_series,
    "_validate_canva_live_music_night_square_resize": _validate_canva_live_music_night_square_resize,
    "_validate_canva_music_festival_multiformat": _validate_canva_music_festival_multiformat,
    "_validate_canva_podcast_thumbnail_presentation_resize": _validate_canva_podcast_thumbnail_presentation_resize,
    "_validate_biz_card_letterhead_sarah": _validate_biz_card_letterhead_sarah,
    "_validate_video_content_podcast_package": _validate_video_content_podcast_package,
    "_validate_poster_resize_marketing_suite": _validate_poster_resize_marketing_suite,
    "_validate_video_workflow_folder_setup": _validate_video_workflow_folder_setup,
    "_validate_biz_card_to_letterhead_resize": _validate_biz_card_to_letterhead_resize,
    "_validate_brand_identity_set": _validate_brand_identity_set,
    "_validate_brand_package_4_designs": _validate_brand_package_4_designs,
    "_validate_conference_poster_folder": _validate_conference_poster_folder,
    "_validate_conference_tech_reorganize": _validate_conference_tech_reorganize,
    "_validate_presentation_series_q2": _validate_presentation_series_q2,
    "_validate_welcome_designs_reorganize": _validate_welcome_designs_reorganize,
    "_validate_concert_festival_posters": _validate_concert_festival_posters,
    "_validate_event_marketing_suite": _validate_event_marketing_suite,
    "_validate_header_resize_linkedin": _validate_header_resize_linkedin,
    "_validate_print_materials_festival": _validate_print_materials_festival,
    "_validate_flash_sale_reorganize_resize": _validate_flash_sale_reorganize_resize,
    "_validate_instagram_resize_banner": _validate_instagram_resize_banner,
    "_validate_newsletter_resize_tabloid": _validate_newsletter_resize_tabloid,
    "_validate_video_package_tech_conf": _validate_video_package_tech_conf,
    "_validate_poster_resize_web_banner": _validate_poster_resize_web_banner,
    "_validate_acme_content_audit": _validate_acme_content_audit,
    "_validate_print_marketing_suite_2026": _validate_print_marketing_suite_2026,
    "_validate_global_enterprises_social_workflow": _validate_global_enterprises_social_workflow,
    "_validate_winter_gala_event_suite": _validate_winter_gala_event_suite,
    "_validate_devcon_marketing_suite": _validate_devcon_marketing_suite,
    "_validate_techcorp_client_organization": _validate_techcorp_client_organization,
    "_validate_phoenix_digital_project_setup": _validate_phoenix_digital_project_setup,
    "_validate_welcome_designs_folder_org": _validate_welcome_designs_folder_org,
    "_validate_tech_conference_story_comparison": _validate_tech_conference_story_comparison,
    "_validate_q3_marketing_campaign_workspace": _validate_q3_marketing_campaign_workspace,
    "_validate_youtube_series_podcast_archive": _validate_youtube_series_podcast_archive,
    "_validate_winter_collection_social_campaign": _validate_winter_collection_social_campaign,
    "_validate_ai_podcast_branding_suite": _validate_ai_podcast_branding_suite,
    "_validate_welcome_post_youtube_resize": _validate_welcome_post_youtube_resize,
    "_validate_brand_asset_management": _validate_brand_asset_management,
    "_validate_conference_content_migration": _validate_conference_content_migration,
    "_validate_welcome_post_element_validation": _validate_welcome_post_element_validation,
    "_validate_welcome_post_banner_resize": _validate_welcome_post_banner_resize,
    "_validate_archive_story_flash_sale_org": _validate_archive_story_flash_sale_org,
    "_validate_welcome_campaign_reorganize": _validate_welcome_campaign_reorganize,
    "_validate_quantum_dynamics_brand_identity": _validate_quantum_dynamics_brand_identity,
    "_validate_nexus_technologies_identity_suite": _validate_nexus_technologies_identity_suite,
    "_validate_conference_design_analysis": _validate_conference_design_analysis,
    "_validate_flash_sale_social_campaign": _validate_flash_sale_social_campaign,
    "_validate_dataviz_workshop_suite": _validate_dataviz_workshop_suite,
    "_validate_tech_summit_event_package": _validate_tech_summit_event_package,
    "_validate_phoenix_studios_brand_identity": _validate_phoenix_studios_brand_identity,
    "_validate_fitness_challenge_q2_campaign": _validate_fitness_challenge_q2_campaign,
    "_validate_q1_2026_archive_reorganize": _validate_q1_2026_archive_reorganize,
    "_validate_q1_newsletter_series": _validate_q1_newsletter_series,
    "_validate_starlight_studio_archive": _validate_starlight_studio_archive,
    "_validate_client_portfolio_organize": _validate_client_portfolio_organize,
    "_validate_techstart_project_setup": _validate_techstart_project_setup,
    "_validate_conference_reorganize_resize": _validate_conference_reorganize_resize,
    "_validate_welcome_kit_audit": _validate_welcome_kit_audit,
    "_validate_starlight_brand_audit": _validate_starlight_brand_audit,
    "_validate_summer_product_launch_insta": _validate_summer_product_launch_insta,
    "_validate_flash_sale_folder_org": _validate_flash_sale_folder_org,
    "_validate_podcast_thumbnail_resize_fb": _validate_podcast_thumbnail_resize_fb,
    "_validate_global_corp_project_org": _validate_global_corp_project_org,
    "_validate_welcome_insta_resize_fb": _validate_welcome_insta_resize_fb,
    "_validate_winter_2026_collection_suite": _validate_winter_2026_collection_suite,
    "_validate_youtube_tutorial_thumbnail": _validate_youtube_tutorial_thumbnail,
    "_validate_q2_strategy_presentation": _validate_q2_strategy_presentation,
    "_validate_welcome_insta_resize_custom": _validate_welcome_insta_resize_custom,
    "_validate_techcorp_logo_folder_setup": _validate_techcorp_logo_folder_setup,
    "_validate_flash_sale_analytics_workflow": _validate_flash_sale_analytics_workflow,
    "_validate_podcast_content_organize": _validate_podcast_content_organize,
    "_validate_techfusion_social_media_campaign": _validate_techfusion_social_media_campaign,
    "_validate_product_launch_social_campaign_2": _validate_product_launch_social_campaign_2,
    "_validate_acme_brand_unified_system": _validate_acme_brand_unified_system,
    "_validate_welcome_designs_reorganization_2": _validate_welcome_designs_reorganization_2,
    "_validate_starlight_brand_package": _validate_starlight_brand_package,
    "_validate_social_campaign_with_folder_hierarchy": _validate_social_campaign_with_folder_hierarchy,
    "_validate_quarterly_presentations": _validate_quarterly_presentations,
    "_validate_tech_conference_presentations": _validate_tech_conference_presentations,
    "_validate_acme_folder_reorganization": _validate_acme_folder_reorganization,
    "_validate_spring_collection_campaign": _validate_spring_collection_campaign,
    "_validate_devsummit_marketing_suite": _validate_devsummit_marketing_suite,
    "_validate_techcorp_presentation": _validate_techcorp_presentation,
    "_validate_welcome_campaign_organization": _validate_welcome_campaign_organization,
    "_validate_starbright_rebrand_package": _validate_starbright_rebrand_package,
    "_validate_print_marketing_suite_2": _validate_print_marketing_suite_2,
    "_validate_starlight_logo_variations": _validate_starlight_logo_variations,
    "_validate_product_reveal_social_suite": _validate_product_reveal_social_suite,
    "_validate_techflow_brand_identity": _validate_techflow_brand_identity,
    "_validate_executive_summary_presentation": _validate_executive_summary_presentation,
    "_validate_logo_variations_package": _validate_logo_variations_package,
    "_validate_acme_marketing_reorganization": _validate_acme_marketing_reorganization,
    "_validate_welcome_reorganization_simple": _validate_welcome_reorganization_simple,
    "_validate_video_content_suite": _validate_video_content_suite,
    "_validate_newsletter_campaign": _validate_newsletter_campaign,
    "_validate_event_promotional_materials": _validate_event_promotional_materials,
    "_validate_phoenix_brand_identity": _validate_phoenix_brand_identity,
    "_validate_business_cards_archive": _validate_business_cards_archive,
    "_validate_brand_identity_suite": _validate_brand_identity_suite,
    "_validate_starlight_portfolio_setup": _validate_starlight_portfolio_setup,
    "_validate_conference_event_structure": _validate_conference_event_structure,
    "_validate_acme_bulk_organization": _validate_acme_bulk_organization,
    "_validate_rebrand_logo_variations": _validate_rebrand_logo_variations,
    "_validate_text_content_hierarchy_analysis": _validate_text_content_hierarchy_analysis,
    "_validate_deep_content_extraction": _validate_deep_content_extraction,
    "_validate_poster_content_analysis": _validate_poster_content_analysis,
    "_validate_business_card_text_styling": _validate_business_card_text_styling,
    "_validate_newsletter_content_analysis": _validate_newsletter_content_analysis,
    "_validate_portfolio_dual_structure": _validate_portfolio_dual_structure,
    "_validate_acme_logo_dual_organization": _validate_acme_logo_dual_organization,
    "_validate_format_based_organization": _validate_format_based_organization,
    "_validate_acme_marketing_q2_folder_structure": _validate_acme_marketing_q2_folder_structure,
    "_validate_q1_campaign_structure": _validate_q1_campaign_structure,
    "_validate_q2_campaign_structure": _validate_q2_campaign_structure,
    "_validate_business_card_resize_poster": _validate_business_card_resize_poster,
    "_validate_twitter_to_youtube_resize": _validate_twitter_to_youtube_resize,
    "_validate_business_card_resize_banner": _validate_business_card_resize_banner,
    "_validate_presentation_resize_widescreen": _validate_presentation_resize_widescreen,
    "_validate_welcome_reorganize_and_resize": _validate_welcome_reorganize_and_resize,
    "_validate_acme_welcome_folder_reorganization": _validate_acme_welcome_folder_reorganization,
    "_validate_tech_header_resize_square": _validate_tech_header_resize_square,
    "_validate_tech_conference_reorganization_analysis": _validate_tech_conference_reorganization_analysis,
    "_validate_instagram_social_media_hub": _validate_instagram_social_media_hub,
    "_validate_live_music_youtube_resize": _validate_live_music_youtube_resize,
    "_validate_conference_audit_summary": _validate_conference_audit_summary,
    "_validate_welcome_archive_organization": _validate_welcome_archive_organization,
    "_validate_techcorp_logo_series": _validate_techcorp_logo_series,
    "_validate_executive_business_card": _validate_executive_business_card,
    "_validate_acme_strategy_resize_square": _validate_acme_strategy_resize_square,
    "_validate_acme_client_work_organization": _validate_acme_client_work_organization,
    "_validate_tech_conference_analysis_resize": _validate_tech_conference_analysis_resize,
    "_validate_welcome_collection_organization": _validate_welcome_collection_organization,
    "_validate_ecotech_brand_package": _validate_ecotech_brand_package,
    "_validate_campaign_launch_multi_format": _validate_campaign_launch_multi_format,
    "_validate_acme_content_analysis": _validate_acme_content_analysis,
    "_validate_master_brand_asset_library": _validate_master_brand_asset_library,
    "_validate_summer_campaign_multi_format": _validate_summer_campaign_multi_format,
    "_validate_starlight_social_media_audit": _validate_starlight_social_media_audit,
    "_validate_welcome_designs_presentation": _validate_welcome_designs_presentation,
    "_validate_client_presentation_package": _validate_client_presentation_package,
    "_validate_client_folder_consolidation": _validate_client_folder_consolidation,
    "_validate_acme_starlight_client_archive": _validate_acme_starlight_client_archive,
    "_validate_devcon_conference_promotion": _validate_devcon_conference_promotion,
    "_validate_brand_logo_concepts": _validate_brand_logo_concepts,
    "_validate_client_folder_structure_logo_story_org": _validate_client_folder_structure_logo_story_org,
    "_validate_acme_designs_reorganize_text_extract": _validate_acme_designs_reorganize_text_extract,
    "_validate_story_designs_archive_flash_sale_compare": _validate_story_designs_archive_flash_sale_compare,
    "_validate_phoenix_tech_marketing_materials_org": _validate_phoenix_tech_marketing_materials_org,
    "_validate_a4_monthly_report_series": _validate_a4_monthly_report_series,
    "_validate_acme_designs_move_to_social": _validate_acme_designs_move_to_social,
    "_validate_poster_resize_to_youtube_thumbnail": _validate_poster_resize_to_youtube_thumbnail,
    "_validate_zenith_brand_identity_package": _validate_zenith_brand_identity_package,
    "_validate_instagram_starlight_designs_organize": _validate_instagram_starlight_designs_organize,
    "_validate_live_music_festival_marketing_suite": _validate_live_music_festival_marketing_suite,
    "_validate_live_music_poster_element_analysis": _validate_live_music_poster_element_analysis,
    "_validate_wellness_brand_social_templates": _validate_wellness_brand_social_templates,
    "_validate_youtube_tech_tutorial_thumbnails": _validate_youtube_tech_tutorial_thumbnails,
    "_validate_spring_product_launch_social_kit": _validate_spring_product_launch_social_kit,
    "_validate_acme_q2_campaign_structure": _validate_acme_q2_campaign_structure,
    "_validate_newsletter_template_system": _validate_newsletter_template_system,
    "_validate_podcast_designs_consolidate": _validate_podcast_designs_consolidate,
    "_validate_print_archive_system_setup": _validate_print_archive_system_setup,
    "_validate_acme_project_structure_overview": _validate_acme_project_structure_overview,
    "_validate_spring_festival_multiformat_assets": _validate_spring_festival_multiformat_assets,
    "_validate_techsummit_conference_marketing": _validate_techsummit_conference_marketing,
    "_validate_acme_typography_analysis": _validate_acme_typography_analysis,
    "_validate_archive_alt_designs": _validate_archive_alt_designs,
    "_validate_podcast_thumbnail_element_analysis": _validate_podcast_thumbnail_element_analysis,
    "_validate_conference_announcement_social_set": _validate_conference_announcement_social_set,
    "_validate_starlight_logo_v3_comparison": _validate_starlight_logo_v3_comparison,
    "_validate_winter_campaign_folder_hierarchy": _validate_winter_campaign_folder_hierarchy,
    "_validate_annual_report_document_suite": _validate_annual_report_document_suite,
    "_validate_brand_identity_logo_resize": _validate_brand_identity_logo_resize,
    "_validate_acme_flash_sale_content_comparison": _validate_acme_flash_sale_content_comparison,
    "_validate_music_festival_event_promotion": _validate_music_festival_event_promotion,
    "_validate_content_calendar_week1_campaign": _validate_content_calendar_week1_campaign,
    "_validate_quantumtech_brand_identity_system": _validate_quantumtech_brand_identity_system,
    "_validate_conference_content_migration_2": _validate_conference_content_migration_2,
    "_validate_flash_sale_community_event_compare": _validate_flash_sale_community_event_compare,
    "_validate_master_brand_kit_logos": _validate_master_brand_kit_logos,
    "_validate_executive_summary_presentation_2": _validate_executive_summary_presentation_2,
    "_validate_techcorp_q2_launch_campaign": _validate_techcorp_q2_launch_campaign,
    "_validate_event_marketing_package_formats": _validate_event_marketing_package_formats,
    "_validate_design_content_audit_analysis": _validate_design_content_audit_analysis,
    "_validate_winter_social_media_campaign": _validate_winter_social_media_campaign,
    "_validate_conference_designs_reorganization_2_v2": _validate_conference_designs_reorganization_2_v2,
    "_validate_print_material_organization_expansion": _validate_print_material_organization_expansion,
    "_validate_podcast_content_audit": _validate_podcast_content_audit,
    "_validate_conference_folder_events_2026": _validate_conference_folder_events_2026,
    "_validate_hiring_banner_content_analysis": _validate_hiring_banner_content_analysis,
    "_validate_conference_tech_consolidation": _validate_conference_tech_consolidation,
    "_validate_live_music_poster_resize_landscape": _validate_live_music_poster_resize_landscape,
    "_validate_design_agency_folder_organization": _validate_design_agency_folder_organization,
    "_validate_brand_identity_logo_package": _validate_brand_identity_logo_package,
    "_validate_yoga_studio_print_suite": _validate_yoga_studio_print_suite,
    "_validate_photography_workshop_design_suite": _validate_photography_workshop_design_suite,
    "_validate_nova_fitness_brand_identity": _validate_nova_fitness_brand_identity,
    "_validate_techstart_brand_library": _validate_techstart_brand_library,
    "_validate_green_energy_summit_suite": _validate_green_energy_summit_suite,
    "_validate_zenith_corp_brand_identity": _validate_zenith_corp_brand_identity,
    "_validate_techstart_logo_concept": _validate_techstart_logo_concept,
    "_validate_live_music_poster_youtube_resize": _validate_live_music_poster_youtube_resize,
    "_validate_ecotech_social_media_campaign": _validate_ecotech_social_media_campaign,
    "_validate_archive_2026_folder_reorganization": _validate_archive_2026_folder_reorganization,
    "_validate_acme_brand_asset_inventory": _validate_acme_brand_asset_inventory,
    "_validate_wellness_content_calendar": _validate_wellness_content_calendar,
    "_validate_conference_starlight_reorganization": _validate_conference_starlight_reorganization,
    "_validate_acme_comprehensive_audit": _validate_acme_comprehensive_audit,
    "_validate_business_card_alice_resize": _validate_business_card_alice_resize,
    "_validate_q2_strategy_presentation_workflow": _validate_q2_strategy_presentation_workflow,
}
