/* Tooltip CSS */
.tooltip-container { position: relative; display: inline-block; cursor: help; margin-left: 5px; vertical-align: middle; }
.tooltip-icon { font-size: 0.8em; font-style: normal; color: var(--text-secondary-color); border: 1px solid var(--text-secondary-color); border-radius: 50%; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.tooltip-text { visibility: hidden; width: 220px; background-color: #333; color: #fff; text-align: left; border-radius: 6px; padding: 10px; position: absolute; z-index: 10; bottom: 135%; left: 50%; margin-left: -110px; opacity: 0; transition: opacity 0.3s; font-size: 0.85em; font-weight: normal; line-height: 1.4; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }

/* Chart Container Styling */
 .chart-container { position: relative; min-height: 350px; background-color: transparent; border: none; border-radius: 0; display: block; color: var(--text-secondary-color); }
 .chart-container canvas { background-color: var(--card-bg-color); border-radius: 8px; border: 1px solid var(--border-color); width: 100% !important; height: 350px !important; }
 .chart-placeholder-div { min-height: 350px; background-color: #1a1a1a; border: 1px dashed var(--border-color); display: flex; align-items: center; justify-content: center; color: var(--text-secondary-color); border-radius: 8px; padding: 15px; text-align: center; }

/* --- Vercel-Inspired Dark Mode Theme w/ Inter Font --- */
:root {
    --bg-color: #000000;
    --card-bg-color: #111111;
    --border-color: #333333;
    --text-color: #eaeaea;
    --text-secondary-color: #888888;
    --accent-color: #ffffff; /* White accent */
    --accent-hover-color: #cccccc;
    --positive-color: #28a745;
    --negative-color: #dc3545;
    --link-color: #58a6ff;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* Use Inter */
    --pill-bg: #222;
    --pill-text: #aaa;
    --pill-border: #444;
}

body {
    font-family: var(--font-sans); /* Apply Inter font */
    margin: 0;
    line-height: 1.6;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 16px;
    /* *** UPDATED: Page Background Image *** */
    background-image: url('https://passby.com/wp-content/uploads/2025/10/Artboard-1.jpg');
    background-size: 100% auto;
    background-position: top center;
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps image static on scroll */
}

#page-container { 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 20px; 
    margin-top: 20px; 
}

/* --- Header / Search --- */
#page-header {
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}
.header-logo {
    display: block;
    width: 100%;
    max-width: 150px; /* Increased logo size */
}
.header-logo img {
    width: 100%;
    height: auto;
}
.search-container { position: relative; width: 100%; max-width: 700px; margin: 0 auto; }
.search-container .search-icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--text-secondary-color); font-size: 1.1em; }
#mainSearchInput { width: 100%; padding: 18px 20px 18px 50px; font-size: 1.1em; border-radius: 8px; border: 1px solid var(--border-color); background-color: #1f1f1f; color: var(--text-color); box-sizing: border-box; outline: none; transition: border-color 0.2s ease, box-shadow 0.2s ease; font-family: var(--font-sans); }
#mainSearchInput:focus { border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1); }
#mainSearchInput::placeholder { color: var(--text-secondary-color); }
.suggestions-dropdown { display: none; position: absolute; top: calc(100% + 5px); left: 0; right: 0; background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 8px; z-index: 100; max-height: 300px; overflow-y: auto; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.suggestion-item { padding: 12px 20px; color: var(--text-color); cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 1em; }
.suggestion-item:hover { background-color: #2a2a2a; }
.suggestion-item img { width: 20px; height: 20px; border-radius: 3px; background: white; object-fit: contain;}
.suggestion-item .logo-placeholder { /* Style for placeholder in suggestions */
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; background-color: #222;
    border: 1px solid var(--border-color); border-radius: 3px;
    color: var(--text-secondary-color); font-size: 0.7em;
}
.suggestion-title { padding: 10px 20px; font-size: 0.9em; color: #666; text-transform: uppercase; font-weight: bold; border-bottom: 1px solid var(--border-color); background-color: #1a1a1a; }

/* --- Main Content Area --- */
#content { padding: 0; }

/* --- Homepage Specific --- */
.home-cards-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 20px; margin-bottom: 40px; }
.home-card { background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 25px; transition: background-color 0.2s ease; }
.home-card:hover { background-color: #1a1a1a; }
.home-card h3 { margin-top: 0; font-size: 1.1em; color: var(--text-secondary-color); margin-bottom: 20px; }
.home-card .brand-link { display: flex; align-items: center; font-size: 1.3em; font-weight: 600; color: var(--text-color); margin-bottom: 15px; text-decoration: none; }
.home-card .brand-link:hover { color: var(--link-color); }
.home-card .brand-link img, .home-card .logo-placeholder { width: 30px; height: 30px; margin-right: 12px; border-radius: 4px; background: white; padding: 2px; object-fit: contain; }
.home-card .logo-placeholder { display: inline-flex; align-items: center; justify-content: center; background-color: #222; border: 1px solid var(--border-color); color: var(--text-secondary-color); }
.home-card .metric { font-size: 1.1em; margin-bottom: 8px; }
.home-card .metric-label { color: var(--text-secondary-color); }
.home-card .metric-value { font-weight: 500; margin-left: 5px;}
.home-card .metric-value.positive { color: var(--positive-color); } .home-card .metric-value.negative { color: var(--negative-color); }

h2.table-title { margin-bottom: 15px; font-size: 1.5em; }
#brandsTable { width: 100%; border-collapse: collapse; margin-top: 0; background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; }
th, td { border: none; border-bottom: 1px solid var(--border-color); padding: 15px; text-align: left; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
th { background-color: #1a1a1a; font-weight: 600; color: var(--text-secondary-color); text-transform: uppercase; font-size: 0.8em; letter-spacing: 0.8px; }
/* Table Sort Header Style */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text-color); }
th .sort-arrow {
    font-size: 0.8em;
    margin-left: 5px;
    display: inline-block;
    opacity: 0.5;
    width: 1em; /* Reserve space for arrow */
}
th.sort-asc .sort-arrow,
th.sort-desc .sort-arrow {
    opacity: 1;
}

/* --- Category Filter Dropdown --- */
#category-filter-header { position: relative; cursor: pointer; user-select: none; }
#category-filter-header:hover { color: var(--text-color); }
.category-filter-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--card-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 10;
    min-width: 220px;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    padding: 10px;
    font-size: 0.9em;
    text-transform: none;
    letter-spacing: 0;
}
.category-filter-dropdown.show { display: block; }
.category-filter-item {
    display: block;
    padding: 8px 12px;
    color: var(--text-color);
    cursor: pointer;
    border-radius: 4px;
    white-space: nowrap;
    font-weight: 400;
}
.category-filter-item:hover { background-color: #2a2a2a; }
.category-filter-item input { margin-right: 8px; vertical-align: middle; }
.category-filter-item label { vertical-align: middle; cursor: pointer; }
.category-filter-actions {
    display: flex;
    justify-content: space-between;
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px solid var(--border-color);
}
.filter-action-btn {
    font-size: 0.9em;
    color: var(--link-color);
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
}
.filter-action-btn:hover { text-decoration: underline; }


tbody tr { transition: background-color 0.15s ease; }
tbody tr:hover { background-color: #1c1c1c; }
td span.logo-placeholder { 
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; background-color: #222;
    border: 1px solid var(--border-color); border-radius: 4px;
    vertical-align: middle; margin-right: 10px;
    color: var(--text-secondary-color); font-size: 0.8em;
}
td img.table-logo { width: 28px; height: 28px; vertical-align: middle; margin-right: 10px; border-radius: 4px; background-color: #fff; padding: 2px; object-fit: contain; }
/* Table link style: white, no underline */
td a.brand-table-link { color: var(--text-color); font-weight: 500; display: inline-flex; align-items: center; text-decoration: none; }
td a.brand-table-link:hover { color: #ccc;}

/* Rank Change Column Style */
.rank-change {
    font-weight: 600;
    white-space: nowrap;
}
.rank-change.positive {
    color: var(--positive-color);
}
.rank-change.negative {
    color: var(--negative-color);
}
.rank-change.neutral {
    color: var(--text-secondary-color);
}


/* Pill Style */
.category-pill { display: inline-block; padding: 4px 12px; font-size: 0.75em; font-weight: 500; border-radius: 12px; background-color: var(--pill-bg); color: var(--pill-text); margin: 2px 3px 2px 0; border: 1px solid var(--pill-border); white-space: nowrap; }

/* --- Brand Page Specific --- */
a.back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--text-color); /* White, not blue */
    text-decoration: none;
    font-size: 0.9em;
}
a.back-link:hover {
    text-decoration: underline;
    color: var(--accent-hover-color);
}
.brand-page-layout { display: flex; gap: 40px; align-items: flex-start; }
.brand-main-content-wrapper { flex: 1; min-width: 0; }
.brand-toc-sidebar { width: 200px; flex-shrink: 0; position: sticky; top: 40px; height: calc(100vh - 80px); overflow-y: auto; padding-right: 10px; }

.brand-main-content { background-color: transparent; border: none; padding: 0; margin-bottom: 20px; }

.brand-header-fullwidth { background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 30px; margin-bottom: 30px; }
/* Grid layout for brand header */
.brand-header { 
    display: grid;
    grid-template-columns: auto 1fr; /* Logo | Content */
    grid-template-rows: auto auto; /* Rows for details and pills */
    grid-template-areas: 
        "logo details"
        "logo pills";
    gap: 10px 20px; 
}
.brand-header .logo-container { /* NEW container for logo/placeholder */
    grid-area: logo;
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    /* *** ADDED for onerror fallback *** */
    display: inline-flex; 
    align-items: center;
    justify-content: center;
}
.brand-header .logo { 
    width: 60px; height: 60px; border-radius: 6px; border: 1px solid var(--border-color); 
    object-fit: contain; background-color: #fff; padding: 5px; 
}
.brand-header .logo-placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    width: 60px; height: 60px; background-color: #222;
    border: 1px solid var(--border-color); border-radius: 6px;
    color: var(--text-secondary-color); font-size: 1.5em;
}

.brand-details { grid-area: details; }
.brand-details h1 { margin: 0; border: none; padding: 0; font-size: 2.4em; line-height: 1.2; }
.brand-details .meta-data { font-size: 0.9em; color: var(--text-secondary-color); margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px 20px; }
.brand-details .meta-data span { display: inline-flex; align-items: center; }
.brand-details .meta-data i { margin-right: 6px; font-style: normal; width: 1.2em; text-align: center;}
.brand-details p.categories { grid-area: pills; margin: 0; font-size: 0.95em; }
.brand-details a.website-link { font-weight: 500; color: var(--link-color); font-size: 0.95em; text-decoration: none;}

/* --- TOC Sidebar --- */
.brand-toc-sidebar h3 { font-size: 0.85em; color: var(--text-secondary-color); text-transform: uppercase; letter-spacing: 0.8px; margin: 0 0 15px 0; padding-left: 17px; }
.brand-toc-sidebar ul { list-style: none; padding: 0; margin: 0; }
.brand-toc-sidebar li a { display: block; padding: 8px 0 8px 15px; font-size: 0.9em; color: var(--text-secondary-color); border-left: 2px solid var(--border-color); transition: all 0.2s ease; text-decoration: none; }
.brand-toc-sidebar li a:hover { color: var(--text-color); border-left-color: #555; }
.brand-toc-sidebar li a.active { color: var(--accent-color); font-weight: 600; border-left-color: var(--accent-color); }

/* --- Crunchbase Style Score Header --- */
.score-header { 
    grid-area: scores; /* Place scores in the grid */
    display: flex; gap: 40px; 
    margin-top: 20px; 
    padding-top: 25px; 
    border-top: 1px solid var(--border-color); 
    flex-wrap: wrap; 
}
.score-block { display: flex; align-items: center; gap: 15px; }
.score-widget-circle {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: bold; font-size: 1.1em;
    flex-shrink: 0;
    background: var(--border-color); /* Fallback */
}
.score-widget-circle span { /* Text inside circle */ }
.score-details .score-label { font-size: 0.9em; color: var(--text-secondary-color); text-transform: uppercase; letter-spacing: 0.5px; }
.score-details .score-value { font-size: 1.8em; font-weight: 600; display: block; line-height: 1.1; color: var(--text-color);}
.score-details .score-change { font-size: 0.9em; font-weight: 500; }
.score-change.positive { color: var(--positive-color); } .score-change.negative { color: var(--negative-color); } .score-change.neutral { color: var(--text-secondary-color); }

/* --- Promotional Banner --- */
.promo-banner {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 40px 25px; /* Taller padding */
    margin-top: 30px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    gap: 20px;
    background-image: url('http://passby.com/wp-content/uploads/2025/10/Artboard-scaled.jpg');
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    min-height: 200px; /* Make it taller */
    cursor: pointer; /* Make it clickable */
}
.promo-banner::before { /* Dark overlay */
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.6);
    z-index: 1;
}
.promo-banner p { margin: 0; font-size: 1.2em; font-weight: 500; color: var(--text-color); z-index: 2; position: relative; max-width: 60%; }
.promo-banner a { font-weight: bold; color: var(--accent-color); text-decoration: underline; }

/* --- Section Widgets --- */
.section-widget { background-color: var(--card-bg-color); border: 1px solid var(--border-color); border-radius: 8px; padding: 25px; margin-bottom: 30px; scroll-margin-top: 20px; }
.section-widget h3 { margin-top: 0; font-size: 1.3em; color: var(--text-color); border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 25px; }
.chart-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }

/* Section Header Snippets */
.data-snippet-header { 
    display: flex;
    justify-content: flex-start; /* Align left */
    gap: 40px; /* Wider space */
    background-color: transparent; /* No background */
    padding: 0 0 20px 0; /* Padding below */
    border-bottom: 1px solid var(--border-color); /* Separator */
    margin-bottom: 25px; /* More space */
    text-align: left;
    flex-wrap: wrap;
}
.snippet { flex: none; /* Don't grow/shrink */ }
.snippet-label { font-size: 0.9em; color: var(--text-secondary-color); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 5px; display: block; }
.snippet-value { font-size: 1.8em; font-weight: 600; color: var(--text-color); line-height: 1.1;}
.snippet-value.positive { color: var(--positive-color); }
.snippet-value.negative { color: var(--negative-color); }
.snippet-value.neutral { color: var(--text-secondary-color); }


/* --- Blurred Section Overlay --- */
/* Wrapper for blurred content, whether single or multi */
.blurred-section {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}
/* Special styles for the multi-widget wrapper */
.blurred-section.multi-widget-wrapper {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
    background-color: transparent;
    border: none;
    padding: 0;
}
.blurred-section-content {
    filter: blur(5px);
    transition: filter 0.3s ease;
    user-select: none;
    pointer-events: none; /* Prevent interaction with blurred charts */
}
/* Special styles for multi-wrapper content */
.multi-widget-wrapper .blurred-section-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.blur-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
    text-align: center;
    padding: 10px;
    border-radius: 8px; /* Cover the whole area */
}
.blurred-section:hover .blur-overlay {
    opacity: 1; /* Show overlay on hover */
}
.blur-overlay i { 
    font-size: 1.5em;
    margin-bottom: 10px;
}

/* --- CTA Embed Container (Now just a widget) --- */
#custom-html-card {
    scroll-margin-top: 20px; /* Offset for TOC scroll */
    /* Remove widget padding, the form has its own */
    padding: 0;
    overflow: hidden; /* Ensure form's border radius is respected */
}

/* --- Charts (Keep existing chart container styles) --- */
.chart-container { position: relative; min-height: 350px; background-color: transparent; border: none; border-radius: 0; display: block; color: var(--text-secondary-color); }
.chart-container canvas { background-color: var(--card-bg-color); border-radius: 8px; border: 1px solid var(--border-color); width: 100% !important; height: 350px !important; }
.chart-placeholder-div { min-height: 350px; background-color: #1a1a1a; border: 1px dashed var(--border-color); display: flex; align-items: center; justify-content: center; color: var(--text-secondary-color); border-radius: 8px; padding: 15px; text-align: center; }

/* --- Top Stores Table Styles --- */
.data-table-header-only, .data-table-body-only {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Ensures columns align */
}
.data-table-header-only th {
    background-color: #1a1a1a;
    font-weight: 600;
    color: var(--text-secondary-color);
    text-transform: uppercase;
    font-size: 0.8em;
    letter-spacing: 0.8px;
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}
.data-table-header-only {
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}
.data-table-body-only td {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    text-align: left;
    vertical-align: middle;
    background-color: var(--card-bg-color); /* Match card bg */
    font-size: 0.9em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-table-body-only tr:last-child td {
    border-bottom: none;
}
.data-table-body-only {
    border: 1px solid var(--border-color);
    border-top: none;
    /* border-radius: 0 0 8px 8px; */ /* Handled by blur wrapper */
    overflow: hidden;
}
/* Column widths for alignment */
.data-table-header-only th:nth-child(1), .data-table-body-only td:nth-child(1) { width: 25%; }
.data-table-header-only th:nth-child(2), .data-table-body-only td:nth-child(2) { width: 30%; }
.data-table-header-only th:nth-child(3), .data-table-body-only td:nth-child(3) { width: 15%; }
.data-table-header-only th:nth-child(4), .data-table-body-only td:nth-child(4) { width: 15%; }
.data-table-header-only th:nth-child(5), .data-table-body-only td:nth-child(5) { width: 15%; }

/* --- Demographics Grid --- */
.chart-grid-three {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}
.chart-grid-three .chart-placeholder-div {
    min-height: 250px; /* Smaller for pie charts */
}

/* --- Causal Factors Chart --- */
.causal-factor-chart {
    position: relative;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9em;
    max-width: 100%;
    overflow: hidden;
}
.factor-center-line {
    position: absolute;
    left: 45%; /* Axis position */
    top: 0;
    bottom: 0;
    width: 1px;
    background-color: var(--text-secondary-color);
    z-index: 1;
}
.factor-bar {
    display: flex;
    align-items: center;
    height: 28px;
    color: var(--text-color);
    position: relative;
    margin-left: 45%; /* Align with center line */
    min-width: 1px; /* Ensure bar is visible */
}
.factor-label {
    position: absolute;
    right: 100%;
    margin-right: 10px;
    color: var(--text-secondary-color);
    white-space: nowrap;
    text-align: right;
    width: 40%; /* Fixed width for labels */
}
.factor-value {
    position: relative; /* Inside the bar */
    padding: 0 10px;
    font-weight: 600;
    color: #fff;
    z-index: 2;
    white-space: nowrap;
}
.factor-bar.positive {
    background-color: var(--positive-color);
    border-radius: 0 4px 4px 0;
}
.factor-bar.negative {
    background-color: var(--negative-color);
    margin-left: 0; /* Reset margin */
    /* Move to center, align right, and use width */
    transform-origin: right;
    width: auto; /* Let content push width */
    transform: translateX(45%);
    display: inline-flex; /* Fit to content */
    flex-direction: row-reverse;
    border-radius: 4px 0 0 4px;
}
.factor-bar.negative .factor-label {
    /* Label is already on the left, this is fine */
}
.factor-bar.negative .factor-value {
    /* Text is already correct, no flip needed */
    padding-left: 10px;
}


.loading { text-align: center; font-size: 1.2em; color: var(--text-secondary-color); padding: 50px; }
/* Responsive Adjustments */
@media screen and (max-width: 900px) { 
    .brand-page-layout { grid-template-columns: 1fr; } 
    .brand-toc-sidebar { display: none; } 
    .chart-pair { grid-template-columns: 1fr; } 
    .chart-grid-three { grid-template-columns: 1fr; } /* Stack demo charts */
}
@media screen and (max-width: 600px) { 
    /* Responsive table styles */ 
    table, thead, tbody, th, td, tr { display: block; } 
    thead tr { position: absolute; top: -9999px; left: -9999px; } 
    tr { border: 1px solid var(--border-color); margin-bottom: 10px;} 
    td { border: none; border-bottom: 1px solid var(--border-color); position: relative; padding-left: 50%; text-align: right; min-height: 30px; background-color: var(--card-bg-color); } 
    td:before { position: absolute; left: 6px; width: 45%; padding-right: 10px; white-space: nowrap; text-align: left; font-weight: bold; color: var(--text-secondary-color); } 
    
    /* Mobile Table Headers */
    td:nth-of-type(1):before { content: "Rank"; } 
    td:nth-of-type(2):before { content: "Brand"; } 
    td:nth-of-type(3):before { content: "Category"; } 
    td:nth-of-type(4):before { content: "Change"; } 
    td:nth-of-type(5):before { content: "Growth"; } 
    td:nth-of-type(6):before { content: "Heat"; }
    td:nth-of-type(7):before { content: "Total"; }
    
    /* Stack brand header on mobile */
    .brand-header { grid-template-areas: "logo details" "pills pills" "scores scores"; }
    .brand-details p.categories { grid-area: pills; margin-top: 15px; }
    .score-header { grid-area: scores; }
    .promo-banner { min-height: 100px; padding: 20px; }
    .promo-banner p { max-width: 100%; }
    .data-snippet-header { justify-content: space-between; } /* Better stacking */
    .snippet { min-width: 120px; }

    /* Causal chart on mobile */
    .factor-center-line { left: 35%; }
    .factor-bar { margin-left: 35%; }
    .factor-label { width: 30%; font-size: 0.9em; }
    .factor-bar.negative { transform: translateX(35%); }

    /* --- NEW: Form Responsive --- */
    #custom-html-card .form-row .form-group {
        float: none;
        width: 100%;
    }
    #custom-html-card .form-row .form-group:first-child { padding-right: 0; }
    #custom-html-card .form-row .form-group:last-child { padding-left: 0; }
    #custom-html-card .review-panel { flex-direction: column; }
    #custom-html-card .form-content { padding: 2rem 1.5rem; }
}

/* --- --- --- --- --- --- --- --- --- --- --- */
/* --- --- --- NEW FORM STYLES --- --- --- */
/* --- All rules below are scoped to #custom-html-card --- */

#custom-html-card {
    /* These are the :root variables, scoped to the card */
    --background: #1e1e1e; /* Form's --card color */
    --foreground-primary: #FFFFFF;
    --foreground-secondary: #b3b3b3;
    --card: #1e1e1e;
    --border: #333333;
    --input: #2a2a2a;
    --accent: #FFFFFF; 
    --radius: 8px;
    --growth-green: #1DB954;
    --growth-red: #e74c3c;
    
    /* Use the form's font inside this card */
    font-family: 'Space Mono', monospace; 
}

#custom-html-card * {
    box-sizing: border-box;
}

/* Override widget padding for the form */
#custom-html-card.section-widget {
    padding: 0;
}

#custom-html-card .main-container {
    width: 100%;
    background-color: var(--card);
    border-radius: var(--radius);
    /* The form is already in a bordered card, so no extra border */
    border: none; 
    overflow: hidden;
    /* No shadow, it's inside a card */
    box-shadow: none; 
}

#custom-html-card .stepper-nav {
    display: flex; background-color: #252525; padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}
#custom-html-card .step {
    flex: 1; text-align: center; color: var(--foreground-secondary);
    font-weight: 700; padding-bottom: 1rem; border-bottom: 3px solid transparent;
    position: relative; text-transform: lowercase; font-size: 0.9rem;
    transition: color 0.3s ease;
}
#custom-html-card .step.active, #custom-html-card .step.completed {
    color: var(--foreground-primary);
}
#custom-html-card .step.active {
     border-bottom-color: var(--accent);
}
#custom-html-card .step-number {
    background-color: var(--border); color: var(--foreground-secondary); border-radius: 50%;
    width: 24px; height: 24px; display: inline-block; line-height: 24px;
    font-size: 0.8rem; margin-right: 0.5rem; transition: background-color 0.3s ease, color 0.3s ease;
}
#custom-html-card .step.active .step-number {
    background-color: var(--accent); color: var(--background);
}
#custom-html-card .step.completed .step-number::before {
    content: '✓'; font-weight: 700;
}
#custom-html-card .step.completed .step-number {
    background-color: var(--accent); color: var(--background);
}


#custom-html-card .form-content { padding: 3rem; }
#custom-html-card .form-step { display: none; }
#custom-html-card .form-step.active { display: block; }

#custom-html-card h2, #custom-html-card h3, #custom-html-card h4 { font-weight: 700; color: var(--foreground-primary); }
#custom-html-card h2 { font-size: 2rem; margin-bottom: 0.5rem; }
#custom-html-card h3 { font-size: 1.5rem; margin-bottom: 1.5rem; }
#custom-html-card p { color: var(--foreground-secondary); margin-bottom: 2rem; }

/* Override dashboard h3 styles */
#custom-html-card .section-widget h3 {
    margin-top: 0; font-size: 1.5rem; color: var(--foreground-primary); 
    border-bottom: none; padding-bottom: 0; margin-bottom: 1.5rem;
}

#custom-html-card .form-group { margin-bottom: 1.5rem; }
#custom-html-card label { display: block; margin-bottom: 0.5rem; font-weight: 700; }

#custom-html-card .form-row::after {
    content: "";
    display: table;
    clear: both;
}
#custom-html-card .form-row .form-group {
    float: left;
    width: 50%;
}
#custom-html-card .form-row .form-group:first-child {
    padding-right: 0.75rem;
}
#custom-html-card .form-row .form-group:last-child {
    padding-left: 0.75rem;
}


#custom-html-card input[type="text"], 
#custom-html-card input[type="email"], 
#custom-html-card select {
    width: 100%; background-color: var(--input); border: 1px solid var(--border);
    color: var(--foreground-primary); padding: 0.75rem 1rem; border-radius: var(--radius); 
    font-size: 1rem; font-family: 'Space Mono', monospace;
}

#custom-html-card .brand-search-trigger {
    cursor: pointer; position: relative;
}
#custom-html-card .brand-search-trigger::after {
    content: '⌕'; position: absolute; right: 1rem; top: 50%;
    transform: translateY(-50%); color: var(--foreground-secondary);
}

#custom-html-card .modal-results .option-logo, 
#custom-html-card .brand-metadata .brand-logo { 
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover;
    background-color: #fff; flex-shrink: 0; border: 2px solid var(--border);
    overflow: hidden; 
}
#custom-html-card .brand-metadata {
    display: flex; align-items: center; gap: 1.5rem; background-color: var(--input);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem;
    margin-top: 1rem; display: none;
}
#custom-html-card .brand-metadata .brand-logo { width: 60px; height: 60px; } 
#custom-html-card .brand-info h4 { margin: 0; font-size: 1.2rem; }
#custom-html-card .brand-info p { margin: 0.25rem 0 0; color: var(--foreground-secondary); font-size: 0.9rem; }
#custom-html-card .brand-stats { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; margin-left: auto; text-align: right; }
#custom-html-card .brand-stats div { color: var(--foreground-primary); }

#custom-html-card .error-message { color: var(--growth-red); font-size: 0.9rem; margin-top: 0.5rem; display: none; }
#custom-html-card .has-error { border-color: var(--growth-red) !important; }

#custom-html-card .map-container {
    position: relative; background: url('https://passby.com/docs/data/Screenshot%202025-10-06%20at%2012.23.49.png') no-repeat center center;
    background-size: cover; border-radius: var(--radius); border: 1px solid var(--border);
}
#custom-html-card .form-step .map-container { height: 300px; }

#custom-html-card .map-overlay {
    position: absolute; top: 1rem; left: 1rem; background: rgba(30, 30, 30, 0.9);
    padding: 1rem; border-radius: var(--radius); backdrop-filter: blur(5px);
}
#custom-html-card .map-overlay p { margin: 0.25rem 0 0; font-size: 0.9rem; }

#custom-html-card .tag-group { display: flex; flex-wrap: wrap; gap: 0.75rem; }
#custom-html-card .tag {
    background-color: var(--input); border: 1px solid var(--border); padding: 0.5rem 1rem;
    border-radius: 20px; cursor: pointer; transition: all 0.2s ease;
}
#custom-html-card .tag.selected { background-color: #444; border-color: var(--accent); } 
#custom-html-card .tag-group.has-error { padding: 0.5rem; border: 1px solid var(--growth-red); border-radius: var(--radius); }

#custom-html-card .review-panel { display: flex; gap: 2rem; align-items: stretch; }
#custom-html-card .review-summary { flex: 1; }
#custom-html-card .review-summary .summary-item { margin-bottom: 1rem; border-left: 3px solid var(--accent); padding-left: 1rem; }
#custom-html-card .review-summary .summary-item strong { display: block; color: var(--foreground-secondary); }
#custom-html-card .review-panel .map-container { flex: 1; }

#custom-html-card .nav-buttons {
    display: flex; justify-content: flex-end; margin-top: 3rem; border-top: 1px solid var(--border); padding-top: 2rem;
}
#custom-html-card .btn-container { display: flex; gap: 1rem; }
#custom-html-card .btn {
    background: var(--input); color: var(--foreground-primary); border: 1px solid var(--border);
    padding: 0.75rem 1.5rem; font-size: 1rem; font-weight: 700; border-radius: var(--radius);
    cursor: pointer; transition: all 0.2s ease; font-family: 'Space Mono', monospace;
}
#custom-html-card .btn:hover { border-color: var(--foreground-secondary); }
#custom-html-card .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--background); font-weight: 700; } 
#custom-html-card .btn-primary:hover { opacity: 0.9; border-color: var(--accent); }
#custom-html-card #prevBtn { visibility: hidden; }

/* Modal Styles - Scoped */
#custom-html-card .modal-container {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
    display: none; justify-content: center; align-items: center; z-index: 2000;
}
#custom-html-card .modal-content {
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius); width: 90%; max-width: 700px;
    display: flex; flex-direction: column; max-height: 80vh;
}
#custom-html-card .modal-header { padding: 1.5rem; border-bottom: 1px solid var(--border); position: relative; }
#custom-html-card .modal-header .close-btn {
    position: absolute; top: 1.5rem; right: 1.5rem;
    background: none; border: none; color: var(--foreground-secondary);
    font-size: 2rem; line-height: 1; cursor: pointer;
}
#custom-html-card .modal-body { padding: 1.5rem; overflow-y: auto; }
#custom-html-card #modal-search-input { 
    background-color: var(--input); border: 1px solid var(--border); color: var(--foreground-primary);
    margin-bottom: 1rem;
}
#custom-html-card .modal-results { padding: 0 0.5rem; }
#custom-html-card .modal-results .option-layout {
    cursor: pointer; border-radius: var(--radius); margin-bottom: 0.5rem;
    transition: background-color 0.2s ease;
    /* Added from your original file, missing from copy */
    display: flex; align-items: center; gap: 1rem; padding: 0.75rem;
}
#custom-html-card .modal-results .option-layout:hover { background-color: var(--input); }
#custom-html-card .option-layout .option-details { min-width: 0; } 
#custom-html-card .option-layout .option-details strong { white-space: nowrap; display: block; }
/* Added from your original file, missing from copy */
#custom-html-card .option-layout .option-stats { 
    margin-left: auto; text-align: right; font-size: 0.9rem; 
    color: var(--foreground-secondary); flex-shrink: 0;
}
#custom-html-card .growth-positive { color: var(--growth-green) !important; font-weight: 700; } 
#custom-html-card .growth-negative { color: var(--growth-red) !important; font-weight: 700; }

#custom-html-card .thank-you-message { text-align: center; padding: 4rem 2rem; }
#custom-html-card .thank-you-message .icon { font-size: 4rem; margin-bottom: 1rem; color: var(--accent); }