:root {
  color-scheme: light;
  --canvas: #f7f7f2;
  --surface: #ffffff;
  --ink: #25352d;
  --muted: #626d63;
  --green: #47684f;
  --green-dark: #2f5038;
  --border: #dfe4db;
  --tint: #edf2e9;
  --danger: #a43a31;
  --shadow: 0 18px 42px rgba(47, 80, 56, 0.09), 0 2px 8px rgba(37, 53, 45, 0.04);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--canvas); }

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
}

button, input, select { font: inherit; }

button, select { cursor: pointer; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.app-shell {
  width: 100%;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 28px clamp(24px, 4vw, 64px) 24px;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
}

.brand {
  width: fit-content;
  direction: ltr;
  unicode-bidi: isolate;
  color: #3f654e;
  font-size: clamp(2rem, 2vw, 2.125rem);
  font-weight: 760;
  letter-spacing: -0.06em;
  line-height: 1;
  text-decoration: none;
}

.brand span { color: #3f654e; }

.header-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 16px;
}

.language-trigger {
  border: 0;
  padding: 7px 2px;
  color: var(--muted);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 650;
}

.language-switch { position: relative; }

.language-trigger {
  min-width: 47px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--green-dark);
}

.language-trigger:hover { color: var(--ink); }
.language-icon { display: block; width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; }
.language-trigger svg { width: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 150ms ease; }
.language-trigger[aria-expanded="true"] svg { transform: rotate(180deg); }

.calculator-mode {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
}

.calculator-mode a {
  min-width: 58px;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.calculator-mode a:hover { color: var(--green-dark); background: var(--tint); }

.calculator-mode a[aria-current="page"],
.calculator-mode a[aria-current="page"]:hover {
  color: #fff;
  background: var(--green);
}

.language-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 9px);
  right: 0;
  width: min(238px, calc(100vw - 32px));
  max-height: min(430px, calc(100vh - 90px));
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 46px rgba(37, 53, 45, 0.16);
}

.language-menu button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 0;
  border-radius: 9px;
  padding: 9px 10px;
  color: var(--ink);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 650;
  text-align: left;
}

.language-menu button:hover,
.language-menu button:focus-visible { background: var(--tint); }
.language-menu button[aria-selected="true"] { color: var(--green-dark); background: var(--tint); }
.language-menu small { color: var(--muted); font-size: 0.68rem; font-weight: 760; letter-spacing: 0.08em; }

.main-content {
  width: min(1220px, 100%);
  min-width: 0;
  min-height: 0;
  margin: 0 auto;
  display: grid;
  grid-template-rows: minmax(260px, 1fr) auto;
  gap: clamp(28px, 6vh, 64px);
  padding: clamp(28px, 5vh, 60px) 0 clamp(16px, 4vh, 38px);
}

.result-area {
  align-self: center;
  justify-self: center;
  width: min(960px, 100%);
  min-width: 0;
  text-align: center;
}

.result-context,
.result-note {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.result-area.has-large-amount .result-context {
  position: static;
  width: auto;
  height: auto;
  margin: 0 0 10px;
  overflow: visible;
  clip: auto;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.4;
}

.result-change {
  min-height: 1.45em;
  margin: 0;
  color: #3f654e;
  font-size: clamp(0.76rem, 0.92vw, 0.86rem);
  font-weight: 720;
  line-height: 1.45;
}

.result-caution { max-width: 38rem; margin: 6px auto 0; color: var(--muted); font-size: 0.72rem; line-height: 1.4; }
.result-caution[hidden] { display: none; }

.result-precision {
  margin-top: 5px;
  color: var(--green-dark);
  font-size: 0.74rem;
  line-height: 1.4;
}

.result-precision[hidden] { display: none; }
.result-precision summary { cursor: pointer; width: fit-content; margin-inline: auto; }
.result-precision summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.result-precision p { margin: 4px 0 0; overflow-wrap: anywhere; }
.result-precision a { color: inherit; text-underline-offset: 2px; }

.result-value {
  min-height: clamp(3.53rem, 8.14vw, 7.25rem);
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 10px;
  color: #3f654e;
  font-size: clamp(3.6rem, 8.3vw, 7.4rem);
  font-weight: 660;
  letter-spacing: -0.075em;
  line-height: 0.98;
  overflow-wrap: anywhere;
  overflow: hidden;
}

.result-value-content { display: inline; }

.result-currency-mark {
  display: inline-block;
  color: inherit;
  font-size: 0.8em;
  font-weight: 550;
  letter-spacing: -0.03em;
  unicode-bidi: isolate;
}

.result-currency-mark.is-adjacent-prefix { margin-inline-end: 0.1em; }
.result-currency-mark.is-adjacent-suffix { margin-inline-start: 0.1em; }

@media (forced-colors: active) {
  .result-currency-mark {
    color: CanvasText;
  }
}

.result-area.is-stale .result-value {
  color: var(--muted);
  font-size: clamp(2.1rem, 4vw, 3.5rem);
  letter-spacing: -0.045em;
}

.result-area.has-error .result-value {
  color: var(--danger);
  font-size: clamp(1.45rem, 2.8vw, 2.2rem);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.calculator-bar {
  position: relative;
  align-self: end;
  justify-self: center;
  width: 100%;
  max-width: 950px;
  display: grid;
  grid-template-columns: minmax(185px, 1.6fr) minmax(125px, 0.85fr) minmax(125px, 0.95fr) 48px minmax(125px, 0.95fr) minmax(130px, 0.9fr);
  align-items: end;
  gap: 0;
  padding: 11px;
  border: 1px solid rgba(155, 187, 154, 0.6);
  border-radius: 18px;
  background: radial-gradient(ellipse 105% 120% at 50% 0%, rgba(230, 241, 228, 0.52), rgba(246, 250, 244, 0.24) 48%, rgba(255, 255, 255, 0) 78%), var(--surface);
  box-shadow: var(--shadow), 0 0 24px rgba(86, 127, 87, 0.05);
}

.currency-change-notice {
  position: absolute;
  z-index: 3;
  inset-block-end: calc(100% + 10px);
  left: 50%;
  width: max-content;
  max-width: min(420px, calc(100vw - 40px));
  padding: 8px 13px;
  border: 1px solid rgba(155, 187, 154, 0.7);
  border-radius: 999px;
  color: var(--green-dark);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(47, 80, 56, 0.12);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.3;
  text-align: center;
  overflow-wrap: anywhere;
  pointer-events: none;
  transform: translateX(-50%);
}

.currency-change-notice:empty { display: none; }

.field {
  min-width: 0;
  position: relative;
  padding: 8px 18px 9px;
  border-right: 1px solid var(--border);
}

.calculator-bar .field {
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.calculator-bar .field:focus-within {
  border-radius: 8px;
  background-color: rgba(232, 243, 231, 0.62);
  box-shadow: inset 0 0 0 2px var(--green);
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.field-label { overflow-wrap: anywhere; }

.country-field > label::before,
.amount-field > label::before,
.year-field > label::before,
.date-field > .field-label::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-inline-end: 6px;
  border-radius: 50%;
  background: var(--green);
  opacity: 0.75;
  vertical-align: 0.12em;
}

.field select,
.field input {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.98rem;
  font-weight: 660;
  line-height: 1.3;
  outline: none;
}

.select-wrap { position: relative; }
.select-wrap::after {
  content: "";
  position: absolute;
  right: 1px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--green);
  border-bottom: 1.5px solid var(--green);
  pointer-events: none;
  transform: translateY(-72%) rotate(45deg);
}

.field select {
  padding: 0 18px 0 0;
  appearance: none;
}

.country-field select {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-input-wrap { display: flex; align-items: center; gap: 8px; }
.amount-input-wrap input { min-width: 0; flex: 1 1 auto; text-overflow: ellipsis; }
.amount-input-wrap span { color: var(--green); font-size: 0.8rem; font-weight: 750; }
.amount-field.has-long-currency .amount-input-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.amount-field.has-long-currency .amount-input-wrap span { justify-self: end; font-size: 0.72rem; line-height: 1; }

.field-error {
  position: absolute;
  top: calc(100% + 18px);
  left: 0;
  width: 220px;
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 600;
}

.field-error:empty { display: none; }

.amount-field.has-error { box-shadow: inset 0 -2px var(--danger); }

@media (max-width: 1120px) {
  .calculator-bar.has-amount-error .field-error {
    position: static;
    display: block;
    width: auto;
    padding: 3px 0 7px;
    background: transparent;
  }
}

.swap-button {
  width: 44px;
  height: 44px;
  align-self: center;
  justify-self: center;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--green-dark);
  background: transparent;
}

.swap-button-visual {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #cbd9cb;
  border-radius: 50%;
  background: var(--tint);
  box-shadow: 0 1px 3px rgba(47, 80, 56, 0.08);
  transition: background 150ms ease, border-color 150ms ease;
}

.swap-button:hover .swap-button-visual { border-color: #9fbd9f; background: #e1ecdf; }
.swap-button:active .swap-button-visual { background: #d4e5d1; }
.swap-button:focus-visible { outline: 2px solid var(--green-dark); outline-offset: 1px; }
.swap-button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }

.calculate-button {
  min-height: 58px;
  border: 0;
  border-radius: 12px;
  padding: 0 22px;
  color: #fff;
  background: var(--green);
  font-size: 0.92rem;
  font-weight: 750;
  transition: background 150ms ease, transform 150ms ease;
}

.calculate-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.calculate-button:active { transform: translateY(0); }

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.footer-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.5;
}

.footer-note-line {
  display: flex;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 7px;
  padding-inline: 12px;
  text-align: center;
}

.footer-note-line[hidden] {
  display: none;
}

.footer-note-line.currency-era-note {
  color: var(--green-dark);
  font-weight: 650;
  padding-inline: 12px;
}

.footer-history-link { color: var(--green-dark); font-weight: 700; text-underline-offset: 2px; }
.footer-history-link:hover, .footer-history-link:focus-visible { color: var(--green); }
#ru-retail-link-unit::before, #ru-retail-monthly-link-unit::before { content: "·"; margin-inline-end: 7px; }

.footer-source-unit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.footer-source-unit[hidden] {
  display: none;
}

.footer-institution-links {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 2px;
}

.footer-institution-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  flex: none;
}

.footer-institution-link:focus-visible {
  outline: 2px solid var(--green-dark);
  outline-offset: 2px;
  border-radius: 3px;
}

.footer-source-link,
.footer-secondary-source-link,
.footer-source-file-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  gap: 4px;
  color: inherit;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 2px;
}

/* Shared source signature: existing mark, restrained divider, institution name. */
.footer-source-name { min-width: 0; overflow-wrap: break-word; }
/* Keep the acronym beside the mark, ahead of the existing name divider. */
.footer-source-link[data-source-acronym]::before,
.footer-secondary-source-link[data-source-acronym]::before {
  content: attr(data-source-acronym);
  order: 1;
  flex: none;
  direction: ltr;
  unicode-bidi: isolate;
}
.footer-source-link[data-source-acronym] > .footer-source-name,
.footer-secondary-source-link[data-source-acronym] > .footer-source-name { order: 2; }
.has-source-mark > .footer-source-name {
  position: relative;
  margin-inline-start: 4px;
  padding-inline-start: 9px;
}
.has-source-mark > .footer-source-name::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 1px;
  height: 16px;
  background: #c8d1c9;
  transform: translateY(-50%);
  pointer-events: none;
}

.footer-source-file-link {
  font-weight: 600;
  text-decoration: underline;
}

.footer-source-file-link::before {
  content: "·";
  margin-inline-end: 4px;
  text-decoration: none;
}

.footer-source-icon {
  display: block;
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: none;
}

.footer-source-icon[data-brand="destatis"] {
  width: 18px;
}

.footer-source-icon[data-brand="e-stat"] {
  width: 43px;
}

.footer-source-icon[data-brand="tcmb"] {
  width: 62px;
}

.footer-source-icon[data-brand="bps"] {
  width: 19px;
}

.footer-source-icon[data-brand="scb"] {
  width: 18px;
  height: 20px;
}

.footer-source-icon[data-brand="indec"] {
  width: 18px;
  height: 18px;
}

.footer-source-icon[data-brand="at"] {
  width: 18px;
  height: 18px;
}

.footer-source-icon[data-brand="idecba"] {
  width: 16px;
  height: 20px;
}

.footer-source-icon[data-brand="tpso"] {
  width: 32px;
  height: 16px;
  object-fit: cover;
}

.footer-source-icon[data-brand="nso-vietnam"] {
  width: 18px;
  height: 18px;
}

.footer-source-fallback {
  --source-mark-bars: #596b68;
  display: inline-flex;
  box-sizing: border-box;
  flex: none;
  align-items: flex-end;
  justify-content: center;
  gap: 1px;
  width: 17px;
  height: 17px;
  padding: 2px 2px 3px;
  direction: ltr;
}

/* Our data bars use source-inspired, contrast-adjusted tones, never a source logo. */
.footer-source-fallback[data-acronym] {
  width: auto;
}
.footer-source-fallback[data-acronym]::after {
  content: attr(data-acronym);
  align-self: center;
  margin-inline-start: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  color: var(--muted);
}
.footer-source-fallback[data-palette="world-bank"] {
  --source-mark-bars: #007ba8;
}

.footer-source-fallback[data-palette="oecd"] {
  --source-mark-bars: #1162d4;
}

.footer-source-fallback[data-palette="bls"] { --source-mark-bars: #1b4d7d; }
.footer-source-fallback[data-palette="ssb"] { --source-mark-bars: #274247; }
.footer-source-fallback[data-palette="fso"] { --source-mark-bars: #b21e35; }
.footer-source-fallback[data-palette="dst"] { --source-mark-bars: #235484; }
.footer-source-fallback[data-palette="dosm"] { --source-mark-bars: #176b9d; }
.footer-source-fallback[data-palette="labour-bureau"] { --source-mark-bars: #1b5a8f; }
.footer-source-fallback[data-palette="bis"] { --source-mark-bars: #a51f32; }
.footer-source-fallback[data-palette="imf"] { --source-mark-bars: #204a79; }

.footer-source-fallback-bar {
  display: block;
  width: 3px;
  height: 5px;
  flex: none;
  border-radius: 1px 1px 0 0;
  background: var(--source-mark-bars);
}

.footer-source-fallback-bar:nth-child(2) { height: 8px; }
.footer-source-fallback-bar:nth-child(3) { height: 11px; }

.footer-source-link:hover,
.footer-source-link:focus-visible,
.footer-secondary-source-link:hover,
.footer-secondary-source-link:focus-visible,
.footer-source-file-link:hover,
.footer-source-file-link:focus-visible {
  color: var(--green-dark);
  text-decoration: underline;
}

.footer-source-unit-secondary:not([hidden])::before {
  content: "+";
  margin-inline: 2px;
}

/* Argentina keeps its measured source-row height; only long names truncate. */
.site-footer:has([data-ar-compact]) { min-width: 0; max-width: 100%; }
.footer-note:has(> [data-ar-compact]) { width: 100%; min-width: 0; max-width: 100%; }
.footer-note-line[data-ar-compact] {
  height: var(--ar-source-height);
  flex-wrap: nowrap;
  gap: 6px;
  line-height: 1.2rem;
}
.footer-note-line[data-ar-compact] .footer-source-unit { flex: 0 1 auto; }
.footer-note-line[data-ar-compact] .footer-source-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.footer-note-line[data-ar-compact] .footer-source-unit-secondary::before { content: none; }
@media (max-width: 680px) {
  .footer-note-line[data-ar-compact] { font-size: 11px; }
  .footer-note-line[data-ar-compact] .has-source-mark > .footer-source-name {
    margin-inline-start: 2px;
    padding-inline-start: 6px;
  }
}

.footer-secondary-source-link[hidden] {
  display: none;
}

.footer-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 4px;
}

.footer-nav > *::before {
  content: "·";
  margin-right: 6px;
  color: #9aa39a;
  font-weight: 500;
}

.footer-nav-action {
  border: 0;
  padding: 4px 0;
  color: var(--green-dark);
  background: transparent;
  font-size: inherit;
  font-weight: 700;
  text-decoration: none;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.footer-nav-action:hover,
.footer-nav-action:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.footer-nav-link,
.footer-nav-current {
  padding: 4px 0;
  color: var(--muted);
  font-size: inherit;
  font-weight: 650;
  text-decoration: none;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.footer-nav-link:hover,
.footer-nav-link:focus-visible {
  color: var(--green-dark);
  text-decoration: underline;
}

.footer-nav-current { color: var(--green-dark); font-weight: 750; }

.method-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(760px, calc(100svh - 40px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 22px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(37, 53, 45, 0.24);
}

.method-dialog::backdrop { background: rgba(37, 53, 45, 0.32); backdrop-filter: blur(4px); }
.method-dialog[open] { animation: dialog-in 180ms ease-out; }

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 27px 28px 20px;
  border-bottom: 1px solid var(--border);
}

.dialog-kicker { margin: 0 0 7px; color: var(--green); font-size: 0.78rem; font-weight: 800; }
.dialog-header h2 { margin: 0; font-size: 1.5rem; letter-spacing: -0.035em; }

.dialog-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--muted);
  background: var(--canvas);
}

.dialog-close svg, .source-link svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dialog-body { padding: 24px 28px 30px; overflow: auto; }
.dialog-body > p { margin: 0 0 13px; color: var(--muted); font-size: 0.94rem; line-height: 1.65; }

.dialog-body > .range-policy-note {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--green);
  border-radius: 4px 10px 10px 4px;
  color: var(--ink);
  background: var(--tint);
  font-size: 0.86rem;
}

.dialog-body > .historical-method-note:not([hidden]) {
  padding: 10px 12px;
  border-left: 3px solid var(--green);
  color: var(--ink);
  background: var(--tint);
}

.source-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0; }
.source-list div { padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--canvas); }
.source-list dt { margin-bottom: 5px; color: var(--muted); font-size: 0.72rem; font-weight: 650; }
.source-list dd { margin: 0; color: var(--ink); font-size: 0.83rem; font-weight: 700; }

.source-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 16px;
  border-radius: 12px;
  color: var(--green-dark);
  background: var(--tint);
  font-size: 0.88rem;
  font-weight: 730;
  text-decoration: none;
}
.secondary-source-link { margin-top: 8px; }

.rates-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-top: 26px; }
.rates-heading h3 { margin: 0; font-size: 1rem; }
.rates-heading span { color: var(--muted); font-size: 0.8rem; }
.table-wrap { max-height: 245px; margin-top: 10px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; }
th { position: sticky; top: 0; color: var(--muted); background: var(--canvas); font-size: 0.72rem; }
th:last-child, td:last-child { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }

[dir="rtl"] .language-menu { right: auto; left: 0; }
[dir="rtl"] .language-menu button { text-align: right; }
[dir="rtl"] .select-wrap::after {
  right: auto;
  left: 1px;
  transform: translateY(-72%) rotate(45deg);
}
[dir="rtl"] .field select { padding: 0 0 0 18px; }
[dir="rtl"] .field { border-right: 0; border-left: 1px solid var(--border); }
[dir="rtl"] .calculator-bar > .calculate-button { border-left: 0; }
[dir="rtl"] .field-error { right: 0; left: auto; }
[dir="rtl"] .dialog-body > .range-policy-note {
  border-right: 3px solid var(--green);
  border-left: 0;
  border-radius: 10px 4px 4px 10px;
}
[dir="rtl"] th,
[dir="rtl"] td { text-align: right; }
[dir="rtl"] th:last-child,
[dir="rtl"] td:last-child { text-align: left; }
[dir="rtl"] .footer-nav > *::before { margin-right: 0; margin-left: 6px; }

@media (min-width: 981px) {
  .calculator-bar:not(.monthly-calculator) { padding: 5px; }
  .calculator-bar:not(.monthly-calculator) .field { padding: 4px 18px; }
  .calculator-bar:not(.monthly-calculator) .calculate-button { min-height: 56px; }
}

@media (min-width: 1121px) {
  .monthly-calculator { padding: 5px; }
  .monthly-calculator .field { padding: 4px 18px; }
  .monthly-calculator .calculate-button { min-height: 56px; }
}

@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.985); } }

@media (max-width: 980px) {
  .app-shell { padding-inline: 24px; }
  .site-header { grid-template-columns: 1fr auto; }
  .brand { font-size: clamp(1.7rem, 3vw, 1.85rem); }
  .calculator-bar { grid-template-columns: 1.5fr 0.85fr 0.9fr 48px 0.9fr; row-gap: 10px; }
  .calculate-button { grid-column: 1 / -1; }
  .year-field:nth-of-type(4) { border-right: 0; }
}

@media (max-width: 680px) {
  .app-shell {
    min-height: 100svh;
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(14px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .site-header { align-items: center; gap: 8px 12px; }
  .brand { font-size: clamp(1.48rem, 6.2vw, 1.55rem); }
  .header-actions { align-self: center; gap: 10px; }
  .language-trigger { font-size: 0.76rem; }
  .calculator-mode a { min-width: 54px; min-height: 30px; padding-inline: 9px; font-size: 0.72rem; }
  .main-content { grid-template-rows: minmax(max-content, 0.72fr) auto; gap: 24px; padding: 24px 0 18px; }
  .result-area { align-self: start; margin-top: clamp(104px, 18svh, 224px); }
  .result-change { font-size: 0.78rem; }
  .result-value { min-height: clamp(2.7rem, 15.7vw, 4.5rem); margin: 0 0 8px; font-size: clamp(2.75rem, 16vw, 4.6rem); }
  .result-area.is-stale .result-value { font-size: 1.8rem; }
  .result-area.has-error .result-value { font-size: 1.35rem; }
  .calculator-bar { max-width: 560px; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0; padding: 5px; border-radius: 16px; }
  .field { padding: 2px 13px 1px; border-bottom: 1px solid var(--border); }
  .field label { margin-bottom: 2px; }
  .field select, .field input { min-height: 44px; }
  .country-field { grid-column: 1 / span 6; grid-row: 1; border-right: 1px solid var(--border); }
  .amount-field { grid-column: 7 / span 4; grid-row: 1; border-right: 0; }
  .year-field { border-bottom: 0; }
  .swap-button { grid-column: 1 / -1; grid-row: 2; margin: -22px auto; z-index: 1; }
  .swap-button-visual { box-shadow: 0 0 0 5px var(--surface), 0 1px 3px rgba(47, 80, 56, 0.08); }
  .year-field:nth-of-type(3) { grid-column: 1 / span 5; grid-row: 2; padding-right: 28px; border-right: 1px solid var(--border); }
  .year-field:nth-of-type(4) { grid-column: 6 / span 5; grid-row: 2; padding-left: 28px; }
  [dir="rtl"] .country-field { border-right: 0; border-left: 1px solid var(--border); }
  [dir="rtl"] .year-field:nth-of-type(3) { padding-right: 13px; padding-left: 28px; border-right: 0; border-left: 1px solid var(--border); }
  [dir="rtl"] .year-field:nth-of-type(4) { padding-right: 28px; padding-left: 13px; border-left: 0; }
  .calculate-button { grid-column: 1 / -1; grid-row: 3; min-height: 52px; margin-top: 4px; }
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .country-field,
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .amount-field { grid-column: 1 / -1; border-right: 0; border-left: 0; }
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .country-field { grid-row: 1; }
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .amount-field { grid-row: 2; }
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .year-field:nth-of-type(3),
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .year-field:nth-of-type(4),
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .swap-button { grid-row: 3; }
  .calculator-bar:is(.has-expanded-amount, .has-amount-error):not(.monthly-calculator) .calculate-button { grid-row: 4; }
  .calculator-bar.has-expanded-amount .amount-field .field-error { width: calc(100% - 24px); }
  .field-error { top: calc(100% + 3px); right: 12px; left: auto; width: calc(200% - 24px); z-index: 2; padding: 4px 8px; border-radius: 6px; background: var(--surface); }
  .method-dialog { width: calc(100% - 20px); max-height: calc(100svh - 20px); border-radius: 18px; }
  .dialog-header { padding: 21px 20px 16px; }
  .dialog-body { padding: 20px; }
  .source-list { grid-template-columns: 1fr; }
  .footer-note-line > span[aria-hidden="true"] { display: none; }
  .footer-nav {
    width: min(100%, 420px);
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
  }
  .footer-nav > * { flex: 0 0 auto; max-width: 100%; }
  .footer-nav .footer-nav-link,
  .footer-nav .footer-nav-current {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
  }
}

@media (max-height: 760px) and (min-width: 681px) {
  .app-shell { padding-top: 20px; padding-bottom: 18px; }
  .main-content { grid-template-rows: minmax(210px, 1fr) auto; padding-block: 20px; gap: 24px; }
  .result-value { font-size: clamp(3.2rem, 7.2vw, 6rem); }
}

@media (max-height: 760px) and (max-width: 680px) {
  .result-area { margin-top: clamp(48px, 8svh, 60px); }
}

@media (max-width: 420px) {
  .site-header { grid-template-columns: minmax(0, 1fr); }
  .header-actions { justify-self: start; flex-wrap: wrap; }
  [dir="rtl"] .header-actions { justify-self: end; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* Official compact source marks, 2026-11-09; preserve intrinsic proportions. */
.footer-source-icon[data-brand="ssb"] { width: 16px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="dgbas"] { width: 19px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="bundesbank"] { width: 48px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="bok"] { width: 16px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="fipe"] { width: 27px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="abs"] { width: 16px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="nbs"] { width: 16px; height: 16px; object-fit: contain; }
.footer-source-icon[data-brand="nbs-nigeria"] { width: 29px; height: 16px; object-fit: contain; }

/* Short mobile footer labels, full desktop and accessible names. */
.footer-label-mobile { display: none; }
@media (max-width: 680px) {
  .footer-nav[data-compact-labels] .footer-label-full { display: none; }
  .footer-nav[data-compact-labels] .footer-label-mobile { display: inline; }
  .site-footer .footer-nav[data-compact-labels] {
    width: 100%; max-width: 100%; gap: 2px 0; flex-wrap: wrap;
  }
  .site-footer .footer-nav[data-compact-labels] > * {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 32px; min-width: 24px; box-sizing: border-box;
    padding: 6px 4px; white-space: nowrap; line-height: 1.4;
  }
  .site-footer .footer-nav[data-compact-labels] > *::before {
    content: ""; margin: 0; border: 0;
    border-inline-start: 1px solid #bdc9bf;
    height: 1em; margin-inline-end: 5px;
  }
  .site-footer .footer-nav[data-compact-labels] > *:first-child::before { display: none; }
}

/* Currency symbols share the existing text scale; no card dimensions change. */
.has-sar-symbol { position: relative; }
.currency-riyal-glyph { display: inline-block; width: .89474em; height: 1em; vertical-align: -.1em; }
.has-sar-symbol > .currency-symbol-fallback {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* Plain copyright below the existing footer links. */
.site-footer:has(> .site-copyright) { row-gap: 6px; }
.site-footer > .site-copyright {
  position: relative; top: 8px;
  display: inline-flex; align-items: baseline; justify-content: center; gap: 6px;
  margin: 0; padding: 0;
  color: #5f7868; font-size: 12px; font-weight: 400; line-height: 1.3;
  text-align: center; direction: ltr; unicode-bidi: isolate;
}

.site-copyright .site-signature {
  display: block; flex: none; height: 18px; width: auto; max-width: 100%; object-fit: contain;
}
.site-copyright > .site-copyright-text { white-space: nowrap; }

/* The transparent hit target stays fixed; only the original image moves. */
.site-copyright > .site-signature-control {
  appearance: none; display: inline-flex; align-items: baseline; flex: none;
  position: relative; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: none; color: inherit; font: inherit; line-height: 0;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.site-signature-control::before {
  content: ""; position: absolute; width: 44px; height: 44px;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.site-signature-control .site-signature {
  transform: translateY(0) scale(1); transform-origin: center;
  transition: transform 240ms cubic-bezier(.2, .7, .3, 1);
}
@media (hover: hover) and (pointer: fine) {
  .site-signature-control:hover .site-signature { transform: translateY(-1px) scale(1); }
}
.site-signature-control:is(:active, [data-pressed]) .site-signature { transform: translateY(0) scale(.92); }
@media (prefers-reduced-motion: reduce) {
  .site-signature-control .site-signature { transition: none !important; }
}

/* Scoped interface ink. White selected-mode text and every surface stay unchanged. */
.site-footer .footer-nav > :is(a, button, .footer-nav-current) { color: #3f654e; }
.site-footer .footer-nav > :is(a, button):is(:hover, :focus-visible) { color: #173f2d; }
.language-trigger:not(:disabled) { color: #3f654e; }
.language-trigger:not(:disabled):is(:hover, :focus-visible) { color: #173f2d; }
.language-mark {
  display: inline-flex; flex: none; background-color: currentColor;
  -webkit-mask: url("./assets/language-bubbles.png") center / contain no-repeat;
  mask: url("./assets/language-bubbles.png") center / contain no-repeat;
}
.language-mark > .language-icon { opacity: 0; }
.calculator-mode a:not([aria-current="page"]):not([aria-disabled="true"]) { color: #3f654e; }
.calculator-mode a:not([aria-current="page"]):not([aria-disabled="true"]):is(:hover, :focus-visible) { color: #173f2d; }
