/* Shared foundations and components. Layouts live in pages.css and home.css. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--text-soft); font: 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--accent-strong); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
strong, h1, h2, h3, h4 { color: var(--text); }
h1, h2, h3, h4 { margin: 0 0 .75rem; line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.3rem); font-weight: 750; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.85rem); font-weight: 720; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
small, .muted { color: var(--text-muted); }
small { font-size: .83rem; }
.container, .wrap, main { width: min(calc(100% - 32px), var(--container)); margin-inline: auto; }
main { padding: 22px 0 56px; }
main > * + * { margin-top: 24px; }
.eyebrow { display: block; margin-bottom: 8px; color: var(--accent); font-size: .72rem; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; color: var(--text-muted); font-size: .82rem; }
.intro-text { max-width: 72ch; }
.sr-only, .file-upload-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: 8px; left: 16px; z-index: 1000; padding: 10px 16px; background: var(--surface); transform: translateY(-160%); border: 2px solid var(--focus); border-radius: var(--radius-sm); }
.skip-link:focus { transform: translateY(0); }

/* Navigation: all destinations remain visible without a menu on mobile. */
.site-header { position: sticky; top: -46px; z-index: 100; background: var(--header-bg); border-bottom: 1px solid var(--header-border); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 28px; padding-block: 8px 0; }
.logo { display: inline-flex; align-items: center; gap: 7px; min-height: 38px; color: var(--header-text); }
.logo:hover { color: var(--header-text); text-decoration: none; }
.logo-mark { flex: 0 0 auto; width: 19px; height: 23px; fill: var(--brand-mark); }
.logo-text { font-size: 1.03125rem; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.header-caption { display: none; color: var(--text-muted); font-size: .75rem; }
.nav { display: flex; justify-content: space-between; width: 100%; gap: 4px; }
.nav a { position: relative; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 7px 13px; color: var(--header-muted); font-size: .875rem; font-weight: 500; letter-spacing: .005em; white-space: nowrap; }
.nav a:hover { color: var(--header-text); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--header-text); font-weight: 600; }
.site-header :focus-visible { outline-color: var(--header-accent); outline-offset: -3px; }
.nav a[aria-current="page"]::after { position: absolute; bottom: -1px; left: 18%; right: 18%; height: 2px; background: var(--header-accent); border-radius: 3px 3px 0 0; content: ""; }

/* Cards and layouts. */
.card, .stat-card, .calc-card, .custom-calc, .usage-card, .today-hero-card, .history-v2-card, .history-stat-card, .smart-calc__panel, .smart-result, .smart-window-card, .analysis-preview-panel, .analysis-upload-card__format, .datahub-guide-points > div, .cost-hotspot-row { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card--soft, .stat-card--meta { background: var(--surface-soft); }
.card--hero { padding: clamp(22px, 4vw, 40px); }
.grid, .stats-grid, .usage-recommendations, .calculator-grid, .history-card__grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.stat-card h3, .stat-card h2 { font-size: .84rem; color: var(--text-muted); letter-spacing: 0; }
.stat-card__price { font-size: 1.55rem; font-weight: 700; line-height: 1.3; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-card__time { margin: 6px 0 0; font-size: .82rem; color: var(--text-muted); }
.stat-card__meta { font-size: 1.45rem; font-weight: 700; }
.price-inline { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.price-dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; }
.price-dot--very-cheap, .price-dot--cheap { background: var(--green); }
.price-dot--normal { background: var(--yellow); }
.price-dot--expensive { background: var(--orange); }
.price-dot--very-expensive { background: var(--red); }
.big-price { margin: 16px 0; font-size: clamp(2.5rem, 8vw, 4rem); font-weight: 750; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.hero-validity { color: var(--text-muted); font-size: .88rem; }
.usage-card__eyebrow, .usage-card__title { font-size: .8rem; color: var(--text-muted); }
.usage-card__eyebrow { margin-bottom: 8px; font-weight: 650; }
.usage-card__time { margin: 8px 0; color: var(--text); font-size: clamp(1.2rem, 2.7vw, 1.6rem); font-weight: 720; letter-spacing: -.04em; }
.usage-card__price { color: var(--accent); font-weight: 700; }
.usage-card__note { margin: 10px 0 0; font-size: .82rem; color: var(--text-muted); }
.usage-card--primary, .smart-result--highlight, .smart-window-card:first-child { border-color: var(--accent); background: var(--accent-soft); }
.insight, .hero-cheapest-summary, .example-box, .smart-recommendation, .smart-delay-info { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-soft); font-size: .9rem; }
.insight--cheap, .insight--ok { background: var(--green-soft); color: var(--green); }
.insight--neutral { background: var(--yellow-soft); color: var(--yellow); }
.insight--expensive { background: var(--red-soft); color: var(--red); }
.hero-cheapest-summary__rows, .action-list { display: grid; gap: 12px; }
.hero-cheapest-summary__row, .action-row__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.hero-cheapest-summary__title { margin-bottom: 10px; font-weight: 700; }
.hero-cheapest-summary__link { display: inline-block; margin-top: 12px; }
.action-card__header, .savings-card__header { margin-bottom: 18px; }
.action-card__intro, .savings-card__intro, .action-card__analysis { font-size: .9rem; color: var(--text-muted); }
.action-card__intro { margin-top: 18px; }
.action-row { padding: 14px 0; border-bottom: 1px solid var(--border); }
.action-row__time, .action-row__value { font-weight: 700; }
.action-row__desc { margin-top: 5px; font-size: .85rem; color: var(--text-muted); }

/* Controls. Native inputs, disclosures and existing JS hooks are preserved. */
button, .cta, .file-upload-cta, .history-link, .month-pill--large { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: .88rem; font-weight: 650; line-height: 1.3; text-align: center; }
button:hover, .history-link:hover { background: var(--surface-soft); }
.cta, .file-upload-cta { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.cta:hover, .file-upload-cta:hover { border-color: var(--accent-strong); background: var(--accent-strong); color: var(--on-accent); text-decoration: none; }
input:not([type="radio"]):not([type="checkbox"]):not([type="file"]):not([type="range"]), select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); }
input, select { accent-color: var(--accent); }
.calc-field > span, .smart-field > span, .smart-field > label { display: block; margin-bottom: 6px; color: var(--text-soft); font-size: .85rem; font-weight: 600; }
.calc-card__top { margin-bottom: 18px; }
.calc-card__inputs, .calc-card__results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-block: 16px; }
.calc-result { min-width: 0; padding: 12px; border-radius: var(--radius-sm); background: var(--surface-soft); }
.calc-result__label { display: block; margin-bottom: 6px; font-size: .76rem; color: var(--text-muted); }
.calc-result strong { display: block; font-size: 1.3rem; }
.calc-result small { display: block; margin-top: 4px; }
.calc-result--highlight { background: var(--green-soft); }
.calc-quick-values, .history-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.calc-quick-values button { padding: 6px 12px; }
.calc-quick-values .active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* Tables and long-form content. */
table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { padding: 12px 8px; text-align: left; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
th { color: var(--text-muted); font-weight: 650; font-size: .78rem; background: var(--surface-soft); }
tbody tr:last-child td { border-bottom: 0; }
.savings-table-wrap { overflow-x: auto; }
.savings-table { min-width: 440px; }
.table-subtime, .savings-value__pct, .savings-item__badge { display: block; font-size: .73rem; }
.savings-value strong, .savings-value--good { color: var(--green); }
.savings-highlight, .savings-state { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; margin-block: 16px; border-radius: var(--radius-sm); background: var(--green-soft); }
.savings-card__footnote { margin-top: 16px; font-size: .8rem; color: var(--text-muted); }
details { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-top: 8px; }
summary { min-height: 48px; padding: 14px; color: var(--text); }
details[open] > summary { border-bottom: 1px solid var(--border); }
.hour-summary { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: .85rem; }
.hour-summary__left { font-weight: 650; }
.hour-summary__right { display: flex; align-items: center; gap: 8px; }
.hour-summary__meta { font-size: .72rem; color: var(--text-muted); }
.hour-summary__toggle { font-size: 1.2rem; }
.is-current-hour { border-color: var(--blue); }
.is-cheapest-hour { border-color: var(--green); }
.hour-summary-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.hour-summary-pill { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-soft); font-size: .8rem; }
.hour-summary-pill__label { display: block; color: var(--text-muted); }
.seo-content { line-height: 1.75; }
.seo-content h2:not(:first-child), .seo-content h3:not(:first-child) { margin-top: 28px; }
.seo-content p, .seo-content li { max-width: 80ch; }
.seo-content a { text-decoration: underline; }
.faq-item { padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--border); }
.history-item { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.history-item__label, .history-item__meta { display: block; }
.history-item__meta { margin-top: 5px; font-size: .85rem; color: var(--text-muted); }
.ad-slot { min-height: 100px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface-soft); }
.ad-slot:empty { display: none; }

/* Existing chart containers on other pages. */
.day-chart-block { margin-top: 20px; }
.day-chart-header, .day-chart-meta, .day-chart-legend { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-block: 12px; font-size: .83rem; }
.day-chart { position: relative; display: grid; align-items: end; gap: 2px; min-height: 190px; padding: 12px 0; overflow: hidden; }
.day-chart__bar { display: block; min-width: 0; min-height: 3px; background: var(--chart-bar); }
.day-chart-scale { display: flex; justify-content: space-between; gap: 2px; color: var(--text-muted); font-size: .65rem; }
.day-chart__now-line { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--text); pointer-events: none; }
.day-chart__now-label { position: absolute; top: 0; right: 3px; color: var(--text); font-size: .7rem; }
.day-chart-legend { justify-content: flex-start; color: var(--text-muted); }
.day-chart-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.day-chart-legend__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chart-bar); }
.day-chart-legend__dot--current { background: var(--yellow); }
.day-chart-legend__dot--min { background: var(--green); }
.day-chart-legend__dot--max { background: var(--red); }
.day-chart-insight, .day-chart-updated { margin-top: 12px; color: var(--text-muted); font-size: .8rem; }
.hour-chart-wrap { position: relative; width: 100%; height: 320px; }

/* Footer. */
.site-footer { border-top: 1px solid var(--border); background: var(--surface-soft); padding: 36px 0 20px; font-size: .85rem; }
.footer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
.footer-col h4 { font-size: .82rem; letter-spacing: 0; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-muted); }
.footer-bottom { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: .75rem; }

@media (min-width: 640px) {
  .grid, .stats-grid, .usage-recommendations, .history-card__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calculator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { padding: 28px; }
}
@media (min-width: 960px) {
  .site-header { top: 0; }
  .header-inner { flex-wrap: nowrap; min-height: 68px; padding-block: 0; }
  .nav { width: auto; gap: 16px; }
  .nav a { min-height: 68px; }
  .header-caption { display: none; }
  .grid, .stats-grid, .usage-recommendations { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .history-card__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .header-caption, .hour-summary__meta { display: none; }
  .nav { gap: 0; }
  .nav a { flex: 1; padding-inline: 2px; font-size: .78rem; }
  .hour-summary { font-size: .75rem; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Absolute VAT-inclusive price level; legacy dots on other pages stay untouched. */
.price-level-dot { display: inline-block; flex: 0 0 auto; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; vertical-align: middle; background: var(--price-unavailable-text); }
.price-level--cheap { background: var(--price-cheap-text); }
.price-level--normal { background: var(--price-normal-text); }
.price-level--expensive { background: var(--price-expensive-text); }
.price-level--unavailable { background: transparent; border: 1px solid var(--price-unavailable-text); }

/* One visible trail and one matching BreadcrumbList are generated together. */
.site-breadcrumb { margin: 0 0 12px; font-size: .75rem; color: var(--text-muted); }
.site-breadcrumb ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; margin: 0; padding: 0; list-style: none; }
.site-breadcrumb li { display: inline-flex; align-items: center; gap: 8px; }
.site-breadcrumb li + li::before { content: '›'; color: var(--text-muted); }
.site-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-muted); }
.site-breadcrumb [aria-current] { line-height: 1.5; }
.site-breadcrumb + .daily-report { margin-top: 0; }
