@charset "UTF-8";

:root {
  --pk-focus-color: #8f8f8f;
  --pk-bg-dark: #131313;
  --pk-surface-muted-dark: rgba(30, 30, 30, 0.6);
  --pk-surface-dark: rgba(30, 30, 30, 0.98);
  --pk-text-dark: #dddddd;
  --pk-text-muted-dark: #b7b7b7;
  --pk-border-dark: #444444;
  --pk-bg-light: #f4f4f4;
  --pk-surface-light: rgba(255, 255, 255, 0.96);
  --pk-text-light: #202020;
  --pk-text-muted-light: #626262;
  --pk-border-light: #cfcfcf;
  --pk-gutter-desktop: 14px;
  --pk-gutter-mobile: 8px;
  --pk-content-max: 1280px;
  --pk-content-max-main: 1540px;
  --pk-page-max-width: 1280px;
  --pk-page-max-width-main: 1540px;
  --pk-card-radius: 8px;
  --pk-shadow-dark: 0 2px 10px rgba(0, 0, 0, 0.24);
  --pk-shadow-light: 0 2px 10px rgba(24, 24, 24, 0.12);
  --pk-overlay-top: 64px;
  --pk-overlay-bottom: 62px;
  --pk-page-title-size: clamp(1.35rem, 2.45vw, 2.05rem);
  --pk-page-subtitle-size: clamp(0.84rem, 1.05vw, 0.92rem);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

.skip-link {
  position: absolute;
  left: 10px;
  top: -44px;
  z-index: 3000;
  background: #ffffff;
  color: #111111;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 4px;
  text-decoration: none;
}

.pk-content-bounded {
  width: 100%;
  max-width: var(--pk-content-max);
  margin-inline: auto;
  min-width: 0;
}

.pk-content-bounded--main {
  max-width: var(--pk-content-max-main);
}

.skip-link:focus {
  top: 10px;
}

a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--pk-focus-color);
  outline-offset: 2px;
}

/* Keep keyboard focus visuals on controls, but suppress browser default ring on chart canvases. */
body[data-page="main"] #chart-container:focus,
body[data-page="main"] #chart-container:focus-visible,
body[data-page="hallitus"] #chart-container:focus,
body[data-page="hallitus"] #chart-container:focus-visible,
body[data-page="ennuste"] #prediction-chart:focus,
body[data-page="ennuste"] #prediction-chart:focus-visible,
body[data-page="latest"] #latest-chart:focus,
body[data-page="latest"] #latest-chart:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--pk-bg-dark, #131313);
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #dddddd;
  border-top-color: #e25953;
  border-radius: 50%;
  animation: pk-loading-spin 1s linear infinite;
}

@keyframes pk-loading-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.pk-global-nav {
  position: relative;
  z-index: 260;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  background: var(--pk-surface-dark, rgba(30, 30, 30, 0.98));
}

.pk-global-nav-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px var(--pk-gutter-desktop);
  box-sizing: border-box;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.pk-global-brand {
  color: var(--pk-text-dark, #dddddd);
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.pk-global-nav-toggle {
  display: none;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #d8d8d8;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1;
  padding: 7px 11px;
  cursor: pointer;
  width: 34px;
  height: 34px;
  padding: 0;
}

.pk-global-nav-toggle span[aria-hidden="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.05rem;
  line-height: 1;
}

.pk-global-nav-close {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #ececec;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.pk-global-links {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pk-global-link {
  color: #c8c8c8;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1;
  padding: 7px 10px;
  border-radius: 999px;
  transition: background-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}

.pk-global-link:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.pk-global-link[aria-current="page"] {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.footer-link-button {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0 5px;
  cursor: pointer;
  text-decoration: none;
  vertical-align: baseline;
}

footer .footer-link-button:hover {
  color: #fff;
}

.pk-footer {
  position: relative;
  margin-top: auto;
  background: var(--pk-surface-dark);
  color: var(--pk-text-dark);
  text-align: center;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  font-size: 0.8rem;
  font-weight: 700;
}

.pk-footer p {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  margin: 0;
}

.pk-footer .pipe {
  margin: 0 5px;
}

.pk-footer a,
.pk-footer .footer-link-button {
  color: inherit;
  text-decoration: none;
  margin: 0 5px;
}

.pk-footer a:hover,
.pk-footer .footer-link-button:hover {
  color: #ffffff;
}

.pk-info-overlay {
  position: fixed;
  left: 50%;
  top: var(--pk-overlay-top);
  bottom: calc(var(--pk-overlay-bottom) + env(safe-area-inset-bottom));
  width: min(760px, calc(100% - 20px));
  transform: translateX(-50%);
  padding: 18px 20px 16px;
  border: none;
  border-radius: var(--pk-card-radius, 8px);
  background: var(--pk-surface-dark, rgba(30, 30, 30, 0.98));
  color: var(--pk-text-dark, #dddddd);
  overflow-y: auto;
  max-height: calc(100dvh - var(--pk-overlay-top) - var(--pk-overlay-bottom) - env(safe-area-inset-bottom));
  overscroll-behavior: contain;
  z-index: 760;
  box-shadow: var(--pk-shadow-dark, 0 2px 10px rgba(0, 0, 0, 0.24));
}

.pk-info-overlay .close-button {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: #aaaaaa;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.pk-info-overlay .close-button:hover {
  color: #ffffff;
}

.pk-info-content {
  padding-right: 8px;
}

.pk-info-content h2 {
  margin: 0 0 10px;
  color: #f2f2f2;
  font-size: 1.1rem;
}

.pk-info-content h3 {
  margin: 14px 0 8px;
  color: #e9e9e9;
  font-size: 0.98rem;
}

.pk-info-content p {
  margin: 0 0 10px;
  line-height: 1.45;
}

.pk-info-content ul {
  margin: 0 0 16px;
  padding-left: 20px;
}

.pk-info-content li {
  margin-bottom: 6px;
  line-height: 1.45;
}

.pk-info-content a {
  color: #dd3266;
  text-decoration: none;
}

.pk-info-content a:hover {
  color: #ffffff;
}

.annotation.annotation--faded .annotation-line {
  stroke: #686868;
  stroke-opacity: 0.08;
}

.annotation.annotation--faded .annotation-note {
  fill: #a0a0a0;
  fill-opacity: 0.07;
  text-shadow: none !important;
}

.annotation.annotation--faded:hover .annotation-line {
  stroke: #f3f4f6 !important;
  stroke-opacity: 1 !important;
}

.annotation.annotation--faded:hover .annotation-note {
  fill: #ffffff !important;
  fill-opacity: 1 !important;
  font-weight: 700;
}

.legend-item {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  text-align: left;
}

body[data-page="main"] #chart-shell {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: fit-content(158px) minmax(0, 1fr);
  column-gap: 8px;
  align-items: stretch;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 8px var(--pk-gutter-mobile) 8px;
}

body[data-page="main"] #legend-sidebar {
  display: flex;
  flex-direction: column;
  width: fit-content;
  min-height: 0;
  min-width: 0;
  overflow: visible;
  overflow-x: hidden;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border-right: none;
}

body[data-page="main"] #legend {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: fit-content;
  min-width: 0;
  max-width: 158px;
  top: auto;
  left: auto;
  background: var(--pk-surface-muted-dark, rgba(30, 30, 30, 0.6)) !important;
  border-radius: var(--pk-card-radius, 8px);
  padding: 8px 9px;
  margin: 0;
  max-height: none;
  overflow: visible;
  font-size: 0.8rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.24);
  box-sizing: border-box;
}

body[data-page="main"] #legend .close-button,
body[data-page="main"] #legend-collapsed {
  display: none !important;
}

body[data-page="main"] #legend-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
}

body[data-page="main"] #legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 0;
  margin-right: 0;
  padding: 2px 0;
  line-height: 1.14;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: color 140ms ease;
}

body[data-page="main"] #legend .legend-item.legend-item--highlighted {
  font-weight: 700;
  color: #f3f3f3;
  opacity: 1;
}

body[data-page="main"] #legend .legend-item.legend-item--faded {
  color: #8e8e8e;
  opacity: 0.66;
}

body[data-page="main"] #legend .legend-item.legend-item--faded .legend-color {
  opacity: 0.7;
}

body[data-page="main"] .legend-annotation-toggle {
  width: 100%;
  border: none;
  border-radius: 0;
  padding: 2px 0 !important;
  background: transparent;
  color: #bcbcbc;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
}

body[data-page="main"] #legend .legend-color {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-right: 0;
  border-radius: 50%;
}

body[data-page="main"] .legend-annotation-toggle span:last-child {
  font: inherit;
}

body[data-page="main"] .legend-annotation-toggle:hover {
  color: #f0f0f0;
}

body[data-page="main"] .legend-annotation-toggle .legend-color--annotation {
  border-radius: 50% !important;
  border: 2px solid #8a8a8a;
  background: transparent;
  position: relative;
  box-sizing: border-box;
  margin-right: 0;
}

body[data-page="main"] .legend-annotation-toggle .legend-color--annotation::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform 120ms ease;
  background: #a7a7a7;
}

body[data-page="main"] .legend-annotation-toggle[aria-pressed="true"] .legend-color--annotation::after {
  transform: scale(1);
}

body[data-page="main"] #chart-container {
  min-width: 0;
  min-height: 0;
  display: block;
  position: relative;
  background: var(--pk-bg-dark, #131313);
  overflow: hidden;
}

body[data-page="main"] #chart-container svg {
  display: block;
}

html[data-theme="light"],
html[data-theme="light"] body,
html[data-theme="light"] svg {
  background-color: var(--pk-bg-light) !important;
  color: var(--pk-text-light) !important;
}

html[data-theme="light"] #chart-container,
html[data-theme="light"] #loading-screen,
html[data-theme="light"] .noscript-message {
  background-color: var(--pk-bg-light) !important;
  color: var(--pk-text-light) !important;
}

html[data-theme="light"] .legend,
html[data-theme="light"] .legend-collapsed,
html[data-theme="light"] .pk-info-overlay,
html[data-theme="light"] footer,
html[data-theme="light"] #legend-panel,
html[data-theme="light"] .tooltip,
html[data-theme="light"] .hover-label {
  background: var(--pk-surface-light) !important;
  color: var(--pk-text-light) !important;
  box-shadow: var(--pk-shadow-light);
}

html[data-theme="light"] .pk-global-nav-inner {
  background: transparent;
  box-shadow: none;
}

html[data-theme="light"] .pk-global-brand {
  color: #3c3c3c;
}

html[data-theme="light"] .pk-global-nav {
  background: var(--pk-surface-light, rgba(255, 255, 255, 0.96));
}

html[data-theme="light"] .pk-global-link {
  color: #545454;
}

html[data-theme="light"] .pk-global-link:hover {
  color: #1e1e1e;
  background: rgba(20, 20, 20, 0.08);
}

html[data-theme="light"] .pk-global-link[aria-current="page"] {
  color: #1f1f1f;
  background: rgba(20, 20, 20, 0.14);
}

html[data-theme="light"] .pk-global-nav-toggle {
  border: none;
  background: transparent;
  color: #444444;
}

html[data-theme="light"] .pk-global-nav-close {
  border-color: rgba(18, 18, 18, 0.18);
  background: rgba(18, 18, 18, 0.03);
  color: #202020;
}

html[data-theme="light"] .hover-label {
  border: 1px solid #d1d1d1;
}

html[data-theme="light"] .axis text {
  fill: #626262 !important;
}

html[data-theme="light"] .axis path,
html[data-theme="light"] .axis line,
html[data-theme="light"] .annotation-line,
html[data-theme="light"] .persistent-annotation-line {
  stroke: #bec3cc !important;
}

html[data-theme="light"] .annotation-note,
html[data-theme="light"] .persistent-annotation-note {
  fill: #3b3b3b !important;
  text-shadow: none !important;
}

html[data-theme="light"] .poll-source {
  color: #666666 !important;
}

html[data-theme="light"] .legend-item--faded {
  color: #6b6b6b !important;
}

html[data-theme="light"] .legend-item--highlighted {
  color: var(--pk-text-light) !important;
}

html[data-theme="light"] body[data-page="hallitus"] .legend button {
  color: var(--pk-text-light) !important;
}

html[data-theme="light"] body[data-page="hallitus"] .legend {
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="light"] body[data-page="hallitus"],
html[data-theme="light"] body[data-page="hallitus"] .page,
html[data-theme="light"] body[data-page="hallitus"] .chart-card,
html[data-theme="light"] body[data-page="hallitus"] .chart-layout {
  background: var(--pk-bg-light, #f4f4f4) !important;
  color: var(--pk-text-light, #202020) !important;
}

html[data-theme="light"] body[data-page="hallitus"] #legend-panel {
  background: var(--pk-surface-light, rgba(255, 255, 255, 0.96)) !important;
  box-shadow: var(--pk-shadow-light);
}

html[data-theme="light"] body[data-page="main"] #legend-sidebar {
  background: transparent;
}

html[data-theme="light"] body[data-page="main"] #legend {
  background: rgba(255, 255, 255, 0.96) !important;
  border: none;
  box-shadow: var(--pk-shadow-light);
}

html[data-theme="light"] body[data-page="main"] .legend-annotation-toggle {
  color: #575757;
}

html[data-theme="light"] body[data-page="main"] .legend-annotation-toggle:hover {
  color: #2f2f2f;
}

html[data-theme="light"] body[data-page="main"] .legend-annotation-toggle .legend-color--annotation {
  border-color: #7f7f7f;
}

html[data-theme="light"] body[data-page="main"] .legend-annotation-toggle .legend-color--annotation::after {
  background: #6c6c6c;
}

html[data-theme="light"] body[data-page="main"] #legend .legend-item.legend-item--highlighted {
  color: #1f1f1f;
  opacity: 1;
}

html[data-theme="light"] body[data-page="main"] #legend .legend-item.legend-item--faded {
  color: #777777;
  opacity: 0.68;
}

body[data-page="hallitus"] #chart-container {
  background: var(--pk-bg-dark, #131313) !important;
}

html[data-theme="light"] body[data-page="hallitus"] #chart-container {
  background: var(--pk-bg-light, #f4f4f4) !important;
}

html[data-theme="light"] body[data-page="hallitus"] .legend button:hover {
  color: #111111 !important;
}

html[data-theme="light"] body[data-page="hallitus"] .legend button.is-hidden {
  color: #6b6b6b !important;
  opacity: 0.62;
}

html[data-theme="light"] footer a,
html[data-theme="light"] footer .footer-link-button {
  color: #555555 !important;
}

html[data-theme="light"] .annotation.annotation--faded .annotation-line {
  stroke: #9a9a9a;
  stroke-opacity: 0.18;
}

html[data-theme="light"] .annotation.annotation--faded .annotation-note {
  fill: #707070;
  fill-opacity: 0.18;
  text-shadow: none !important;
}

html[data-theme="light"] .annotation.annotation--faded:hover .annotation-line {
  stroke: #333333 !important;
  stroke-opacity: 1 !important;
}

html[data-theme="light"] .annotation.annotation--faded:hover .annotation-note {
  fill: #2d2d2d !important;
  fill-opacity: 1 !important;
  font-weight: 700;
}

html[data-theme="light"] footer a:hover,
html[data-theme="light"] footer .footer-link-button:hover {
  color: #2f2f2f !important;
}

html[data-theme="light"] .gov-name,
html[data-theme="light"] body[data-page="hallitus"] .hero h1,
html[data-theme="light"] body[data-page="ennuste"] .prediction-hero h1,
html[data-theme="light"] body[data-page="latest"] .latest-hero h1 {
  color: var(--pk-text-light) !important;
}

html[data-theme="light"] .pk-info-overlay {
  background: var(--pk-surface-light, rgba(255, 255, 255, 0.96));
  color: var(--pk-text-light, #202020);
  box-shadow: var(--pk-shadow-light);
}

html[data-theme="light"] .pk-info-overlay .close-button {
  color: #6a6a6a;
}

html[data-theme="light"] .pk-info-overlay .close-button:hover {
  color: var(--pk-text-light);
}

html[data-theme="light"] .pk-info-content h2,
html[data-theme="light"] .pk-info-content h3 {
  color: var(--pk-text-light) !important;
}

html[data-theme="light"] .pk-info-content,
html[data-theme="light"] .pk-info-content p,
html[data-theme="light"] .pk-info-content li {
  color: #3b3b3b;
}

html[data-theme="light"] .pk-info-content a {
  color: #ad1752;
}

html[data-theme="light"] .pk-info-content a:hover {
  color: #711336;
}

html[data-theme="light"] .gov-segments,
html[data-theme="light"] .eyebrow,
html[data-theme="light"] .legend-title,
html[data-theme="light"] footer p span.pipe,
html[data-theme="light"] .tooltip,
html[data-theme="light"] .hover-label {
  color: #3b3b3b !important;
}

html[data-theme="light"] .tooltip {
  border: 1px solid #d6d6d6;
}

.export-overlay {
  position: fixed;
  left: 50%;
  top: calc(var(--pk-overlay-top) + 6px);
  bottom: auto;
  width: min(460px, calc(100% - 20px));
  transform: translateX(-50%);
  max-height: min(560px, calc(100dvh - var(--pk-overlay-top) - 24px - env(safe-area-inset-bottom)));
  padding: 18px;
  overflow-y: auto;
  background: rgba(24, 24, 24, 0.98);
  border-radius: 4px;
  z-index: 760;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.export-content {
  display: flex;
  flex-direction: column;
}

.export-content h2 {
  margin: 0 0 8px;
  color: #f3f4f6;
  font-size: 1.25rem;
}

.export-overlay .close-button {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  color: #ababab;
  cursor: pointer;
  font-size: 1.35rem;
}

.export-overlay .close-button:hover {
  color: #ffffff;
}

.export-intro {
  margin: 0 0 16px;
  color: #b9b9b9;
  line-height: 1.45;
  font-size: 0.9rem;
}

.export-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  color: #d4d4d4;
  font-size: 0.88rem;
}

.export-field select {
  min-height: 36px;
  border: 1px solid #3a3f49;
  border-radius: 6px;
  background: #171a21;
  color: #f0f0f0;
  padding: 7px 10px;
  font: inherit;
}

.export-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  color: #d4d4d4;
  font-size: 0.88rem;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.export-action {
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 0.88rem;
  padding: 8px 13px;
  cursor: pointer;
}

.export-action--secondary {
  border-color: #3b404a;
  background: transparent;
  color: #d4d4d4;
}

.export-action--primary {
  border-color: #5c5c5c;
  background: #3a3a3a;
  color: #f1f1f1;
}

.export-action:disabled {
  opacity: 0.6;
  cursor: wait;
}

.export-status {
  margin: 10px 0 0;
  min-height: 1.2em;
  color: #b0b0b0;
  font-size: 0.8rem;
}

html[data-theme="light"] .export-overlay {
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 8px 26px rgba(24, 24, 24, 0.14);
}

html[data-theme="light"] .export-content h2 {
  color: var(--pk-text-light);
}

html[data-theme="light"] .export-overlay .close-button {
  color: #6a6a6a;
}

html[data-theme="light"] .export-overlay .close-button:hover {
  color: var(--pk-text-light);
}

html[data-theme="light"] .export-intro,
html[data-theme="light"] .export-field,
html[data-theme="light"] .export-check,
html[data-theme="light"] .export-status {
  color: #565656;
}

html[data-theme="light"] .export-field select {
  background: #ffffff;
  color: var(--pk-text-light);
  border-color: #cfcfcf;
}

html[data-theme="light"] .export-action--secondary {
  border-color: #d1d1d1;
  color: #3b3b3b;
}

html[data-theme="light"] .export-action--primary {
  border-color: #767676;
  background: #767676;
  color: #ffffff;
}

@media (max-width: 768px) {
  .pk-footer {
    font-size: 0.76rem;
  }

  .pk-info-overlay {
    top: calc(var(--pk-overlay-top) + 2px);
    bottom: calc(66px + env(safe-area-inset-bottom));
    width: calc(100% - 20px);
    padding: 14px 14px 12px;
  }

  .pk-info-content {
    padding-right: 4px;
  }

  .pk-info-content h2 {
    font-size: 1rem;
  }

  body[data-page="main"] #chart-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    row-gap: 4px;
    padding: 7px 4px 7px;
  }

  body[data-page="main"] #chart-container {
    grid-row: 1;
  }

  body[data-page="main"] #legend-sidebar {
    grid-row: 2;
    width: 100%;
    border-right: none;
    border-bottom: none;
    padding: 0;
    max-height: none;
  }

  body[data-page="main"] #legend {
    width: 100%;
    max-width: none;
    padding: 6px 8px;
    border-radius: var(--pk-card-radius, 8px);
  }

  body[data-page="hallitus"] #legend-panel,
  body[data-page="latest"] .latest-controls-card,
  body[data-page="ennuste"] .forecast-panel {
    border-radius: var(--pk-card-radius, 8px);
  }

  body[data-page="main"] #legend-body {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 8px;
  }

  body[data-page="main"] #legend .legend-item {
    width: auto;
    padding: 1px 0;
    margin-right: 0;
    margin-bottom: 0;
  }

  body[data-page="main"] .axis text {
    font-size: 0.7rem;
  }

  html[data-theme="light"] body[data-page="main"] #legend-sidebar {
    border-bottom-color: transparent;
  }

  .export-overlay {
    top: calc(var(--pk-overlay-top) + 4px);
    left: 50%;
    bottom: auto;
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    transform: translateX(-50%);
    max-height: calc(100dvh - var(--pk-overlay-top) - 86px - env(safe-area-inset-bottom));
    padding: 14px;
  }
}

@media (max-width: 860px) {
  body.pk-nav-open {
    overflow: hidden;
  }

  .pk-global-nav {
    padding: 0;
  }

  .pk-global-nav-inner {
    position: relative;
    min-height: 56px;
    padding: 6px var(--pk-gutter-mobile);
    border-radius: 0;
  }

  .pk-global-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 46px;
    height: 46px;
  }

  .pk-global-nav-toggle span[aria-hidden="true"] {
    font-size: 1.35rem;
  }

  .pk-global-links {
    position: fixed;
    inset: 0;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: calc(env(safe-area-inset-top) + 74px) max(16px, var(--pk-gutter-mobile)) calc(env(safe-area-inset-bottom) + 26px);
    background: rgba(14, 14, 14, 0.96);
    box-shadow: none;
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 160ms ease, visibility 160ms ease;
    z-index: 900;
    overflow-y: auto;
  }

  .pk-global-nav[data-nav-open="true"] .pk-global-links {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .pk-global-nav-close {
    display: inline-flex;
    position: absolute;
    top: calc(env(safe-area-inset-top) + 10px);
    right: calc(max(10px, var(--pk-gutter-mobile)));
    z-index: 2;
  }

  .pk-global-link {
    width: min(100%, 460px);
    box-sizing: border-box;
    text-align: center;
    padding: 14px 18px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.2;
  }

  html[data-theme="light"] .pk-global-links {
    background: rgba(245, 245, 245, 0.95);
  }

  html[data-theme="light"] .pk-global-nav-close {
    border-color: rgba(24, 24, 24, 0.22);
    background: rgba(24, 24, 24, 0.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
