:root {
  color-scheme: light;
  --ink: #16201c;
  --muted: #66716c;
  --surface: #f3f5f1;
  --panel: #ffffff;
  --line: #d9dfd8;
  --shadow: 0 18px 50px rgba(32, 43, 37, 0.1);
  --sector: #d89b00;
  --sector-soft: #fff5cf;
  --sector-line: #e8c85d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
}

button,
input {
  font: inherit;
}

.dashboard-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 18px;
  max-width: 1480px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--sector);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 4.4rem;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.status-pill {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.status-pill span {
  color: var(--ink);
  font-weight: 800;
}

.control-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1480px;
  margin: 0 auto 18px;
}

.sector-switcher {
  display: grid;
  grid-template-columns: repeat(4, minmax(104px, 1fr));
  gap: 8px;
  width: min(100%, 560px);
}

.sector-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  font-weight: 800;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.sector-button:hover {
  transform: translateY(-1px);
}

.sector-button.is-active {
  border-color: var(--sector);
  box-shadow: inset 0 0 0 2px var(--sector), 0 10px 24px rgba(32, 43, 37, 0.08);
  background: var(--sector-soft);
}

.sector-button.energy {
  --sector: #d89b00;
  --sector-soft: #fff5cf;
}

.sector-button.water {
  --sector: #1479c9;
  --sector-soft: #e2f1ff;
}

.sector-button.land {
  --sector: #268248;
  --sector-soft: #e3f5e7;
}

.sector-button.society {
  --sector: #c63f36;
  --sector-soft: #ffe4e0;
}

.country-search {
  display: grid;
  gap: 6px;
  min-width: 260px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.country-search input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--panel);
  outline: none;
}

.country-search input:focus {
  border-color: var(--sector);
  box-shadow: 0 0 0 3px var(--sector-soft);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  max-width: 1480px;
  margin: 0 auto;
}

.map-section,
.inspector {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.map-section {
  min-width: 0;
  overflow: hidden;
}

.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 0;
}

.legend {
  display: grid;
  grid-template-columns: auto minmax(112px, 160px) auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.legend-ramp {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--sector-soft), var(--sector));
}

.map-canvas {
  width: 100%;
  height: min(70vh, 720px);
  min-height: 520px;
}

.inspector {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 22px;
}

.profile-panel {
  display: grid;
  gap: 18px;
}

.profile-kicker {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.country-name {
  margin-bottom: 8px;
  font-size: 1.7rem;
  line-height: 1.08;
}

.score-hero {
  display: grid;
  grid-template-columns: 112px 1fr;
  align-items: center;
  gap: 16px;
}

.score-ring {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 10px solid var(--sector-soft);
  border-top-color: var(--sector);
  border-right-color: var(--sector);
  border-radius: 50%;
  color: var(--sector);
  font-size: 1.8rem;
  font-weight: 900;
}

.score-hero p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.sector-bars {
  display: grid;
  gap: 12px;
}

.sector-row {
  display: grid;
  gap: 6px;
}

.sector-row-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #edf0eb;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color);
}

.ranking-panel {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.ranking-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.ranking-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfcfa;
}

.ranking-list button {
  border: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 800;
  text-align: left;
}

.ranking-list span {
  color: var(--sector);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  line-height: 1.5;
  background: #fbfcfa;
}

@media (max-width: 1050px) {
  h1 {
    font-size: 3.2rem;
  }

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

  .inspector {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  }
}

@media (max-width: 760px) {
  h1 {
    font-size: 2.25rem;
  }

  .dashboard-shell {
    padding: 14px;
  }

  .topbar,
  .control-band,
  .map-header {
    align-items: stretch;
    flex-direction: column;
  }

  .status-pill,
  .country-search {
    width: 100%;
  }

  .sector-switcher {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .map-canvas {
    height: 58vh;
    min-height: 380px;
  }

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

  .score-hero {
    grid-template-columns: 88px 1fr;
  }

  .score-ring {
    width: 88px;
    height: 88px;
    font-size: 1.45rem;
  }
}
