* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, sans-serif;
  background: #f5f7fa;
  color: #1f2933;
  line-height: 1.4;
}

header {
  background: #14213d;
  color: #ffffff;
  padding: 1.5rem 2rem;
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
}

main {
  padding: 1.5rem 2rem 3rem;
  max-width: 1400px;
  margin: 0 auto;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.controls label {
  font-weight: 600;
}

.controls input {
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
  min-width: 200px;
}

.controls button {
  background: #fca311;
  color: #111827;
  border: none;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.controls button:hover,
.controls button:focus {
  background: #fbbf24;
}

.status {
  margin-bottom: 1.5rem;
  min-height: 1.2rem;
  font-weight: 500;
}

.status.error {
  color: #b91c1c;
}

.status.success {
  color: #047857;
}

.content {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.2fr);
  gap: 1.5rem;
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.card h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

tbody tr.active {
  background: #eef2ff;
}

.value {
  font-variant-numeric: tabular-nums;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chart-header .metric-name {
  font-size: 1.1rem;
  font-weight: 600;
}

.chart-header .unit-badge {
  background: #e0efff;
  color: #1d4ed8;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.chart-wrapper {
  position: relative;
  min-height: 360px;
}

.chart-wrapper canvas {
  width: 100% !important;
  height: 100% !important;
}

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

  main {
    padding: 1.5rem 1.25rem 3rem;
  }
}

@media (max-width: 520px) {
  header {
    padding: 1.5rem 1.25rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .controls input {
    width: 100%;
  }
}
