:root {
  color-scheme: dark;
  --ink: #e8edf4;
  --muted: #8d9caf;
  --faint: #5e6d7f;
  --line: rgba(148, 163, 184, 0.16);
  --panel: #111923;
  --panel-soft: #15202c;
  --panel-deep: #0b1119;
  --accent: #38bdf8;
  --accent-2: #22c55e;
  --warning: #f59e0b;
  --danger: #fb7185;
  --radius: 16px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #081019;
  color: var(--ink);
  font-family:
    Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui,
    sans-serif;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  color: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 112px;
  background:
    radial-gradient(circle at 20% -20%, rgba(56, 189, 248, 0.11), transparent 30%),
    #081019;
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(330px, 1fr) auto minmax(220px, 0.55fr);
  align-items: center;
  gap: 24px;
  min-width: 0;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 23, 0.96);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 11px;
  background: rgba(56, 189, 248, 0.09);
}

.brand-mark span {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.8);
}

.brand-mark span:nth-child(1) {
  transform: translate(-8px, 6px);
}

.brand-mark span:nth-child(2) {
  transform: translate(8px, 6px);
}

.brand-mark span:nth-child(3) {
  transform: translateY(-8px);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 1px;
  background: rgba(56, 189, 248, 0.55);
  transform-origin: center;
}

.brand-mark::before {
  transform: rotate(28deg) translateY(2px);
}

.brand-mark::after {
  transform: rotate(-28deg) translateY(2px);
}

.eyebrow {
  margin-bottom: 2px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 680;
  letter-spacing: -0.025em;
  white-space: nowrap;
}

.method-badges {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.method-badge {
  min-width: 105px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 30, 42, 0.72);
}

.method-badge span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.method-badge strong {
  color: #f8fafc;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  font-weight: 650;
}

.country-picker {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
}

.country-picker > span {
  color: var(--muted);
  font-size: 11px;
}

.country-picker select,
.speed-control select {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 9px;
  background: #15202c;
  cursor: pointer;
}

.country-picker select {
  min-width: 156px;
  padding: 9px 32px 9px 11px;
  font-size: 13px;
  font-weight: 650;
}

.inspector-header {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 14px 16px 13px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 23, 0.96);
}

.inspector-header .brand-block {
  gap: 10px;
}

.inspector-header .brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.inspector-header h1 {
  overflow: hidden;
  font-size: 16px;
  text-overflow: ellipsis;
}

.inspector-header .country-picker {
  justify-self: stretch;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
}

.inspector-header .country-picker select {
  width: 100%;
  min-width: 0;
}

.record-search {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(250, 204, 21, 0.3);
  border-radius: 10px;
  background: rgba(113, 84, 10, 0.12);
}

.record-search > label {
  color: #fde68a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.record-search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}

.record-search input {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid rgba(250, 204, 21, 0.32);
  border-radius: 8px;
  outline: none;
  background: rgba(8, 16, 25, 0.88);
  color: #f8fafc;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.record-search input::placeholder {
  color: #8d9caf;
  font-family: inherit;
}

.record-search input:focus {
  border-color: #facc15;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.16);
}

.record-search button {
  padding: 8px 10px;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 8px;
  background: rgba(161, 98, 7, 0.34);
  color: #fef3c7;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.record-search button:hover:not(:disabled) {
  background: rgba(202, 138, 4, 0.48);
}

.record-search button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.record-search-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.record-search-status.success {
  color: #fde68a;
}

.record-search-status.error {
  color: #fda4af;
}

.record-search-location-label {
  transform: translateY(-50%);
  padding: 2px 5px;
  border: 1px solid rgba(250, 204, 21, 0.82);
  border-radius: 999px;
  background: rgba(69, 52, 9, 0.9);
  color: #fef08a;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}

.record-search-panel {
  margin-bottom: 13px;
  border-color: #f0c36a;
  background: #fff9e8;
}

.record-search-panel > label,
.record-search-panel .record-search-status.success {
  color: #8a5a00;
}

.record-search-panel input {
  border-color: #d7b45e;
  background: #ffffff;
  color: #172033;
}

.record-search-panel input::placeholder {
  color: #7c8798;
}

.record-search-panel button {
  border-color: #d6a83e;
  background: #f2c253;
  color: #4f3500;
}

.record-search-panel button:hover:not(:disabled) {
  background: #e9b535;
}

.record-search-panel .record-search-status.error {
  color: #b42318;
}

.record-search-empty {
  display: grid;
  gap: 7px;
  padding: 26px 18px;
  border: 1px dashed #cfd8e3;
  border-radius: 12px;
  background: #f8fafc;
  color: #667085;
  text-align: center;
}

.record-search-empty strong {
  color: #344054;
  font-size: 14px;
}

.record-search-empty span {
  font-size: 11px;
  line-height: 1.6;
}

.record-search-result {
  display: grid;
  gap: 13px;
}

.record-search-result[hidden] {
  display: none;
}

.record-search-summary {
  display: grid;
  gap: 10px;
}

.record-search-overview {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid #e6b43e;
  border-radius: 12px;
  background: #fffaf0;
}

.record-search-full-detail {
  display: grid;
  gap: 9px;
}

.record-search-detail-note {
  margin: -2px 1px 2px;
  padding: 7px 9px;
  border-left: 3px solid #f59e0b;
  color: #92400e;
  background: #fffbeb;
  font-size: 8px;
  line-height: 1.55;
}

.record-search-summary-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.record-search-summary-title strong {
  color: #172033;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.record-search-source-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #fff0bf;
  color: #8a5a00;
  font-size: 9px;
  font-weight: 800;
}

.record-search-summary-note {
  margin: 0;
  color: #667085;
  font-size: 10px;
  line-height: 1.55;
}

.record-search-provenance {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-top: 7px;
  border-top: 1px solid #f1d78d;
}

.record-search-provenance > div {
  min-width: 0;
}

.record-search-provenance dt {
  color: #8a5a00;
  font-size: 8px;
  font-weight: 800;
}

.record-search-provenance dd {
  margin: 2px 0 0;
  color: #334155;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.record-search-address-list {
  display: grid;
  gap: 12px;
}

.record-search-country-group {
  display: grid;
  gap: 8px;
}

.record-search-country-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 0 2px;
}

.record-search-country-header strong {
  color: #172033;
  font-size: 13px;
}

.record-search-country-header span {
  color: #667085;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.record-search-country-stats {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.m-le-n-contract {
  display: grid;
  gap: 6px;
  margin: -4px 0 16px;
  padding: 11px 12px;
  border: 1px solid #76d39b;
  border-left: 5px solid #16a34a;
  border-radius: 11px;
  background: #eefbf3;
}

.m-le-n-contract strong {
  color: #166534;
  font-size: 11px;
}

.m-le-n-contract span {
  color: #3f6f50;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  line-height: 1.55;
}

.record-inclusion-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
}

.record-inclusion-summary[hidden] {
  display: none;
}

.record-inclusion-tile {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid;
  border-radius: 9px;
}

.record-inclusion-tile.partial {
  border-color: #86efac;
  background: #f0fdf4;
}

.record-inclusion-tile.equal {
  border-color: #c4b5fd;
  background: #f5f3ff;
}

.record-inclusion-tile span,
.record-inclusion-tile small {
  font-size: 8px;
  line-height: 1.35;
}

.record-inclusion-tile.partial span,
.record-inclusion-tile.partial strong {
  color: #15803d;
}

.record-inclusion-tile.equal span,
.record-inclusion-tile.equal strong {
  color: #6d28d9;
}

.record-inclusion-tile strong {
  font-size: 10px;
  overflow-wrap: anywhere;
}

.record-inclusion-tile small {
  color: #667085;
}

.record-inclusion-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.record-inclusion-badge.partial {
  background: #dcfce7;
  color: #15803d;
}

.record-inclusion-badge.equal {
  background: #ede9fe;
  color: #6d28d9;
}

.record-inclusion-badge.warning {
  background: #fef3c7;
  color: #92400e;
}

.record-inclusion-badge.mixed {
  background: #ffedd5;
  color: #c2410c;
}

.record-relation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin: -8px 0 16px;
  padding: 8px 10px;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  background: #ffffff;
}

.record-relation-legend strong,
.record-relation-legend span {
  font-size: 8px;
  line-height: 1.4;
}

.record-relation-legend strong {
  width: 100%;
  color: #334155;
}

.record-relation-legend span {
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 999px;
  font-weight: 800;
}

.record-relation-legend .partial {
  border-color: #86efac;
  color: #15803d;
  background: #f0fdf4;
}

.record-relation-legend .equal {
  border-color: #c4b5fd;
  color: #6d28d9;
  background: #f5f3ff;
}

.record-relation-legend .mixed {
  border-color: #fdba74;
  color: #c2410c;
  background: #fff7ed;
}

.record-search-address-button {
  width: 100%;
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 11px;
  border: 1px solid #d9e2ec;
  border-left: 4px solid #0ea5e9;
  border-radius: 11px;
  background: #ffffff;
  color: #344054;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 3px 12px rgba(38, 51, 77, 0.04);
}

.record-search-address-button:hover:not(:disabled) {
  border-color: #7dd3fc;
  border-left-color: #0284c7;
  background: #f8fcff;
}

.record-search-address-button.external {
  border-color: #f0c36a;
  border-left-color: #f59e0b;
  background: #fffbeb;
}

.record-search-address-button.active {
  border-color: #e6a817;
  border-left-color: #f59e0b;
  background: #fff7d6;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
}

.record-search-address-button:disabled {
  border-left-color: #98a2b3;
  background: #f2f4f7;
  cursor: not-allowed;
  opacity: 0.76;
}

.record-search-address-ordinal {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 800;
}

.record-search-address-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.record-search-address-copy strong {
  color: #172033;
  font-size: 11px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.record-search-address-meta {
  color: #667085;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  line-height: 1.45;
}

.record-search-address-action {
  display: grid;
  justify-items: end;
  gap: 5px;
}

.record-search-address-action span {
  padding: 3px 6px;
  border-radius: 999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 8px;
  font-weight: 800;
  white-space: nowrap;
}

.record-search-address-button.external .record-search-address-action span {
  background: #fef3c7;
  color: #92400e;
}

.record-search-address-button:disabled .record-search-address-action span {
  background: #e4e7ec;
  color: #667085;
}

.inspector-header .method-badges {
  display: grid;
  grid-template-columns: minmax(82px, 0.7fr) minmax(0, 1.3fr);
}

.inspector-header .method-badge {
  min-width: 0;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
}

.map-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: #111923;
}

#map {
  position: absolute;
  inset: 0;
}

.map-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(5, 10, 16, 0.2), transparent 22%),
    linear-gradient(90deg, rgba(5, 10, 16, 0.16), transparent 20%);
}

.maplibregl-map {
  font-family: inherit;
}

.maplibregl-ctrl-group {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2) !important;
  border-radius: 10px !important;
  background: rgba(14, 22, 31, 0.9) !important;
  box-shadow: var(--shadow) !important;
}

.maplibregl-ctrl-group button {
  background-color: rgba(14, 22, 31, 0.9) !important;
  filter: invert(1) opacity(0.8);
}

.maplibregl-ctrl-scale {
  color: #dbe7f4;
  border-color: rgba(226, 232, 240, 0.5) !important;
  background: rgba(9, 15, 23, 0.72) !important;
}

.maplibregl-popup {
  z-index: 30;
  width: min(420px, calc(100vw - 32px));
  max-width: min(420px, calc(100vw - 32px)) !important;
}

.maplibregl-popup-content {
  padding: 0 !important;
  max-height: min(680px, calc(100vh - 32px));
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 13px !important;
  background: #111923 !important;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45) !important;
}

.maplibregl-popup-tip {
  border-top-color: #111923 !important;
  border-bottom-color: #111923 !important;
}

.maplibregl-popup-close-button {
  top: 7px;
  right: 8px;
  width: 26px;
  height: 26px;
  color: #dbe7f4;
  font-size: 20px;
}

.point-popup {
  width: 100%;
  min-width: 0;
}

.popup-head {
  padding: 14px 42px 12px 15px;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 37, 51, 0.92);
}

.popup-head span {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.popup-head strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.45;
}

.popup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 14px;
  padding: 13px 15px;
}

.popup-grid > div {
  min-width: 0;
}

.popup-grid span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.popup-grid strong {
  display: block;
  margin-top: 3px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.popup-links {
  display: flex;
  gap: 8px;
  padding: 0 15px 14px;
}

.popup-links a {
  flex: 1;
  padding: 8px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: 8px;
  color: #a8dcf8;
  font-size: 10px;
  text-align: center;
  text-decoration: none;
  background: rgba(56, 189, 248, 0.07);
}

.phase-card {
  position: absolute;
  z-index: 5;
  top: 20px;
  left: 20px;
  width: min(390px, calc(100% - 40px));
  padding: 15px 17px 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 14px;
  background: rgba(9, 15, 23, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.phase-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.phase-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.phase-card h2 {
  margin: 8px 0 5px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.phase-card p {
  min-height: 36px;
  margin: 0;
  color: #b5c1cf;
  font-size: 12px;
  line-height: 1.5;
}

.phase-meter {
  height: 3px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.14);
}

.phase-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0284c7, #38bdf8);
  transition: width 220ms ease;
}

.metric-strip {
  position: absolute;
  z-index: 5;
  top: 20px;
  right: 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(94px, 1fr));
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(9, 15, 23, 0.89);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.metric {
  min-width: 104px;
  padding: 12px 13px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
}

.metric strong {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.metric-accent strong {
  color: #7dd3fc;
}

.map-legend {
  position: absolute;
  z-index: 5;
  left: 20px;
  bottom: 20px;
  display: grid;
  gap: 8px;
  min-width: 248px;
  padding: 13px 14px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(9, 15, 23, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.map-legend.hidden {
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
}

.legend-title {
  margin-bottom: 2px;
  color: #cbd5e1;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #aab7c6;
  font-size: 10px;
}

.legend-symbol {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.legend-symbol.raw {
  background: #64748b;
}

.legend-symbol.core {
  width: 11px;
  height: 11px;
  border: 0;
  background: #c13ac2;
  box-shadow: none;
}

.legend-symbol.member {
  border: 2px solid #c13ac2;
  background: #fff;
}

.legend-symbol.radius-member {
  border: 2px solid #2563eb;
  background: #fff;
}

.legend-symbol.offshore {
  width: 11px;
  height: 11px;
  border: 2px solid #fff1f2;
  background: #f43f5e;
  box-shadow: 0 0 0 1px rgba(244, 63, 94, 0.42);
}

.legend-line {
  width: 18px;
  height: 3px;
  border-radius: 99px;
}

.legend-line.pass {
  background: #22c55e;
}

.legend-line.fail {
  background: repeating-linear-gradient(
    90deg,
    #fb7185 0,
    #fb7185 4px,
    transparent 4px,
    transparent 7px
  );
}

.map-chip {
  position: absolute;
  z-index: 6;
  left: 20px;
  bottom: 20px;
  padding: 8px 11px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 9px;
  background: rgba(9, 15, 23, 0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.legend-toggle {
  display: none;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  background:
    radial-gradient(circle, rgba(30, 58, 83, 0.72), transparent 36%),
    rgba(7, 12, 18, 0.94);
  transition:
    opacity 240ms ease,
    visibility 240ms ease;
}

.loading-overlay.hidden {
  visibility: hidden;
  opacity: 0;
}

.loading-overlay strong {
  margin-top: 8px;
  font-size: 15px;
}

.loading-overlay > span {
  color: var(--muted);
  font-size: 11px;
}

.loader-orbit {
  width: 48px;
  height: 48px;
  position: relative;
  border: 1px solid rgba(56, 189, 248, 0.28);
  border-radius: 50%;
  animation: orbit-spin 1.4s linear infinite;
}

.loader-orbit::before,
.loader-orbit::after,
.loader-orbit span {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.8);
}

.loader-orbit::before {
  top: -4px;
  left: 20px;
}

.loader-orbit::after {
  right: 0;
  bottom: 5px;
}

.loader-orbit span {
  left: 0;
  bottom: 5px;
}

@keyframes orbit-spin {
  to {
    transform: rotate(360deg);
  }
}

.inspector {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto 52px minmax(0, 1fr);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(25, 38, 52, 0.62), transparent 18%),
    var(--panel);
}

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

.sidebar-collapse-button {
  position: absolute;
  z-index: 60;
  top: 13px;
  right: 55px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #475569;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.sidebar-collapse-button:hover {
  border-color: #38bdf8;
  color: #0369a1;
  background: #f0f9ff;
}

.inspector-tabs {
  height: 52px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 17, 25, 0.62);
}

.tab-button {
  position: relative;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.tab-button:last-child {
  border-right: 0;
}

.tab-button::after {
  content: "";
  position: absolute;
  right: 20%;
  bottom: -1px;
  left: 20%;
  height: 2px;
  border-radius: 99px;
  background: transparent;
}

.tab-button.active {
  color: #f8fafc;
}

.tab-button.active::after {
  background: var(--accent);
}

.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 99px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.tab-panel {
  display: none;
  min-height: 0;
  height: auto;
  overflow: auto;
  padding: 21px 18px 30px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

.tab-panel.active {
  display: block;
}

.panel-intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.panel-kicker {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
}

.panel-intro h2 {
  margin: 5px 0 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.large-count {
  color: #dff5ff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.06em;
}

.panel-note {
  margin: 9px 0 17px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.cluster-list,
.merge-list {
  display: grid;
  gap: 8px;
}

.cluster-card {
  width: 100%;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 11px 12px 11px 10px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 11px;
  background: rgba(21, 32, 44, 0.68);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 150ms ease,
    background 150ms ease,
    transform 150ms ease;
}

.cluster-card:hover {
  transform: translateX(-2px);
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(26, 41, 56, 0.82);
}

.cluster-card.official-overlay {
  border-color: rgba(37, 99, 235, 0.52);
  background:
    linear-gradient(110deg, rgba(37, 99, 235, 0.19), rgba(21, 32, 44, 0.82));
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.12);
}

.cluster-card.official-overlay:hover {
  border-color: rgba(96, 165, 250, 0.82);
  background:
    linear-gradient(110deg, rgba(37, 99, 235, 0.28), rgba(26, 41, 56, 0.9));
}

.cluster-swatch {
  width: 8px;
  height: 35px;
  border-radius: 99px;
  box-shadow: 0 0 18px color-mix(in srgb, var(--swatch) 50%, transparent);
  background: var(--swatch);
}

.cluster-card-main {
  min-width: 0;
}

.cluster-card-main strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.cluster-card-main strong em {
  display: inline-flex;
  margin-left: 7px;
  padding: 2px 6px;
  border: 1px solid rgba(96, 165, 250, 0.42);
  border-radius: 99px;
  color: #bfdbfe;
  font-size: 8px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: 1px;
}

.cluster-card-main span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cluster-card-score {
  display: grid;
  min-width: 190px;
  gap: 5px;
  text-align: right;
}

.cluster-card-score .cluster-score-row {
  display: grid;
  grid-template-columns: 28px minmax(60px, auto);
  column-gap: 7px;
  align-items: baseline;
  max-width: none;
  color: var(--faint);
  line-height: 1.2;
  white-space: normal;
}

.cluster-score-row b {
  color: #7dd3fc;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.cluster-card-score .cluster-score-row strong {
  display: block;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.cluster-card-score .cluster-score-row em {
  grid-column: 1 / -1;
  display: block;
  color: var(--faint);
  font-size: 8px;
  font-style: normal;
  line-height: 1.25;
  white-space: normal;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 24px;
  border: 1px dashed rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  text-align: center;
  background: rgba(8, 15, 23, 0.36);
}

.merge-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 13px;
}

.summary-tile {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(21, 32, 44, 0.65);
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.summary-tile strong {
  display: block;
  margin-top: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 15px;
}

.merge-card {
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.15);
  border-radius: 11px;
  background: rgba(21, 32, 44, 0.7);
}

.merge-card.pass {
  border-color: rgba(34, 197, 94, 0.32);
}

.merge-card.fail {
  border-color: rgba(251, 113, 133, 0.22);
}

.merge-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.merge-card-head strong {
  font-size: 11px;
}

.status-pill {
  padding: 4px 7px;
  border-radius: 99px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.status-pill.pass {
  color: #86efac;
  background: rgba(34, 197, 94, 0.12);
}

.status-pill.fail {
  color: #fda4af;
  background: rgba(251, 113, 133, 0.1);
}

.merge-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}

.merge-card-grid > div {
  padding: 10px;
  background: #131d29;
}

.merge-card-grid span {
  display: block;
  color: var(--muted);
  font-size: 8px;
}

.merge-card-grid strong {
  display: block;
  margin-top: 4px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.merge-reason {
  margin: 0;
  padding: 10px 12px;
  color: #aebaca;
  font-size: 9px;
  line-height: 1.55;
}

.method-stack {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.method-card {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 11px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 11px;
  background: rgba(21, 32, 44, 0.64);
}

.method-number {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 9px;
  color: #7dd3fc;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
  background: rgba(56, 189, 248, 0.07);
}

.method-card h3 {
  margin: 1px 0 5px;
  font-size: 11px;
}

.method-card p {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

.method-card code {
  color: #dff5ff;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.source-box {
  margin-top: 13px;
  padding: 13px;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 11px;
  background: rgba(8, 15, 23, 0.54);
}

.source-box > span {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.source-box p {
  margin: 7px 0 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.7;
}

.source-box a {
  color: #7dd3fc;
  font-size: 9px;
  text-decoration: none;
}

.timeline {
  position: relative;
  z-index: 30;
  display: grid;
  grid-template-columns: 285px minmax(320px, 1fr) 245px;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  border-top: 1px solid var(--line);
  background: #0a111a;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.2);
}

.timeline-collapse-button {
  position: absolute;
  z-index: 70;
  top: -31px;
  right: 10px;
  height: 27px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border: 1px solid #cbd5e1;
  border-radius: 9px 9px 0 0;
  color: #475569;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -3px 12px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  font-size: 9px;
  font-weight: 750;
}

.timeline-collapse-button:hover {
  border-color: #38bdf8;
  color: #0369a1;
  background: #f0f9ff;
}

.timeline-collapse-button > span:first-child {
  font-size: 14px;
  line-height: 1;
}

.transport {
  display: flex;
  align-items: center;
  gap: 7px;
}

.transport button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 9px;
  background: rgba(21, 32, 44, 0.82);
  cursor: pointer;
  font-size: 17px;
}

.transport button:hover {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(29, 46, 63, 0.92);
}

.transport .play-button {
  width: 42px;
  height: 42px;
  border-color: rgba(56, 189, 248, 0.45);
  border-radius: 50%;
  color: #081019;
  background: #7dd3fc;
  box-shadow: 0 0 26px rgba(56, 189, 248, 0.25);
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 7px;
  color: var(--muted);
  font-size: 9px;
}

.speed-control select {
  padding: 6px 7px;
  font-size: 10px;
}

.timeline-track {
  position: relative;
  min-width: 0;
  padding-top: 27px;
}

.active-cluster-label {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: #dff5ff;
  font-size: 9px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-cluster-label::before {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--active-cluster-color, #38bdf8);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--active-cluster-color, #38bdf8) 22%, transparent);
  content: "";
}

.stage-labels {
  display: none;
}

.stage-label {
  position: absolute;
  top: 0;
  border: 0;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  font-size: 8px;
  line-height: 1;
  transform: translateX(-50%);
  white-space: nowrap;
}

.stage-label.active {
  color: #dff5ff;
}

.stage-label::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 1px;
  height: 7px;
  background: rgba(148, 163, 184, 0.22);
}

#timelineRange {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 18px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.timeline-progress {
  position: absolute;
  right: 0;
  bottom: 7px;
  left: 0;
  height: 8px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.15);
  pointer-events: none;
}

.timeline-progress span {
  position: relative;
  z-index: 2;
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.12);
}

.cluster-timeline-segments {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  overflow: hidden;
  border-radius: inherit;
}

.cluster-timeline-segment {
  min-width: 1px;
  height: 100%;
  padding: 0;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--segment-color, #94a3b8);
  opacity: 0.22;
  pointer-events: auto;
}

.cluster-timeline-segment.completed {
  opacity: 0.74;
}

.cluster-timeline-segment.active {
  opacity: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.95);
}

.timeline-progress::after {
  content: "";
  position: absolute;
  top: -4px;
  left: var(--progress, 0%);
  width: 12px;
  height: 12px;
  border: 2px solid #0a111a;
  border-radius: 50%;
  background: #bae6fd;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
  transform: translateX(-50%);
}

.frame-counter {
  text-align: right;
}

.cluster-view-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-bottom: 5px;
}

.cluster-view-toggle button {
  padding: 5px 7px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(21, 32, 44, 0.72);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.cluster-view-toggle button.active {
  border-color: #38bdf8;
  color: #e0f2fe;
  background: #0284c7;
}

.frame-counter > span {
  display: block;
  color: #dff5ff;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

.frame-counter small {
  display: block;
  margin-top: 6px;
  color: var(--faint);
  font-size: 8px;
}

@media (max-width: 1260px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .timeline {
    grid-template-columns: 260px 1fr 185px;
  }
}

@media (max-width: 980px) {
  html,
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    grid-template-rows: auto auto;
  }

  .topbar {
    position: sticky;
    top: 0;
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 15px 18px;
  }

  .country-picker {
    justify-self: stretch;
  }

  .country-picker select {
    flex: 1;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .map-stage {
    height: 70vh;
    min-height: 520px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .inspector {
    height: 620px;
  }

  .metric-strip {
    top: auto;
    right: 16px;
    bottom: 16px;
    left: 16px;
    grid-template-columns: repeat(4, 1fr);
  }

  .metric {
    min-width: 0;
  }

  .metric:nth-child(2) {
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 0;
  }

  .map-legend {
    left: 16px;
    bottom: 98px;
  }

  .timeline {
    position: sticky;
    bottom: 0;
    grid-template-columns: 1fr;
    gap: 13px;
    padding: 15px 18px;
  }

  .transport {
    justify-content: center;
  }

  .frame-counter {
    display: none;
  }
}

@media (max-width: 620px) {
  .maplibregl-popup {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px) !important;
  }

  .popup-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  h1 {
    font-size: 16px;
  }

  .phase-card {
    top: 12px;
    left: 12px;
    width: calc(100% - 24px);
  }

  .metric-strip {
    display: none;
  }

  .map-legend {
    left: 12px;
    bottom: 60px;
  }

  .legend-toggle {
    display: block;
    left: 12px;
    bottom: 12px;
  }

  .cluster-card {
    grid-template-columns: 8px minmax(0, 1fr);
  }

  .cluster-card-score {
    grid-column: 2;
    min-width: 0;
    text-align: left;
  }
}

@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;
  }
}

/* 明亮审计主题：底图、散点与聚类结果在白色界面中保持高可读性。 */
:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --faint: #98a2b3;
  --line: rgba(38, 51, 77, 0.12);
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --panel-deep: #f2f5f8;
  --accent: #0ea5e9;
  --accent-2: #16a34a;
  --warning: #d97706;
  --danger: #e11d48;
  --shadow: 0 12px 34px rgba(38, 51, 77, 0.12);
}

html,
body {
  background: #f4f6f9;
  color: var(--ink);
}

.app-shell {
  background:
    radial-gradient(circle at 18% -20%, rgba(14, 165, 233, 0.09), transparent 31%),
    #f4f6f9;
}

.topbar {
  border-bottom-color: #dfe5ec;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 6px 24px rgba(38, 51, 77, 0.07);
}

.brand-mark {
  border-color: rgba(14, 165, 233, 0.25);
  background: #effaff;
}

.brand-mark span {
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.34);
}

.method-badge {
  border-color: #e1e7ee;
  background: #f8fafc;
}

.method-badge strong,
.tab-button.active,
.phase-card h2,
.metric strong,
.cluster-card-main strong,
.cluster-card-score strong,
.summary-tile strong,
.merge-card-head strong,
.merge-card-grid strong,
.method-card h3 {
  color: var(--ink);
}

.country-picker select,
.speed-control select {
  border-color: #d7dee8;
  background: #ffffff;
  color: var(--ink);
}

.map-stage {
  border-right-color: #dfe5ec;
  background: #f7f9fb;
}

.map-scrim {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 18%);
}

.maplibregl-ctrl-group {
  border-color: #d8e0e9 !important;
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 8px 22px rgba(38, 51, 77, 0.12) !important;
}

.maplibregl-ctrl-group button {
  background-color: rgba(255, 255, 255, 0.96) !important;
  filter: none;
}

.maplibregl-ctrl-scale {
  color: #475467;
  border-color: #667085 !important;
  background: rgba(255, 255, 255, 0.8) !important;
}

.maplibregl-popup-content {
  border-color: #d9e1ea;
  background: #ffffff !important;
  color: var(--ink);
  box-shadow: 0 20px 54px rgba(38, 51, 77, 0.18) !important;
}

.maplibregl-popup-tip {
  border-top-color: #ffffff !important;
  border-bottom-color: #ffffff !important;
}

.maplibregl-popup-close-button {
  color: #667085;
}

.popup-head {
  border-bottom-color: #e3e8ef;
  background: #f8fafc;
}

.popup-links a {
  border-color: #bae6fd;
  color: #0369a1;
  background: #f0f9ff;
}

.phase-card,
.metric-strip,
.map-legend,
.map-chip {
  border-color: rgba(38, 51, 77, 0.13);
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.phase-card p,
.legend-row,
.merge-reason {
  color: #667085;
}

.phase-meter {
  background: #e8edf3;
}

.metric-accent strong {
  color: #0284c7;
}

.legend-title {
  color: #344054;
}

.legend-symbol.raw {
  background: #a7b0be;
}

.legend-symbol.core {
  border-color: transparent;
  background: #2563eb;
  box-shadow: none;
}

.loading-overlay {
  background:
    radial-gradient(circle, rgba(224, 242, 254, 0.94), transparent 34%),
    rgba(255, 255, 255, 0.96);
}

.loader-orbit {
  border-color: rgba(14, 165, 233, 0.25);
}

.loader-orbit::before,
.loader-orbit::after,
.loader-orbit span {
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.35);
}

.inspector {
  background: #ffffff;
}

.inspector-header {
  border-bottom-color: #e2e8f0;
  background: #ffffff;
}

.inspector-tabs {
  border-bottom-color: #e2e8f0;
  background: #fbfcfd;
}

.tab-badge {
  color: #0369a1;
  background: #e0f2fe;
}

.large-count {
  color: #172033;
}

.cluster-card,
.summary-tile,
.merge-card,
.method-card {
  border-color: #e1e7ee;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(38, 51, 77, 0.04);
}

.cluster-card:hover {
  border-color: #7dd3fc;
  background: #f8fcff;
}

.cluster-swatch {
  box-shadow: 0 0 12px color-mix(in srgb, var(--swatch) 25%, transparent);
}

.empty-state {
  border-color: #cfd8e3;
  background: #f8fafc;
}

.merge-card.pass {
  border-color: #86efac;
}

.merge-card.fail {
  border-color: #fecdd3;
}

.status-pill.pass {
  color: #15803d;
  background: #dcfce7;
}

.status-pill.fail {
  color: #be123c;
  background: #ffe4e6;
}

.merge-card-grid {
  background: #e7ecf2;
}

.merge-card-grid > div {
  background: #f8fafc;
}

.method-number {
  border-color: #bae6fd;
  color: #0369a1;
  background: #f0f9ff;
}

.method-card code {
  color: #075985;
}

.source-box {
  border-color: #bae6fd;
  background: #f7fcff;
}

.source-box a {
  color: #0369a1;
}

.timeline {
  border-top-color: #dfe5ec;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 -8px 26px rgba(38, 51, 77, 0.08);
}

.transport button {
  border-color: #d9e1ea;
  background: #ffffff;
  color: #475467;
}

.transport button:hover {
  border-color: #7dd3fc;
  background: #f0f9ff;
}

.transport .play-button {
  border-color: #38bdf8;
  color: #ffffff;
  background: #0ea5e9;
  box-shadow: 0 8px 22px rgba(14, 165, 233, 0.22);
}

.stage-label.active,
.frame-counter > span {
  color: #172033;
}

.active-cluster-label {
  color: #172033;
}

.timeline-progress {
  background: #e2e8f0;
}

.timeline-progress::after {
  border-color: #ffffff;
  background: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.15);
}

.cluster-timeline-segment {
  border-right-color: rgba(255, 255, 255, 0.92);
}

.cluster-view-toggle button {
  border-color: #d9e1ea;
  color: #64748b;
  background: #ffffff;
}

.cluster-view-toggle button.active {
  border-color: #0284c7;
  color: #ffffff;
  background: #0284c7;
}

/* 动画演示控制：正常模式可一键隐藏多余界面，简洁模式只保留地图与时间线。 */
.view-controls {
  position: absolute;
  z-index: 18;
  top: 16px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.view-controls .map-chip {
  position: static;
  min-width: 72px;
  padding: 9px 12px;
  color: #344054;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.transport .step-button {
  width: auto;
  min-width: 62px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

body.focus-mode .app-shell {
  grid-template-rows: minmax(0, 1fr) 82px;
}

body.focus-mode .topbar,
body.focus-mode .inspector,
body.focus-mode .phase-card,
body.focus-mode .metric-strip,
body.focus-mode .map-legend,
body.focus-mode .legend-toggle,
body.focus-mode .maplibregl-control-container {
  display: none !important;
}

body.focus-mode .workspace {
  grid-template-columns: minmax(0, 1fr);
}

body.focus-mode .map-stage {
  grid-column: 1;
  border-right: 0;
}

body.focus-mode .view-controls {
  top: 14px;
  right: 14px;
  opacity: 0.16;
  transition: opacity 160ms ease;
}

body.focus-mode .view-controls:hover,
body.focus-mode .view-controls:focus-within {
  opacity: 1;
}

body.focus-mode .view-controls #fullscreenToggle {
  display: none;
}

body.focus-mode .timeline {
  grid-template-columns: 230px minmax(320px, 1fr) 190px;
  gap: 16px;
  padding: 0 18px;
}

body.focus-mode .frame-counter small {
  display: none;
}

@media (min-width: 981px) {
  body.sidebar-collapsed .workspace {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  body.timeline-collapsed .app-shell,
  body.focus-mode.timeline-collapsed .app-shell {
    grid-template-rows: minmax(0, 1fr) 36px;
  }
}

body.sidebar-collapsed .inspector {
  grid-template-rows: minmax(0, 1fr);
}

body.sidebar-collapsed .inspector > :not(.sidebar-collapse-button) {
  display: none !important;
}

body.sidebar-collapsed .sidebar-collapse-button {
  top: 10px;
  right: 7px;
}

body.timeline-collapsed .timeline {
  display: block;
  min-height: 36px;
  padding: 0;
}

body.timeline-collapsed .timeline > :not(.timeline-collapse-button) {
  display: none !important;
}

body.timeline-collapsed .timeline-collapse-button {
  top: 4px;
  right: 10px;
  border-radius: 9px;
  box-shadow: none;
}

@media (max-width: 980px) {
  body.sidebar-collapsed .inspector {
    height: 44px;
  }

  body.timeline-collapsed .timeline {
    height: 36px;
  }
}

/* 地图只承担空间展示；阶段、统计和图例统一收进右侧“集群”侧栏。 */
.sidebar-utilities {
  display: grid;
  gap: 10px;
  margin: -4px 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e8f0;
}

.sidebar-utilities .phase-card,
.sidebar-utilities .metric-strip,
.sidebar-utilities .map-legend {
  position: static;
  inset: auto;
  width: 100%;
  min-width: 0;
  transform: none;
  border-color: #e1e7ee;
  border-radius: 11px;
  background: #f8fafc;
  box-shadow: none;
  backdrop-filter: none;
}

.sidebar-utilities .phase-card {
  padding: 12px 13px 11px;
}

.sidebar-utilities .phase-card h2 {
  margin: 6px 0 4px;
  font-size: 15px;
}

.sidebar-utilities .phase-card p {
  min-height: 0;
  font-size: 10px;
  line-height: 1.55;
}

.sidebar-utilities .phase-meter {
  margin-top: 9px;
}

.sidebar-utilities .metric-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
}

.sidebar-utilities .metric {
  min-width: 0;
  padding: 10px 11px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.sidebar-utilities .metric:nth-child(2n) {
  border-right: 0;
}

.sidebar-utilities .metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.sidebar-utilities .metric span {
  margin-bottom: 3px;
  font-size: 8px;
}

.sidebar-utilities .metric strong {
  font-size: 13px;
}

.sidebar-utilities .map-legend {
  display: grid;
  gap: 7px;
  padding: 11px 12px;
}

.sidebar-utilities .map-legend.hidden {
  pointer-events: auto;
  opacity: 1;
  transform: none;
}

.sidebar-utilities .legend-title {
  margin-bottom: 1px;
  font-size: 9px;
}

.sidebar-utilities .legend-row {
  align-items: flex-start;
  gap: 8px;
  font-size: 9px;
  line-height: 1.45;
}

.sidebar-utilities .legend-symbol,
.sidebar-utilities .legend-line {
  margin-top: 2px;
}

.sidebar-utilities .legend-toggle {
  display: none !important;
}

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 390px;
  }
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .sidebar-utilities .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .view-controls {
    top: 8px;
    right: 8px;
  }

  .view-controls .map-chip {
    min-width: 62px;
    padding: 7px 9px;
  }

  body.focus-mode .timeline {
    grid-template-columns: auto minmax(180px, 1fr);
  }

  body.focus-mode .frame-counter {
    display: none;
  }
}

/* 点击坐标后的 15 km 邻域逐点分数复核。 */
.neighborhood-clear {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #dbe3ec;
  border-radius: 8px;
  color: #475569;
  background: #f8fafc;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

/* 只固定头部本身；清除按钮位于主标题右侧，结果标题随内容正常滚动。 */
.inspector-header .brand-block > div {
  min-width: 0;
  flex: 1 1 auto;
}

.build-version-label {
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  line-height: 1.35;
}

.inspector-header .header-clear {
  margin-left: auto;
  align-self: center;
}

.neighborhood-clear:hover {
  border-color: #7dd3fc;
  color: #0369a1;
  background: #f0f9ff;
}

.neighborhood-empty {
  display: grid;
  gap: 7px;
  padding: 18px 15px;
  border: 1px dashed #cbd5e1;
  border-radius: 11px;
  color: #64748b;
  background: #f8fafc;
  text-align: center;
}

.neighborhood-empty strong {
  color: #334155;
  font-size: 13px;
}

.neighborhood-empty span {
  font-size: 10px;
  line-height: 1.65;
}

.neighborhood-result {
  display: grid;
  gap: 11px;
}

.neighborhood-result[hidden] {
  display: none;
}

.selected-point-card,
.record-detail-section,
.neighborhood-points-section {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid;
  border-radius: 13px;
}

.selected-point-card {
  border-color: #38bdf8;
  background: #f0f9ff;
  box-shadow: inset 4px 0 0 #0284c7;
}

.record-detail-section {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: inset 4px 0 0 #d97706;
}

.neighborhood-points-section {
  border-color: #34d399;
  background: #ecfdf5;
  box-shadow: inset 4px 0 0 #059669;
}

.audit-block-heading {
  display: grid;
  gap: 2px;
}

.audit-block-heading span {
  color: #64748b;
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.audit-block-heading strong {
  color: #172033;
  font-size: 12px;
}

.selected-point-card > .audit-block-heading strong {
  color: #075985;
}

.record-detail-section > .audit-block-heading strong {
  color: #92400e;
}

.neighborhood-points-section > .audit-block-heading strong {
  color: #065f46;
}

.neighborhood-decision {
  padding: 12px 14px;
  border: 1px solid #dbe3ec;
  border-radius: 11px;
  color: #334155;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
}

.neighborhood-decision.pass {
  border-color: #86efac;
  color: #166534;
  background: #f0fdf4;
}

.neighborhood-decision.fail {
  border-color: #fdba74;
  color: #9a3412;
  background: #fff7ed;
}

.neighborhood-decision.mismatch {
  box-shadow: inset 4px 0 0 #22c55e;
}

.neighborhood-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #ffffff;
}

.neighborhood-summary > div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.neighborhood-summary > div:nth-child(2n) {
  border-right: 0;
}

.neighborhood-summary > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.neighborhood-summary span,
.neighborhood-meta dt {
  display: block;
  color: #64748b;
  font-size: 8px;
  letter-spacing: 0.04em;
}

.neighborhood-summary strong {
  display: block;
  margin-top: 4px;
  color: #172033;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.neighborhood-meta {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 11px;
  background: #f8fafc;
}

.neighborhood-meta > div {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.neighborhood-meta dd {
  min-width: 0;
  margin: 0;
  color: #334155;
  font-size: 9px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.neighborhood-list-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.neighborhood-list-head strong {
  color: #172033;
  font-size: 11px;
}

.neighborhood-list-head span {
  color: #94a3b8;
  font-size: 8px;
}

.neighborhood-list {
  display: grid;
  gap: 6px;
}

.neighborhood-row {
  width: 100%;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.neighborhood-row:hover:not(:disabled),
.neighborhood-row.record-selected {
  border-color: #0ea5e9;
  background: #ecfeff;
}

.neighborhood-row:disabled {
  cursor: default;
  opacity: 0.68;
}

.neighborhood-row.selected {
  border-color: #38bdf8;
  background: #f0f9ff;
}

.neighborhood-distance {
  color: #64748b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.neighborhood-row-copy {
  min-width: 0;
}

.neighborhood-row-copy strong {
  display: block;
  overflow: hidden;
  color: #334155;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.neighborhood-row-copy span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.neighborhood-score {
  color: #0369a1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}

.record-detail-section {
  gap: 8px;
}

.record-detail-section[hidden] {
  display: none;
}

.record-detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.record-detail-head > div {
  min-width: 0;
}

.record-detail-head strong,
.record-detail-head span {
  display: block;
}

.record-detail-head strong {
  color: #172033;
  font-size: 11px;
}

.record-detail-head span {
  overflow: hidden;
  margin-top: 3px;
  color: #64748b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-detail-head b {
  flex: none;
  color: #0369a1;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.record-load-status {
  padding: 10px 11px;
  border: 1px solid #bae6fd;
  border-radius: 9px;
  color: #075985;
  background: #f0f9ff;
  font-size: 9px;
  line-height: 1.55;
}

.record-load-status.warning {
  border-color: #fed7aa;
  color: #9a3412;
  background: #fff7ed;
}

.record-load-status.error {
  border-color: #fecaca;
  color: #991b1b;
  background: #fef2f2;
}

.record-load-status[hidden] {
  display: none;
}

.record-detail-list {
  display: grid;
  gap: 7px;
}

.record-detail-card {
  overflow: hidden;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: #ffffff;
}

.record-detail-card.relation-partial {
  border-color: #4ade80;
  border-left: 5px solid #16a34a;
  background: #f0fdf4;
}

.record-detail-card.relation-equal {
  border-color: #a78bfa;
  border-left: 5px solid #7c3aed;
  background: #f5f3ff;
}

.record-detail-card.relation-warning {
  border-color: #fbbf24;
  border-left: 5px solid #d97706;
  background: #fffbeb;
}

.record-search-country-group.relation-partial {
  padding: 8px;
  border: 1px solid #86efac;
  border-left: 5px solid #16a34a;
  border-radius: 10px;
  background: #f0fdf4;
}

.record-search-country-group.relation-equal {
  padding: 8px;
  border: 1px solid #c4b5fd;
  border-left: 5px solid #7c3aed;
  border-radius: 10px;
  background: #f5f3ff;
}

.record-detail-card[open] {
  border-color: #38bdf8;
  box-shadow: 0 4px 12px rgba(14, 116, 144, 0.09);
}

.record-detail-card summary {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  cursor: pointer;
  list-style: none;
}

.record-detail-card summary::-webkit-details-marker {
  display: none;
}

.record-sequence {
  color: #64748b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
}

.record-summary-copy {
  min-width: 0;
}

.record-summary-copy strong,
.record-summary-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-summary-copy strong {
  color: #172033;
  font-size: 9px;
}

.record-summary-copy small {
  margin-top: 3px;
  color: #64748b;
  font-size: 8px;
}

.record-summary-copy .record-inclusion-badge {
  margin-top: 4px;
}

.record-status {
  max-width: 125px;
  padding: 3px 6px;
  overflow: hidden;
  border-radius: 99px;
  font-size: 7px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-status.complete {
  color: #166534;
  background: #dcfce7;
}

.record-status.warning {
  color: #9a3412;
  background: #ffedd5;
}

.record-detail-body {
  display: grid;
  gap: 10px;
  padding: 10px 11px 12px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.record-core-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
}

.record-core-fields > div,
.record-field-group {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
}

.record-core-fields dt,
.record-field-group h4 {
  margin: 0;
  color: #64748b;
  font-size: 8px;
  font-weight: 700;
}

.record-core-fields dd {
  margin: 4px 0 0;
  color: #172033;
  font-size: 9px;
  overflow-wrap: anywhere;
}

.record-core-fields .record-source-path {
  grid-column: 1 / -1;
}

.record-value-list {
  display: grid;
  gap: 4px;
  margin: 7px 0 0;
  padding-left: 19px;
  color: #334155;
  font-size: 9px;
  line-height: 1.5;
}

.record-value-list li {
  padding-left: 2px;
  overflow-wrap: anywhere;
}

.record-empty-value {
  display: block;
  margin-top: 7px;
  color: #94a3b8;
  font-size: 8px;
  line-height: 1.5;
}

.record-source-audit {
  margin: 0;
  color: #64748b;
  font-size: 8px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.record-completeness {
  margin: 0;
  padding: 7px 8px;
  border-left: 3px solid #fb923c;
  color: #9a3412;
  background: #fff7ed;
  font-size: 8px;
  line-height: 1.55;
}

.record-pagination {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 76px;
  gap: 8px;
  align-items: center;
}

.record-pagination[hidden] {
  display: none;
}

.record-pagination button {
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: #334155;
  background: #ffffff;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.record-pagination button:disabled {
  cursor: default;
  opacity: 0.45;
}

.record-pagination span {
  color: #64748b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  text-align: center;
}

.map-score-label {
  pointer-events: none;
  padding: 1px 3px;
  border: 1px solid rgba(2, 132, 199, 0.65);
  border-radius: 4px;
  color: #075985;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8px;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

@media (max-width: 1260px) {
  .tab-button {
    font-size: 10px;
  }
}


/* VC overlay: black fill throughout; border is classified only after DBSCAN. */
.legend-symbol.vc-pending,
.legend-symbol.vc-inside,
.legend-symbol.vc-outside {
  width: 11px;
  height: 11px;
  background: #111827;
  border: 2px solid #111827;
}
.legend-symbol.vc-inside { border-color: #16a34a; }
.legend-symbol.vc-outside { border-color: #dc2626; }
.cluster-card-score.calibrated-only { min-width: 210px; }
.cluster-card-score.calibrated-only .cluster-score-row {
  grid-template-columns: 32px minmax(72px, auto);
}
