:root {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f6f7fb;
  color: #182033;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-nav {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid #dde3ee;
  background: #ffffff;
}

.site-brand,
.site-nav__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-brand {
  color: #13213d;
  font-weight: 700;
  text-decoration: none;
}

.site-brand__logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.site-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
  flex: 1;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  padding: 18px 28px;
  color: #667085;
  border-top: 1px solid #dde3ee;
  background: #ffffff;
  font-size: 14px;
}

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 12px 0 28px;
}

.dashboard-hero h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1.15;
  color: #111827;
}

.dashboard-hero p {
  margin: 10px 0 0;
  color: #667085;
}

.page-kicker {
  margin: 0 0 8px;
  color: #2f6f73;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.compact-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.compact-metric,
.insight-strip article {
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
  padding: 13px 14px;
}

.compact-metric span,
.insight-strip span {
  display: block;
  color: #667085;
  font-size: 12px;
}

.compact-metric strong,
.insight-strip strong {
  display: block;
  margin-top: 7px;
  color: #111827;
  font-size: 18px;
  line-height: 1.2;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.message-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.message {
  margin: 0;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid #bfd6c5;
  background: #f0f8f2;
  color: #1f5b32;
}

.message--error {
  border-color: #f2b8b5;
  background: #fff4f2;
  color: #9b2c24;
}

.analysis-panel,
.dashboard-source-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 20px;
  align-items: end;
  padding: 20px;
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  align-items: end;
  padding: 20px;
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.search-panel h2 {
  margin: 0;
  font-size: 20px;
  color: #111827;
}

.search-panel p {
  margin: 8px 0 0;
  color: #667085;
}

.analysis-panel h2,
.dashboard-source-panel h2 {
  margin: 0;
  font-size: 20px;
  color: #111827;
}

.analysis-panel p,
.dashboard-source-panel p {
  margin: 8px 0 0;
  color: #667085;
}

.analysis-form,
.search-form,
.dashboard-source-form {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.search-form {
  grid-template-columns: minmax(260px, 1fr) auto;
}

.analysis-form label,
.search-form label,
.dashboard-source-form label {
  display: grid;
  gap: 6px;
  color: #475467;
  font-size: 13px;
  font-weight: 600;
}

.analysis-form input,
.analysis-form select,
.search-form input,
.search-form select,
.dashboard-source-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd7e6;
  border-radius: 8px;
  padding: 0 12px;
  color: #111827;
  background: #ffffff;
}

.analysis-form select,
.search-form select,
.dashboard-source-form select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #667085 50%), linear-gradient(135deg, #667085 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 12px) 18px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.analysis-form__dataset select,
.search-form__dataset select,
.dashboard-source-form select {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.search-results {
  margin: 4px 0 22px;
}

.search-results__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.search-result-block {
  margin-bottom: 14px;
}

.search-result-block h3 {
  margin: 0 0 8px;
  color: #344054;
  font-size: 14px;
  font-weight: 800;
}

.search-panel__source {
  grid-column: 2;
  margin: -8px 0 0;
  color: #667085;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.product-result {
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
}

.product-result summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(90px, auto) minmax(160px, auto);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
}

.product-result summary span {
  color: #111827;
  font-weight: 700;
}

.product-result summary strong,
.product-result summary em {
  color: #667085;
  font-size: 13px;
  font-style: normal;
}

.product-result__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 10px;
}

.product-result__meta span {
  padding: 4px 7px;
  background: #f6f7fb;
  border-radius: 6px;
  color: #475467;
  font-size: 11px;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.product-detail-group {
  border: 1px solid #edf0f5;
  border-radius: 6px;
  background: #fafbfc;
  overflow: hidden;
}

.product-detail-group h3 {
  margin: 0;
  padding: 8px 10px;
  color: #111827;
  font-size: 13px;
  background: #ffffff;
  border-bottom: 1px solid #edf0f5;
}

.product-detail-group dl {
  margin: 0;
}

.product-detail-group dl div {
  display: grid;
  grid-template-columns: minmax(82px, 0.3fr) minmax(0, 1fr);
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #edf0f5;
}

.product-detail-group dl div:last-child {
  border-bottom: 0;
}

.product-detail-group dt {
  color: #667085;
  font-size: 11px;
  font-weight: 700;
}

.product-detail-group dd {
  margin: 0;
  color: #111827;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
  white-space: normal;
}

.product-image-link {
  display: inline-block;
  color: #2f6f73;
  text-decoration: none;
}

.product-image-link img {
  width: 64px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #dde3ee;
  border-radius: 6px;
  background: #ffffff;
}

.product-datatable {
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
  overflow: hidden;
}

.product-datatable__toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-bottom: 1px solid #edf0f5;
  background: #fafbfc;
}

.product-datatable__toolbar label {
  display: grid;
  gap: 5px;
  width: min(420px, 100%);
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.product-datatable__toolbar input {
  min-height: 36px;
  border: 1px solid #cfd7e6;
  border-radius: 7px;
  padding: 0 10px;
  color: #111827;
  background: #ffffff;
}

.product-datatable__toolbar strong {
  color: #475467;
  font-size: 12px;
  white-space: nowrap;
}

.product-datatable__wrap {
  overflow-x: auto;
}

.product-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  font-size: 12px;
}

.product-table th,
.product-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
}

.product-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475467;
  font-size: 11px;
  font-weight: 800;
  background: #f6f7fb;
  white-space: nowrap;
}

.product-table th[data-sort-key] {
  cursor: pointer;
}

.product-table th[data-sort-key]::after {
  content: "↕";
  margin-left: 5px;
  color: #98a2b3;
  font-size: 10px;
}

.product-table th[data-sort-direction="asc"]::after {
  content: "↑";
  color: #2f6f73;
}

.product-table th[data-sort-direction="desc"]::after {
  content: "↓";
  color: #2f6f73;
}

.product-table td {
  color: #111827;
  line-height: 1.45;
}

.product-table tbody tr:hover {
  background: #fafdfc;
}

.product-table__image img {
  width: 42px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid #dde3ee;
  border-radius: 5px;
  background: #ffffff;
}

.role-section-divider {
  height: 1px;
  margin: 20px 0 14px;
  background: #d8e0ea;
}

.role-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.role-tab {
  display: grid;
  gap: 7px;
  min-height: 86px;
  padding: 16px;
  color: #344054;
  text-decoration: none;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
}

.role-tab span {
  font-size: 15px;
  font-weight: 800;
  color: #111827;
}

.role-tab strong {
  color: #667085;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.role-tab--active {
  border-color: #2f6f73;
  background: #eef8f6;
  box-shadow: inset 0 0 0 1px #2f6f73;
}

.role-brief {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 20px;
  margin-bottom: 20px;
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
}

.role-brief h2 {
  margin: 0;
  font-size: 24px;
  color: #111827;
}

.role-brief p {
  margin: 8px 0 0;
  color: #667085;
}

.role-brief a {
  color: #2f6f73;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.metric-card,
.panel {
  background: #ffffff;
  border: 1px solid #dde3ee;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.metric-card {
  padding: 18px;
}

.metric-card span {
  color: #667085;
  font-size: 14px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
  color: #111827;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 20px;
}

.dashboard-grid--wide {
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.9fr);
}

.analysis-section {
  margin-top: 26px;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  color: #111827;
}

.mini-panel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.mini-panel-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.role-rank-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.panel {
  overflow: hidden;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid #edf0f5;
}

.panel__header h2 {
  margin: 0;
  font-size: 18px;
  color: #111827;
}

.panel__header a {
  color: #2f6f73;
  text-decoration: none;
  font-weight: 600;
}

.panel__header span {
  color: #667085;
  font-size: 13px;
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: #667085;
  font-weight: 600;
  background: #fafbfc;
}

.data-table td:nth-child(2) {
  max-width: 360px;
}

.country-list {
  padding: 8px 20px 18px;
}

.country-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid #edf0f5;
}

.country-row--stacked {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.country-row--stacked small {
  grid-column: 1 / -1;
  color: #667085;
  font-size: 12px;
}

.country-row:last-child {
  border-bottom: 0;
}

.empty-cell,
.empty-copy {
  color: #667085;
}

@media (max-width: 860px) {
  .site-nav,
  .dashboard-hero,
  .site-footer,
  .role-brief {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
  }

  .site-nav {
    padding: 16px;
  }

  .site-nav__actions {
    flex-wrap: wrap;
  }

  .metric-grid,
  .compact-metric-grid,
  .insight-strip,
  .mini-panel-grid,
  .role-switcher,
  .mini-panel-grid--three,
  .dashboard-grid,
  .analysis-panel,
  .dashboard-source-panel,
  .search-panel,
  .analysis-form,
  .dashboard-source-form,
  .search-form,
  .product-detail-grid,
  .product-result summary {
    grid-template-columns: 1fr;
  }

  .search-panel__source {
    grid-column: auto;
  }

  .search-results__header,
  .product-datatable__toolbar {
    align-items: stretch;
    flex-direction: column;
  }
}
