:root {
  --bg: #091220;
  --bg-accent: #10233f;
  --surface: rgba(15, 23, 42, 0.86);
  --surface-strong: #0f172a;
  --surface-soft: rgba(30, 41, 59, 0.78);
  --border: rgba(148, 163, 184, 0.18);
  --text-main: #e5eefb;
  --text-soft: #94a3b8;
  --text-muted: #64748b;
  --brand: #38bdf8;
  --brand-strong: #14b8a6;
  --success: #22c55e;
  --danger: #fb7185;
  --warning: #f59e0b;
  --shadow-lg: 0 28px 80px rgba(2, 6, 23, 0.45);
  --shadow-sm: 0 12px 28px rgba(2, 6, 23, 0.22);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 10% 20%, rgba(20, 184, 166, 0.18), transparent 24%),
    radial-gradient(circle at 84% 14%, rgba(59, 130, 246, 0.2), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(249, 115, 22, 0.12), transparent 30%),
    linear-gradient(160deg, var(--bg), var(--bg-accent));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at center, black 46%, transparent 100%);
  opacity: 0.42;
}

.dashboard {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(14px);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-card {
  width: min(100%, 420px);
  padding: 28px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(11, 18, 32, 0.94));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: var(--shadow-lg);
  text-align: left;
}

.loading-card h2 {
  margin: 10px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.6rem;
  letter-spacing: -0.04em;
}

.loading-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #bff4ff;
}

.loading-badge::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.64);
  animation: pulse 1.2s ease-in-out infinite;
}

.hero,
.panel,
.metric-card {
  backdrop-filter: blur(16px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding: 30px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.72));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.hero__content {
  max-width: 760px;
}

.hero__eyebrow,
.panel__eyebrow {
  margin: 0 0 10px;
  color: #67e8f9;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1,
.panel__header h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.05em;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.hero__description {
  margin: 14px 0 0;
  max-width: 700px;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.hero__meta {
  display: grid;
  gap: 12px;
  min-width: 220px;
}

.hero-pill {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.66);
  border: 1px solid rgba(148, 163, 184, 0.14);
  box-shadow: var(--shadow-sm);
}

.hero-pill__label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-pill strong {
  font-size: 1rem;
}

.panel {
  padding: 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.72));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel__header--table {
  align-items: flex-end;
}

.filters-panel {
  margin-bottom: 24px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field__label {
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.34);
  color: var(--text-main);
  font: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.16s ease;
}

.field input::placeholder {
  color: var(--text-muted);
}

.field input:focus,
.field select:focus,
.button:focus-visible,
.sort-button:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.54);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 184, 166, 0.96), rgba(8, 145, 178, 0.96));
  color: #ecfeff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.2s ease, border-color 0.2s ease;
}

.button:hover,
.sort-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.button:active,
.sort-button:active {
  transform: translateY(1px);
}

.button--ghost {
  background: rgba(2, 6, 23, 0.36);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text-main);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  padding: 22px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.86), rgba(15, 23, 42, 0.7)),
    rgba(15, 23, 42, 0.82);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.metric-card__label {
  display: block;
  margin-bottom: 12px;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 700;
}

.metric-card__value {
  display: block;
  margin-bottom: 8px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  letter-spacing: -0.05em;
}

.metric-card__hint {
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card--wide {
  grid-column: 1 / -1;
}

.chart-wrap {
  min-height: 310px;
}

.table-panel {
  margin-bottom: 12px;
}

.results-meta {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: right;
}

.table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(2, 6, 23, 0.26);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.data-table th,
.data-table td {
  padding: 16px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  text-align: left;
}

.data-table td {
  color: var(--text-soft);
  font-size: 0.94rem;
}

.data-table tbody tr:hover {
  background: rgba(15, 23, 42, 0.42);
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.sort-button::after {
  content: attr(data-direction);
  color: var(--text-muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  margin-bottom: 18px;
  padding: 24px;
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.32);
  border: 1px dashed rgba(148, 163, 184, 0.2);
  text-align: center;
}

.empty-state h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.4rem;
}

.empty-state p {
  margin: 0;
  max-width: 520px;
  color: var(--text-soft);
  line-height: 1.6;
}

.status-positive {
  color: #86efac;
  font-weight: 700;
}

.status-neutral {
  color: var(--text-soft);
  font-weight: 700;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.12);
    opacity: 0.78;
  }
}

@media (max-width: 1080px) {
  .filters-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .chart-card--wide {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .dashboard {
    width: min(100% - 24px, 1240px);
    padding: 22px 0 36px;
  }

  .hero,
  .panel,
  .metric-card {
    border-radius: 22px;
  }

  .hero {
    flex-direction: column;
    padding: 22px;
  }

  .hero__meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  .panel {
    padding: 20px;
  }

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

  .filters-grid,
  .metrics-grid,
  .hero__meta {
    grid-template-columns: 1fr;
  }

  .results-meta {
    text-align: left;
  }

  .chart-wrap {
    min-height: 280px;
  }
}

@media (max-width: 480px) {
  .dashboard {
    width: min(100% - 16px, 1240px);
  }

  .hero,
  .panel,
  .metric-card,
  .loading-card {
    padding: 18px;
    border-radius: 20px;
  }

  .field input,
  .field select,
  .button {
    min-height: 44px;
  }

  .data-table th,
  .data-table td {
    padding: 14px 12px;
  }
}
