:root {
  color-scheme: light;
  --bg: #f5f6f3;
  --surface: #ffffff;
  --surface-soft: #eef3f1;
  --surface-warm: #fbf4e6;
  --ink: #17201d;
  --muted: #68716e;
  --line: #dfe5e2;
  --accent: #197e72;
  --accent-strong: #0e5e55;
  --blue: #2b6fae;
  --amber: #b7791f;
  --danger: #a33a2e;
  --shadow: 0 16px 45px rgba(25, 32, 29, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body.has-lightbox {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(80px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  font-weight: 760;
}

.brand-mark {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background:
    linear-gradient(135deg, #197e72 0 50%, transparent 50%),
    linear-gradient(315deg, #d6a33f 0 50%, #2b6fae 50%);
}

.top-nav {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.nav-link,
.lang-switch,
.button-primary,
.button-secondary {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.nav-link.active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(25, 32, 29, 0.08);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.header-icon-link {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.header-icon-link:hover,
.header-icon-link:focus-visible,
.header-icon-link.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 6px 16px rgba(23, 32, 29, 0.12);
}

.gear-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lang-picker {
  position: relative;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 74px;
  padding: 0 10px 0 12px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
  font-weight: 760;
}

.lang-current::before {
  content: "EN";
}

html[data-current-lang="ru"] .lang-current::before {
  content: "RU";
}

html[data-current-lang="de"] .lang-current::before {
  content: "DE";
}

html[data-current-lang="es"] .lang-current::before {
  content: "ES";
}

html[data-current-lang="fr"] .lang-current::before {
  content: "FR";
}

html[data-current-lang="it"] .lang-current::before {
  content: "IT";
}

html[data-current-lang="pt"] .lang-current::before {
  content: "PT";
}

.lang-switch::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
}

.lang-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 74px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.lang-options[hidden] {
  display: none;
}

.lang-options button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 760;
}

.lang-options button:hover,
.lang-options button:focus-visible,
.lang-options button.is-selected {
  color: var(--ink);
  background: var(--surface-soft);
  outline: 0;
}

.donation-strip {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  gap: 10px;
  align-items: center;
  width: fit-content;
  max-width: min(940px, calc(100vw - 40px));
  margin: 14px auto 0;
  padding: 8px 10px 8px 14px;
  color: #5c4515;
  background: #fff4d2;
  border: 1px solid #e4c56f;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(25, 32, 29, 0.06);
}

.donation-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.donation-line {
  min-width: 0;
  font-size: 14px;
  font-weight: 760;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.donation-address {
  width: fit-content;
  max-width: 100%;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: left;
}

.donation-address:hover,
.donation-address:focus-visible {
  color: var(--accent-strong);
  outline: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.donation-qr-link {
  display: block;
  width: 76px;
  height: 76px;
  padding: 4px;
  background: #fff;
  border: 1px solid rgba(92, 69, 21, 0.18);
  border-radius: 6px;
  cursor: pointer;
}

.donation-qr {
  display: block;
  width: 100%;
  height: 100%;
}

.donation-copy-status {
  position: absolute;
  top: -12px;
  right: 10px;
  z-index: 1;
  min-height: 24px;
  padding: 3px 8px;
  color: var(--surface);
  background: var(--accent-strong);
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(25, 32, 29, 0.16);
  font-size: 12px;
  font-weight: 760;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.donation-copy-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.page-shell {
  width: min(1500px, calc(100vw - 40px));
  margin: 24px auto 64px;
}

.dashboard-toolbar,
.compare-toolbar,
.settings-toolbar,
.settings-summary {
  display: grid;
  gap: 18px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dashboard-toolbar {
  grid-template-columns: minmax(280px, 1.35fr) minmax(220px, 0.85fr) minmax(220px, 0.85fr) minmax(260px, 1fr);
  align-items: end;
}

.compare-toolbar {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 12px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.compare-mode-tabs {
  display: inline-flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 12px;
  padding: 4px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compare-mode-tab {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 760;
  white-space: nowrap;
}

.compare-mode-tab.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(25, 32, 29, 0.08);
}

.compare-mode-tab:focus-visible {
  outline: 3px solid rgba(25, 126, 114, 0.18);
  outline-offset: 2px;
}

.compare-primary-controls,
.compare-secondary-controls,
.similarity-search-controls,
.similarity-result-controls,
.best-worst-search-controls,
.best-worst-result-controls,
.country-top5-controls {
  display: grid;
  gap: 18px;
  align-items: start;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.compare-primary-controls {
  grid-template-columns: minmax(360px, 0.95fr) minmax(560px, 1.45fr);
}

.compare-secondary-controls {
  grid-template-columns: minmax(300px, 340px) minmax(340px, 420px);
  align-items: end;
  justify-content: start;
}

.similarity-search-controls {
  grid-template-columns: minmax(220px, 0.9fr) minmax(320px, 1.25fr) minmax(260px, 0.8fr) auto;
  align-items: end;
}

.best-worst-search-controls {
  grid-template-columns: minmax(380px, 1.4fr) minmax(260px, 0.8fr) auto auto;
  align-items: end;
}

.country-top5-controls {
  grid-template-columns: minmax(260px, 0.9fr) minmax(260px, 0.7fr) auto;
  align-items: end;
}

.similarity-search-button,
.best-worst-search-button,
.country-top5-search-button {
  min-height: 44px;
  white-space: nowrap;
}

.similarity-result-controls,
.best-worst-result-controls {
  grid-template-columns: 1fr;
}

.similarity-result-top {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.similarity-result-top strong {
  display: block;
  margin-top: 4px;
  font-size: 17px;
  line-height: 1.25;
}

.rank-mode-links {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding-bottom: 2px;
}

.rank-mode-link {
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 780;
  line-height: 1.2;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
}

.rank-mode-link.is-active {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.rank-mode-link:focus-visible {
  outline: 3px solid rgba(25, 126, 114, 0.18);
  outline-offset: 4px;
}

.country-top5-results {
  display: grid;
  gap: 18px;
}

.country-top5-results-header {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.country-top5-results-header strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.15;
}

.country-top5-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.country-top5-column {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(25, 32, 29, 0.06);
}

.country-top5-column h2 {
  margin: 0 0 14px;
  font-size: 22px;
  line-height: 1.15;
}

.country-top5-list {
  display: grid;
  gap: 10px;
}

.country-top5-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 13px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.country-top5-item:hover,
.country-top5-item:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
  outline: none;
}

.country-top5-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 32px;
  padding: 0 9px;
  color: var(--teal);
  background: rgba(25, 126, 114, 0.1);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 850;
}

.country-top5-item-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.country-top5-item-title {
  font-size: 17px;
  font-weight: 850;
  line-height: 1.22;
}

.country-top5-item-meta,
.country-top5-item-value,
.country-top5-empty {
  color: var(--muted);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.35;
}

.country-top5-empty {
  padding: 16px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.country-picker,
.year-picker,
.category-picker,
.single-picker,
.multi-picker,
.settings-search {
  display: grid;
  gap: 8px;
}

.country-picker {
  position: relative;
}

.multi-picker {
  min-width: 0;
  position: relative;
}

label,
.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

input[type="search"] {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  color: var(--ink);
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
}

input[type="search"]:disabled {
  color: var(--muted);
  background: #f1f5f3;
  cursor: wait;
}

.country-combobox {
  position: relative;
}

.country-combobox input[type="search"] {
  padding-right: 48px;
}

.combo-toggle {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
}

.combo-toggle::before {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: translateY(-2px) rotate(45deg);
}

.combo-toggle[aria-expanded="true"]::before {
  transform: translateY(2px) rotate(225deg);
}

.combo-toggle:hover,
.combo-toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
}

.combo-toggle:disabled,
.country-combobox.is-loading .combo-toggle {
  cursor: wait;
  opacity: 0.62;
}

.country-combobox.is-loading input[type="search"] {
  border-color: var(--line);
  box-shadow: none;
}

.country-options {
  position: absolute;
  z-index: 35;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: grid;
  max-height: min(390px, 58vh);
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 52px rgba(23, 32, 29, 0.18);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.multi-select {
  position: relative;
  display: grid;
  gap: 8px;
  min-height: 84px;
  padding: 9px;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.multi-select:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
}

.selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  align-items: center;
}

.selection-placeholder {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.selection-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 28px;
  padding: 0 8px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 760;
}

.selection-chip span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-chip b {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.selection-chip:disabled {
  cursor: default;
}

.selection-chip:hover:not(:disabled),
.selection-chip:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.multi-select input[type="search"] {
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.multi-select input[type="search"]:focus {
  box-shadow: none;
}

.multi-options {
  position: absolute;
  z-index: 35;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  display: grid;
  max-height: min(420px, 58vh);
  overflow: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 20px 52px rgba(23, 32, 29, 0.18);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.multi-option {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 9px 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
}

.multi-option-group {
  display: grid;
  gap: 4px;
  padding: 4px;
}

.multi-option-group + .multi-option-group {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.multi-option-group h3 {
  position: sticky;
  z-index: 1;
  top: -6px;
  margin: 0;
  padding: 7px 9px;
  color: var(--muted);
  background: linear-gradient(180deg, var(--surface) 0%, rgba(247, 250, 248, 0.96) 100%);
  border-radius: 7px;
  font-size: 11px;
  font-weight: 850;
}

.multi-option-group-items {
  display: grid;
  gap: 2px;
}

.indicator-option {
  min-height: 44px;
}

.multi-option:hover,
.multi-option.is-selected {
  background: var(--surface-soft);
}

.multi-option:disabled {
  cursor: default;
  opacity: 0.62;
}

.multi-option strong,
.multi-option em {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multi-option strong {
  font-size: 14px;
  font-style: normal;
}

.multi-option em {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 650;
}

.multi-option small {
  color: var(--amber);
  font-size: 11px;
  font-weight: 760;
}

.multi-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
}

.multi-option.is-selected .multi-check {
  background:
    linear-gradient(135deg, transparent 0 45%, var(--surface) 45% 55%, transparent 55%),
    var(--accent);
  border-color: var(--accent);
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.compare-secondary-controls .year-picker,
.compare-secondary-controls .toolbar-metrics {
  min-width: 0;
}

.country-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
}

.country-option:hover,
.country-option.is-active,
.country-option[aria-selected="true"] {
  background: var(--surface-soft);
}

.country-option[aria-selected="true"] {
  box-shadow: inset 3px 0 0 var(--accent);
}

.country-option-name {
  min-width: 0;
  overflow: hidden;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.country-option-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

.country-option-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 14px;
}

.year-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.year-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.select-field {
  position: relative;
  height: 44px;
  overflow: hidden;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.select-field::after {
  content: "";
  position: absolute;
  right: 15px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}

.select-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
}

.select-field select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0 42px 0 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  appearance: none;
  font-size: 18px;
  font-weight: 760;
  line-height: 44px;
  cursor: pointer;
}

.select-field select:disabled {
  color: var(--muted);
  cursor: wait;
}

.category-picker .select-field select {
  font-size: 16px;
}

.toolbar-metrics {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr);
  gap: 10px;
}

.compare-summary {
  grid-template-columns: 1fr 1fr;
}

.settings-summary {
  grid-template-columns: repeat(2, minmax(120px, 1fr));
}

.toolbar-metrics > div,
.settings-summary > div {
  min-height: 58px;
  padding: 10px 12px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.toolbar-metrics strong,
.settings-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.notice-cluster {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  justify-content: start;
}

.notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.notice-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  transition: box-shadow 120ms ease;
}

.notice-toggle:hover,
.notice-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
}

.notice-content {
  width: min(760px, calc(100vw - 32px));
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  box-shadow: 0 12px 26px rgba(23, 32, 29, 0.08);
}

.notice-content[hidden] {
  display: none;
}

.notice-content:not([hidden]) {
  animation: notice-reveal 140ms ease-out;
}

@keyframes notice-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.badge,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
  white-space: nowrap;
}

.badge-cpi {
  color: #5c4515;
  background: #ffe7a8;
  border: 1px solid #e4c56f;
}

.badge-muted {
  color: var(--muted);
  background: #eef1f0;
  border: 1px solid var(--line);
}

.badge-info {
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid rgba(25, 126, 114, 0.22);
}

.cpi-mode-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  color: var(--muted);
  background: #eef1f0;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 780;
  line-height: 1;
  white-space: nowrap;
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease, color 120ms ease;
}

.cpi-mode-toggle[aria-pressed="true"] {
  color: #5c4515;
  background: #ffe7a8;
  border-color: #e4c56f;
}

.cpi-mode-toggle:hover {
  box-shadow: 0 6px 16px rgba(23, 32, 29, 0.12);
}

.cpi-mode-toggle:focus-visible {
  outline: 3px solid rgba(25, 126, 114, 0.2);
  outline-offset: 2px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: #eef1f0;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 120ms ease, box-shadow 120ms ease, border-color 120ms ease, background 120ms ease;
}

.icon-button:hover,
.icon-button:focus-visible {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 6px 16px rgba(23, 32, 29, 0.12);
}

.expand-icon {
  width: 15px;
  height: 15px;
  background:
    linear-gradient(currentColor, currentColor) left top / 7px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left top / 2px 7px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 7px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 2px 7px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 7px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 2px 7px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 7px 2px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 2px 7px no-repeat;
}

.print-icon {
  position: relative;
  width: 16px;
  height: 15px;
}

.print-icon::before,
.print-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 2px solid currentColor;
}

.print-icon::before {
  top: 0;
  width: 10px;
  height: 6px;
  background: transparent;
  border-bottom: 0;
}

.print-icon::after {
  bottom: 0;
  width: 14px;
  height: 8px;
  background:
    linear-gradient(currentColor, currentColor) center 5px / 8px 2px no-repeat,
    transparent;
  border-radius: 2px;
}

.share-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.share-icon::before,
.share-icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 6px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.share-icon::before {
  left: 0;
  top: 6px;
  transform: rotate(-35deg);
}

.share-icon::after {
  right: 0;
  top: 3px;
  transform: rotate(-35deg);
}

.export-icon {
  position: relative;
  width: 17px;
  height: 17px;
  background:
    linear-gradient(currentColor, currentColor) left bottom / 17px 2px no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 2px 6px no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 2px 6px no-repeat;
}

.export-icon::before,
.export-icon::after {
  content: "";
  position: absolute;
}

.export-icon::before {
  left: 50%;
  top: 1px;
  width: 2px;
  height: 10px;
  background: currentColor;
  border-radius: 2px;
  transform: translateX(-50%);
}

.export-icon::after {
  left: 50%;
  top: 5px;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.loading-panel {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.loading-panel.loading-error {
  background: #fff1ee;
  border-color: #e0aca4;
}

.loading-panel.loading-error .progress-fill {
  background: var(--danger);
}

.loading-copy {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.loading-copy strong {
  color: var(--ink);
}

.progress-track {
  height: 10px;
  margin-top: 12px;
  overflow: hidden;
  background: #e5e9e7;
  border-radius: 999px;
}

.progress-fill {
  width: 8%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #d6a33f);
  border-radius: inherit;
  transition: width 220ms ease;
}

.progress-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.progress-stage {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 5px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.2;
}

.progress-stage-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  color: var(--muted);
  background: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}

.progress-stage.is-done {
  color: var(--teal);
  border-color: rgba(25, 126, 114, 0.22);
}

.progress-stage.is-done .progress-stage-number {
  color: #fff;
  background: var(--teal);
}

.progress-stage.is-current {
  color: var(--ink);
  background: rgba(214, 163, 63, 0.18);
  border-color: rgba(214, 163, 63, 0.62);
}

.progress-stage.is-current .progress-stage-number {
  color: #5e4510;
  background: #f7d989;
}

.loading-panel.is-indeterminate .progress-fill {
  width: 42%;
  animation: progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-110%);
  }

  55% {
    transform: translateX(45%);
  }

  100% {
    transform: translateX(245%);
  }
}

.dashboard-grid,
.compare-grid,
.settings-list {
  display: grid;
  gap: 30px;
  margin-top: 28px;
}

.category-section,
.settings-category {
  padding: 20px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.category-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.category-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  min-width: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card-top {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
  min-height: 52px;
}

.card-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.lightbox-copy-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  color: #fff;
  background: #17201d;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.lightbox-copy-status.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.lightbox-copy-status[hidden] {
  display: none;
}

.card-top h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.latest-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
}

.latest-row strong {
  min-width: 0;
  font-size: 30px;
  line-height: 1.05;
  overflow-wrap: normal;
  text-wrap: nowrap;
  white-space: nowrap;
  word-break: normal;
}

.latest-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

canvas {
  display: block;
  width: 100%;
  height: 150px;
  margin-top: 10px;
}

.card-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.card-footer > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-footer > span:last-child {
  grid-column: 3;
  justify-self: end;
  text-align: right;
}

.indicator-description-button {
  display: inline-grid;
  grid-column: 2;
  place-items: center;
  width: 26px;
  height: 24px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  line-height: 1;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.indicator-description-button:hover,
.indicator-description-button:focus-visible,
.indicator-description-button[aria-expanded="true"] {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 5px 14px rgba(23, 32, 29, 0.12);
}

.description-popover {
  position: absolute;
  z-index: 8;
  right: 14px;
  bottom: 42px;
  left: 14px;
  max-height: 176px;
  padding: 10px 12px;
  overflow: auto;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(23, 32, 29, 0.2);
}

.description-popover strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  line-height: 1.25;
}

.description-popover p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.42;
}

.compare-card {
  position: relative;
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 34px rgba(25, 32, 29, 0.06);
}

.lightbox-widget {
  position: relative;
}

.compare-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.compare-card-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.compare-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.legend-item {
  display: inline-grid;
  grid-template-columns: auto minmax(0, auto) auto;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 720;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--series-color);
}

.legend-country {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-value {
  color: var(--muted);
  font-weight: 650;
}

.compare-chart {
  height: 330px;
  margin-top: 16px;
}

.compare-lightbox-panel {
  width: min(1320px, calc(100vw - 44px));
}

.compare-lightbox-chart {
  height: min(56vh, 520px);
}

.chart-tooltip {
  position: fixed;
  z-index: 100;
  display: grid;
  gap: 2px;
  min-width: 108px;
  max-width: min(360px, calc(100vw - 20px));
  padding: 8px 10px;
  color: var(--surface);
  background: rgba(23, 32, 29, 0.94);
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 12px 30px rgba(23, 32, 29, 0.22);
}

.chart-tooltip span {
  color: #dce5e1;
  font-size: 12px;
}

.tooltip-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.tooltip-row i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--series-color);
}

.tooltip-row b {
  min-width: 0;
  overflow: hidden;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.widget-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.widget-lightbox-scrim {
  position: absolute;
  inset: 0;
  background: rgba(23, 32, 29, 0.52);
  backdrop-filter: blur(10px);
}

.widget-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 44px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 32px 90px rgba(23, 32, 29, 0.28);
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 4;
  width: 30px;
  height: 30px;
  padding: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.lightbox-close::before,
.lightbox-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  background: var(--ink);
  transform-origin: center;
}

.lightbox-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.lightbox-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 126, 114, 0.12);
}

.lightbox-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding-right: 48px;
}

.lightbox-eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
}

.lightbox-header h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.08;
}

.print-cpi-mode-label {
  display: none;
}

.lightbox-latest {
  margin-top: 20px;
}

.lightbox-latest strong {
  font-size: clamp(34px, 5vw, 58px);
}

.lightbox-chart {
  height: min(44vh, 390px);
  margin-top: 18px;
}

.lightbox-footer {
  margin-top: 12px;
}

.settings-toolbar {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
}

.settings-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button-primary,
.button-secondary {
  padding: 0 14px;
  font-weight: 760;
}

.button-primary {
  color: #fff;
  background: var(--accent);
}

.button-secondary {
  color: var(--ink);
  background: var(--surface-soft);
  border-color: var(--line);
}

.settings-summary {
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  margin-top: 18px;
  box-shadow: none;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px;
}

.metric-toggle-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  align-items: start;
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric-toggle-item.is-selected {
  border-color: rgba(25, 126, 114, 0.58);
  box-shadow: inset 4px 0 0 var(--accent);
}

.metric-checkbox {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}

.toggle-title {
  min-width: 0;
  font-weight: 760;
  line-height: 1.25;
}

.toggle-period {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
  padding: 5px 8px;
  background: var(--surface-soft);
  border-radius: 999px;
}

.metric-description {
  max-height: 7.1em;
  overflow: auto;
  padding: 10px 11px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.42;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1180px) {
  .dashboard-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .compare-primary-controls,
  .compare-secondary-controls,
  .similarity-search-controls,
  .best-worst-search-controls,
  .country-top5-controls {
    grid-template-columns: 1fr 1fr;
  }

  .similarity-search-button,
  .best-worst-search-button,
  .country-top5-search-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .toolbar-metrics {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .app-header {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "nav nav";
    padding: 12px 16px;
  }

  .brand {
    grid-area: brand;
  }

  .top-nav {
    grid-area: nav;
    justify-self: stretch;
  }

  .nav-link {
    flex: 1;
    justify-content: center;
  }

  .header-actions {
    grid-area: actions;
  }

  .page-shell {
    width: min(100vw - 24px, 1500px);
    margin-top: 16px;
  }

  .dashboard-toolbar,
  .compare-toolbar,
  .settings-toolbar {
    grid-template-columns: 1fr;
  }

  .compare-primary-controls,
  .compare-secondary-controls,
  .similarity-search-controls,
  .best-worst-search-controls,
  .country-top5-controls {
    grid-template-columns: 1fr;
  }

  .compare-mode-tabs {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .compare-mode-tabs::-webkit-scrollbar {
    display: none;
  }

  .compare-mode-tab {
    flex: 0 0 auto;
  }

  .similarity-search-button,
  .best-worst-search-button,
  .country-top5-search-button {
    justify-self: stretch;
  }

  .country-top5-columns {
    grid-template-columns: 1fr;
  }

  .similarity-result-top {
    display: grid;
    align-items: start;
  }

  .toolbar-metrics {
    grid-column: auto;
  }

  .toolbar-metrics,
  .compare-summary,
  .settings-summary {
    grid-template-columns: 1fr;
  }

  .donation-strip {
    grid-template-columns: 1fr auto;
    width: min(100vw - 24px, 560px);
    max-width: calc(100vw - 24px);
    margin-top: 12px;
  }

  .compare-card-header {
    grid-template-columns: 1fr;
  }

  .compare-chart {
    height: 290px;
  }

  .settings-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .widget-lightbox {
    padding: 14px;
  }

  .widget-lightbox-panel {
    width: min(100vw - 24px, 1120px);
    max-height: calc(100vh - 24px);
    padding: 18px;
  }

  .lightbox-close {
    top: 18px;
    right: 18px;
  }

  .lightbox-header {
    grid-template-columns: 1fr;
    min-height: 30px;
    padding-right: 152px;
  }

  .lightbox-header > .card-actions {
    position: absolute;
    top: 18px;
    right: 54px;
    z-index: 3;
  }

  .lightbox-widget > .lightbox-header > .card-actions {
    right: 36px;
    top: 0;
  }

  .lightbox-chart {
    height: 300px;
  }
}

@media (max-width: 560px) {
  .donation-strip {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .card-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .category-section,
  .settings-category {
    padding: 14px;
  }

  .metric-toggle-item {
    padding: 12px;
  }

  .toggle-shell {
    grid-template-columns: 1fr;
    gap: 7px;
    align-items: start;
  }

  .toggle-period {
    justify-self: start;
  }

  .metric-description {
    max-height: none;
  }

  .settings-actions {
    grid-template-columns: 1fr;
  }

  .lightbox-latest {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .lightbox-latest strong {
    font-size: 34px;
  }

  .lightbox-chart {
    height: 240px;
  }
}

@media print {
  @page {
    margin: 12mm;
  }

  body.is-printing-lightbox {
    background: #fff;
  }

  body.is-printing-lightbox > *:not(.widget-lightbox) {
    display: none !important;
  }

  body.is-printing-lightbox .widget-lightbox {
    position: static !important;
    inset: auto !important;
    display: block !important;
    padding: 0 !important;
  }

  body.is-printing-lightbox .widget-lightbox-scrim,
  body.is-printing-lightbox .lightbox-close,
  body.is-printing-lightbox .export-widget,
  body.is-printing-lightbox .print-widget,
  body.is-printing-lightbox .share-widget,
  body.is-printing-lightbox .lightbox-copy-status,
  body.is-printing-lightbox .cpi-mode-toggle {
    display: none !important;
  }

  body.is-printing-lightbox .widget-lightbox-panel {
    position: static !important;
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    background: #fff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  body.is-printing-lightbox .lightbox-header {
    grid-template-columns: 1fr !important;
    padding-right: 0 !important;
  }

  body.is-printing-lightbox .lightbox-header h2 {
    font-size: 28px !important;
  }

  body.is-printing-lightbox .print-cpi-mode-label {
    display: inline !important;
  }

  body.is-printing-lightbox .lightbox-chart {
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    page-break-inside: avoid;
  }

  body.is-printing-lightbox .compare-legend,
  body.is-printing-lightbox .lightbox-footer,
  body.is-printing-lightbox .lightbox-latest {
    page-break-inside: avoid;
  }
}
