/* Non-critical CSS — page-specific layout and decorative styles.
   Inlined-critical CSS already covers reset, tokens, header/footer, cards,
   buttons, tables, pills. Anything below this line is loaded deferred. */

/* Compare table — horizontal scroll on narrow viewports */
.compare-table {
    overflow-x: auto;
}
.compare-table table { min-width: 640px; }

/* Calc forms layout */
.calc-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    max-width: 640px;
}
@media (min-width: 600px) {
    .calc-form { grid-template-columns: 1fr 1fr; }
    .calc-form .full { grid-column: 1 / -1; }
}

/* Stat grid */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
@media (min-width: 700px) { .stat-grid { grid-template-columns: repeat(5, 1fr); } }
.stat {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    background: var(--bg-elevated);
}
.stat__label { font-size: var(--text-xs); color: var(--fg-subtle); text-transform: uppercase; letter-spacing: 0.06em; }
.stat__value { font-size: var(--text-xl); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: var(--space-1); }

/* Brand grid */
.brand-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
}
@media (min-width: 600px) { .brand-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px) { .brand-grid { grid-template-columns: repeat(5, 1fr); } }
.brand-tile {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    text-align: center;
    color: var(--fg);
}
.brand-tile small { color: var(--fg-subtle); margin-top: var(--space-1); }

/* Compact Fewly Score chip on brand grid tiles */
.brand-score-chip {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    color: var(--fg);
    line-height: 1.4;
}
.brand-score-chip--high { background: var(--price-low-bg); color: var(--price-low); border-color: transparent; }
.brand-score-chip--mid  { background: var(--price-mid-bg); color: var(--price-mid); border-color: transparent; }
.brand-score-chip--low  { background: var(--price-high-bg); color: var(--price-high); border-color: transparent; }
.brand-score-chip__dot {
    width: 8px; height: 8px;
    border-radius: var(--radius-full);
    background: var(--fg-subtle);
}
.brand-score-chip__dot--green   { background: var(--price-low); }
.brand-score-chip__dot--yellow  { background: var(--price-mid); }
.brand-score-chip__dot--red     { background: var(--price-high); }
.brand-score-chip__dot--neutral { background: var(--fg-subtle); }

/* Full Fewly Score card on /kaeder/{slug} */
.brand-score {
    margin-top: var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    padding: var(--space-5);
}
.brand-score__headline {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    flex-wrap: wrap;
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border);
}
.brand-score__number {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
}
.brand-score__number strong {
    font-size: var(--text-4xl);
    font-weight: 700;
    line-height: 1;
}
.brand-score__number span { color: var(--fg-subtle); font-size: var(--text-lg); }
.brand-score__headline--high .brand-score__number strong { color: var(--price-low); }
.brand-score__headline--mid  .brand-score__number strong { color: var(--price-mid); }
.brand-score__headline--low  .brand-score__number strong { color: var(--price-high); }
.brand-score__title { display: flex; flex-direction: column; gap: 2px; flex: 1 1 0; min-width: 0; }
.brand-score__label { font-weight: 600; font-size: var(--text-sm); letter-spacing: var(--tracking-tight); text-transform: uppercase; color: var(--fg-muted); }
.brand-score__sub { color: var(--fg-subtle); font-size: var(--text-sm); }
.brand-score__badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
}
.brand-score__badge--green   { background: var(--price-low-bg);  color: var(--price-low); }
.brand-score__badge--yellow  { background: var(--price-mid-bg);  color: var(--price-mid); }
.brand-score__badge--red     { background: var(--price-high-bg); color: var(--price-high); }
.brand-score__badge--neutral { background: var(--bg-sunken);     color: var(--fg-muted); }
.brand-score__badge-dot {
    width: 10px; height: 10px;
    border-radius: var(--radius-full);
    background: currentColor;
}
.brand-score__breakdown {
    list-style: none;
    padding: 0;
    margin: var(--space-4) 0 0 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}
@media (min-width: 700px) {
    .brand-score__breakdown { grid-template-columns: repeat(2, 1fr); gap: var(--space-4) var(--space-6); }
}
.brand-score__row-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-2);
}
.brand-score__row-label { font-weight: 600; }
.brand-score__row-value { font-variant-numeric: tabular-nums; font-weight: 700; }
.brand-score__row-value small { color: var(--fg-subtle); font-weight: 400; }
.brand-score__bar {
    height: 6px;
    background: var(--bg-sunken);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.brand-score__bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-full);
}
.brand-score__hint { display: block; margin-top: var(--space-1); color: var(--fg-subtle); }
.brand-tile__logo {
    width: 64px; height: 64px;
    object-fit: contain;
    margin-bottom: var(--space-2);
}
.brand-hero__logo {
    height: 1em;
    width: auto;
    vertical-align: -0.15em;
    margin-right: var(--space-2);
    object-fit: contain;
}
.card__brand-logo {
    width: 20px; height: 20px;
    object-fit: contain;
    vertical-align: -0.25em;
    margin-right: var(--space-1);
}

/* Kommune index grouped by region */
.kommune-region + .kommune-region { margin-top: var(--space-6); }
.kommune-region h2 { font-size: var(--text-xl); margin-bottom: var(--space-3); }
.kommune-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    list-style: none;
    padding: 0;
}
@media (min-width: 600px) { .kommune-list { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .kommune-list { grid-template-columns: repeat(4, 1fr); } }
.kommune-list a {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--space-2);
    text-align: left;
}
.kommune-list__logo {
    width: 28px; height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}
.kommune-hero {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}
.kommune-hero__logo {
    width: 72px; height: 72px;
    object-fit: contain;
    flex-shrink: 0;
}
.kommune-hero__text { flex: 1 1 0; min-width: 0; }

/* Trend chart */
.trend {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}
.trend svg { width: 100%; height: 200px; }
.trend line.axis { stroke: var(--border); }
.trend path.line { fill: none; stroke: var(--accent); stroke-width: 2; }

/* ============================================================
   Price-history charts (3-up on /dagens-priser)
   ============================================================ */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}
@media (min-width: 900px) { .chart-grid { grid-template-columns: repeat(3, 1fr); } }

.chart-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-4) var(--space-3);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Cap the width when the card stands alone on a page (e.g. /benzin) so the
       3.18:1 SVG aspect ratio doesn't grow to half the page height. Inside the
       3-up .chart-grid the column is the constraint, so this max-width never
       triggers there. */
    max-width: 720px;
}
.chart-grid > .chart-card { max-width: none; }
.chart-card__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}
.chart-card__title {
    font-size: var(--text-base);
    font-weight: 600;
    margin: 0;
}
.chart-card__legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-4);
    align-items: center;
    font-size: var(--text-xs);
    color: var(--fg-muted);
    margin-bottom: var(--space-2);
}
.chart-card__unit {
    margin-left: auto;
    color: var(--fg-subtle);
    font-variant-numeric: tabular-nums;
}
.chart-legend__item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.chart-legend__swatch {
    width: 10px; height: 10px;
    border-radius: 2px;
    background: currentColor;
    flex-shrink: 0;
}
.chart-legend__label { color: var(--fg-muted); }
.chart-legend__value {
    color: var(--fg);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: var(--space-1);
}

.chart {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}
.chart line.chart-gridline {
    stroke: var(--border);
    stroke-width: 1;
    stroke-dasharray: 2 4;
}
.chart text.chart-axis {
    font-family: var(--font-sans);
    font-size: 10px;
    fill: var(--fg-subtle);
}
.chart text.chart-axis--y { text-anchor: end; dominant-baseline: middle; }
.chart text.chart-axis--x { dominant-baseline: hanging; }

.chart path.chart-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.chart circle.chart-dot {
    stroke: var(--bg-elevated);
    stroke-width: 1.5;
    cursor: pointer;
    transition: r 0.12s ease, stroke-width 0.12s ease;
}
.chart circle.chart-dot--mid { opacity: 0.85; }
.chart circle.chart-dot:hover,
.chart circle.chart-dot:focus-visible {
    r: 5;
    stroke-width: 2.5;
    opacity: 1;
    outline: none;
}

.chart-tooltip {
    position: fixed;
    z-index: 1000;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-3);
    box-shadow: var(--shadow-md);
    font-size: var(--text-xs);
    color: var(--fg);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 10px));
    transition: opacity 0.12s ease;
    white-space: nowrap;
    min-width: 8ch;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip__when { color: var(--fg-subtle); font-size: 11px; margin-bottom: 2px; }
.chart-tooltip__label { font-weight: 600; }
.chart-tooltip__value { color: var(--fg); font-variant-numeric: tabular-nums; font-weight: 600; }
.chart-tooltip__extra { color: var(--fg-muted); margin-top: 2px; font-size: 11px; }

/* Series colours — re-used by legend swatches via `color:` */
.chart-line--a { color: var(--accent); stroke: var(--accent); fill: var(--accent); }
.chart-line--b { color: #c47a26; stroke: #c47a26; fill: #c47a26; }
.chart-line--c { color: #5d7fdb; stroke: #5d7fdb; fill: #5d7fdb; }
[data-theme="dark"] .chart-line--b { color: #e8a050; stroke: #e8a050; fill: #e8a050; }
[data-theme="dark"] .chart-line--c { color: #8aa6f0; stroke: #8aa6f0; fill: #8aa6f0; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .chart-line--b { color: #e8a050; stroke: #e8a050; fill: #e8a050; }
    :root:not([data-theme="light"]) .chart-line--c { color: #8aa6f0; stroke: #8aa6f0; fill: #8aa6f0; }
}

.chart-empty {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--fg-subtle);
    font-size: var(--text-sm);
    background: var(--bg-sunken);
    border-radius: var(--radius-md);
}

/* Error pages */
.error-page { padding: var(--space-12) 0; text-align: center; }
.error-page h1 { font-size: var(--text-4xl); }
.error-page p { color: var(--fg-muted); margin-top: var(--space-3); }
.error-suggestions { margin-top: var(--space-6); display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* ============================================================
   Find-station page — search header, filter sidebar, map + list
   ============================================================ */

.find-header { padding: var(--space-6) 0 var(--space-5); }
.find-header h1 { font-size: var(--text-3xl); }
.find-header .muted { margin-top: var(--space-2); max-width: 60ch; }

.find-search {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    margin-top: var(--space-5);
}
@media (min-width: 720px) {
    .find-search { grid-template-columns: 1fr auto auto; }
}
.find-search__input {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding-left: var(--space-3);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.find-search__input:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.find-search__input svg { color: var(--fg-subtle); flex-shrink: 0; }
.find-search__input input {
    flex: 1;
    border: 0;
    background: transparent;
    padding: var(--space-3) var(--space-3);
    font-size: var(--text-base);
    color: var(--fg);
    outline: 0;
    min-width: 0;
}
.find-search__submit, .find-search__locate {
    padding: var(--space-3) var(--space-4);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

/* DAWA address autocomplete dropdown — built in JS, anchored under the input. */
.find-suggest {
    position: absolute;
    top: calc(100% + var(--space-1));
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 320px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}
.find-suggest.is-open { display: block; }
.find-suggest__item {
    padding: var(--space-2) var(--space-3);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--fg);
    border-bottom: 1px solid var(--border);
}
.find-suggest__item:last-child { border-bottom: 0; }
.find-suggest__item.is-active,
.find-suggest__item:hover {
    background: var(--accent-soft);
}

.find-hint {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--accent-soft);
    border-radius: var(--radius-md);
    color: var(--fg);
    font-size: var(--text-sm);
}

/* Two-column layout below the search header */
.find-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
    margin-top: var(--space-5);
}
@media (min-width: 960px) {
    .find-layout {
        grid-template-columns: 260px 1fr;
        align-items: start;
    }
}

/* ---- Filter sidebar ---- */
.find-filters {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    position: sticky;
    top: 80px;
}
.filter-group + .filter-group {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}
.filter-group h3 {
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--fg-subtle);
    font-weight: 600;
    margin-bottom: var(--space-3);
}
.filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.filter-pill {
    cursor: pointer;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--fg-muted);
    font-size: var(--text-sm);
    transition: all 120ms ease;
    user-select: none;
}
.filter-pill:hover { color: var(--fg); border-color: var(--fg-muted); }
.filter-pill input { position: absolute; opacity: 0; pointer-events: none; }
.filter-pill.is-active {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

.filter-checkboxes {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 280px;
    overflow-y: auto;
    padding-right: var(--space-2);
}
.filter-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: var(--text-sm);
    color: var(--fg);
    padding: var(--space-1) 0;
}
.filter-check input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---- Results column ---- */
.find-results { min-width: 0; /* prevent grid overflow */ }
.find-results__count {
    color: var(--fg-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-3);
}
.find-results__count strong { color: var(--fg); font-weight: 600; }

.find-empty {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-8) var(--space-5);
    text-align: center;
}
.find-empty h2 { font-size: var(--text-xl); }
.find-empty p { margin-top: var(--space-2); }

.find-results .map { margin-bottom: var(--space-4); }

.find-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.find-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 120ms ease, transform 120ms ease;
}
.find-item:hover { border-color: var(--border-strong); }
.find-item__link {
    display: grid;
    grid-template-columns: 32px 1fr auto;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    color: var(--fg);
}
.find-item__link:hover { text-decoration: none; }
.find-item__rank {
    width: 28px; height: 28px;
    border-radius: var(--radius-full);
    background: var(--bg-sunken);
    color: var(--fg-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.find-item__logo {
    width: 20px; height: 20px;
    object-fit: contain;
    vertical-align: -0.25em;
    margin-right: var(--space-1);
}
.brand-cell {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.brand-cell__logo {
    width: 20px; height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}
.filter-check__logo {
    width: 20px; height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}
.find-item__body { min-width: 0; }
.find-item__name {
    font-size: var(--text-base);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.find-item__meta {
    font-size: var(--text-xs);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.find-item__price {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}
.find-item__price .pill {
    font-size: var(--text-sm);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.find-item__price .subtle { font-size: var(--text-xs); }

/* Mobile: filters become collapsible above results */
@media (max-width: 959px) {
    .find-filters { position: static; padding: var(--space-4); }
}

/* ============================================================
   Live priser — countdown, intraday grid, movers, feed, brand bars
   ============================================================ */
.live-prices { display: flex; flex-direction: column; }

/* ============================================================
   Fewly Market — header (live + countdown) + 3 price cards
   Adapts to both light and dark mode via design tokens.
   ============================================================ */
.fewly-market {
    --market-good: var(--price-low);
    --market-bad:  var(--price-high);
    --market-good-glow: color-mix(in srgb, var(--price-low) 60%, transparent);
    --market-bad-glow:  color-mix(in srgb, var(--price-high) 60%, transparent);
    padding: var(--space-5);
    max-width: none;
    color: var(--fg);
}
.fewly-market__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-5);
    gap: var(--space-4);
    flex-wrap: wrap;
}
.fewly-market__brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: var(--text-sm);
}
.fewly-market__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--market-good);
    box-shadow: 0 0 14px var(--market-good-glow);
    animation: fewly-market-live-pulse 1.8s ease-in-out infinite;
}
@keyframes fewly-market-live-pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%      { transform: scale(0.6); opacity: 0.4; }
}
.fewly-market__counter {
    color: var(--fg-muted);
    font-size: var(--text-sm);
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: var(--space-2);
}
.fewly-market__counter-label { letter-spacing: 0.02em; }
.fewly-market__counter-value {
    color: var(--fg);
    font-weight: 900;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
    font-size: var(--text-lg);
}
.fewly-market__counter-meta { color: var(--fg-subtle); font-size: var(--text-xs); }

.fewly-market__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-4);
}

.fewly-market__card {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    transition: box-shadow 0.5s ease, transform 0.5s ease;
}
.fewly-market__card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    gap: var(--space-3);
}
.fewly-market__card-label { display: inline-flex; align-items: center; gap: var(--space-2); }
.fewly-market__card-icon { font-size: 1.1em; }
.fewly-market__change {
    font-size: var(--text-sm);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.fewly-market__change--down { color: var(--market-good); }
.fewly-market__change--up   { color: var(--market-bad); }
.fewly-market__change--flat { color: var(--fg-subtle); font-weight: 600; }

.fewly-market__price-wrap {
    display: flex;
    align-items: flex-end;
    gap: var(--space-2);
}
.fewly-market__price {
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--bg-sunken), var(--bg));
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    font-variant-numeric: tabular-nums;
    transform-origin: center;
    backface-visibility: hidden;
}
.fewly-market__price::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 50%;
    height: 1px;
    background: color-mix(in srgb, var(--fg) 12%, transparent);
}
.fewly-market__unit {
    color: var(--fg-muted);
    font-size: var(--text-sm);
    padding-bottom: var(--space-2);
}

/* Card flip + glow when the price actually changes. Glow color uses the
   parent card's good/bad tone so falling prices flash green, rising red. */
.fewly-market__card--good { --market-flash: var(--market-good-glow); }
.fewly-market__card--bad  { --market-flash: var(--market-bad-glow); }
.fewly-market__price.is-flipping {
    animation: fewly-market-flip 0.55s ease, fewly-market-glow 0.9s ease;
}
@keyframes fewly-market-flip {
    0%   { transform: rotateX(0deg); }
    45%  { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}
@keyframes fewly-market-glow {
    0%   { box-shadow: 0 0 0  transparent; }
    40%  { box-shadow: 0 0 40px var(--market-flash); }
    100% { box-shadow: 0 0 0  transparent; }
}

.fewly-market__card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--fg-muted);
    font-size: var(--text-sm);
    gap: var(--space-3);
}
.fewly-market__footer-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.fewly-market__status {
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: var(--text-xs);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.fewly-market__status--good { color: var(--market-good); background: var(--price-low-bg); }
.fewly-market__status--bad  { color: var(--market-bad);  background: var(--price-high-bg); }
.fewly-market__status--neutral { color: var(--fg-muted); background: var(--bg-sunken); }

.fewly-market__sparkline {
    width: 100%;
    height: 60px;
    display: block;
    margin-top: auto;
    border-radius: var(--radius-md);
}
.fewly-market__spark-line { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.fewly-market__spark-area { stroke: none; opacity: 0.18; }
.fewly-market__sparkline--good .fewly-market__spark-line { stroke: var(--market-good); filter: drop-shadow(0 0 6px var(--market-good-glow)); }
.fewly-market__sparkline--good .fewly-market__spark-area { fill: var(--market-good); }
.fewly-market__sparkline--bad  .fewly-market__spark-line { stroke: var(--market-bad);  filter: drop-shadow(0 0 6px var(--market-bad-glow)); }
.fewly-market__sparkline--bad  .fewly-market__spark-area { fill: var(--market-bad); }

/* Panels card — top-cheapest + 6h history, below the price tickers */
.fewly-market__panels {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin-top: var(--space-5);
    padding: var(--space-5);
    background: var(--bg-sunken);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
@media (min-width: 820px) {
    .fewly-market__panels { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); }
}
.fewly-market__panel { min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.fewly-market__panel-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.fewly-market__panel-title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 800;
    letter-spacing: 0.02em;
}
.fewly-market__panel-sub { color: var(--fg-subtle); font-size: var(--text-xs); }
.fewly-market__panel-empty { color: var(--fg-muted); font-size: var(--text-sm); margin: 0; }

.fewly-market__rank-list,
.fewly-market__history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.fewly-market__history-list { max-height: 360px; overflow-y: auto; }

.fewly-market__rank,
.fewly-market__history {
    display: grid;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
    min-width: 0;
}
.fewly-market__rank:last-child,
.fewly-market__history:last-child { border-bottom: 0; }

.fewly-market__rank { grid-template-columns: 28px minmax(0, 1fr) auto; }
.fewly-market__history { grid-template-columns: 48px minmax(0, 1fr) auto auto; }

.fewly-market__rank-num {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    color: var(--fg-subtle);
    font-size: var(--text-sm);
}
.fewly-market__rank-station,
.fewly-market__history-station {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--fg);
    text-decoration: none;
    line-height: 1.25;
}
.fewly-market__rank-station strong,
.fewly-market__history-station strong { font-weight: 700; }
.fewly-market__rank-station:hover strong,
.fewly-market__history-station:hover strong { color: var(--accent); }
.fewly-market__rank-city,
.fewly-market__history-where {
    color: var(--fg-muted);
    font-size: var(--text-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fewly-market__rank-pct,
.fewly-market__history-delta {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: var(--text-sm);
    padding: 2px var(--space-2);
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.fewly-market__rank-pct--good   { color: var(--market-good); background: var(--price-low-bg); }
.fewly-market__rank-pct--bad    { color: var(--market-bad);  background: var(--price-high-bg); }

.fewly-market__history-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--fg-muted);
    font-size: var(--text-xs);
}
.fewly-market__history-fuel { color: var(--fg-subtle); font-size: var(--text-xs); white-space: nowrap; }
.fewly-market__history-delta--down { color: var(--market-good); background: var(--price-low-bg); }
.fewly-market__history-delta--up   { color: var(--market-bad);  background: var(--price-high-bg); }
.fewly-market__history-delta--new  { color: var(--accent); background: var(--accent-soft); }
.fewly-market__history-delta--flat { color: var(--fg-subtle); background: var(--bg-elevated); }

@media (max-width: 600px) {
    .fewly-market { padding: var(--space-4); }
    .fewly-market__header { margin-bottom: var(--space-4); }
    .fewly-market__card { padding: var(--space-4); }
    .fewly-market__price { font-size: clamp(2.2rem, 9vw, 3rem); padding: var(--space-2) var(--space-3); }
    .fewly-market__sparkline { height: 44px; }
    .fewly-market__panels { padding: var(--space-4); }
    .fewly-market__history { grid-template-columns: 44px minmax(0, 1fr) auto; }
    .fewly-market__history-fuel { display: none; }
    .fewly-market__counter-meta { display: none; }
    .fewly-market__card-footer { flex-wrap: wrap; gap: var(--space-2); }
}
@media (prefers-reduced-motion: reduce) {
    .fewly-market__dot { animation: none; }
    .fewly-market__price.is-flipping { animation: none; }
}

.live-prices__intraday-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}
@media (min-width: 720px)  { .live-prices__intraday-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .live-prices__intraday-grid { grid-template-columns: repeat(3, 1fr); } }
.live-prices__intraday-grid > .chart-card { max-width: none; }

/* Station-spread band drawn underneath the avg line. Inherits color from
   .chart-line--a/b/c via currentColor so the band tints with the series. */
.chart path.chart-band {
    fill: currentColor;
    opacity: 0.12;
    stroke: none;
}
/* Vertical "now" guide line + label */
.chart line.chart-now-line {
    stroke: var(--fg-subtle);
    stroke-width: 1;
    stroke-dasharray: 3 3;
    opacity: 0.6;
}
.chart text.chart-now-label {
    fill: var(--fg-subtle);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.live-prices__movers {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.live-prices__mover {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 2fr) auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.live-prices__mover-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    color: var(--fg);
    text-decoration: none;
}
.live-prices__mover-link:hover .live-prices__mover-name { text-decoration: underline; }
.live-prices__mover-logo { border-radius: 2px; flex-shrink: 0; }
.live-prices__mover-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 500;
}
.live-prices__mover-fuel {
    font-size: var(--text-xs);
    color: var(--fg-muted);
    padding: 2px var(--space-2);
    background: var(--bg-sunken);
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.live-prices__mover-bar-track {
    height: 6px;
    background: var(--bg-sunken);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.live-prices__mover-bar { height: 100%; border-radius: var(--radius-full); }
.live-prices__mover-bar--up   { background: var(--price-high); }
.live-prices__mover-bar--down { background: var(--price-low); }
.live-prices__mover-figures {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-variant-numeric: tabular-nums;
}
.live-prices__mover-prices { font-size: var(--text-xs); }
.live-prices__mover-delta { font-weight: 600; font-size: var(--text-sm); }
.live-prices__mover-delta--up   { color: var(--price-high); }
.live-prices__mover-delta--down { color: var(--price-low); }
@media (max-width: 600px) {
    .live-prices__mover { grid-template-columns: 1fr; gap: var(--space-2); }
    .live-prices__mover-figures {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
    }
}

.live-prices__feed {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.live-prices__feed-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
    font-size: var(--text-sm);
}
.live-prices__feed-row:last-child { border-bottom: none; }
.live-prices__feed-time {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--fg-muted);
}
.live-prices__feed-logo { border-radius: 2px; }
.live-prices__feed-station {
    color: var(--fg);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.live-prices__feed-station:hover { text-decoration: underline; }
.live-prices__feed-fuel {
    font-size: var(--text-xs);
    color: var(--fg-muted);
    padding: 2px var(--space-2);
    background: var(--bg-sunken);
    border-radius: var(--radius-full);
}
.live-prices__feed-prices {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    font-variant-numeric: tabular-nums;
}
.live-prices__feed-arrow { color: var(--fg-subtle); }
.live-prices__feed-now { font-weight: 600; }
.live-prices__feed-delta { font-weight: 600; }
.live-prices__feed-delta--up   { color: var(--price-high); }
.live-prices__feed-delta--down { color: var(--price-low); }
@media (max-width: 700px) {
    .live-prices__feed-row {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "time station"
            "logo fuel"
            "prices prices";
        row-gap: var(--space-1);
    }
    .live-prices__feed-time    { grid-area: time; }
    .live-prices__feed-station { grid-area: station; }
    .live-prices__feed-logo    { grid-area: logo; }
    .live-prices__feed-fuel    { grid-area: fuel; justify-self: start; }
    .live-prices__feed-prices  { grid-area: prices; justify-content: flex-end; }
}

.live-prices__brand-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}
@media (min-width: 900px) { .live-prices__brand-grid { grid-template-columns: repeat(2, 1fr); } }
.live-prices__brand-grid > .chart-card { max-width: none; }
.live-prices__brand-bars {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.live-prices__brand-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(0, 2fr) auto;
    gap: var(--space-3);
    align-items: center;
}
.live-prices__brand-label {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--fg);
    text-decoration: none;
    min-width: 0;
}
.live-prices__brand-label:hover .live-prices__brand-name { text-decoration: underline; }
.live-prices__brand-logo { border-radius: 2px; flex-shrink: 0; }
.live-prices__brand-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.live-prices__brand-count { font-size: var(--text-xs); white-space: nowrap; flex-shrink: 0; }
.live-prices__brand-bar-track {
    height: 8px;
    background: var(--bg-sunken);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.live-prices__brand-bar {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-full);
}
.live-prices__brand-price {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: var(--text-sm);
}
@media (max-width: 600px) {
    .live-prices__brand-row {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: var(--space-2);
    }
    .live-prices__brand-bar-track { grid-column: 1 / -1; }
    .live-prices__brand-count { display: none; }
}
