        /* ——— Stats grid (proximity: gap ≥ 2× internal; containment: 8px radius) ——— */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: var(--space-24);
            margin-bottom: var(--space-16);
            padding: var(--space-24);
            background: var(--surface-container);
            border-radius: var(--radius-sm);
        }
        .stat-card {
            background: var(--surface);
            border: 1px solid var(--border-soft);
            border-radius: var(--radius-lg);
            padding: var(--space-16);
            transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), border-color 0.2s;
            box-shadow: var(--elevation-1);
        }
        .main .stat-card:hover {
            border-color: var(--border);
            box-shadow: var(--elevation-2);
            transform: translateY(-2px);
        }
        .main .stat-card.highlight {
            border-left: 4px solid var(--forest-600);
            box-shadow: var(--elevation-2);
        }
        .main .stat-card.highlight .stat-value {
            font-size: var(--text-xl);
            color: var(--forest-700);
            font-weight: 700;
        }
        .main .stat-label {
            font-size: var(--text-xs);
            color: var(--text-tertiary);
            margin-bottom: var(--space-4);
            font-weight: 400;
        }
        .main .stat-value {
            font-size: var(--text-lg);
            font-weight: 700;
            color: var(--text-primary);
        }
        .main .stat-meta {
            font-size: var(--text-xs);
            color: var(--text-tertiary);
            margin-top: var(--space-4);
        }
        .main .stat-trend {
            font-size: var(--text-xs);
            font-weight: 500;
            margin-top: var(--space-4);
        }
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: var(--space-24);
        }
        .kpi-item {
            display: flex;
            flex-direction: column;
            gap: var(--space-4);
        }
        .kpi-item .kpi-label {
            font-size: var(--text-xs);
            color: var(--text-tertiary);
            font-weight: 400;
        }
        .kpi-item .kpi-value {
            font-size: var(--text-lg);
            font-weight: 700;
            color: var(--text-primary);
        }
        .kpi-item.highlight .kpi-value {
            font-size: var(--text-xl);
            color: var(--forest-700);
        }
        /* ——— Sections ——— */
        .section {
            margin-bottom: var(--space-24);
            padding-top: var(--space-24);
            border-top: 1px solid var(--border-soft);
        }
        .section:first-child { padding-top: 0; border-top: none; }
        .section:last-of-type { margin-bottom: var(--space-16); }
        .main .section-title {
            font-size: var(--text-base);
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: var(--space-16);
        }
        .main .card {
            background: var(--surface);
            border: 1px solid var(--border-soft);
            border-radius: var(--radius-lg);
            padding: var(--space-16);
            margin-bottom: var(--space-12);
            box-shadow: var(--elevation-1);
            transition: box-shadow 0.3s var(--ease-out);
        }
        .main .card:hover {
            box-shadow: var(--elevation-2);
        }
        .main .card .card-title + canvas {
            margin-top: var(--space-8);
        }
        .main .card-title {
            font-size: var(--text-sm);
            font-weight: 700;
            color: var(--text-secondary);
            margin-bottom: var(--space-12);
        }
        .charts-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-16); }
        .traffic-sources-pages-stack { display: flex; flex-direction: column; gap: var(--space-16); }
        .traffic-card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
        .traffic-filter-badge { font-size: 12px; color: var(--text-secondary); background: var(--bg-soft); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
        .traffic-filter-badge:hover { background: var(--border-soft); }
        .traffic-source-row, .traffic-page-row { cursor: pointer; }
        #sources-table tbody tr.traffic-filter-active, #pages-table tbody tr.traffic-filter-active { background: rgba(0,0,0,0.04); font-weight: 500; }
        #pages-table { table-layout: fixed; width: 100%; }
        #pages-table th:nth-child(1) { width: 40%; }
        #pages-table th:nth-child(2) { width: 15%; text-align: right; }
        #pages-table th:nth-child(3) { width: 12%; text-align: right; }
        #pages-table th:nth-child(4) { width: 15%; text-align: right; }
        #pages-table th:nth-child(5) { width: 18%; text-align: right; }
        #pages-table td:nth-child(1) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        #pages-table td:nth-child(2),
        #pages-table td:nth-child(3),
        #pages-table td:nth-child(4),
        #pages-table td:nth-child(5) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
        #sources-table { table-layout: fixed; width: 100%; }
        #sources-table th:nth-child(1) { width: 40%; }
        #sources-table th:nth-child(2) { width: 20%; text-align: right; }
        #sources-table th:nth-child(3) { width: 15%; text-align: right; }
        #sources-table th:nth-child(4) { width: 25%; text-align: right; }
        #sources-table td:nth-child(1) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        #sources-table td:nth-child(2),
        #sources-table td:nth-child(3),
        #sources-table td:nth-child(4) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
        .chart-container { height: 280px; position: relative; }
        .overview-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-24); align-items: start; }
        @media (max-width: 768px) { .overview-charts-row { grid-template-columns: 1fr; } }
        table { width: 100%; border-collapse: collapse; }
        .card[style*="overflow-x"] table { min-width: 800px; }
        .main th {
            text-align: left;
            padding: var(--space-8) var(--space-12);
            border-bottom: 1px solid var(--border-soft);
            color: var(--text-tertiary);
            font-weight: 700;
            font-size: var(--text-xs);
        }
        .main td {
            padding: var(--space-8) var(--space-12);
            border-bottom: 1px solid var(--border-soft);
            font-size: var(--text-sm);
            color: var(--text-primary);
        }
        .main tbody tr {
            transition: background 0.15s ease;
        }
        .main tbody tr:hover { background: var(--muted); }
        .channel-breakdown-table th { text-align: left; }
        .channel-breakdown-table td:nth-child(2),
        .channel-breakdown-table td:nth-child(3),
        .channel-breakdown-table td:nth-child(4),
        .channel-breakdown-table td:nth-child(5),
        .channel-breakdown-table th:nth-child(2),
        .channel-breakdown-table th:nth-child(3),
        .channel-breakdown-table th:nth-child(4),
        .channel-breakdown-table th:nth-child(5) { text-align: right; }
        .channel-breakdown-pct { font-size: 13px; font-weight: 500; white-space: nowrap; }
        .channel-breakdown-pct.up { color: var(--ds-forest); }
        .channel-breakdown-pct.down { color: var(--destructive); }
        .channel-breakdown-pct.neutral { color: var(--ds-muted); }
        .channel-breakdown-table tr.total-row { font-weight: 600; border-top: 1px solid var(--border-soft); }
        #product-level-table th, #product-level-table td { padding: var(--space-8) var(--space-12); }
        #product-level-table th:nth-child(1), #product-level-table td:nth-child(1) { text-align: right; font-variant-numeric: tabular-nums; }
        #product-level-table th:nth-child(3), #product-level-table th:nth-child(4),
        #product-level-table td:nth-child(3), #product-level-table td:nth-child(4) { text-align: right; }
        .channel-legend .legend-item { display: inline-flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-8); border-radius: var(--radius-sm); cursor: pointer; font-size: var(--text-sm); border: 1px solid transparent; transition: opacity 0.2s, border-color 0.2s; }
        .channel-legend .legend-item:hover { border-color: var(--border); }
        .channel-legend .legend-item.hidden { opacity: 0.4; text-decoration: line-through; }
        .channel-legend .legend-dot { width: 10px; height: 10px; border-radius: 50%; }
        .main .loading { text-align: center; padding: var(--space-32); color: var(--text-muted); font-size: var(--text-base); }
        .error { background: rgba(197, 48, 48, 0.1); color: var(--destructive); padding: var(--space-12); border-radius: var(--radius); margin-bottom: var(--space-16); border: 1px solid rgba(197, 48, 48, 0.2); }
        .insights-list { display: flex; flex-direction: column; gap: var(--space-4); }
        .insight-item { padding: var(--space-8) var(--space-12); border-radius: var(--radius-sm); font-size: var(--text-sm); display: flex; align-items: flex-start; gap: var(--space-8); }
        .insight-item.success { background: var(--accent); color: var(--primary); border: 1px solid var(--border); }
        .insight-item.warning { background: rgba(180, 83, 9, 0.12); color: var(--warning); border: 1px solid rgba(180, 83, 9, 0.25); }
        .insight-item.info { background: var(--accent); color: var(--primary); border: 1px solid var(--border); }
        .insight-item.error { background: rgba(197, 48, 48, 0.1); color: var(--destructive); border: 1px solid rgba(197, 48, 48, 0.2); }
        .main .footer-meta {
            text-align: center;
            font-size: var(--text-xs);
            color: var(--text-tertiary);
            margin-top: var(--space-24);
            padding-top: var(--space-16);
            border-top: 1px solid var(--border-soft);
        }
        /* ——— Order Status filters ——— */
        .os-filter-select {
            padding: var(--space-4) var(--space-12);
            border-radius: var(--radius-sm);
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            font-size: var(--text-sm);
            font-family: inherit;
            cursor: pointer;
            transition: border-color 0.2s, box-shadow 0.2s;
            -webkit-appearance: none;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%233C836F' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 8px center;
            padding-right: 28px;
        }
        .os-filter-select:hover { border-color: var(--ring); }
        .os-filter-select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px var(--accent); }
        input.os-filter-select { background-image: none; padding-right: var(--space-12); }
        /* Product-level table sortable headers */
        .product-level-sort { cursor: pointer; user-select: none; white-space: nowrap; }
        .product-level-sort:hover { color: var(--accent); }
        .product-level-sort .sort-icon { opacity: 0.4; margin-left: 4px; }
        .product-level-sort.sorted-asc .sort-icon::after { content: '↑'; opacity: 1; }
        .product-level-sort.sorted-desc .sort-icon::after { content: '↓'; opacity: 1; }
        .product-level-row { transition: background 0.15s ease; }
        .product-level-row:hover { background: var(--surface-hover, rgba(0,0,0,0.03)); }
        .product-level-retailer { text-align: center; font-size: var(--text-xs); color: var(--text-tertiary); white-space: nowrap; }
        .product-level-units { text-align: right; font-variant-numeric: tabular-nums; }
        .product-level-name { white-space: normal; word-break: break-word; max-width: 360px; min-width: 140px; }
        .product-level-expand { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; color: var(--text-muted); transition: transform 0.2s ease, color 0.15s; border-radius: 4px; }
        .product-level-row:hover .product-level-expand { color: var(--ds-forest); }
        .product-level-row.expanded .product-level-expand { transform: rotate(90deg); color: var(--ds-forest); }
        .product-level-detail td { padding: 0 !important; vertical-align: top; border-top: none; }
        .product-level-detail-hidden { display: none !important; }
        .product-level-detail-inner {
            padding: var(--space-12) var(--space-16) var(--space-16) 56px;
            font-size: var(--text-sm);
            background: var(--accent-soft);
            border-left: 3px solid var(--ds-forest);
            margin-left: 12px;
            border-radius: 0 0 8px 0;
        }
        .product-level-detail-inner .pl-store-row { padding: var(--space-6) 0; border-bottom: 1px solid var(--border-soft, rgba(0,0,0,0.06)); font-variant-numeric: tabular-nums; }
        .product-level-detail-inner .pl-store-row:last-child { border-bottom: none; }
        .product-level-detail-inner .pl-store-badge { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 600; min-width: 72px; text-align: center; margin-right: var(--space-8); }
        /* Channel badge pill */
        .os-channel-badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: var(--text-xs);
            font-weight: 600;
            letter-spacing: 0.02em;
        }
        .os-status-badge {
            display: inline-block;
            padding: 2px 8px;
            border-radius: 999px;
            font-size: var(--text-xs);
            font-weight: 600;
            text-transform: capitalize;
        }
        /* ——— Period toggle ——— */
        .period-toggle { display: flex; align-items: center; gap: 6px; }
        .period-toggle-label { font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; margin-right: 4px; }
        .date-range-toggle { display: flex; gap: 4px; }
        .date-range-btn {
            padding: 5px 12px;
            font-size: 13px;
            font-weight: 500;
            color: var(--text-tertiary);
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.15s ease;
        }
        .date-range-btn:hover { border-color: var(--ds-muted); color: var(--foreground); background: var(--muted); }
        .date-range-btn.active { background: var(--accent-soft); border-color: var(--sidebar-primary); color: var(--sidebar-primary); }
        .date-picker-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
        .date-picker-row label { font-size: 12px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; }
        .date-picker-row input[type="date"] {
            padding: 7px 12px;
            font-size: 13px;
            font-family: inherit;
            border: 1px solid var(--border);
            border-radius: 8px;
            background: var(--surface);
            color: var(--foreground);
            transition: all 0.15s ease;
        }
        .date-picker-row input[type="date"]:hover { border-color: var(--ds-muted); }
        .date-picker-row input[type="date"]:focus { outline: none; border-color: var(--sidebar-primary); box-shadow: 0 0 0 3px var(--accent-soft); }
        .date-range-controls { display: flex; align-items: center; gap: var(--space-12); }
        .dashboard-date-toolbar {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 8px;
            margin-left: auto;
            max-width: 100%;
        }
        .dashboard-date-toolbar-row {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            flex-wrap: wrap;
            gap: 10px 12px;
        }
        .dashboard-period-summary {
            font-size: 12px;
            line-height: 1.5;
            color: var(--text-tertiary);
            text-align: right;
            max-width: 420px;
        }
        .dashboard-period-summary .period-line-selected {
            color: var(--foreground);
            font-weight: 500;
        }
        .dashboard-period-summary .period-line-compare {
            color: var(--text-tertiary);
        }
        .dashboard-period-summary .period-k {
            font-weight: 600;
            color: var(--text-tertiary);
            text-transform: none;
            letter-spacing: 0;
        }
        .dashboard-compare-group {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-wrap: wrap;
        }
        .dashboard-compare-heading {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-tertiary);
            white-space: nowrap;
        }
        .dashboard-refresh-btn {
            padding: 8px 14px;
            cursor: pointer;
        }
        .revenue-by-channel-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-12); }
        .period-btn {
            padding: 6px 14px;
            border: 1px solid var(--border);
            background: var(--surface);
            border-radius: 8px;
            font-size: 13px;
            font-weight: 500;
            color: var(--text-tertiary);
            cursor: pointer;
            font-family: inherit;
            transition: all 0.15s ease;
        }
        .period-btn:hover { border-color: var(--ds-muted); color: var(--foreground); background: var(--muted); }
        .period-btn.active { background: var(--accent-soft); border-color: var(--sidebar-primary); color: var(--sidebar-primary); font-weight: 600; }
        .ads-period-badge {
            display: inline-flex; align-items: center; gap: 6px;
            padding: 6px 14px;
            font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
            color: var(--sidebar-primary);
            background: var(--accent-soft);
            border: 1px solid rgba(60,131,111,0.25);
            border-radius: 20px;
        }
        .ads-period-badge::before {
            content: '';
            width: 6px; height: 6px;
            border-radius: 50%;
            background: var(--sidebar-primary);
        }
        #ads-channel-summary-table tfoot td {
            padding: 14px 16px;
            font-weight: 700;
            color: var(--foreground);
            font-size: 13px;
            border-top: 2px solid var(--border);
            background: var(--muted);
            font-variant-numeric: tabular-nums;
        }
        #ads-channel-summary-table tbody td { font-size: 14px; }
        .ads-pct-change { font-size: 13px; font-weight: 500; white-space: nowrap; }
        .ads-pct-change.up { color: var(--ds-forest); }
        .ads-pct-change.down { color: var(--destructive); }
        .ads-pct-change.neutral { color: var(--ds-muted); }

        /* Info tooltip — hover/focus reveals a short explanation (PMA-01). Data-tip text
           is sourced from the element's `data-tip` attribute so markup stays plain. */
        .info-tip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 15px; height: 15px;
            margin-left: 4px;
            font-size: 11px;
            line-height: 1;
            color: var(--ds-muted, #6b7280);
            cursor: help;
            position: relative;
            user-select: none;
            vertical-align: baseline;
            transition: color 0.15s;
        }
        .info-tip:hover, .info-tip:focus-visible {
            color: var(--foreground, #1a1a1a);
            outline: none;
        }
        /* The tooltip body — positioned below the icon, fades in on hover/focus. */
        .info-tip::after {
            content: attr(data-tip);
            position: absolute;
            top: calc(100% + 8px);
            left: 50%;
            transform: translateX(-50%);
            min-width: 240px;
            max-width: 320px;
            padding: 10px 12px;
            background: #1a1a1a;
            color: #ffffff;
            font-size: 12px;
            font-weight: 400;
            line-height: 1.45;
            letter-spacing: 0;
            text-transform: none;
            border-radius: 6px;
            box-shadow: 0 4px 16px rgba(0,0,0,0.18);
            opacity: 0;
            pointer-events: none;
            visibility: hidden;
            z-index: 100;
            white-space: normal;
            text-align: left;
            transition: opacity 0.12s ease-out, visibility 0s linear 0.12s;
        }
        .info-tip:hover::after, .info-tip:focus-visible::after {
            opacity: 1;
            visibility: visible;
            transition: opacity 0.12s ease-out, visibility 0s linear 0s;
        }
        /* Small caret pointing up at the icon */
        .info-tip::before {
            content: '';
            position: absolute;
            top: calc(100% + 2px);
            left: 50%;
            transform: translateX(-50%);
            border: 6px solid transparent;
            border-bottom-color: #1a1a1a;
            opacity: 0;
            pointer-events: none;
            z-index: 101;
            transition: opacity 0.12s ease-out;
        }
        .info-tip:hover::before, .info-tip:focus-visible::before {
            opacity: 1;
        }
        /* In cramped table headers, right-align the tooltip so it doesn't overflow */
        th .info-tip::after { left: auto; right: 0; transform: none; }
        th .info-tip::before { left: auto; right: 6px; transform: none; }
