*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #0d1117;
  color: #e6edf3;
  line-height: 1.5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
  font-weight: 700;
}

.subtitle {
  margin: 0;
  color: #8b949e;
  font-size: 0.875rem;
}

.stack-note {
  margin: 0.5rem 0 0;
  color: #58a6ff;
  font-size: 0.8rem;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 1rem;
  margin: 1.5rem 0;
}

.filter-group {
  flex: 1 1 180px;
  min-width: 140px;
}

.filter-group--wide {
  flex: 2 1 260px;
}

.filter-group label {
  display: block;
  font-size: 0.75rem;
  color: #8b949e;
  margin-bottom: 0.35rem;
}

.filter-group select,
.filter-group input[type="search"] {
  width: 100%;
  background: #0d1117;
  color: #e6edf3;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
}

.filter-group input[type="range"] {
  width: 100%;
  accent-color: #58a6ff;
}

.range-marks {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #8b949e;
  margin-top: 0.25rem;
}

.hint {
  display: block;
  font-size: 0.7rem;
  color: #6e7681;
  margin-top: 0.25rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  background: linear-gradient(145deg, #161b22 0%, #1c2128 100%);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

.kpi-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b949e;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.kpi-hint {
  font-size: 0.75rem;
  color: #8b949e;
  margin-top: 0.15rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid #30363d;
  margin-bottom: 0;
}

.tab {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px 8px 0 0;
  color: #8b949e;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.65rem 1.25rem;
  font-family: inherit;
}

.tab:hover {
  color: #c9d1d9;
}

.tab.active {
  color: #58a6ff;
  background: #161b22;
  border-color: #30363d #30363d #161b22;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 0.75rem;
}

.insight {
  color: #8b949e;
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}

.insight strong {
  color: #c9d1d9;
}

.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.chart {
  min-height: 320px;
}

.chart--wide {
  grid-column: span 1;
}

.chart--full {
  margin-top: 1rem;
}

@media (max-width: 900px) {
  .chart-row {
    grid-template-columns: 1fr;
  }
}

.table-toolbar {
  margin-bottom: 0.75rem;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th,
.data-table td {
  border: 1px solid #30363d;
  padding: 0.65rem 0.5rem;
  text-align: center;
}

.data-table th {
  background: #21262d;
  color: #58a6ff;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  background: #2d333b;
}

.data-table td:first-child,
.data-table th:first-child {
  text-align: center;
}

.data-table td:nth-child(2),
.data-table th:nth-child(2) {
  text-align: left;
  font-weight: 500;
  min-width: 130px;
}

.data-table tbody tr:hover {
  background: rgba(88, 166, 255, 0.05);
}

.data-table tr.row-leader {
  background: rgba(81, 207, 102, 0.08);
}

.positive {
  color: #51cf66;
}

.negative {
  color: #ff6b6b;
}

.status-msg {
  text-align: center;
  color: #8b949e;
  padding: 2rem;
}

.status-msg.error {
  color: #ff6b6b;
}
