/* Stats view: panels, controls, charts grid and history tables. */

/* The stats page spans the full width (dashboard/admin keep the narrow one). */
.container { max-width: none; }

.page-title {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 16px;
}

/* ---------- Panels (always expanded) ---------- */
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-top: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-title {
  font-size: 15.5px;
  font-weight: 700;
  padding: 16px 20px;
  background: var(--card-2);
  border-bottom: 1px solid var(--border);
}

.panel .controls, #chart, .chart-sub, .hist { padding: 0 20px; }
.panel .controls { padding-top: 14px; }
#chart { height: 360px; margin: 14px 0 4px; }
.chart-sub { color: var(--muted); font-size: 12px; padding: 14px 0; }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ctrl-group { display: flex; gap: 4px; background: var(--card-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px; }

.btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 11px;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.btn:hover { color: var(--text); background: #edf1f7; }
.btn.active { background: var(--accent); color: #fff; }
.btn.active:hover { background: var(--accent); }

/* ---------- Stats grid ---------- */
.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 14px 20px 20px;
}

.chart-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px 14px;
}

.chart-box > div:not(.chart-head) { height: 400px; }

/* Per-chart header: title on the left, time selector on the right */
.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.chart-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.chart-selector {
  display: flex;
  gap: 3px;
}

.mini-btn {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.mini-btn:hover { color: var(--text); }
.mini-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- History tables ---------- */
.hist { padding: 14px 20px 20px; }
.hist h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin: 14px 0 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }

thead th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--card-2);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.on-cell { color: var(--green); font-weight: 600; }

.hist-empty { margin-top: 12px; color: var(--muted); font-size: 13px; }
