﻿/* ============================================================
   International Egg Rate Manager – Public Styles v2.1
   Mobile-first, premium card design, responsive tables
   ============================================================ */

/* ── Google Font ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Reset & Base ─────────────────────────────────────────── */
.egg-rate-container *,
.egg-rate-container *::before,
.egg-rate-container *::after { box-sizing: border-box; }

.egg-rate-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1a1a2e;
    font-size: 15px;
    line-height: 1.5;
}

/* ── Section Wrapper ──────────────────────────────────────── */
.egg-rate-section,
.egg-rate-grid-section,
.egg-rate-city-section,
.egg-rate-state-section,
.egg-rate-trend-section,
.egg-rate-market-section {
    background: #fff;
    border: 1px solid #e8ecf0;
    border-radius: 14px;
    padding: 24px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

/* ── Section Headings ─────────────────────────────────────── */
.egg-rate-heading,
.egg-rate-section-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 18px 0;
    padding-bottom: 12px;
    border-bottom: 3px solid #f59e0b;
    display: flex;
    align-items: center;
    gap: 8px;
}

.egg-rate-subheading {
    font-size: 17px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 0 12px 0;
}

/* ── Location Header ──────────────────────────────────────── */
.egg-rate-location-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    border-radius: 12px;
    color: #fff;
    flex-wrap: wrap;
}

.location-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.egg-rate-location-name {
    font-weight: 800;
    font-size: 20px;
    color: #f59e0b;
}

.location-state { font-size: 13px; opacity: 0.8; }

.header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.egg-rate-change-location,
.egg-rate-refresh-btn {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.egg-rate-change-location:hover,
.egg-rate-refresh-btn:hover {
    background: rgba(255,255,255,0.28);
    transform: translateY(-1px);
}

.egg-rate-updated-label {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 14px 0;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── City Selector ────────────────────────────────────────── */
#egg-rate-city-selector-wrapper {
    margin-bottom: 14px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.egg-rate-city-dropdown,
.egg-rate-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    color: #1a1a2e;
    transition: border-color 0.2s;
    outline: none;
}

.egg-rate-city-dropdown:focus,
.egg-rate-select:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.15);
}

/* ── Specific-page rate grid (egg-rate-display) ───────────── */
.egg-rate-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-top: 12px;
}
.egg-rate-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 14px;
    text-align: center;
    transition: transform 0.18s, box-shadow 0.18s;
}
.egg-rate-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.09); }
.egg-rate-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 6px;
}
.egg-rate-value {
    display: block;
    font-size: 22px;
    font-weight: 800;
    color: #0f3460;
}

/* Numeric column alignment in comparison table */
.egg-rate-data-table th.numeric,
.egg-rate-data-table td.numeric { text-align: right; }

/* ── ═══════════ RATE CARDS ══════════════════════════════ ── */
.egg-rate-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.egg-rate-grid-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    border: 2px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.egg-rate-grid-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    border-radius: 12px 12px 0 0;
}

.egg-rate-grid-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

/* Card Themes */
.card-primary  { border-color: #dbeafe; }
.card-primary::before  { background: linear-gradient(90deg,#3b82f6,#60a5fa); }

.card-tray     { border-color: #d1fae5; }
.card-tray::before     { background: linear-gradient(90deg,#10b981,#34d399); }

.card-hundred  { border-color: #fde8d8; }
.card-hundred::before  { background: linear-gradient(90deg,#f97316,#fb923c); }

.card-crate    { border-color: #ede9fe; }
.card-crate::before    { background: linear-gradient(90deg,#8b5cf6,#a78bfa); }

.card-desi     { border-color: #fef3c7; }
.card-desi::before     { background: linear-gradient(90deg,#f59e0b,#fbbf24); }

.card-necc     { border-color: #fce7f3; background: linear-gradient(135deg,#fff5fb,#fff); }
.card-necc::before     { background: linear-gradient(90deg,#ec4899,#f472b6); }

.card-icon {
    font-size: 22px;
    margin-bottom: 6px;
    opacity: 0.85;
}

.card-primary  .card-icon { color: #3b82f6; }
.card-tray     .card-icon { color: #10b981; }
.card-hundred  .card-icon { color: #f97316; }
.card-crate    .card-icon { color: #8b5cf6; }
.card-desi     .card-icon { color: #f59e0b; }
.card-necc     .card-icon { color: #ec4899; }

.card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 5px;
}

.card-value {
    font-size: 22px;
    font-weight: 800;
    color: #1a1a2e;
    line-height: 1.1;
    margin-bottom: 4px;
}

.card-necc .card-value { color: #ec4899; }
.card-primary .card-value { color: #2563eb; }
.card-tray .card-value { color: #059669; }

.card-unit {
    font-size: 11px;
    color: #9ca3af;
    font-weight: 500;
}

.na { color: #d1d5db; font-size: 18px; }

/* NECC badge */
.card-necc .card-badge {
    display: inline-block;
    background: #ec4899;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* ── Quick Reference Table ────────────────────────────────── */
.egg-rate-quick-table-wrapper {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e8ecf0;
}

.egg-rate-quick-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.egg-rate-quick-table thead tr {
    background: linear-gradient(90deg, #1a1a2e, #0f3460);
    color: #fff;
}

.egg-rate-quick-table th {
    padding: 10px 14px;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.egg-rate-quick-table tbody tr:nth-child(even) { background: #f8fafc; }
.egg-rate-quick-table tbody tr:hover { background: #f0f7ff; }

.egg-rate-quick-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    font-weight: 500;
}

.egg-rate-quick-table td:nth-child(2),
.egg-rate-quick-table td:nth-child(3) {
    font-weight: 700;
    color: #0f3460;
}

/* ── ═══════════ DATA TABLES (City / State) ══════════════ ── */
.egg-rate-table-controls {
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.egg-rate-search-input {
    flex: 1;
    min-width: 180px;
    padding: 10px 14px 10px 36px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.85-3.85zm-5.242 1.156a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 10px center;
    outline: none;
    transition: border-color 0.2s;
}

.egg-rate-search-input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245,158,11,0.12);
}

/* Table wrapper – scrollable only if truly needed */
.egg-rate-table-wrapper {
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #e8ecf0;
}

/* ── Standard Desktop Table ───────────────────────────────── */
.egg-rate-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.egg-rate-data-table thead tr {
    background: linear-gradient(90deg, #1a1a2e, #0f3460);
    color: #fff;
}

.egg-rate-data-table th {
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
}

.egg-rate-data-table th .sort-icon { opacity: 0.5; margin-left: 4px; font-size: 11px; }
.egg-rate-data-table th.asc .sort-icon::after  { content: '▲'; }
.egg-rate-data-table th.desc .sort-icon::after { content: '▼'; }

.egg-rate-data-table tbody tr:nth-child(even) { background: #f8fafc; }
.egg-rate-data-table tbody tr:hover { background: #fffbeb; }

.egg-rate-data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

/* Highlighted rows */
.egg-rate-data-table tr.lowest-rate  { background: #f0fdf4 !important; }
.egg-rate-data-table tr.highest-rate { background: #fff1f2 !important; }
.egg-rate-data-table tr.lowest-rate td:first-child  { border-left: 3px solid #22c55e; }
.egg-rate-data-table tr.highest-rate td:first-child { border-left: 3px solid #ef4444; }

.city-name, .state-name { font-weight: 600; }
.city-count { display: block; font-size: 11px; color: #9ca3af; font-weight: 400; }
.price-cell { font-weight: 700; color: #1a1a2e; }
.price-cell.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.date-cell { font-size: 12px; color: #6b7280; }
.updated-date { white-space: nowrap; }

/* Badges */
.badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    vertical-align: middle;
}

.badge-lowest  { background: #d1fae5; color: #065f46; }
.badge-highest { background: #fee2e2; color: #991b1b; }

/* ── ═══════ MOBILE STACKED TABLE CARD LAYOUT ════════════ ── */
/*
   NUCLEAR approach: !important on everything so no theme or
   caching plugin override can re-enable horizontal scroll.
   Tested: works even when table has inline styles or theme CSS conflicts.
*/
@media screen and (max-width: 768px) {

    /* Kill the wrapper overflow completely */
    .egg-rate-table-wrapper {
        overflow-x: hidden !important;
        overflow-y: visible !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
    }

    /* Make table itself a block – kills fixed-width column behaviour */
    .egg-rate-data-table,
    .egg-rate-data-table thead,
    .egg-rate-data-table tbody,
    .egg-rate-data-table tfoot,
    .egg-rate-data-table tr,
    .egg-rate-data-table th,
    .egg-rate-data-table td {
        display: block !important;
        width: 100% !important;
    }

    /* Hide the header row – labels come from data-label */
    .egg-rate-data-table thead,
    .egg-rate-data-table thead tr {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* Each row = a card */
    .egg-rate-data-table tr {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 12px !important;
        margin: 0 0 12px 0 !important;
        padding: 12px 14px !important;
        box-shadow: 0 2px 10px rgba(0,0,0,0.06) !important;
    }

    /* Each cell = label: value row */
    .egg-rate-data-table td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 7px 0 !important;
        border-bottom: 1px solid #f0f4f8 !important;
        font-size: 14px !important;
        text-align: right !important;
        min-height: 0 !important;
    }

    .egg-rate-data-table td:last-child {
        border-bottom: none !important;
    }

    /* data-label prepended via ::before */
    .egg-rate-data-table td::before {
        content: attr(data-label) !important;
        display: inline-block !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #64748b !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
        flex-shrink: 0 !important;
        margin-right: 10px !important;
        text-align: left !important;
    }

    /* Colour accent rows */
    .egg-rate-data-table tr.lowest-rate  { border-left: 4px solid #22c55e !important; }
    .egg-rate-data-table tr.highest-rate { border-left: 4px solid #ef4444 !important; }
    .egg-rate-data-table tr.lowest-rate td:first-child,
    .egg-rate-data-table tr.highest-rate td:first-child {
        border-left: none !important;
    }

    /* Quick-ref table stays scrollable (it's compact and correct) */
    .egg-rate-quick-table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    .egg-rate-quick-table { min-width: 340px !important; }

    /* Grid cards – 2 per row on mobile */
    .egg-rate-grid-container {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }

    .card-value { font-size: 18px; }
    .card-icon  { font-size: 18px; }
}

/* ── ═══════ TABLET ADJUSTMENTS ══════════════════════════ ── */
@media screen and (min-width: 641px) and (max-width: 860px) {
    .egg-rate-grid-container { grid-template-columns: repeat(3, 1fr); }

    /* Slim table on tablet to avoid scroll */
    .egg-rate-data-table { font-size: 13px; }
    .egg-rate-data-table th,
    .egg-rate-data-table td { padding: 9px 10px; }

    .date-cell { display: none; } /* hide date col on tablet to save space */
    .egg-rate-data-table th:last-child { display: none; }
}

/* ── Summary row ──────────────────────────────────────────── */
.egg-rate-table-summary {
    margin-top: 14px;
    padding: 12px 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    font-size: 13px;
    color: #374151;
}

.egg-rate-table-summary p { margin: 0; }
.summary-cities { color: #6b7280; }

.egg-rate-error-box {
    padding: 16px;
    background: #fff1f2;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    color: #991b1b;
    font-size: 14px;
}

/* ── Last Sync Label ──────────────────────────────────────── */
.egg-rate-last-sync {
    font-size: 12px;
    color: #6b7280;
    margin: -10px 0 14px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* ── Dashboard Wrapper ────────────────────────────────────── */
.egg-rate-dashboard-wrapper { max-width: 100%; }

.egg-rate-dashboard-header {
    background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    color: #fff;
    border-radius: 14px;
    padding: 22px 24px;
    margin-bottom: 20px;
}

.dashboard-title {
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 8px 0;
    line-height: 1.3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.auto-date {
    font-size: 18px;
    font-weight: 600;
    color: #f59e0b;
}

.dashboard-subtitle {
    font-size: 13px;
    opacity: 0.8;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.last-sync { font-weight: 600; opacity: 1; }

.dashboard-section { margin-bottom: 20px; }

/* ── Chart Section ────────────────────────────────────────── */
.egg-rate-trend-section { overflow: hidden; }

.trend-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.trend-city-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 200px;
}

.trend-city-selector-wrapper label {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    color: #374151;
}

.trend-city-selector-wrapper .egg-rate-select {
    flex: 1;
}

.trend-period-selector { display: flex; gap: 6px; flex-wrap: wrap; }

.trend-period-btn {
    padding: 7px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.trend-period-btn:hover { border-color: #f59e0b; color: #f59e0b; }
.trend-period-btn.active { background: #f59e0b; border-color: #f59e0b; color: #fff; }

.chart-canvas-wrapper {
    position: relative;
    width: 100%;
    min-height: 300px;
    background: #fafafa;
    border-radius: 10px;
    overflow: hidden;
}

#trendChart {
    width: 100% !important;
    display: block;
}

#trend-loading-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.88);
    border-radius: 10px;
    z-index: 10;
}

.chart-loading-spinner {
    text-align: center;
    color: #6b7280;
}

.chart-loading-spinner .spinner {
    width: 38px; height: 38px;
    border: 4px solid #e2e8f0;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Market Summary ───────────────────────────────────────── */
.market-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.market-stat-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px 12px;
    text-align: center;
}

.market-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7280;
    margin-bottom: 6px;
}

.market-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: #0f3460;
}

/* ── Stale Data Warning ───────────────────────────────────── */
.stale-data-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #92400e;
    flex-wrap: wrap;
}

.stale-data-warning .refresh-btn-inline {
    background: #f59e0b;
    color: #fff;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

/* ── Location Selector ────────────────────────────────────── */
.egg-rate-location-selector {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
}

.location-dropdowns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.location-dropdown-group { display: flex; flex-direction: column; }

.location-dropdown-group label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 5px;
    color: #374151;
}

.priority-cities {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.priority-label { font-size: 12px; font-weight: 600; color: #374151; }

.priority-city-btn {
    background: #fff;
    border: 1.5px solid #e2e8f0;
    color: #374151;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.priority-city-btn:hover {
    background: #f59e0b;
    border-color: #f59e0b;
    color: #fff;
}

.detect-location-btn {
    background: #0f3460;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.detect-location-btn:hover { background: #1a1a2e; }

/* ── Extremes Grid ────────────────────────────────────────── */
.egg-rate-extreme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.extreme-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.extreme-highest { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.extreme-lowest  { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }

.extreme-label  { display: block; font-size: 13px; opacity: 0.9; margin-bottom: 8px; font-weight: 500; }
.extreme-value  { display: block; font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.extreme-location { display: block; font-size: 13px; opacity: 0.9; }

/* ── Compare Box ──────────────────────────────────────────── */
.egg-rate-compare-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.compare-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}

.compare-label { display: block; font-size: 13px; color: #6b7280; margin-bottom: 6px; }

.compare-value {
    display: block;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.price-up   { color: #059669; }
.price-down { color: #dc2626; }

/* ── Trust / Confidence ───────────────────────────────────── */
.trust-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.trust-item {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
}

.trust-label  { display: block; font-size: 12px; color: #6b7280; margin-bottom: 5px; }
.trust-value  { display: block; font-size: 15px; font-weight: 700; color: #1a1a2e; }

.confidence-high   { color: #059669; }
.confidence-medium { color: #d97706; }
.confidence-low    { color: #dc2626; }

/* ── Disclaimer ───────────────────────────────────────────── */
.egg-rate-disclaimer {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    margin: 12px 0 0;
    padding: 10px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 6px;
}

/* ── Error states ─────────────────────────────────────────── */
.egg-rate-error {
    background: #fff1f2;
    color: #991b1b;
    padding: 14px;
    border: 1px solid #fecdd3;
    border-radius: 8px;
    text-align: center;
    font-size: 14px;
}

/* ── Loading skeleton ─────────────────────────────────────── */
.egg-rate-grid-container.loading { opacity: 0.55; pointer-events: none; }

.loading-dots::after {
    content: '...';
    animation: dotpulse 1.4s steps(4,end) infinite;
}

@keyframes dotpulse {
    0%,20%  { content: '.';   }
    40%     { content: '..';  }
    60%,100%{ content: '...'; }
}

/* ── Print ────────────────────────────────────────────────── */
@media print {
    .egg-rate-location-selector,
    .trend-controls,
    .egg-rate-change-location,
    .egg-rate-refresh-btn { display: none; }

    .egg-rate-section,
    .egg-rate-data-table tr { page-break-inside: avoid; }
}

/* ══════════════════════════════════════════════════════════════
   City-Wise Rate Table  (.ercw-*)
   Table-first · Mobile responsive · Yesterday comparison
   ══════════════════════════════════════════════════════════════ */

.ercw-wrap { font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif; max-width:100%; }

.ercw-header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.ercw-title  { font-size:18px; font-weight:700; color:#0f3460; margin:0; }
.ercw-date   { font-size:13px; font-weight:400; color:#6b7280; margin-left:8px; }

.ercw-search {
    padding:8px 14px; border:1px solid #d1d5db; border-radius:8px;
    font-size:14px; min-width:200px; outline:none;
    transition:border-color .2s,box-shadow .2s;
}
.ercw-search:focus { border-color:#0f3460; box-shadow:0 0 0 3px rgba(15,52,96,.1); }

/* Table wrapper */
.egg-rate-table-wrapper { overflow-x:auto; border-radius:10px; border:1px solid #e5e7eb; }

.ercw-table {
    width:100%; border-collapse:collapse; font-size:14px;
}
.ercw-table thead { background:linear-gradient(135deg,#0f3460 0%,#16213e 100%); color:#fff; }
.ercw-table thead th {
    padding:12px 14px; text-align:left; font-weight:600;
    font-size:12px; letter-spacing:.4px; text-transform:uppercase; white-space:nowrap;
}
.ercw-table thead th.numeric { text-align:right; }
.ercw-table tbody tr { border-bottom:1px solid #f3f4f6; transition:background .15s; }
.ercw-table tbody tr:last-child { border-bottom:none; }
.ercw-table tbody tr:hover { background:#f8fafc; }
.ercw-table tbody td { padding:11px 14px; vertical-align:middle; }
.ercw-table tbody td.numeric { text-align:right; font-variant-numeric:tabular-nums; }
.ercw-table tbody td strong { color:#0f3460; }

.price-up   { color:#dc2626; font-weight:700; }
.price-down { color:#059669; font-weight:700; }

.ercw-footer {
    display:flex; flex-wrap:wrap; gap:16px;
    font-size:13px; color:#6b7280;
    padding:10px 0; border-top:1px solid #f3f4f6; margin-top:10px;
}
.ercw-footer strong { color:#0f3460; }

.stale-data-warning {
    background:#fffbeb; border:1px solid #fcd34d; color:#92400e;
    padding:10px 14px; border-radius:8px; font-size:13px; margin-bottom:12px;
}
.egg-rate-error-box {
    background:#fff1f2; border:1px solid #fecdd3; color:#991b1b;
    padding:16px; border-radius:10px; text-align:center; font-size:14px;
}

/* ── Mobile: stack table rows ─────────────────────────────── */
@media (max-width:640px) {
    .ercw-header { flex-direction:column; align-items:flex-start; }
    .ercw-search { width:100%; }
    .ercw-title  { font-size:16px; }

    .ercw-table thead { display:none; }
    .ercw-table tbody tr {
        display:block; margin-bottom:12px;
        border:1px solid #e5e7eb; border-radius:10px;
        box-shadow:0 2px 6px rgba(0,0,0,.05); overflow:hidden;
    }
    .ercw-table tbody td {
        display:flex; justify-content:space-between; align-items:center;
        padding:9px 14px; border-bottom:1px solid #f3f4f6; font-size:14px;
        text-align:right;
    }
    .ercw-table tbody td:last-child { border-bottom:none; }
    .ercw-table tbody td::before {
        content:attr(data-label); font-weight:600;
        color:#6b7280; text-align:left; font-size:12px;
        text-transform:uppercase; letter-spacing:.3px;
    }
    .ercw-table tbody td.numeric { text-align:right; }
}

   Mobile-first · Yesterday comparison · Search · Table toggle
   ══════════════════════════════════════════════════════════════ */

.ercw-wrap {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    max-width: 100%;
    margin: 0;
    color: #1a1a2e;
}

/* Header */
.ercw-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}
.ercw-title {
    font-size: 18px;
    font-weight: 700;
    color: #0f3460;
    margin: 0;
}
.ercw-date {
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    margin-left: 8px;
}
.ercw-search {
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    min-width: 180px;
    outline: none;
    transition: border-color 0.2s;
}
.ercw-search:focus { border-color: #0f3460; box-shadow: 0 0 0 3px rgba(15,52,96,0.1); }

/* Card Grid */
.ercw-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

/* Single Card */
.ercw-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 16px;
    transition: transform 0.18s, box-shadow 0.18s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.ercw-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(15,52,96,0.12);
}
.ercw-card--lowest { border-left: 4px solid #10b981; background: linear-gradient(135deg,#f0fdf4 0%,#fff 100%); }
.ercw-card--highest { border-left: 4px solid #ef4444; background: linear-gradient(135deg,#fff1f2 0%,#fff 100%); }

/* Card head */
.ercw-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}
.ercw-city {
    font-size: 16px;
    font-weight: 700;
    color: #0f3460;
    flex: 1;
}
.ercw-state {
    font-size: 11px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 7px;
    border-radius: 20px;
}
.ercw-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.ercw-badge--low  { background: #d1fae5; color: #065f46; }
.ercw-badge--high { background: #fee2e2; color: #991b1b; }

/* Prices Grid inside card */
.ercw-prices {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}
.ercw-price-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
}
.ercw-price--main {
    grid-column: span 2;
    background: linear-gradient(135deg,#0f3460 0%,#16213e 100%);
    color: #fff;
    border-radius: 10px;
}
.ercw-price--main .ercw-price-label { color: rgba(255,255,255,0.8); }
.ercw-price--main .ercw-price-val   { font-size: 22px; color: #fff; }

.ercw-price-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #6b7280;
    margin-bottom: 3px;
}
.ercw-price-val {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
}

/* Yesterday comparison */
.ercw-compare {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}
.ercw-compare-label { color: #92400e; font-weight: 600; flex: 1; min-width: 100px; }
.ercw-compare-val   { font-weight: 700; font-size: 13px; }
.ercw-yest-val      { color: #6b7280; font-size: 11px; width: 100%; }
.ercw-up   { color: #dc2626; }
.ercw-down { color: #059669; }
.ercw-same { color: #6b7280; }

/* Table toggle */
.ercw-table-toggle {
    margin-bottom: 16px;
}
.ercw-table-toggle summary {
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #0f3460;
    padding: 8px 0;
    user-select: none;
}
.ercw-table-toggle summary:hover { color: #e94560; }

/* Footer summary bar */
.ercw-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
    padding: 10px 0;
    border-top: 1px solid #f3f4f6;
    margin-top: 8px;
}
.ercw-footer strong { color: #0f3460; }

/* Stale data warning */
.stale-data-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 14px;
}

/* Error box */
.egg-rate-error-box {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #991b1b;
    padding: 16px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ercw-cards { grid-template-columns: 1fr; }
    .ercw-title { font-size: 15px; }
    .ercw-header { flex-direction: column; align-items: flex-start; }
    .ercw-search { width: 100%; }
    .ercw-prices { grid-template-columns: 1fr 1fr; }
    .ercw-price-val { font-size: 14px; }
    .ercw-price--main .ercw-price-val { font-size: 20px; }

    /* Mobile table: hide headers, use data-label */
    .ercw-table thead { display: none; }
    .ercw-table tr    { display: block; border-bottom: 1px solid #e5e7eb; margin-bottom: 10px; }
    .ercw-table td    { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 13px; }
    .ercw-table td::before { content: attr(data-label); font-weight: 600; color: #6b7280; }
}
@media (min-width: 601px) and (max-width: 900px) {
    .ercw-cards { grid-template-columns: repeat(2, 1fr); }
}
/* --------------------------------------------------------------
   V3 DESIGN SYSTEM - New Card UI, Share, History, Ads
   -------------------------------------------------------------- */

/* Base container */
.er-container { max-width: 100%; font-family: 'Inter', -apple-system, sans-serif; color: #1a1a2e; }
.er-container * { box-sizing: border-box; }
.er-section { margin-bottom: 24px; }

/* Notices */
.er-notice { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; line-height: 1.5; }
.er-notice-warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.er-notice-info { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* Error box */
.er-error-box { display: flex; align-items: center; gap: 12px; padding: 20px; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 12px; color: #991b1b; font-size: 14px; margin-bottom: 20px; }
.er-error-box p { margin: 0; }

/* Page heading */
.er-page-heading { position: relative; margin-bottom: 20px; padding: 20px 22px; background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%); border-radius: 14px; color: #fff; }
.er-main-title { font-size: clamp(18px, 4vw, 24px); font-weight: 800; margin: 0 0 8px 0; line-height: 1.3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.er-state-badge { display: inline-block; background: rgba(245,158,11,0.25); color: #fbbf24; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 20px; border: 1px solid rgba(251,191,36,0.4); }
.er-sync-label { font-size: 12px; color: rgba(255,255,255,0.7); margin: 0; }
.er-sync-label strong { color: #fbbf24; }

/* Relocate / detect-my-location button */
.er-relocate-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: #0f3460;
    background: #fbbf24;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    line-height: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background 0.18s, transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    z-index: 2;
}
.er-relocate-btn:hover { background: #f59e0b; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.er-relocate-btn:active { transform: translateY(0); }
.er-relocate-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.er-relocate-btn i { font-size: 13px; }
.er-relocate-btn.is-detecting { opacity: 0.7; cursor: progress; }
.er-relocate-btn.is-detecting i { animation: spin 0.8s linear infinite; }

/* Compact (icon-only) on small screens to stay responsive */
@media (max-width: 600px) {
    .er-page-heading { padding-right: 58px; }
    .er-relocate-btn { top: 12px; right: 12px; padding: 8px; border-radius: 50%; }
    .er-relocate-text { display: none; }
    .er-relocate-btn i { font-size: 14px; }
}

/* ROW 1: MAIN RATE CARDS */
.er-main-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.er-card { background: #fff; border-radius: 16px; padding: 20px 16px; text-align: center; border: 2px solid #f1f5f9; box-shadow: 0 4px 16px rgba(0,0,0,0.06); transition: transform 0.2s, box-shadow 0.2s; position: relative; overflow: hidden; }
.er-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.10); }
.er-card-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; padding: 4px 10px; border-radius: 20px; margin-bottom: 10px; }
.er-card-title { font-size: 12px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.er-card-value { font-size: clamp(22px, 5vw, 32px); font-weight: 900; line-height: 1.1; margin-bottom: 6px; }
.er-card-sub   { font-size: 12px; color: #6b7280; }
.er-card-date  { font-size: 11px; color: #9ca3af; margin-top: 8px; }
.er-value-na   { color: #d1d5db; font-size: 24px; }
.er-card-today { border-color: #fde68a; background: linear-gradient(160deg, #fffbeb 0%, #fff 60%); }
.er-card-today .er-card-badge { background: #fef3c7; color: #b45309; }
.er-card-today .er-card-value { color: #b45309; }
.er-card-yesterday { border-color: #bfdbfe; background: linear-gradient(160deg, #eff6ff 0%, #fff 60%); }
.er-card-yesterday .er-card-badge { background: #dbeafe; color: #1d4ed8; }
.er-card-yesterday .er-card-value { color: #1e40af; }
.er-card-desi { border-color: #a7f3d0; background: linear-gradient(160deg, #ecfdf5 0%, #fff 60%); }
.er-card-desi .er-card-badge { background: #d1fae5; color: #065f46; }
.er-card-desi .er-card-value { color: #047857; }

/* ROW 2: SIZE CARDS */
.er-sizes-wrap { background: #fff; border-radius: 16px; padding: 22px 20px; margin-bottom: 24px; border: 1px solid #f1f5f9; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.er-section-title { font-size: 16px; font-weight: 700; color: #1a1a2e; margin: 0 0 16px 0; display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 2px solid #f1f5f9; }
.er-size-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.er-size-card { background: #f8fafc; border-radius: 12px; padding: 16px 12px; text-align: center; border: 1px solid #e2e8f0; transition: all 0.2s; }
.er-size-card:hover { background: #fff; border-color: #f59e0b; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.07); }
.er-size-card.er-size-featured { background: linear-gradient(135deg, #fffbeb, #fff); border-color: #fde68a; }
.er-size-icon { font-size: 20px; color: #f59e0b; margin-bottom: 8px; }
.er-size-label { font-size: 11px; color: #6b7280; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.er-size-value { font-size: clamp(16px, 3.5vw, 22px); font-weight: 800; color: #1a1a2e; }

/* 7-DAY HISTORY TABLE */
.er-history-wrap { background: #fff; border-radius: 16px; padding: 22px 20px; border: 1px solid #f1f5f9; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.er-history-header { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid #f1f5f9; }
.er-history-title { font-size: 16px; font-weight: 700; color: #1a1a2e; margin: 0; display: flex; align-items: center; gap: 8px; }
.er-history-state-badge { background: #dbeafe; color: #1e40af; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px; }
.er-history-note { font-size: 11px; color: #9ca3af; margin: 12px 0 0; display: flex; align-items: center; gap: 6px; }
.er-history-city { font-weight: 700; color: #b45309; }
.er-history-empty { text-align: center; padding: 30px 20px; color: #9ca3af; }
.er-history-empty i { font-size: 36px; margin-bottom: 12px; display: block; }
.er-history-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.er-history-table thead tr { background: linear-gradient(90deg, #1a1a2e, #0f3460); color: #fff; }
.er-history-table th { padding: 10px 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.er-history-table th.numeric, .er-history-table td.numeric { text-align: right; }
.er-history-table tbody tr:nth-child(even) { background: #f8fafc; }
.er-history-table tbody tr:hover { background: #fffbeb; }
.er-history-table tbody tr.er-today-row { background: #fffbeb !important; border-left: 4px solid #f59e0b; }
.er-history-table td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.er-history-table .today-label { color: #b45309; font-weight: 700; }
.er-change-up   { color: #dc2626; font-weight: 700; font-size: 12px; }
.er-change-down { color: #16a34a; font-weight: 700; font-size: 12px; }
.er-change-same { color: #6b7280; font-size: 12px; }

/* STATE TABLE */
.er-state-section { background: #fff; border-radius: 16px; padding: 22px 20px; border: 1px solid #f1f5f9; box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.er-section-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 2px solid #f1f5f9; }
.er-controls { display: flex; gap: 10px; align-items: center; }
.er-search-input { padding: 9px 14px 9px 36px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; min-width: 180px; }
.er-search-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,0.12); }
.er-data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.er-data-table thead tr { background: linear-gradient(90deg, #1a1a2e, #0f3460); color: #fff; }
.er-data-table th { padding: 11px 13px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; }
.er-data-table th.numeric { text-align: right; }
.er-data-table th.sortable { cursor: pointer; user-select: none; }
.er-data-table tbody tr:nth-child(even) { background: #f8fafc; }
.er-data-table tbody tr:hover { background: #fffbeb; }
.er-data-table td { padding: 11px 13px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.er-data-table td.numeric, .er-data-table .price-cell { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.er-table-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 12px; color: #6b7280; }
.er-table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; border: 1px solid #e8ecf0; }
.er-state-name-wrap { display: flex; align-items: center; gap: 8px; }
.er-expand-btn { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; font-size: 11px; color: #374151; transition: all 0.2s; flex-shrink: 0; }
.er-expand-btn:hover { background: #fef3c7; border-color: #fde68a; }
.er-city-count-badge { display: inline-block; background: #dbeafe; color: #1e40af; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.er-cities-cell { padding: 0 !important; background: #f8fafc !important; }
.er-cities-inner { padding: 16px 20px; }
.er-cities-title { font-size: 14px; font-weight: 700; color: #374151; margin: 0 0 12px 0; }
.er-cities-table { font-size: 13px; }
.er-cities-table thead tr { background: linear-gradient(90deg, #374151, #1f2937); }

/* SHARE BUTTONS */
.er-share-wrap { background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%); border-radius: 16px; padding: 20px 22px; margin-bottom: 24px; }
.er-share-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.er-share-label { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; }
.er-share-label i { font-size: 16px; color: #f59e0b; }
.er-share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.er-share-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; border: 2px solid transparent; transition: all 0.2s; white-space: nowrap; font-family: inherit; }
.er-share-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.2); }
.er-share-wa   { background: #25D366; color: #fff; }
.er-share-wa:hover { background: #128C7E; color: #fff; }
.er-share-tw   { background: #000; color: #fff; }
.er-share-tw:hover { background: #333; color: #fff; }
.er-share-fb   { background: #1877F2; color: #fff; }
.er-share-fb:hover { background: #1565D8; color: #fff; }
.er-share-tg   { background: #0088cc; color: #fff; }
.er-share-tg:hover { background: #006daa; color: #fff; }
.er-share-dl   { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
.er-share-dl:hover { background: #f59e0b; border-color: #f59e0b; color: #fff; }
.er-share-copy { background: rgba(255,255,255,0.15); color: #fff; border-color: rgba(255,255,255,0.3); }
.er-share-copy.er-copied { background: #16a34a; border-color: #16a34a; }

/* AD SLOTS */
.egg-rate-ad-slot { display: flex; align-items: center; justify-content: center; min-height: 90px; width: 100%; margin: 16px 0; border-radius: 8px; overflow: hidden; text-align: center; }
.egg-rate-ad-auto { min-height: 50px; }
.egg-rate-ad-slot ins, .egg-rate-ad-slot > * { display: block; margin: 0 auto; }

/* TRUST BLOCK */
.er-trust-block { padding: 18px 20px; background: #f8fafc; border-radius: 12px; border: 1px solid #e2e8f0; margin-bottom: 24px; }
.er-trust-items { display: flex; flex-wrap: wrap; gap: 16px 28px; margin-bottom: 12px; }
.er-trust-item { display: flex; flex-direction: column; gap: 2px; }
.er-trust-label { font-size: 10px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 600; }
.er-trust-val { font-size: 13px; font-weight: 700; color: #1a1a2e; }
.er-trust-val.confidence-high   { color: #16a34a; }
.er-trust-val.confidence-medium { color: #b45309; }
.er-trust-val.confidence-low    { color: #dc2626; }
.er-disclaimer { font-size: 11px; color: #9ca3af; margin: 0; line-height: 1.6; }

/* LOADING STATE */
.er-loading { opacity: 0.6; pointer-events: none; }

/* MOBILE RESPONSIVE (V3) */
@media (max-width: 640px) {
    .er-main-cards { grid-template-columns: 1fr; gap: 10px; }
    .er-card { padding: 16px 14px; }
    .er-card-value { font-size: 26px; }
    .er-size-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .er-size-card { padding: 12px 10px; }
    .er-size-value { font-size: 16px; }
    .er-share-inner { flex-direction: column; align-items: flex-start; }
    .er-share-buttons { width: 100%; }
    .er-share-btn { flex: 1 1 calc(50% - 4px); justify-content: center; font-size: 12px; padding: 8px 10px; }
    .er-history-table, .er-history-table thead, .er-history-table tbody, .er-history-table tr, .er-history-table th, .er-history-table td { display: block; }
    .er-history-table thead { display: none; }
    .er-history-table tbody tr { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 10px; padding: 10px 14px; }
    .er-history-table td { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
    .er-history-table td:last-child { border-bottom: none; }
    .er-history-table td::before { content: attr(data-label); font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; margin-right: 10px; }
    .er-data-table, .er-data-table thead, .er-data-table tbody, .er-data-table tr, .er-data-table th, .er-data-table td { display: block; }
    .er-data-table thead { display: none; }
    .er-data-table tbody tr { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; margin-bottom: 10px; padding: 10px 14px; }
    .er-data-table tbody td { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
    .er-data-table tbody td:last-child { border-bottom: none; }
    .er-data-table tbody td::before { content: attr(data-label); font-size: 11px; font-weight: 600; color: #6b7280; text-transform: uppercase; margin-right: 10px; }
    .er-page-heading { padding: 16px; }
    .er-section-head { flex-direction: column; align-items: flex-start; }
    .er-search-input { min-width: unset; width: 100%; }
    .egg-rate-ad-slot { margin: 12px 0; }
}
@media (min-width: 641px) and (max-width: 900px) {
    .er-main-cards { grid-template-columns: 1fr 1fr; }
    .er-size-cards { grid-template-columns: repeat(3, 1fr); }
    .er-share-btn { padding: 9px 14px; font-size: 12px; }
}

/* --------------------------------------------------------------
   ERCW � City Table Component Styles (Desktop Table + Mobile Cards)
   -------------------------------------------------------------- */

/* -- Wrapper -------------------------------------------------- */
.ercw-wrap {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 16px rgba(0,0,0,0.06);
    overflow: hidden;
    margin-bottom: 24px;
    position: relative;
}

/* -- Header --------------------------------------------------- */
.ercw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 2px solid #f8fafc;
}
.ercw-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ercw-title i { color: #f59e0b; }
.ercw-date {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
    background: #f8fafc;
    padding: 2px 10px;
    border-radius: 20px;
    border: 1px solid #e2e8f0;
}
.ercw-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 8px 14px;
    min-width: 220px;
    transition: border-color 0.2s;
}
.ercw-search-wrap:focus-within { border-color: #f59e0b; }
.ercw-search-wrap i { color: #9ca3af; font-size: 13px; }
.ercw-search {
    border: none;
    background: transparent;
    font-size: 13px;
    font-family: inherit;
    color: #1a1a2e;
    width: 100%;
    outline: none;
}

/* -- Desktop Table -------------------------------------------- */
.ercw-table-desktop {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.ercw-table-desktop table {
    border-radius: 0;
    border: none;
}
.ercw-table-desktop thead th:first-child { padding-left: 20px; }
.ercw-table-desktop tbody td:first-child  { padding-left: 20px; }

/* -- Mobile Cards Grid (HIDDEN on desktop) -------------------- */
.ercw-cards-mobile { display: none; }

/* -- Footer --------------------------------------------------- */
.ercw-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
    font-size: 12px;
    color: #6b7280;
}
.ercw-footer strong { color: #1a1a2e; }
.ercw-footer-meta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.ercw-footer-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* City-table footer action buttons (Share / Download) */
.ercw-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.18s, transform 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    line-height: 1;
}
.ercw-action-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.ercw-action-btn:active { transform: translateY(0); }
.ercw-action-btn svg { width: 15px; height: 15px; flex-shrink: 0; }

/* WhatsApp green */
.ercw-action-wa {
    background: #25D366;
    color: #fff;
}
.ercw-action-wa:hover { background: #1da851; color: #fff; }

/* Download – dark accent */
.ercw-action-dl {
    background: #0f3460;
    color: #fff;
}
.ercw-action-dl:hover { background: #16213e; color: #fff; }
.ercw-action-dl:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
    box-shadow: none;
}

/* Spinner keyframe (used in download loading state) */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

@media (max-width: 767px) {
    .ercw-footer { flex-direction: column; align-items: flex-start; padding: 10px 12px; gap: 8px; }
    .ercw-footer-actions { width: 100%; }
    .ercw-action-btn { flex: 1; justify-content: center; font-size: 12px; padding: 8px 10px; }
}

/* --------------------------------------------------------------
   MOBILE CARD STYLES  (<= 767px)
   Each city row becomes a self-contained premium card.
   Layout: Header row (city + state + change badge)
           Price grid 2�2
   -------------------------------------------------------------- */
@media (max-width: 767px) {

    /* Wider table on mobile — stretch near full viewport width */
    .ercw-wrap { margin-left: 0; margin-right: 0; border-radius: 10px; width: 100%; max-width: 100%; }

    /* Hide desktop table, show card grid */
    .ercw-table-desktop { display: none !important; }
    .ercw-cards-mobile  { display: block !important; padding: 10px 8px 4px; }

    /* Search bar full-width */
    .ercw-header { flex-direction: column; align-items: stretch; padding: 14px 14px 12px; }
    .ercw-search-wrap { min-width: unset; width: 100%; }
    .ercw-title { font-size: 15px; }

    /* Individual city card */
    .ercw-card {
        background: #fff;
        border: 1px solid #e8ecf0;
        border-radius: 14px;
        margin-bottom: 10px;
        overflow: hidden;
        box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        transition: box-shadow 0.2s, transform 0.2s;
        position: relative;
    }
    .ercw-card:active { transform: scale(0.985); }

    /* Card header: city name left, change badge right */
    .ercw-card-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 11px 14px 9px;
        background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    }
    .ercw-card-city-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
    .ercw-card-city {
        font-size: 15px;
        font-weight: 700;
        color: #fff;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ercw-card-state {
        font-size: 11px;
        color: rgba(255,255,255,0.55);
        font-weight: 400;
    }

    /* Change badge */
    .ercw-change-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        font-weight: 700;
        padding: 4px 9px;
        border-radius: 20px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .ercw-change-up   { background: rgba(220,38,38,0.18); color: #fca5a5; }
    .ercw-change-down { background: rgba(22,163,74,0.18);  color: #86efac; }
    .ercw-change-same { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.5); }

    /* Price grid: 2x2 */
    .ercw-card-prices {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
    }
    .ercw-price-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 10px 12px;
        border-right: 1px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
        text-align: center;
    }
    /* Remove right border on 2nd column items */
    .ercw-price-item:nth-child(2n) { border-right: none; }
    /* Remove bottom border on last row (items 3 & 4) */
    .ercw-price-item:nth-last-child(-n+2) { border-bottom: none; }

    .ercw-price-label {
        font-size: 10px;
        font-weight: 600;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 4px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .ercw-price-label i { color: #f59e0b; }

    .ercw-price-val {
        font-size: 17px;
        font-weight: 800;
        color: #1a1a2e;
        line-height: 1.1;
        display: block;
        white-space: nowrap;
    }

    /* Highlight the two main prices (1 egg + tray) */
    .ercw-price-main { background: #fffbeb; }
    .ercw-price-main .ercw-price-val { color: #b45309; font-size: 19px; }
}

/* Tablet (641�900): keep table but make it compact + no horizontal scroll */
@media (min-width: 641px) and (max-width: 900px) {
    .ercw-table-desktop { overflow-x: hidden; }
    .er-data-table { font-size: 13px; }
    .er-data-table th, .er-data-table td { padding: 9px 10px; }
    .ercw-search-wrap { min-width: 160px; }
}

/* --------------------------------------------------------------
   ERH � 7-Day History: Desktop Table + Mobile Timeline Cards
   -------------------------------------------------------------- */

/* Desktop table shown, mobile hidden by default */
.erh-table-desktop { display: block; }
.erh-cards-mobile  { display: none; }

@media (max-width: 767px) {

    /* Flip visibility */
    .erh-table-desktop { display: none !important; }
    .erh-cards-mobile  { display: block !important; padding: 12px 12px 4px; }

    /* Individual history day card */
    .erh-card {
        background: #fff;
        border: 1px solid #e8ecf0;
        border-radius: 14px;
        margin-bottom: 10px;
        overflow: hidden;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }
    /* Today card gets special amber highlight */
    .erh-card--today {
        border-color: #fde68a;
        box-shadow: 0 4px 16px rgba(245,158,11,0.15);
    }
    .erh-card--today .erh-card-head {
        background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
    }

    /* Card header */
    .erh-card-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 10px 14px;
        background: linear-gradient(135deg, #1a1a2e 0%, #0f3460 100%);
    }
    .erh-card-date-wrap { display: flex; align-items: center; gap: 8px; }
    .erh-today-pill {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #fff;
        background: rgba(255,255,255,0.2);
        padding: 3px 8px;
        border-radius: 10px;
    }
    .erh-today-pill i { font-size: 7px; color: #fbbf24; }
    .erh-date-label {
        font-size: 13px;
        font-weight: 600;
        color: rgba(255,255,255,0.9);
    }

    /* Change badge */
    .erh-change-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        font-size: 12px;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 20px;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .erh-badge-up   { background: rgba(220,38,38,0.2);  color: #fca5a5; }
    .erh-badge-down { background: rgba(22,163,74,0.2);  color: #86efac; }
    .erh-badge-same { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.5); }

    /* 2�2 price grid */
    .erh-card-prices {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0;
    }
    .erh-price-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        padding: 10px 10px;
        border-right: 1px solid #f1f5f9;
        border-bottom: 1px solid #f1f5f9;
        text-align: center;
    }
    .erh-price-cell:nth-child(2n)      { border-right: none; }
    .erh-price-cell:nth-last-child(-n+2) { border-bottom: none; }

    /* Highlighted main prices (1 egg + tray) */
    .erh-main-price { background: #fffbeb; }
    .erh-main-price .erh-price-val { color: #b45309; font-size: 18px; }

    .erh-price-lbl {
        font-size: 10px;
        font-weight: 600;
        color: #9ca3af;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        margin-bottom: 4px;
        display: flex;
        align-items: center;
        gap: 4px;
    }
    .erh-price-lbl i { color: #f59e0b; }
    .erh-price-val {
        font-size: 16px;
        font-weight: 800;
        color: #1a1a2e;
        line-height: 1.1;
    }
}

/* --------------------------------------------------------------
   STATE TABLE � Mobile card view override
   Replace the old block-display stacking with proper cards
   -------------------------------------------------------------- */
@media (max-width: 767px) {

    /* State table: convert rows to cards */
    .er-state-table,
    .er-state-table thead,
    .er-state-table tbody,
    .er-state-table tfoot,
    .er-state-table tr,
    .er-state-table th,
    .er-state-table td { display: block; width: 100%; }

    .er-state-table thead { display: none; }

    .er-state-table tbody tr.er-state-row {
        background: #fff !important;
        border: 1px solid #e8ecf0 !important;
        border-radius: 14px !important;
        margin: 0 0 10px !important;
        padding: 12px 14px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.05) !important;
    }
    /* State name as card header line */
    .er-state-table tbody tr.er-state-row td.col-state {
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #1a1a2e !important;
        padding: 0 0 10px !important;
        border-bottom: 1px solid #f1f5f9 !important;
        margin-bottom: 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    /* Price cells: inline flex with label */
    .er-state-table tbody tr.er-state-row td:not(.col-state) {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 5px 0 !important;
        border-bottom: 1px dashed #f1f5f9 !important;
        font-size: 13px !important;
    }
    .er-state-table tbody tr.er-state-row td:last-child { border-bottom: none !important; }
    .er-state-table tbody tr.er-state-row td::before {
        content: attr(data-label) !important;
        font-size: 11px !important;
        font-weight: 600 !important;
        color: #6b7280 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.3px !important;
    }

    /* Cities expand sub-row: keep as block */
    .er-state-table tbody tr.er-cities-row td.er-cities-cell {
        display: block !important;
        width: 100% !important;
        padding: 0 !important;
    }
}

/* ----------------------------------------------------------------
   CITY-WISE TABLE v3 � TRUE TABLE ON ALL SCREEN SIZES
   Strategy: hide 2 heavy cols on mobile, keep 4 col table.
   NO card flip. NO horizontal scroll. Real table everywhere.
   ---------------------------------------------------------------- */

/* Wrapper / section */
.ercw-wrap {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f1f5f9;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    padding: 0;
    overflow: hidden;
    font-family: 'Inter', -apple-system, sans-serif;
    color: #1a1a2e;
}

/* Header bar */
.ercw-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 20px 14px;
    border-bottom: 2px solid #f1f5f9;
}
.ercw-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f3460;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.ercw-date {
    font-size: 12px;
    font-weight: 500;
    color: #9ca3af;
    white-space: nowrap;
}
.ercw-search {
    padding: 8px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    min-width: 180px;
    transition: border-color .2s;
}
.ercw-search:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.12); }

/* Table container � NO overflow-x, no scroll */
.ercw-table-container {
    overflow: visible;
    width: 100%;
}

/* THE TABLE � stays as table on ALL sizes */
.ercw-table {
    width: 100%;
    table-layout: fixed;        /* key: forces columns to share space */
    border-collapse: collapse;
    font-size: 14px;
}

/* Column widths � desktop */
.ercw-table .col-city    { width: 28%; }
.ercw-table .col-egg     { width: 14%; }
.ercw-table .col-tray    { width: 14%; }
.ercw-table .col-hundred { width: 14%; }
.ercw-table .col-peti    { width: 15%; }
.ercw-table .col-change  { width: 15%; }

/* Header */
.ercw-table thead {
    background: linear-gradient(90deg, #1a1a2e 0%, #0f3460 100%);
    color: #fff;
}
.ercw-table thead th {
    padding: 11px 10px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    white-space: nowrap;
    overflow: hidden;
}
.ercw-table thead th.numeric { text-align: right; }

/* Body */
.ercw-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
}
.ercw-table tbody tr:last-child { border-bottom: none; }
.ercw-table tbody tr:nth-child(even) { background: #f8fafc; }
.ercw-table tbody tr:hover { background: #fffbeb; }

.ercw-table tbody td {
    padding: 10px 10px;
    vertical-align: middle;
    font-size: 13px;
    overflow: hidden;
    white-space: nowrap;
}
.ercw-table tbody td.numeric {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: #1a1a2e;
}

/* City + state in same cell */
.city-name-text {
    display: block;
    font-weight: 700;
    color: #0f3460;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.city-state-tag {
    display: block;
    font-size: 10px;
    color: #9ca3af;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tray value */
.tray-val { color: #0f3460; }

/* Change column badges */
.chg { font-size: 12px; font-weight: 700; white-space: nowrap; }
.chg-up { color: #dc2626; }
.chg-dn { color: #16a34a; }
.chg-nc { color: #9ca3af; font-weight: 400; }

/* Footer */
.ercw-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    font-size: 12px;
    color: #6b7280;
    padding: 12px 20px;
    border-top: 1px solid #f1f5f9;
}
.ercw-footer strong { color: #0f3460; }

/* -- MOBILE: hide 2 heavy columns, keep 4-col real table -- */
@media (max-width: 640px) {

    /* Only these 2 columns hide � rest stays as real table */
    .col-hide-mobile { display: none !important; }

    .ercw-header { padding: 14px 14px 10px; }
    .ercw-search { min-width: unset; width: 100%; font-size: 13px; }
    .ercw-title  { font-size: 15px; }

    /* Tighter padding so 4 cols fit in ~360px */
    .ercw-table { font-size: 12px; }
    .ercw-table thead th { padding: 9px 6px; font-size: 10px; letter-spacing: 0; }
    .ercw-table tbody td { padding: 9px 6px; font-size: 12px; }

    /* Adjusted 4-col widths for mobile */
    .ercw-table .col-city   { width: 38%; }
    .ercw-table .col-egg    { width: 20%; }
    .ercw-table .col-tray   { width: 22%; }
    .ercw-table .col-change { width: 20%; }

    .city-name-text { font-size: 12px; }
    .city-state-tag { font-size: 10px; }

    .chg { font-size: 11px; }

    .ercw-footer { padding: 10px 14px; gap: 8px 14px; }
}

/* -- SMALL MOBILE (< 360px): slightly looser text -- */
@media (max-width: 360px) {
    .ercw-table { font-size: 11px; }
    .ercw-table thead th { padding: 8px 4px; font-size: 9px; }
    .ercw-table tbody td { padding: 8px 4px; font-size: 11px; }
    .ercw-table .col-city   { width: 40%; }
    .ercw-table .col-egg    { width: 18%; }
    .ercw-table .col-tray   { width: 22%; }
    .ercw-table .col-change { width: 20%; }
    .city-name-text { font-size: 11px; }
}

/* -- TABLET 641-900px: show all columns -- */
@media (min-width: 641px) and (max-width: 900px) {
    .col-hide-mobile { display: table-cell !important; }
    .ercw-table { font-size: 13px; }
    .ercw-table thead th { padding: 10px 8px; }
    .ercw-table tbody td { padding: 9px 8px; }
}

/* -- ALSO FIX er-data-table on mobile (state table) -- */
/* Override the old card-flip rule for er-data-table � keep as real table */
@media (max-width: 640px) {
    .er-data-table,
    .er-data-table thead,
    .er-data-table tbody,
    .er-data-table tr,
    .er-data-table th,
    .er-data-table td { display: revert !important; }

    /* Re-declare as proper table */
    .er-data-table { display: table !important; table-layout: fixed; width: 100%; font-size: 12px; }
    .er-data-table thead { display: table-header-group !important; }
    .er-data-table tbody { display: table-row-group !important; }
    .er-data-table tr { display: table-row !important; }
    .er-data-table th,
    .er-data-table td { display: table-cell !important; padding: 8px 6px !important; font-size: 12px !important; }
    .er-data-table td::before { display: none !important; }
    .er-data-table th.col-hide-mobile,
    .er-data-table td.col-hide-mobile { display: none !important; }
}

/* -- HISTORY TABLE on mobile � real table too -- */
@media (max-width: 640px) {
    .er-history-table,
    .er-history-table thead,
    .er-history-table tbody,
    .er-history-table tr,
    .er-history-table th,
    .er-history-table td { display: revert !important; }

    .er-history-table { display: table !important; table-layout: fixed; width: 100%; font-size: 11px; }
    .er-history-table thead { display: table-header-group !important; }
    .er-history-table tbody { display: table-row-group !important; }
    .er-history-table tr { display: table-row !important; }
    .er-history-table th,
    .er-history-table td { display: table-cell !important; padding: 8px 5px !important; font-size: 11px !important; }
    .er-history-table td::before { display: none !important; }

    /* Hide 100 Pcs and Peti columns in history table too */
    .er-history-table th.col-hide-mobile,
    .er-history-table td.col-hide-mobile { display: none !important; }
}

/* ----------------------------------------------------------------
   CRITICAL OVERRIDE: Cancel old ercw-table card-flip rules.
   The old @media(max-width:640px) block at ~line 1032 flipped
   ercw-table to display:block cards. New v3 uses col-hide-mobile
   instead. These rules run last so they win the cascade.
   ---------------------------------------------------------------- */
@media (max-width: 640px) {

    /* Restore ercw-table as a real table */
    .ercw-table,
    .ercw-table thead,
    .ercw-table tbody,
    .ercw-table tfoot { display: revert !important; }
    .ercw-table         { display: table !important; table-layout: fixed !important; width: 100% !important; }
    .ercw-table thead   { display: table-header-group !important; }
    .ercw-table tbody   { display: table-row-group !important; }
    .ercw-table tr      { display: table-row !important; border-radius: 0 !important; margin: 0 !important; box-shadow: none !important; }
    .ercw-table th,
    .ercw-table td      { display: table-cell !important; }

    /* Kill old ::before label injection on ercw-table cells */
    .ercw-table td::before { content: none !important; display: none !important; }

    /* Apply col-hide-mobile */
    .ercw-table .col-hide-mobile { display: none !important; }
}

/* ----------------------------------------------------------------
   STATE-WISE TABLE v3 � erst-* classes
   Real table on ALL screen sizes. col-hide-mobile drops 2 cols.
   ---------------------------------------------------------------- */

.erst-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-family: 'Inter', -apple-system, sans-serif;
}

.erst-row { transition: background .12s; }
.erst-row:hover td { background: #fffbeb !important; }

/* Section header */
.er-state-section .er-section-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f1f5f9;
}
.er-state-section .er-section-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Search input */
.er-state-section .er-search-input {
    padding: 9px 14px 9px 36px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    min-width: 180px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.415l-3.85-3.85zm-5.242 1.156a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E") no-repeat 10px center;
}
.er-state-section .er-search-input:focus {
    border-color: #f59e0b;
    box-shadow: 0 0 0 3px rgba(245,158,11,.12);
}

/* Footer */
.er-state-section .er-table-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    font-size: 12px;
    color: #6b7280;
    padding: 12px 0 0;
    border-top: 1px solid #f1f5f9;
    margin-top: 8px;
}
.er-state-section .er-table-footer strong { color: #0f3460; }

/* -- MOBILE: hide 2 cols, keep 4-col real table ------------ */
@media (max-width: 640px) {

    /* Cancel any old block-display rules that may target er-state-table */
    .erst-table,
    .erst-table thead,
    .erst-table tbody,
    .erst-table tfoot,
    .erst-table tr,
    .erst-table th,
    .erst-table td { display: revert !important; }

    .erst-table       { display: table !important; table-layout: fixed !important; width: 100% !important; }
    .erst-table thead { display: table-header-group !important; }
    .erst-table tbody { display: table-row-group !important; }
    .erst-table tr    { display: table-row !important; background: inherit !important; border-radius: 0 !important; margin: 0 !important; box-shadow: none !important; }
    .erst-table th,
    .erst-table td    { display: table-cell !important; }

    /* Kill old ::before content injection */
    .erst-table td::before { content: none !important; display: none !important; }

    /* Hide heavy columns */
    .erst-table .col-hide-mobile,
    .erst-table colgroup .col-hide-mobile { display: none !important; }

    /* Tighter padding for 4-col fit */
    .erst-table thead th { padding: 8px 5px !important; font-size: 10px !important; }
    .erst-table tbody td { padding: 9px 5px !important; font-size: 12px !important; }

    /* Section adjustments */
    .er-state-section .er-section-head { flex-direction: column; align-items: flex-start; }
    .er-state-section .er-search-input { min-width: unset; width: 100%; }

    /* Cities sub-table also fixes itself via col-hide-mobile */
}

/* -- TABLET 641-900px: show all cols, tighter padding ------- */
@media (min-width: 641px) and (max-width: 900px) {
    .erst-table thead th { padding: 9px 7px !important; font-size: 11px !important; }
    .erst-table tbody td { padding: 9px 7px !important; font-size: 13px !important; }
}

/* ----------------------------------------------------------------
   CITY TABLE � Highest (red) & Lowest (green) Row Highlights
   ---------------------------------------------------------------- */

/* Highest rate row � red left border + very light red tint */
.ercw-table tr.ercw-row-highest {
    background: #fff5f5 !important;
    border-left: 3px solid #ef4444 !important;
}
.ercw-table tr.ercw-row-highest:hover td {
    background: #fee2e2 !important;
}

/* Lowest rate row � green left border + very light green tint */
.ercw-table tr.ercw-row-lowest {
    background: #f0fdf4 !important;
    border-left: 3px solid #22c55e !important;
}
.ercw-table tr.ercw-row-lowest:hover td {
    background: #dcfce7 !important;
}

/* Pill badge shown next to city name */
.ercw-hl-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1.4;
}
.ercw-hl-high {
    background: #fecaca;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}
.ercw-hl-low {
    background: #bbf7d0;
    color: #15803d;
    border: 1px solid #86efac;
}

/* On mobile keep the border-left visible (it's on the tr, not td) */
@media (max-width: 640px) {
    .ercw-table tr.ercw-row-highest { border-left: 3px solid #ef4444 !important; }
    .ercw-table tr.ercw-row-lowest  { border-left: 3px solid #22c55e !important; }
}

/* ----------------------------------------------------------------
   BULK BUYING CALCULATOR � erbc-* classes
   ---------------------------------------------------------------- */
.erbc-wrap {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    overflow: hidden;
    font-family: "Inter",-apple-system,sans-serif;
    margin: 20px 0;
}

/* Header */
.erbc-header {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg,#1a1a2e,#0f3460);
    padding: 18px 20px;
    color: #fff;
}
.erbc-icon { font-size: 36px; line-height:1; }
.erbc-title {
    font-size: 17px; font-weight: 700; margin: 0 0 3px;
    color: #fff;
}
.erbc-city-label { font-size: 13px; color: #93c5fd; margin: 0; }

/* Quantity section */
.erbc-qty-section {
    padding: 20px 20px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}
.erbc-qty-label {
    font-size: 13px; font-weight: 600; color: #374151;
    display: block; margin-bottom: 10px;
}
.erbc-qty-row {
    display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.erbc-qty-btn {
    width: 38px; height: 38px; border-radius: 10px;
    border: 2px solid #e2e8f0; background: #fff;
    font-size: 20px; font-weight: 700; cursor: pointer;
    color: #374151; display: flex; align-items: center;
    justify-content: center; flex-shrink: 0;
    transition: all .15s;
}
.erbc-qty-btn:hover { border-color: #f59e0b; color: #d97706; background: #fffbeb; }
.erbc-qty-input {
    flex: 1; min-width: 0; text-align: center;
    padding: 8px 10px; border: 2px solid #e2e8f0;
    border-radius: 10px; font-size: 22px; font-weight: 700;
    color: #0f3460; font-family: inherit; outline: none;
}
.erbc-qty-input:focus { border-color: #f59e0b; box-shadow: 0 0 0 3px rgba(245,158,11,.12); }

/* Slider */
.erbc-slider {
    width: 100%; margin: 4px 0 14px;
    -webkit-appearance: none; appearance: none;
    height: 6px; background: #e2e8f0; border-radius: 3px; outline: none;
}
.erbc-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 22px; height: 22px;
    border-radius: 50%; background: #f59e0b; cursor: pointer;
    box-shadow: 0 2px 6px rgba(245,158,11,.4);
}
.erbc-slider::-moz-range-thumb {
    width: 22px; height: 22px; border-radius: 50%;
    background: #f59e0b; cursor: pointer; border: none;
}

/* Chips */
.erbc-chips {
    display: flex; flex-wrap: wrap; gap: 7px; padding-bottom: 14px;
}
.erbc-chip {
    padding: 5px 12px; border-radius: 20px; border: 1.5px solid #e2e8f0;
    background: #fff; font-size: 12px; font-weight: 600; color: #374151;
    cursor: pointer; transition: all .15s; font-family: inherit;
}
.erbc-chip:hover, .erbc-chip-active {
    background: #f59e0b; border-color: #f59e0b; color: #fff;
}

/* Results grid */
.erbc-results {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0;
}
.erbc-result-card {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 16px 8px; text-align: center;
    border-right: 1px solid #f1f5f9;
}
.erbc-result-card:last-child { border-right: none; }
.erbc-result-total {
    background: linear-gradient(135deg,#fef3c7,#fde68a);
    border-radius: 0;
}
.erbc-result-label { font-size: 11px; color: #6b7280; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.erbc-result-value { font-size: 18px; font-weight: 800; color: #0f3460; }
.erbc-result-total .erbc-result-value { font-size: 22px; color: #b45309; }

/* Breakdown table */
.erbc-breakdown { padding: 16px 20px 0; }
.erbc-breakdown-title { font-size: 13px; font-weight: 700; color: #374151; margin: 0 0 10px; }
.erbc-breakdown-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px; table-layout: fixed;
}
.erbc-breakdown-table thead th {
    padding: 8px 8px; text-align: left; font-size: 11px;
    text-transform: uppercase; letter-spacing: .4px;
    color: #9ca3af; border-bottom: 2px solid #f1f5f9; font-weight: 600;
}
.erbc-breakdown-table tbody td {
    padding: 10px 8px; border-bottom: 1px solid #f8fafc;
    vertical-align: middle; color: #374151;
}
.erbc-bd-cost { font-weight: 700; color: #0f3460; text-align: right; }
.erbc-bd-save { font-size: 11px; font-weight: 700; color: #9ca3af; text-align: right; }
.erbc-save-green { color: #16a34a; }
.erbc-best-deal { background: #f0fdf4 !important; }
.erbc-best-deal td { color: #15803d !important; font-weight: 700; }
.erbc-best-deal .erbc-bd-cost::after {
    content: " ? Best"; font-size: 10px; color: #16a34a;
    font-weight: 800; margin-left: 4px;
}

/* Note */
.erbc-note {
    font-size: 11px; color: #9ca3af; padding: 10px 20px 16px;
    margin: 0; display: flex; gap: 5px; align-items: flex-start;
}

/* Mobile */
@media (max-width: 640px) {
    .erbc-results { grid-template-columns: 1fr 1fr; }
    .erbc-result-total { grid-column: 1 / -1; border-radius: 0; }
    .erbc-result-card:nth-child(2) { border-right: 1px solid #f1f5f9; }
    .erbc-result-card:nth-child(3) { border-right: none; }
    .erbc-result-value { font-size: 15px; }
    .erbc-result-total .erbc-result-value { font-size: 20px; }
    .erbc-breakdown-table thead th:nth-child(4),
    .erbc-breakdown-table tbody td:nth-child(4) { display: none; }
    .erbc-header { padding: 14px 16px; }
    .erbc-icon { font-size: 28px; }
    .erbc-title { font-size: 15px; }
    .erbc-breakdown { padding: 14px 14px 0; }
    .erbc-note { padding: 10px 14px 14px; }
    .erbc-qty-section { padding: 16px 14px 8px; }
}

/* ----------------------------------------------------------------
   INDIA EGG RATE HEATMAP � erm-* classes
   ---------------------------------------------------------------- */
.erm-wrap {
    background: #fff; border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,.08);
    overflow: hidden; margin: 20px 0;
    font-family: "Inter",-apple-system,sans-serif;
    position: relative;
}
.erm-header {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 8px;
    background: linear-gradient(135deg,#1a1a2e,#0f3460);
    padding: 16px 20px;
}
.erm-title {
    font-size: 16px; font-weight: 700; color: #fff; margin: 0;
    display: flex; align-items: center; gap: 8px;
}
.erm-date { font-size: 12px; color: #93c5fd; }

/* Legend */
.erm-legend {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px 6px; font-size: 12px; color: #6b7280;
}
.erm-legend-bar {
    flex: 1; height: 10px; border-radius: 5px;
    background: linear-gradient(to right, #22c55e, #eab308, #ef4444);
}
.erm-legend-low  { color: #16a34a; font-weight: 700; white-space: nowrap; }
.erm-legend-high { color: #dc2626; font-weight: 700; white-space: nowrap; }

/* Grid */
.erm-grid {
    display: grid;
    grid-template-columns: repeat(12,1fr);
    grid-template-rows: repeat(12,36px);
    gap: 3px;
    padding: 12px 16px 8px;
}

/* State cell */
.erm-state {
    border-radius: 6px; cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 2px; text-align: center; overflow: hidden;
    transition: filter .15s, transform .15s, box-shadow .15s;
    position: relative; user-select: none;
}
.erm-state:hover, .erm-state:focus {
    filter: brightness(1.12);
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0,0,0,.18);
    outline: none;
}
.erm-abbr {
    font-size: 10px; font-weight: 800;
    letter-spacing: .3px; line-height: 1.1;
}
.erm-rate { font-size: 9px; font-weight: 600; opacity: .9; line-height: 1.2; }

/* Min/max badges */
.erm-badge {
    font-size: 7px; font-weight: 900; text-transform: uppercase;
    letter-spacing: .3px; padding: 1px 4px; border-radius: 4px;
    line-height: 1.4; margin-top: 1px;
}
.erm-badge-low  { background: rgba(255,255,255,.4); color: #14532d; }
.erm-badge-high { background: rgba(255,255,255,.4); color: #7f1d1d; }

/* Highlight borders */
.erm-state-min { box-shadow: 0 0 0 2px #16a34a, 0 0 8px 2px rgba(22,163,74,.5) !important; z-index: 3; }
.erm-state-max { box-shadow: 0 0 0 2px #dc2626, 0 0 8px 2px rgba(220,38,38,.5) !important; z-index: 3; }

/* Tooltip */
.erm-tooltip {
    position: absolute; z-index: 100;
    background: #1a1a2e; color: #fff; border-radius: 10px;
    padding: 10px 14px; font-size: 12px; pointer-events: none;
    opacity: 0; transform: translateY(4px);
    transition: opacity .15s, transform .15s;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    min-width: 160px; max-width: 200px;
    display: flex; flex-direction: column; gap: 5px;
}
.erm-tooltip.erm-tip-visible { opacity: 1; transform: translateY(0); }
.erm-tip-state { font-size: 13px; font-weight: 700; color: #fbbf24; }
.erm-tip-row { display: flex; align-items: center; gap: 6px; color: #d1d5db; font-size: 12px; }
.erm-tip-row i { color: #f59e0b; width: 12px; }

.erm-note {
    font-size: 11px; color: #9ca3af; padding: 8px 20px 14px;
    margin: 0; display: flex; gap: 5px; align-items: flex-start;
}

/* Mobile: smaller cells */
@media (max-width: 640px) {
    .erm-grid { grid-template-rows: repeat(12,26px); gap: 2px; padding: 8px 10px 6px; }
    .erm-abbr { font-size: 7px; }
    .erm-rate { display: none; }
    .erm-badge { display: none; }
    .erm-legend { padding: 8px 14px 4px; font-size: 11px; }
    .erm-header { padding: 12px 14px; }
}
