:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f5f6f2;
  color: #202421;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.page {
  width: calc(100vw - 32px);
  margin: 28px auto 44px;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
  border: 1px solid #24594f;
  border-radius: 8px;
  background: #fff;
}

.view-tab {
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #24594f;
  min-height: 48px;
  text-transform: none;
}

.view-tab + .view-tab {
  border-left: 1px solid #24594f;
}

.view-tab:hover,
.view-tab.selected {
  background: #24594f;
  color: #fff;
}

.view-tab:focus-visible {
  outline: 3px solid #c95732;
  outline-offset: -3px;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
}

button {
  border: 1px solid #24594f;
  border-radius: 8px;
  background: #24594f;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  min-height: 40px;
  padding: 0 18px;
}

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

.status {
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.status-error {
  border-color: #b94a48;
  background: #fff4f3;
  color: #8b2421;
}

.status-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  border: 1px solid #24594f;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.status-filter-title {
  color: #24594f;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 0 4px;
  text-transform: uppercase;
}

.status-filters label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #eef5f1;
  color: #202421;
  font-weight: 700;
  padding: 0 12px;
}

.status-filters input {
  width: 16px;
  height: 16px;
  accent-color: #24594f;
}

.map-panel {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: start;
}

.map-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
}

.world-map {
  display: block;
  width: 100%;
  height: 100%;
}

.map-loader {
  position: absolute;
  inset: 0;
  z-index: 450;
  display: grid;
  place-items: center;
  background: #e7eee9;
}

.leaflet-container {
  background: #e7eee9;
  font: inherit;
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-control-attribution {
  font-size: 11px;
}

.country-tooltip {
  border: 1px solid #2b342e;
  border-radius: 6px;
  background: #202421;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 9px;
  box-shadow: 0 10px 26px rgb(0 0 0 / 18%);
}

.country-tooltip::before {
  display: none;
}

.map-fallback {
  position: absolute;
  inset: auto 14px 14px;
  z-index: 500;
  border: 1px solid #b94a48;
  border-radius: 8px;
  background: #fff4f3;
  color: #8b2421;
  padding: 12px 14px;
}

.area-index {
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.area-index h2 {
  margin-bottom: 12px;
}

.area-list {
  display: grid;
  gap: 8px;
  max-height: min(52vw, 560px);
  overflow: auto;
}

.area-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  border: 1px solid #d8dbd0;
  background: #fff;
  color: #202421;
  min-height: 38px;
  padding: 8px 10px;
  text-align: left;
}

.area-pill:hover,
.area-pill.selected {
  border-color: #24594f;
  background: #eef5f1;
}

.area-pill strong {
  border-radius: 999px;
  background: #24594f;
  color: #fff;
  min-width: 28px;
  padding: 3px 8px;
  text-align: center;
}

.patent-section {
  margin-top: 16px;
}

.patent-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.sort-heading,
.subsystem-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.patent-heading p {
  margin-top: 4px;
  color: #646a63;
}

.sort-heading p,
.subsystem-heading p {
  margin-top: 4px;
  color: #646a63;
}

.sort-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.sort-controls label {
  display: grid;
  gap: 4px;
  color: #646a63;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sort-controls select {
  min-width: 180px;
  border: 1px solid #bfc6bb;
  border-radius: 8px;
  background: #fff;
  color: #202421;
  font: inherit;
  font-size: 14px;
  min-height: 38px;
  padding: 0 34px 0 10px;
  text-transform: none;
}

.patent-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.subsystem-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.subsystem-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 50px;
  padding: 8px 10px;
  text-align: left;
}

.subsystem-button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.subsystem-button strong {
  border-radius: 999px;
  background: rgb(255 255 255 / 18%);
  min-width: 28px;
  padding: 3px 8px;
  text-align: center;
}

.subsystem-button:hover,
.subsystem-button.selected {
  border-color: #873b25;
  background: #c95732;
}

.sort-table-wrap {
  margin-top: 12px;
  overflow: auto;
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
}

.company-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.company-filter-bar button {
  min-height: 34px;
  padding: 0 12px;
}

.company-filter-sort {
  display: grid;
  gap: 4px;
  color: #646a63;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.company-filter-sort:first-of-type {
  margin-left: auto;
}

.company-filter-sort select {
  min-width: 180px;
  border: 1px solid #bfc6bb;
  border-radius: 8px;
  background: #fff;
  color: #202421;
  font: inherit;
  font-size: 14px;
  min-height: 34px;
  padding: 0 34px 0 10px;
  text-transform: none;
}

.company-filter-button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1d564c;
  min-height: 0;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}

.company-filter-button:hover {
  background: transparent;
  color: #873b25;
}

.sort-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
}

.sort-table th,
.sort-table td {
  border-bottom: 1px solid #e4e7df;
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.sort-table th {
  background: #eef1ea;
  color: #525950;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sort-table tbody tr:last-child td {
  border-bottom: 0;
}

.sort-table .patent-title {
  font-size: 15px;
}

.sort-muted {
  color: #646a63;
}

.patent-card {
  border: 1px solid #d8dbd0;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.patent-card-main {
  display: grid;
  gap: 8px;
}

.patent-title {
  color: #1d564c;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  text-decoration: none;
}

.patent-title:hover {
  text-decoration: underline;
}

.patent-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #525950;
  font-size: 13px;
}

.patent-meta span {
  border-radius: 999px;
  background: #eef1ea;
  padding: 4px 8px;
}

.patent-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 14px 0 0;
}

.patent-details div {
  min-width: 0;
}

.patent-details dt {
  color: #646a63;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.patent-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.empty {
  color: #646a63;
  padding: 14px;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .page {
    width: calc(100vw - 20px);
    margin: 18px auto 30px;
  }

  .toolbar,
  .map-panel {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .view-tab {
    min-height: 44px;
  }

  .toolbar button {
    width: 100%;
  }

  .status-filters label {
    flex: 1 1 130px;
  }

  .status-filter-title {
    flex: 1 0 100%;
  }

  .map-wrap {
    aspect-ratio: 2 / 1;
  }

  .area-list {
    max-height: none;
  }

  .sort-heading,
  .subsystem-heading,
  .sort-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .sort-controls select {
    width: 100%;
  }

  .company-filter-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .company-filter-sort {
    margin-left: 0;
  }

  .company-filter-sort select {
    width: 100%;
  }

  .subsystem-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .patent-details {
    grid-template-columns: 1fr;
  }
}
