:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --surface-dark: #101820;

  --text: #14202a;
  --text-soft: #61707b;
  --text-muted: #8a969d;

  --line: #e4e9ec;
  --line-dark: #d4dce1;

  --primary: #102f42;
  --primary-light: #1b5266;
  --accent: #e3a837;
  --accent-soft: #f8ebc9;

  --positive: #27866b;
  --negative: #c65b5b;

  --sidebar-width: 270px;
  --radius: 18px;
  --shadow: 0 14px 35px rgba(16, 39, 52, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-dark);
  color: #fff;
  padding: 30px 18px 22px;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 35px;
}

.brand-mark {
  display: flex;
  align-items: end;
  gap: 3px;
  width: 34px;
  height: 29px;
}

.brand-mark span {
  display: block;
  width: 8px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}

.brand-mark span:nth-child(1) {
  height: 16px;
  opacity: 0.55;
}

.brand-mark span:nth-child(2) {
  height: 23px;
  opacity: 0.8;
}

.brand-mark span:nth-child(3) {
  height: 29px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-copy strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  letter-spacing: -0.5px;
}

.brand-copy small {
  color: #a8b7be;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 5px;
}

.sidebar-section {
  flex: 1;
}

.sidebar-label {
  display: block;
  color: #738790;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 0 13px 12px;
}

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #aab9c0;
  padding: 13px;
  border-radius: 12px;
  font-size: 14px;
  transition: 0.2s ease;
}

.nav-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-link.active {
  color: #fff;
  background: var(--primary-light);
  box-shadow: inset 3px 0 var(--accent);
}

.nav-icon {
  width: 20px;
  color: var(--accent);
  font-size: 17px;
  text-align: center;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.data-status {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #68d19b;
  box-shadow: 0 0 0 4px rgba(104, 209, 155, 0.12);
}

.data-status div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.data-status strong {
  font-size: 12px;
  font-weight: 600;
}

.data-status small {
  color: #8ca0a7;
  font-size: 10px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-note {
  color: #738790;
  font-size: 11px;
  line-height: 1.5;
  padding: 0 12px;
}

/* MAIN */

.main-content {
  width: calc(100% - var(--sidebar-width));
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.topbar {
  height: 76px;
  padding: 0 5vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(244, 246, 248, 0.9);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(14px);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.breadcrumb b {
  color: var(--line-dark);
}

.breadcrumb strong {
  color: var(--text);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.mobile-menu {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--primary);
}

.mobile-menu {
  display: none;
}

.page-content {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 48px 5vw 30px;
}

.page {
  display: none;
  animation: fadeIn 0.28s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.7px;
  margin-bottom: 9px;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", sans-serif;
  margin: 0;
  letter-spacing: -0.7px;
}

h1 {
  font-size: clamp(30px, 4vw, 52px);
  line-height: 1.03;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 17px;
}

p {
  color: var(--text-soft);
  line-height: 1.65;
}

.page-intro {
  margin-bottom: 32px;
}

.page-intro h1 {
  font-size: clamp(31px, 4vw, 48px);
  margin-bottom: 13px;
}

.page-intro p {
  max-width: 660px;
  margin: 0;
}

/* HERO */

.hero {
  min-height: 330px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
  padding: 50px 55px;
  border-radius: 24px;
  color: #fff;
  background:
    linear-gradient(110deg, #102f42 0%, #174b5d 62%, #1d5967 100%);
  box-shadow: 0 22px 45px rgba(16, 47, 66, 0.18);
}

.hero > div:first-child {
  max-width: 620px;
  position: relative;
  z-index: 2;
}

.hero .eyebrow {
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(34px, 4.8vw, 63px);
  margin-bottom: 20px;
}

.hero h1 span {
  display: block;
  color: #dce7e8;
  font-weight: 500;
}

.hero p {
  max-width: 520px;
  color: #c5d6da;
  margin: 0;
}

.hero-decoration {
  width: 370px;
  height: 300px;
  position: absolute;
  right: 5%;
  top: 15px;
  opacity: 0.5;
}

.hero-grid {
  position: absolute;
  width: 330px;
  height: 260px;
  right: 15px;
  top: 20px;
  background-image:
    linear-gradient(rgba(255,255,255,0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.1) 1px, transparent 1px);
  background-size: 30px 30px;
  transform: perspective(350px) rotateY(-22deg) rotateX(16deg);
}

.hero-circle {
  position: absolute;
  border: 1px solid rgba(227, 168, 55, 0.5);
  border-radius: 50%;
}

.circle-one {
  width: 260px;
  height: 260px;
  right: 35px;
  top: 15px;
}

.circle-two {
  width: 150px;
  height: 150px;
  right: 95px;
  top: 70px;
  background: rgba(227, 168, 55, 0.08);
}

/* SECTIONS */

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin: 48px 0 20px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.metric-card-label {
  min-height: 35px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.4;
}

.metric-card-value {
  color: var(--primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 27px;
  font-weight: 700;
  margin: 14px 0 7px;
}

.metric-card-note {
  color: var(--text-muted);
  font-size: 11px;
}

.metric-card-accent {
  border-top: 3px solid var(--accent);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.85fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 25px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 23px;
}

.panel-header .eyebrow {
  margin-bottom: 6px;
}

.select-control {
  min-height: 42px;
  padding: 0 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 9px;
  outline: none;
}

.select-control:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(27, 82, 102, 0.1);
}

.select-small {
  max-width: 260px;
}

.quick-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 11px;
  border-radius: 12px;
  transition: 0.2s ease;
}

.quick-link:hover {
  background: var(--surface-soft);
}

.quick-link-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: #93670c;
  font-size: 16px;
}

.quick-link span:nth-child(2) {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.quick-link strong {
  font-size: 13px;
}

.quick-link small {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 3px;
}

.quick-link > b {
  color: var(--text-muted);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: 145px 1fr 100px;
  align-items: center;
  gap: 12px;
}

.chart-label {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-track,
.ranking-track {
  width: 100%;
  height: 11px;
  overflow: hidden;
  background: #edf1f3;
  border-radius: 30px;
}

.chart-fill,
.ranking-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary-light), var(--accent));
  transition: width 0.55s ease;
}

.chart-value {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

/* FILTERS */

.filters-panel {
  display: flex;
  align-items: end;
  gap: 15px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 160px;
}

.field-grow {
  flex: 1;
}

.field-group label {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.field-help {
  color: var(--text-muted);
  font-size: 11px;
}

.ranking-summary {
  color: var(--text-soft);
  font-size: 12px;
  margin-bottom: 20px;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.ranking-row {
  display: grid;
  grid-template-columns: 33px 175px 1fr 125px;
  align-items: center;
  gap: 13px;
}

.ranking-position {
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 13px;
  font-weight: 700;
}

.ranking-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-value {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

/* STATES */

.state-layout {
  display: grid;
  grid-template-columns: 285px minmax(0, 1fr);
  gap: 19px;
  align-items: start;
}

.state-selector-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  box-shadow: var(--shadow);
}

.search-wrapper {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.search-wrapper span {
  color: var(--text-muted);
  font-size: 20px;
}

.search-wrapper input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.state-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 610px;
  overflow-y: auto;
  margin-top: 13px;
  padding-right: 3px;
}

.state-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.2s ease;
}

.state-item:hover,
.state-item.active {
  background: var(--accent-soft);
}

.state-item.active {
  color: var(--primary);
  font-weight: 700;
}

.state-uf {
  display: grid;
  place-items: center;
  width: 31px;
  height: 27px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--primary-light);
  font-size: 10px;
  font-weight: 700;
}

.state-item.active .state-uf {
  background: var(--accent);
  color: var(--primary);
}

.state-name {
  font-size: 12px;
}

.state-profile {
  min-width: 0;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.profile-title {
  display: flex;
  align-items: center;
  gap: 15px;
}

.profile-uf {
  display: grid;
  place-items: center;
  width: 65px;
  height: 65px;
  border-radius: 17px;
  background: var(--primary);
  color: var(--accent);
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.profile-title h2 {
  margin-bottom: 5px;
}

.profile-title p {
  margin: 0;
  font-size: 12px;
}

.profile-sections {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.profile-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 23px;
  box-shadow: var(--shadow);
}

.profile-section h3 {
  color: var(--primary);
  margin-bottom: 17px;
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.profile-metric {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 14px;
}

.profile-metric-label {
  display: block;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.45;
}

.profile-metric-value {
  display: block;
  color: var(--primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-top: 9px;
}

/* COMPARISON */

.comparison-filters {
  align-items: start;
}

.comparison-filters .field-group {
  min-height: 100%;
}

#comparisonStates {
  min-height: 150px;
  padding: 8px;
}

#comparisonStates option {
  padding: 7px;
}

.comparison-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}

.comparison-table th,
.comparison-table td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.comparison-table th {
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.comparison-table td {
  color: var(--text);
  font-size: 13px;
}

.comparison-table td strong {
  color: var(--primary);
  font-size: 15px;
}

/* CATALOG */

.catalog-toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.catalog-search {
  flex: 1;
  max-width: 550px;
}

.indicator-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.indicator-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.indicator-card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.indicator-card h3 {
  color: var(--primary);
  font-size: 14px;
  line-height: 1.4;
}

.indicator-tag {
  flex: 0 0 auto;
  color: #7e5b16;
  background: var(--accent-soft);
  border-radius: 20px;
  font-size: 10px;
  padding: 5px 8px;
}

.indicator-meta {
  display: flex;
  gap: 14px;
  color: var(--text-muted);
  font-size: 11px;
}

/* SOURCES */

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.source-card {
  min-height: 225px;
}

.source-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: #93670c;
  font-size: 20px;
  margin-bottom: 22px;
}

.source-card h3 {
  margin-bottom: 11px;
}

.source-card p {
  font-size: 13px;
  margin: 0;
}

.dataset-details {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.dataset-stat {
  background: var(--surface-soft);
  border-radius: 12px;
  padding: 17px;
}

.dataset-stat strong {
  display: block;
  color: var(--primary);
  font-family: "Space Grotesk", sans-serif;
  font-size: 23px;
  margin-bottom: 5px;
}

.dataset-stat span {
  color: var(--text-soft);
  font-size: 11px;
}

/* STATES EMPTY */

.empty-state {
  display: grid;
  place-items: center;
  min-height: 130px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.empty-profile {
  display: grid;
  place-items: center;
  min-height: 390px;
  padding: 40px;
  background: var(--surface);
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  text-align: center;
}

.empty-profile-icon {
  display: grid;
  place-items: center;
  width: 65px;
  height: 65px;
  margin-bottom: 17px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 27px;
}

.empty-profile h2 {
  font-size: 23px;
  margin-bottom: 8px;
}

.empty-profile p {
  max-width: 330px;
  margin: 0;
  font-size: 13px;
}

.loading-card {
  min-height: 137px;
  border-radius: var(--radius);
  background: linear-gradient(
    90deg,
    #edf1f3 25%,
    #f8fafb 50%,
    #edf1f3 75%
  );
  background-size: 200% 100%;
  animation: loading 1.4s infinite;
}

@keyframes loading {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

/* FOOTER */

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 5vw 35px;
  color: var(--text-muted);
  font-size: 11px;
}

/* TOAST */

.toast {
  position: fixed;
  right: 25px;
  bottom: 25px;
  z-index: 50;
  max-width: 350px;
  padding: 13px 17px;
  border-radius: 10px;
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: 0.25s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* RESPONSIVE */

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .source-grid {
    grid-template-columns: 1fr;
  }

  .indicator-catalog {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 850px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    width: 275px;
    min-width: 275px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    width: 100%;
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .topbar {
    gap: 15px;
  }

  .breadcrumb {
    flex: 1;
  }

  .state-layout {
    grid-template-columns: 1fr;
  }

  .state-list {
    max-height: 230px;
  }

  .profile-header {
    align-items: start;
    flex-direction: column;
  }

  .filters-panel,
  .comparison-filters {
    align-items: stretch;
    flex-direction: column;
  }

  .field-group {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .page-content {
    padding: 30px 18px 20px;
  }

  .topbar {
    padding: 0 18px;
  }

  .hero {
    min-height: 390px;
    padding: 32px 25px;
  }

  .hero-decoration {
    right: -100px;
    bottom: -40px;
    top: auto;
    transform: scale(0.8);
  }

  .section-heading,
  .panel-header {
    align-items: start;
    flex-direction: column;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 110px 1fr 78px;
    gap: 7px;
  }

  .ranking-row {
    grid-template-columns: 25px 125px 1fr 78px;
    gap: 7px;
  }

  .ranking-name {
    font-size: 11px;
  }

  .catalog-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .catalog-search {
    max-width: none;
  }

  .dataset-details {
    grid-template-columns: 1fr;
  }

  .footer {
    align-items: start;
    flex-direction: column;
    padding-left: 18px;
    padding-right: 18px;
  }
}