:root {
  color-scheme: dark;
  --ink: #f5f3ed;
  --muted: #9da3ad;
  --line: rgba(255, 255, 255, 0.1);
  --paper: #111318;
  --panel: rgba(28, 30, 35, 0.92);
  --black: #020203;
  --gold: #b6934b;
  --green: #24b47e;
  --orange: #ff9f1c;
  --red: #e25151;
  --gray: #7d8491;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: #101216;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.detail-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: var(--panel);
  backdrop-filter: blur(18px);
}

.detail-panel {
  position: fixed;
  top: 18px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 36px);
  padding: 20px;
  overflow: auto;
}

.detail-panel {
  right: 18px;
  width: min(440px, calc(100vw - 36px));
}
h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 2.05rem;
  font-weight: 560;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 1.55rem;
  font-weight: 560;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 8px;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.detail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.map-stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.metric-strip {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: calc(100vw - 510px);
  transform: translateX(-50%);
  overflow: visible;
  white-space: nowrap;
}

.metric {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 11px 8px 13px;
  cursor: default;
  outline: none;
  transition:
    filter 180ms ease,
    transform 180ms ease;
}

.metric:hover,
.metric:focus-visible {
  filter: brightness(1.12);
}

.metric strong,
.metric span {
  display: inline-flex;
}

.metric strong {
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 560;
}

.metric span {
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.78rem;
  font-weight: 560;
  letter-spacing: 0;
  white-space: nowrap;
}

.metric.red {
  border-color: rgba(226, 81, 81, 0.55);
  background: rgba(226, 81, 81, 0.28);
}

.metric.orange {
  border-color: rgba(217, 154, 43, 0.55);
  background: rgba(217, 154, 43, 0.28);
}

.metric.green {
  border-color: rgba(36, 180, 126, 0.55);
  background: rgba(36, 180, 126, 0.28);
}

.metric.gray {
  border-color: rgba(125, 132, 145, 0.55);
  background: rgba(125, 132, 145, 0.26);
}

.detail-panel {
  background: rgba(28, 30, 35, 0.94);
  color: #fff;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.detail-panel.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateX(16px);
}

.detail-panel p,
.detail-panel li {
  color: rgba(255, 255, 255, 0.72);
}

.detail-topline {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  font-weight: 560;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-topline span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  min-width: max-content;
  padding: 5px 9px;
  color: #fff;
}

.status-pill.green {
  background: rgba(36, 180, 126, 0.22);
}

.status-pill.orange {
  background: rgba(217, 154, 43, 0.22);
}

.status-pill.red {
  background: rgba(226, 81, 81, 0.22);
}

.status-pill.gray {
  background: rgba(125, 132, 145, 0.22);
}

.detail-section {
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  padding-top: 16px;
}

.detail-section.is-hidden {
  display: none;
}

.detail-section h3 {
  color: var(--gold);
  font-size: 0.88rem;
  font-weight: 620;
  letter-spacing: 0;
  text-transform: none;
}

ul {
  margin: 0;
  padding-left: 18px;
}

li + li {
  margin-top: 8px;
}

.checklist-list {
  display: grid;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.checklist-list li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 9px;
  align-items: start;
  margin-top: 0;
}

.checklist-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.checklist-list p {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.35;
}

.status-card-list {
  display: grid;
  gap: 10px;
  padding-left: 0;
  list-style: none;
}

.status-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.status-card.orange {
  border-color: rgba(255, 159, 28, 0.34);
  background: rgba(255, 159, 28, 0.08);
}

.status-card.red {
  border-color: rgba(226, 81, 81, 0.36);
  background: rgba(226, 81, 81, 0.09);
}

.status-card.green {
  border-color: rgba(36, 180, 126, 0.34);
  background: rgba(36, 180, 126, 0.08);
}

.status-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.status-card strong {
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 580;
}

.status-card-heading span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.72rem;
  font-weight: 580;
}

.status-card ul {
  margin: 0;
  padding-left: 18px;
}

.status-card li {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
  line-height: 1.35;
  list-style: disc;
}

.status-card li + li {
  margin-top: 6px;
}

.status-card p {
  margin: 0;
  font-size: 0.84rem;
}

.checklist-list .green span {
  background: rgba(36, 180, 126, 0.18);
  color: var(--green);
}

.checklist-list .orange span {
  background: rgba(255, 159, 28, 0.16);
  color: var(--orange);
}

.checklist-list .red span {
  background: rgba(226, 81, 81, 0.16);
  color: var(--red);
}

.checklist-list .gray span {
  background: rgba(125, 132, 145, 0.18);
  color: var(--gray);
}

.asset-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.asset-pill-list li {
  position: relative;
  margin-top: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  padding: 7px 10px;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  cursor: help;
}

.asset-pill-list li.green {
  border-color: rgba(36, 180, 126, 0.45);
  background: rgba(36, 180, 126, 0.18);
}

.asset-pill-list li.orange {
  border-color: rgba(255, 159, 28, 0.48);
  background: rgba(255, 159, 28, 0.16);
}

.asset-pill-list li.red {
  border-color: rgba(226, 81, 81, 0.48);
  background: rgba(226, 81, 81, 0.16);
}

.asset-pill-list li.gray {
  border-color: rgba(125, 132, 145, 0.5);
  background: rgba(125, 132, 145, 0.18);
}

.asset-tooltip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 9px);
  z-index: 40;
  display: grid;
  gap: 7px;
  width: 290px;
  max-width: calc(100vw - 70px);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 14px;
  background: rgba(38, 40, 47, 0.98);
  color: rgba(255, 255, 255, 0.78);
  opacity: 0;
  padding: 11px 12px;
  pointer-events: none;
  transform: translateY(5px);
  transition: opacity 140ms ease, transform 140ms ease;
  white-space: normal;
  line-height: 1.35;
}

.asset-tooltip strong {
  display: block;
  margin-bottom: 2px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 560;
}

.asset-pill-list li:hover .asset-tooltip,
.asset-pill-list li:focus-visible .asset-tooltip {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1180px) {
  .detail-panel {
    width: min(390px, calc(100vw - 36px));
  }
}

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

  .detail-panel,
  .map-controls {
    position: static;
    width: auto;
    max-height: none;
    margin: 10px;
    transform: none;
  }

  .map-stage {
    position: relative;
    min-height: 620px;
  }

  .map-card {
    position: relative;
    height: 620px;
  }

  .detail-topline {
    align-items: flex-start;
    flex-direction: column;
  }

  .metric-strip {
    width: 100%;
    flex-wrap: wrap;
  }

  .map-card,
  #resilienceMap {
    height: 620px;
    min-height: 620px;
    max-height: none;
  }
}
