:root {
  color-scheme: light;
  --ink: #17221f;
  --muted: #63716c;
  --line: #dce4e0;
  --wash: #f4f7f5;
  --accent: #087a58;
  --accent-dark: #035f44;
  --good: #087a58;
  --warn: #9a6500;
  --bad: #a33b31;
  --page: min(1500px, calc(100vw - 48px));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.afir-header {
  padding: 28px max(24px, calc((100vw - var(--page)) / 2)) 38px;
  background:
    linear-gradient(110deg, rgba(4, 97, 68, 0.96), rgba(8, 122, 88, 0.9)),
    #087a58;
  color: #fff;
}

.afir-brandline,
.afir-heading,
.afir-meta,
.afir-main {
  width: var(--page);
  margin-inline: auto;
}

.afir-brandline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 60px;
}

.afir-brand {
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

.afir-context-link {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 700;
  text-underline-offset: 4px;
}

.afir-heading {
  display: grid;
  grid-template-columns: minmax(0, 820px) 1fr;
  align-items: end;
  gap: 48px;
}

.afir-kicker,
.afir-section-kicker {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.afir-heading h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(40px, 5vw, 74px);
  line-height: 1.02;
  letter-spacing: -0.045em;
}

.afir-heading > p:last-child {
  max-width: 560px;
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 17px;
}

.afir-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 42px;
  border-top: 1px solid rgba(255, 255, 255, 0.35);
}

.afir-meta div {
  padding: 18px 24px 0 0;
}

.afir-meta dt {
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.afir-meta dd {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 700;
}

.afir-main {
  padding: 0 0 80px;
}

.afir-breadcrumb {
  position: sticky;
  z-index: 5;
  top: 0;
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.afir-breadcrumb button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.afir-breadcrumb span {
  color: #93a09b;
}

.afir-loading {
  --afir-progress: 0%;
  position: sticky;
  z-index: 4;
  top: 58px;
  display: grid;
  gap: 10px;
  padding: 14px 0 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
}

.afir-loading[hidden] {
  display: none;
}

.afir-loading-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}

.afir-loading-copy p {
  margin: 0;
}

.afir-loading-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.afir-loading-detail {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.afir-progress {
  height: 4px;
  overflow: hidden;
  background: #e5ece8;
}

.afir-progress-value {
  display: block;
  width: var(--afir-progress);
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.afir-loading[data-mode="indeterminate"] .afir-progress-value {
  width: 34%;
  animation: afir-progress-sweep 1.4s ease-in-out infinite;
}

.afir-loading[data-state="success"] .afir-loading-label {
  color: var(--good);
}

.afir-loading[data-state="error"] .afir-loading-label,
.afir-loading[data-state="error"] .afir-loading-detail {
  color: var(--bad);
}

.afir-loading[data-state="error"] .afir-progress-value {
  width: 100%;
  background: var(--bad);
}

@keyframes afir-progress-sweep {
  from {
    transform: translateX(-110%);
  }
  to {
    transform: translateX(325%);
  }
}

.afir-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 46px 0 20px;
}

.afir-eu27-section {
  padding-top: 46px;
}

.afir-eu27-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 20px;
}

.afir-eu27-heading h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.afir-eu27-heading > p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
}

.afir-toolbar h2,
.afir-field-heading h2,
.afir-notes h2 {
  margin: 0;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.afir-section-kicker {
  color: var(--accent);
}

.afir-search {
  display: grid;
  gap: 6px;
  min-width: min(340px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.afir-search input {
  width: 100%;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 9px 2px;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.afir-search input:focus {
  border-color: var(--accent);
}

.afir-search-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--wash);
  color: var(--ink);
}

.afir-search-summary[hidden] {
  display: none;
}

.afir-search-summary-label {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.afir-search-summary strong {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.afir-search-summary button {
  margin-left: auto;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 2px 0;
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.afir-search-summary button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.afir-status {
  min-height: 24px;
  margin-bottom: 14px;
  color: var(--muted);
}

.afir-status[data-tone="error"] {
  color: var(--bad);
  font-weight: 700;
}

.afir-table-wrap {
  overflow-x: auto;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.afir-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.afir-table th {
  padding: 13px 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.afir-sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  text-align: left;
  text-transform: inherit;
  cursor: pointer;
}

.afir-sort-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}

.afir-sort-indicator {
  display: inline-grid;
  width: 1em;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1;
  place-items: center;
}

.afir-sort-indicator::before {
  content: "↕";
  opacity: 0.48;
}

.afir-sort-button[data-sort-direction="ascending"] .afir-sort-indicator::before {
  content: "↑";
  opacity: 1;
}

.afir-sort-button[data-sort-direction="descending"] .afir-sort-indicator::before {
  content: "↓";
  opacity: 1;
}

.afir-table td {
  padding: 16px 14px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.afir-table tbody tr {
  transition: background-color 140ms ease, transform 140ms ease;
}

.afir-table tbody tr[data-actionable="true"] {
  cursor: pointer;
}

.afir-table tbody tr[data-actionable="true"]:hover,
.afir-table tbody tr[data-selected="true"] {
  background: var(--wash);
}

.afir-table tbody tr[data-aggregate="eu27"] {
  background: #eef7f3;
}

.afir-table tbody tr[data-aggregate="eu27"] .afir-identity strong {
  color: var(--accent-dark);
}

.afir-table tbody tr[data-actionable="true"]:active {
  transform: translateY(1px);
}

.afir-identity {
  min-width: 250px;
}

.afir-identity strong,
.afir-field-code {
  display: block;
  font-weight: 800;
}

.afir-identity small,
.afir-field-key {
  display: block;
  max-width: 480px;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
}

.afir-identity .afir-group-updated {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.afir-implementation,
.afir-provider-count {
  min-width: 170px;
}

.afir-implementation strong,
.afir-provider-count strong {
  display: inline;
  font-weight: 800;
}

.afir-implementation sup {
  margin-left: 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
}

.afir-implementation small,
.afir-provider-count small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.afir-metric {
  font-weight: 800;
}

.afir-metric[data-state="complete"] {
  color: var(--good);
}

.afir-metric[data-state="partial"] {
  color: var(--warn);
}

.afir-metric[data-state="none"] {
  color: var(--bad);
}

.afir-open {
  color: var(--accent);
  font-size: 22px;
  font-weight: 700;
}

.afir-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 13px;
}

.afir-country-implementation-notes {
  max-width: 980px;
  margin-top: 46px;
  padding: 26px 0 4px;
  border-top: 1px solid var(--line);
}

.afir-country-implementation-notes h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.afir-country-implementation-notes > p:last-of-type {
  max-width: 820px;
  color: var(--muted);
}

.afir-country-implementation-notes ol {
  display: grid;
  gap: 10px;
  margin: 18px 0 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 13px;
}

.afir-pagination button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 15px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
}

.afir-pagination button:disabled {
  cursor: default;
  opacity: 0.38;
}

.afir-field-section {
  margin-top: 70px;
  scroll-margin-top: 76px;
}

.afir-field-group + .afir-field-group {
  margin-top: 46px;
}

.afir-field-group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 14px;
}

.afir-field-group-heading h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.afir-field-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.afir-field-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 20px;
}

.afir-field-context {
  max-width: 520px;
  text-align: right;
}

.afir-field-context p {
  margin: 0;
  color: var(--muted);
}

.afir-detail-link,
#afir-detail-link {
  display: inline-block;
  margin-top: 7px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-underline-offset: 4px;
}

.afir-detail-link {
  white-space: nowrap;
}

.afir-field-table td:first-child {
  min-width: 70px;
}

.afir-field-table td:nth-child(2) {
  min-width: 340px;
}

.afir-field-value {
  max-width: 360px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.afir-f3-note {
  max-width: 920px;
  margin: 24px 0 0;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.afir-notes {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 60px;
  margin-top: 90px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.afir-notes p {
  max-width: 800px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 780px) {
  :root {
    --page: calc(100vw - 32px);
  }

  .afir-header {
    padding-inline: 16px;
  }

  .afir-brandline {
    padding-bottom: 42px;
  }

  .afir-heading {
    display: block;
  }

  .afir-heading h1 {
    font-size: clamp(38px, 12vw, 58px);
  }

  .afir-meta {
    grid-template-columns: 1fr;
  }

  .afir-meta div {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  .afir-meta dd {
    margin: 0;
    font-size: 14px;
    text-align: right;
  }

  .afir-toolbar,
  .afir-eu27-heading,
  .afir-field-heading {
    display: grid;
    align-items: stretch;
  }

  .afir-search {
    min-width: 0;
  }

  .afir-search-summary button {
    margin-left: 0;
  }

  .afir-loading-copy {
    display: grid;
    gap: 3px;
  }

  .afir-loading-detail {
    text-align: left;
  }

  .afir-pagination {
    justify-content: space-between;
  }

  .afir-field-context {
    text-align: left;
  }

  .afir-notes {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }

  .afir-loading[data-mode="indeterminate"] .afir-progress-value {
    width: 40%;
    animation: none;
    transform: none;
  }
}
