:root {
  --black: #090909;
  --charcoal: #181818;
  --ink: #242424;
  --ink-soft: #626262;
  --paper: #f5f7fa;
  --surface: #ffffff;
  --line: #d9dde2;
  --red: #cd2328;
  --red-dark: #a9161b;
  --red-soft: #fff0f1;
  --shadow: 0 12px 30px rgba(13, 18, 26, .09);
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.site-header {
  position: relative;
  z-index: 5;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-primary {
  width: min(1240px, calc(100% - 40px));
  min-height: 88px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  align-items: center;
}

.brand {
  width: 200px;
  height: 78px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.brand img {
  width: 196px;
  height: auto;
  display: block;
}

.portal-title {
  margin: 0;
  color: var(--ink);
  text-align: center;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 500;
  letter-spacing: .01em;
}

.support-link {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--ink-soft);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .12em;
}

.support-link strong {
  color: var(--red);
  font-size: 15px;
  letter-spacing: .04em;
}

.header-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  color: #fff;
  background: var(--black);
}

.header-bar-inner {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.section-label {
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7d7d7;
  font-size: 12px;
}

.status-label i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(205, 35, 40, .2);
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  position: relative;
  width: 100vw;
  min-height: 366px;
  margin-left: calc(50% - 50vw);
  padding: 58px max(24px, calc((100vw - 1180px) / 2));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: center;
  gap: 58px;
  overflow: hidden;
  color: #fff;
  background: var(--black);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 0 64%, rgba(255,255,255,.035) 64% 66%, transparent 66%);
}

.hero::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 37%;
  height: 6px;
  background: var(--red);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.eyebrow, .section-kicker {
  margin: 0 0 13px;
  color: var(--red);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: .18em;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  font-size: clamp(44px, 6.1vw, 72px);
  line-height: .98;
  letter-spacing: .02em;
  font-weight: 500;
  text-transform: uppercase;
}

h1 em {
  display: inline-block;
  color: #fff;
  font-style: normal;
  font-weight: 700;
}

.hero-copy {
  max-width: 610px;
  margin: 25px 0 0;
  color: #d0d0d0;
  font-size: 16px;
  line-height: 1.65;
}

.hero-art {
  position: relative;
  width: 330px;
  height: 260px;
  justify-self: end;
}

.diamond {
  position: absolute;
  display: grid;
  place-content: center;
  text-align: center;
  transform: rotate(45deg);
}

.diamond > * { transform: rotate(-45deg); }

.diamond-large {
  width: 184px;
  height: 184px;
  top: 37px;
  left: 61px;
  color: #fff;
  background: var(--red);
  box-shadow: 28px 28px 0 rgba(255,255,255,.065);
}

.diamond-large span {
  font-size: 12px;
  letter-spacing: .22em;
}

.diamond-large strong {
  margin-top: 5px;
  font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  font-size: 24px;
  letter-spacing: .015em;
  font-weight: 500;
}

.diamond-accent {
  width: 53px;
  height: 53px;
  top: 7px;
  right: 28px;
  background: #fff;
}

.diamond-outline {
  width: 76px;
  height: 76px;
  right: 2px;
  bottom: 4px;
  border: 2px solid rgba(255,255,255,.35);
}

.filter-panel, .chart-card, .ranking-card {
  background: var(--surface);
  border: 1px solid #e1e4e8;
  box-shadow: var(--shadow);
}

.filter-panel {
  position: relative;
  z-index: 2;
  margin-top: -34px;
  padding: 32px 34px 24px;
  border-radius: 11px;
}

.filter-heading, .analysis-heading, .card-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

h2, h3 {
  margin: 0;
  color: var(--ink);
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  letter-spacing: -.02em;
}

h2 {
  font-size: 30px;
  font-weight: 750;
}

h3 {
  font-size: 20px;
  font-weight: 750;
}

.section-intro {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.text-button {
  padding: 7px 0;
  border: 0;
  color: var(--red);
  background: transparent;
  font-weight: 700;
}

.text-button:hover { color: var(--red-dark); }

.filter-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.65fr 1.2fr 1fr .9fr .9fr .9fr;
  gap: 15px;
  margin-top: 27px;
}

label {
  display: grid;
  gap: 8px;
  color: #3c3c3c;
  font-size: 12px;
  font-weight: 700;
}

select, input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #cfd3d8;
  border-radius: 4px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}

select:focus, input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(205, 35, 40, .11);
}

select:disabled {
  color: #969da5;
  background: #f2f3f5;
  cursor: not-allowed;
}

.filter-actions {
  margin-top: 22px;
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid #e3e5e8;
}

.filter-actions p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.primary-button {
  min-height: 46px;
  padding: 0 21px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 0;
  border-radius: 7px;
  color: white;
  background: var(--red);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(205, 35, 40, .2);
  transition: background .15s, transform .15s;
}

.primary-button:hover {
  background: var(--red-dark);
  transform: translateY(-1px);
}

.primary-button:disabled {
  opacity: .65;
  transform: none;
  cursor: wait;
}

.primary-button b {
  font-size: 19px;
  font-weight: 400;
}

.alert {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #e7a0a3;
  border-radius: 5px;
  color: #83181d;
  background: var(--red-soft);
}

.analysis { padding: 58px 0 80px; }

.analysis-heading {
  align-items: end;
  margin-bottom: 24px;
}

.analysis-heading .section-kicker { margin-bottom: 10px; }

.muted {
  margin: 7px 0 0;
  color: var(--ink-soft);
}

.analysis-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.print-button {
  min-height: 39px;
  padding: 0 13px;
  border: 1px solid #cfd3d8;
  border-radius: 5px;
  color: var(--ink);
  background: var(--surface);
  font-size: 12px;
  font-weight: 750;
}

.print-button:hover {
  border-color: var(--red);
  color: var(--red-dark);
  background: var(--red-soft);
}

.print-button:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.metric-switcher, .tab-list {
  display: inline-flex;
  padding: 4px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #e9ecef;
}

.metric-switcher button, .tab-list button {
  padding: 8px 11px;
  border: 0;
  border-radius: 4px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.metric-switcher button.active,
.tab-list button[aria-selected="true"] {
  color: #fff;
  background: var(--black);
  box-shadow: 0 2px 6px rgba(0,0,0,.14);
}

.metric-switcher button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.kpi-card {
  min-height: 150px;
  padding: 21px;
  display: flex;
  flex-direction: column;
  border: 1px solid #dfe2e6;
  border-radius: 7px;
  background: var(--surface);
}

.kpi-card p {
  margin: 0 0 auto;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.kpi-card strong {
  display: block;
  margin-top: 15px;
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -.035em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-card span {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12px;
}

.accent-card {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.accent-card p, .accent-card span { color: rgba(255,255,255,.76); }

.chart-card, .ranking-card {
  padding: 27px;
  border-radius: 8px;
}

.chart-card { margin-bottom: 14px; }

.card-heading p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.legend > span:first-child {
  width: 27px;
  height: 3px;
  border-radius: 4px;
  background: var(--red);
}

.chart-wrap {
  position: relative;
  min-height: 350px;
  margin-top: 24px;
}

#trendChart {
  width: 100%;
  height: 350px;
  display: block;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--ink-soft);
  text-align: center;
  background: var(--surface);
}

.chart-empty[hidden] { display: none; }
.chart-empty strong { color: var(--ink); font-size: 17px; }
.chart-empty p { margin: 6px 0; }

.empty-icon {
  width: 45px;
  height: 45px;
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-size: 24px;
}

.ranking-heading { align-items: center; }

.table-wrap {
  margin-top: 22px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 12px 14px;
  color: #fff;
  background: var(--black);
  font-size: 10px;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .1em;
}

th:first-child {
  width: 70px;
  border-radius: 4px 0 0 4px;
}

th:last-child {
  border-radius: 0 4px 4px 0;
  text-align: right;
}

td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 13px;
}

td:last-child { text-align: right; }
td strong { color: var(--ink); font-size: 14px; }

.entity-link {
  position: relative;
  margin: -6px;
  padding: 6px 27px 6px 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: color .15s, background .15s;
}

.entity-link::after {
  content: "→";
  position: absolute;
  right: 7px;
  top: 50%;
  color: var(--red);
  font-size: 16px;
  line-height: 1;
  opacity: .55;
  transform: translate(-3px, -50%);
  transition: opacity .15s, transform .15s;
}

.entity-link:hover {
  color: var(--red-dark);
  background: var(--red-soft);
}

.entity-link:hover::after,
.entity-link:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.entity-link:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.selected-pest-row td {
  background: var(--red-soft);
}

.selected-pest-row .entity-link {
  color: var(--red-dark);
}

.selected-badge {
  padding: 3px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--red);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1;
  text-transform: uppercase;
}

.rank {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  color: #fff;
  background: var(--red);
  font-weight: 800;
  font-size: 11px;
}

.entity-sub {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.rate-cell {
  min-width: 170px;
}

.rate-content {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rate-track {
  flex: 1;
  height: 5px;
  border-radius: 9px;
  background: #e1e3e6;
  overflow: hidden;
}

.rate-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--red);
}

.rate-value {
  min-width: 42px;
  color: var(--ink);
  font-weight: 700;
}

.table-empty {
  padding: 36px 12px;
  color: var(--ink-soft);
  text-align: center;
}

footer {
  min-height: 96px;
  padding: 18px max(22px, calc((100vw - 1180px) / 2));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 30px;
  border-top: 1px solid #2c2c2c;
  color: #b9b9b9;
  background: var(--black);
  font-size: 12px;
}

footer div {
  display: grid;
  color: #fff;
}

footer div strong {
  font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif;
  font-size: 16px;
}

footer div span { color: #b9b9b9; }
footer p { margin: 0; text-align: center; }
footer a { color: #fff; font-weight: 700; }

@media (max-width: 980px) {
  .header-primary { grid-template-columns: 190px 1fr 170px; }
  .brand { width: 175px; }
  .brand img { width: 172px; }
  .hero { grid-template-columns: 1fr 230px; }
  .hero-art { width: 220px; transform: scale(.78); transform-origin: center; }
  .filter-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  footer { grid-template-columns: auto 1fr; }
  footer > span:last-child { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  main { width: min(100% - 24px, 1180px); }
  .header-primary {
    width: calc(100% - 28px);
    min-height: 75px;
    grid-template-columns: 145px 1fr;
  }
  .brand { width: 140px; height: 64px; }
  .brand img { width: 138px; }
  .portal-title { text-align: right; font-size: 22px; }
  .support-link { display: none; }
  .header-bar-inner { width: calc(100% - 28px); }
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 50px 20px 76px;
  }
  .hero-art { display: none; }
  h1 { font-size: clamp(40px, 12vw, 56px); }
  .filter-panel {
    margin-top: -32px;
    padding: 25px 19px 19px;
  }
  .filter-heading { align-items: flex-start; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-actions {
    align-items: stretch;
    flex-direction: column;
  }
  .primary-button { justify-content: center; }
  .analysis { padding-top: 42px; }
  .analysis-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .analysis-tools {
    align-items: flex-start;
    flex-direction: column;
  }
  .metric-switcher {
    align-self: flex-start;
    max-width: 100%;
    overflow-x: auto;
  }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { min-height: 132px; padding: 17px; }
  .kpi-card strong { font-size: 30px; }
  .chart-card, .ranking-card { padding: 21px 16px; }
  .card-heading { flex-direction: column; }
  .ranking-heading { align-items: flex-start; }
  footer {
    grid-template-columns: 1fr;
    gap: 13px;
    text-align: left;
  }
  footer p { text-align: left; }
  footer > span:last-child { grid-column: auto; }
}

@media (max-width: 440px) {
  .status-label { display: none; }
  .filter-grid, .kpi-grid { grid-template-columns: 1fr; }
  .filter-heading { flex-direction: column; gap: 8px; }
  .metric-switcher button { padding-inline: 8px; }
}

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

@media print {
  @page {
    margin: .45in;
  }

  *,
  *::before,
  *::after {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .site-header,
  .hero,
  .filter-panel,
  #alert,
  .analysis-tools,
  .tab-list,
  footer {
    display: none !important;
  }

  html,
  body {
    width: 100%;
    color: #111;
    background: #fff;
  }

  body {
    font-size: 11pt;
  }

  main {
    width: 100%;
    margin: 0;
  }

  .analysis {
    padding: 0;
  }

  .analysis-heading {
    margin-bottom: 18px;
  }

  .analysis-heading h2 {
    font-size: 22pt;
  }

  .kpi-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .kpi-card {
    min-height: 105px;
    padding: 14px;
    break-inside: avoid;
    box-shadow: none;
  }

  .kpi-card strong {
    font-size: 24pt;
  }

  .chart-card,
  .ranking-card {
    padding: 18px;
    border-color: #bbb;
    box-shadow: none;
    break-inside: avoid-page;
  }

  .chart-wrap,
  #trendChart {
    height: 300px;
    min-height: 300px;
  }

  .ranking-card {
    margin-top: 12px;
  }

  .entity-link {
    margin: 0;
    padding: 0;
    color: var(--ink);
  }

  .entity-link::after {
    display: none;
  }

  thead {
    display: table-header-group;
  }

  tr,
  td,
  th {
    break-inside: avoid;
  }
}
