/* Stats page: quick-view cards, sections, charts, tables */

.stats-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats-filters-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.stats-filters-form label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.stats-filters-form input[type="date"],
.stats-filters-form select {
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.quick-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stats-sections-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

@media (min-width: 1200px) {
  .stats-sections-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1800px) {
  .stats-sections-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stats-section {
  min-width: 0;
  overflow-x: auto;
}

.stats-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--text-muted);
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 420px;
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: 8px;
  padding: 0.5rem;
}

.chart-wrap canvas {
  max-width: 100%;
  max-height: 100%;
}

.map-container {
  height: 420px;
  margin-bottom: 1rem;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.stats-table {
  width: 100%;
  min-width: 300px;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
}

.stats-table th,
.stats-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

/* Prevent columns from shrinking too small */
.stats-table th:first-child,
.stats-table td:first-child {
  min-width: 6rem;
}

.stats-table th:not(:first-child),
.stats-table td:not(:first-child) {
  min-width: 4rem;
}

.stats-table th:last-child,
.stats-table td:last-child {
  white-space: nowrap;
}

.stats-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.stats-table tbody tr:hover {
  background: rgba(122, 162, 247, 0.08);
}

.stats-table tbody tr:last-child td {
  border-bottom: none;
}

.stats-table .path-cell {
  min-width: 8rem;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-table .path-cell code {
  font-size: 0.85rem;
}

.stats-message {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}
