.jpp-rate-view {
    --jpp-rate-accent: #b7791f;
    --jpp-rate-positive: #16794b;
    --jpp-rate-negative: #b42318;
    --jpp-rate-border: rgba(15, 23, 42, .14);
    --jpp-rate-muted: #64748b;
    --jpp-selector-gap: .35rem;
    --jpp-selector-text: inherit;
    --jpp-selector-bg: transparent;
    --jpp-selector-border: var(--jpp-rate-border);
    --jpp-selector-hover-text: inherit;
    --jpp-selector-hover-bg: rgba(148, 163, 184, .12);
    --jpp-selector-active-text: #fff;
    --jpp-selector-active-bg: var(--jpp-rate-accent);
    --jpp-scrollbar-size: 6px;
    --jpp-scrollbar-thumb: rgba(100, 116, 139, .52);
    --jpp-scrollbar-track: rgba(148, 163, 184, .12);
    --jpp-mobile-label-width: 38%;
    --jpp-mobile-cell-gap: .5rem;
    --jpp-mobile-row-gap: .5rem;
    --jpp-mobile-card-radius: .5rem;
    --jpp-mobile-selector-columns: 2;
    --jpp-chart-line-1: #b7791f;
    --jpp-chart-line-2: #2563eb;
    --jpp-chart-line-3: #7c3aed;
    --jpp-chart-line-4: #0891b2;
    --jpp-chart-line-5: #db2777;
    --jpp-chart-line-6: #ea580c;
    --jpp-chart-line-7: #16a34a;
    --jpp-chart-line-8: #4f46e5;
    --jpp-chart-line-9: #be123c;
    --jpp-chart-line-10: #0f766e;
    --jpp-chart-line-11: #9333ea;
    --jpp-chart-line-12: #ca8a04;
    --jpp-chart-grid: rgba(100, 116, 139, .16);
    --jpp-chart-axis: rgba(100, 116, 139, .48);
    --jpp-chart-label: currentColor;
    --jpp-chart-line-width: 3px;
    --jpp-chart-area-opacity: .09;
    --jpp-chart-point-size: 4px;
    --jpp-chart-point-fill: #fff;
    --jpp-chart-point-border: 3px;
    box-sizing: border-box;
    color: inherit;
    margin: 1rem 0;
    max-width: 100%;
    min-width: 0;
}

.jpp-rate-view *, .jpp-rate-view *::before, .jpp-rate-view *::after { box-sizing: border-box; }
.jpp-rate-view [hidden] { display: none !important; }
.jpp-rate-view .screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.jpp-rate-view__head {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    justify-content: space-between;
    margin-bottom: .75rem;
}
.jpp-rate-view__head h3 { color: inherit; flex: 1 1 12rem; font: inherit; font-size: 1.15em; font-weight: 700; margin: 0; min-width: 0; }
.jpp-rate-updated { color: var(--jpp-rate-muted); font-size: .85em; margin: .65rem 0 0; }
.jpp-rate-empty { border: 1px dashed var(--jpp-rate-border); color: var(--jpp-rate-muted); padding: 1rem; text-align: center; }

/* Visitor selectors: pill, underline, and segmented modes share behaviour. */
.jpp-rate-selector {
    display: flex;
    flex-wrap: wrap;
    gap: var(--jpp-selector-gap);
    margin: 0 0 .75rem;
    max-width: 100%;
}
.jpp-rate-view__head .jpp-rate-selector { flex: 0 1 auto; margin: 0; }
.jpp-rate-selector button {
    align-items: center;
    appearance: none;
    background: var(--jpp-selector-bg);
    border: 1px solid var(--jpp-selector-border);
    color: var(--jpp-selector-text);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-size: .82em;
    font-weight: 700;
    gap: .35rem;
    justify-content: center;
    line-height: 1.15;
    margin: 0;
    min-height: 2.1rem;
    padding: .48rem .68rem;
    text-decoration: none;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.jpp-rate-selector button:hover, .jpp-rate-selector button:focus-visible { background: var(--jpp-selector-hover-bg); color: var(--jpp-selector-hover-text); outline: none; }
.jpp-rate-selector button:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--jpp-selector-active-bg) 28%, transparent); }
.jpp-rate-selector button[aria-selected="true"], .jpp-rate-selector button[aria-pressed="true"] { background: var(--jpp-selector-active-bg); border-color: var(--jpp-selector-active-bg); color: var(--jpp-selector-active-text); }
.jpp-rate-selector--pill button { border-radius: 999px; }
.jpp-rate-selector--underline { border-bottom: 1px solid var(--jpp-selector-border); gap: calc(var(--jpp-selector-gap) * 2); }
.jpp-rate-selector--underline button { background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 0; color: var(--jpp-selector-text); margin-bottom: -1px; }
.jpp-rate-selector--underline button:hover, .jpp-rate-selector--underline button:focus-visible { background: transparent; color: var(--jpp-selector-hover-text); }
.jpp-rate-selector--underline button[aria-selected="true"], .jpp-rate-selector--underline button[aria-pressed="true"] { background: transparent; border-bottom-color: var(--jpp-selector-active-bg); color: var(--jpp-selector-active-bg); }
.jpp-rate-selector--segmented { background: var(--jpp-selector-border); border: 1px solid var(--jpp-selector-border); border-radius: .55rem; gap: 1px; overflow: hidden; padding: 1px; }
.jpp-rate-selector--segmented button { border: 0; border-radius: .42rem; }

/* Tables are fluid by default. Scroll mode is opt-in and always gets a thin owned scrollbar. */
.jpp-rate-table-scroll {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-color: var(--jpp-scrollbar-thumb) var(--jpp-scrollbar-track);
    scrollbar-width: thin;
}
.jpp-rate-table-scroll::-webkit-scrollbar { height: var(--jpp-scrollbar-size); width: var(--jpp-scrollbar-size); }
.jpp-rate-table-scroll::-webkit-scrollbar-thumb { background: var(--jpp-scrollbar-thumb); border-radius: 999px; }
.jpp-rate-table-scroll::-webkit-scrollbar-track { background: var(--jpp-scrollbar-track); }
.jpp-rate-table { border-collapse: collapse; font: inherit; table-layout: auto; width: 100%; }
.jpp-rate-table th, .jpp-rate-table td { border-color: var(--jpp-rate-border); border-style: solid; border-width: 1px; padding: .75rem .875rem; text-align: right; vertical-align: middle; }
.jpp-rate-table th:first-child, .jpp-rate-table td:first-child { text-align: left; }
.jpp-rate-table thead th { background: rgba(148, 163, 184, .12); color: inherit; font-weight: 700; }
.jpp-rate-table thead small { color: var(--jpp-rate-muted); display: block; font-size: .75em; font-weight: 500; margin-top: .15rem; }
.jpp-rate-table tbody tr:nth-child(even) { background: rgba(148, 163, 184, .06); }
.jpp-rate-history__period { display: grid; gap: 1rem; }
.jpp-rate-history__group { min-width: 0; }
.jpp-rate-history__group h4 { color: inherit; font: inherit; font-weight: 700; margin: 0 0 .4rem; }
.jpp-rate-width--content .jpp-rate-table-scroll { width: max-content; }
.jpp-rate-width--content .jpp-rate-table { width: max-content; }
.jpp-rate-density--compact .jpp-rate-table th, .jpp-rate-density--compact .jpp-rate-table td { font-size: .92em; padding: .5rem .625rem; }
.jpp-rate-density--compact .jpp-rate-history__period { gap: .7rem; }
.jpp-rate-density--ultra_compact .jpp-rate-table th, .jpp-rate-density--ultra_compact .jpp-rate-table td { font-size: .84em; padding: .34rem .45rem; }
.jpp-rate-density--ultra_compact .jpp-rate-history__period { gap: .5rem; }

.jpp-rate-change { align-items: center; display: inline-flex; font-weight: 700; gap: .25em; white-space: nowrap; }
.jpp-rate-change.is-up, .jpp-rate-change__icon.is-up { color: var(--jpp-rate-positive); }
.jpp-rate-change.is-down, .jpp-rate-change__icon.is-down { color: var(--jpp-rate-negative); }
.jpp-rate-change.is-flat, .jpp-rate-change__icon.is-flat { color: var(--jpp-rate-muted); }
.jpp-rate-change__icon { fill: none; flex: 0 0 auto; height: 1em; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; width: 1em; }

/* Multi-series chart. Series colours are independent from selector/accent colours. */
.jpp-rate-series-selector__swatch { background: currentColor; border-radius: 50%; height: .62em; width: .62em; }
.jpp-rate-series-selector button:nth-child(1) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-1); }
.jpp-rate-series-selector button:nth-child(2) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-2); }
.jpp-rate-series-selector button:nth-child(3) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-3); }
.jpp-rate-series-selector button:nth-child(4) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-4); }
.jpp-rate-series-selector button:nth-child(5) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-5); }
.jpp-rate-series-selector button:nth-child(6) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-6); }
.jpp-rate-series-selector button:nth-child(7) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-7); }
.jpp-rate-series-selector button:nth-child(8) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-8); }
.jpp-rate-series-selector button:nth-child(9) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-9); }
.jpp-rate-series-selector button:nth-child(10) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-10); }
.jpp-rate-series-selector button:nth-child(11) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-11); }
.jpp-rate-series-selector button:nth-child(12) .jpp-rate-series-selector__swatch { color: var(--jpp-chart-line-12); }
.jpp-rate-chart__canvas { border: 1px solid var(--jpp-rate-border); border-radius: .5rem; min-width: 0; overflow: hidden; padding: .5rem; position: relative; }
.jpp-rate-chart__canvas svg { display: block; height: clamp(230px, 42vw, 340px); max-width: 100%; overflow: visible; width: 100%; }
.jpp-rate-chart__grid { stroke: var(--jpp-chart-grid); stroke-width: 1; }
.jpp-rate-chart__axis { stroke: var(--jpp-chart-axis); stroke-width: 1; }
.jpp-rate-chart__area { fill: var(--jpp-series-color); opacity: var(--jpp-chart-area-opacity); pointer-events: none; }
.jpp-rate-chart__line { fill: none; pointer-events: none; stroke: var(--jpp-series-color); stroke-linecap: round; stroke-linejoin: round; stroke-width: var(--jpp-chart-line-width); vector-effect: non-scaling-stroke; }
.jpp-rate-chart__point { fill: var(--jpp-chart-point-fill); r: var(--jpp-chart-point-size); stroke: var(--jpp-series-color); stroke-width: var(--jpp-chart-point-border); transition: r .14s ease, filter .14s ease; vector-effect: non-scaling-stroke; }
.jpp-rate-chart__point:hover, .jpp-rate-chart__point:focus { filter: drop-shadow(0 1px 3px rgba(15, 23, 42, .28)); outline: none; r: calc(var(--jpp-chart-point-size) + 2px); }
.jpp-rate-chart__label { fill: var(--jpp-chart-label); font-size: 12px; opacity: .76; }
.jpp-rate-chart__tooltip {
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: .4rem;
    color: #fff;
    font-size: .78rem;
    font-weight: 600;
    left: 0;
    max-width: min(18rem, calc(100% - 1rem));
    opacity: 0;
    padding: .45rem .58rem;
    pointer-events: none;
    position: absolute;
    top: 0;
    transform: translate(-50%, calc(-100% - .55rem));
    transition: opacity .12s ease;
    visibility: hidden;
    white-space: normal;
    z-index: 3;
}
.jpp-rate-chart__tooltip.is-visible { opacity: 1; visibility: visible; }

@media (max-width: 767px) {
    .jpp-rate-view { margin: .75rem 0; }
    .jpp-rate-view__head { align-items: stretch; flex-direction: column; }
    .jpp-rate-view__head h3 { flex-basis: auto; }
    .jpp-rate-view__head .jpp-rate-selector { width: 100%; }
    .jpp-rate-selector {
        display: grid;
        grid-template-columns: repeat(var(--jpp-mobile-selector-columns), minmax(0, 1fr));
        max-width: 100%;
        overflow: visible;
        padding-bottom: 0;
        width: 100%;
    }
    .jpp-rate-selector-cols--1 { --jpp-mobile-selector-columns: 1; }
    .jpp-rate-selector-cols--2 { --jpp-mobile-selector-columns: 2; }
    .jpp-rate-selector-cols--3 { --jpp-mobile-selector-columns: 3; }
    .jpp-rate-range-selector { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .jpp-rate-selector button { flex: none; min-height: 2.2rem; min-width: 0; overflow-wrap: anywhere; white-space: normal; width: 100%; }
    .jpp-rate-chart__canvas { padding: .25rem; }
    .jpp-rate-chart__canvas svg { height: clamp(220px, 78vw, 310px); }
    .jpp-rate-chart__label { font-size: 11px; }

    .jpp-rate-mobile--stack .jpp-rate-table-scroll { max-width: 100% !important; min-width: 0 !important; overflow: hidden !important; width: 100% !important; }
    .jpp-rate-mobile--stack .jpp-rate-table { margin: 0 !important; max-width: 100% !important; min-width: 0 !important; table-layout: fixed !important; width: 100% !important; }
    .jpp-rate-mobile--stack .jpp-rate-table tbody, .jpp-rate-mobile--stack .jpp-rate-table tr, .jpp-rate-mobile--stack .jpp-rate-table th, .jpp-rate-mobile--stack .jpp-rate-table td { max-width: 100% !important; min-width: 0 !important; width: 100% !important; }
    .jpp-rate-mobile--stack .jpp-rate-table, .jpp-rate-mobile--stack .jpp-rate-table tbody, .jpp-rate-mobile--stack .jpp-rate-table tr { display: block; }
    .jpp-rate-mobile--stack .jpp-rate-table thead { border: 0; clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); height: 1px; overflow: hidden; position: absolute; width: 1px; }
    .jpp-rate-mobile--stack .jpp-rate-table tbody { display: grid; gap: var(--jpp-mobile-row-gap); }
    .jpp-rate-mobile--stack .jpp-rate-table tbody tr { background: transparent; border: 1px solid var(--jpp-rate-border); border-radius: var(--jpp-mobile-card-radius); overflow: hidden; }
    .jpp-rate-mobile--stack .jpp-rate-table tbody th, .jpp-rate-mobile--stack .jpp-rate-table tbody td {
        align-items: center;
        border: 0;
        border-bottom: 1px solid var(--jpp-rate-border);
        display: grid;
        gap: var(--jpp-mobile-cell-gap);
        grid-template-columns: minmax(4.75rem, var(--jpp-mobile-label-width)) minmax(0, 1fr);
        overflow-wrap: anywhere;
        padding: .5rem .6rem;
        text-align: right;
    }
    .jpp-rate-mobile--stack .jpp-rate-table tbody tr > :last-child { border-bottom: 0; }
    .jpp-rate-mobile--stack .jpp-rate-table tbody th::before, .jpp-rate-mobile--stack .jpp-rate-table tbody td::before { color: var(--jpp-rate-muted); content: attr(data-label); font-size: .82em; font-weight: 600; min-width: 0; overflow-wrap: anywhere; text-align: left; }
    .jpp-rate-mobile--stack .jpp-rate-table tbody th > *, .jpp-rate-mobile--stack .jpp-rate-table tbody td > * { max-width: 100%; min-width: 0; }
    .jpp-rate-mobile--stack .jpp-rate-table .woocommerce-Price-amount, .jpp-rate-mobile--stack .jpp-rate-table .woocommerce-Price-amount bdi { white-space: nowrap; }
    .jpp-rate-mobile--stack .jpp-rate-table tbody th { background: rgba(148, 163, 184, .1); }
    .jpp-rate-mobile--scroll .jpp-rate-table { min-width: 520px; }
    .jpp-rate-density--compact.jpp-rate-mobile--stack .jpp-rate-table tbody th, .jpp-rate-density--compact.jpp-rate-mobile--stack .jpp-rate-table tbody td { padding: .4rem .5rem; }
    .jpp-rate-density--ultra_compact.jpp-rate-mobile--stack .jpp-rate-table tbody th, .jpp-rate-density--ultra_compact.jpp-rate-mobile--stack .jpp-rate-table tbody td { padding: .28rem .4rem; }
}

@media (prefers-reduced-motion: reduce) {
    .jpp-rate-selector button, .jpp-rate-chart__point, .jpp-rate-chart__tooltip { transition: none; }
}
