/* =============================================
   Statistics Dashboard  (/v1/statistics)
   Matches the dark playground theme (style.css tokens).
   Enlarged sizing pass for sales-demo readability — same
   content, bigger cards / table / controls / type.
   ============================================= */

.stats-area {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  display: none;
}
.stats-area.active { display: block; }

.stats-wrap {
  max-width: 1640px;
  margin: 0 auto;
  padding: 30px 40px 90px;
}

/* ---- Header / controls ---- */
.stats-head { margin-bottom: 26px; }

.stats-title-row { margin-bottom: 18px; }
.stats-title {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.stats-sub {
  display: block;
  margin-top: 7px;
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.stats-sub code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--accent-light);
  background: var(--surface2);
  padding: 2px 7px;
  border-radius: 5px;
}

.stats-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stats-ctl { display: flex; flex-direction: column; gap: 7px; }
.stats-ctl-label {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.stats-select, .stats-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 15px;
  min-width: 210px;
}
.stats-input:focus, .stats-select:focus {
  outline: none;
  border-color: var(--accent-light);
}
.stats-ctl-check { justify-content: flex-end; padding-bottom: 11px; }
.stats-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
}
.stats-check input { width: 18px; height: 18px; accent-color: var(--accent-light); }

.stats-refresh-btn {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-light);
  border-radius: var(--radius-sm);
  padding: 13px 34px;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.stats-refresh-btn:hover:not(:disabled) { background: var(--accent-light); }
.stats-refresh-btn:disabled { opacity: .55; cursor: default; }

/* ---- Summary cards ---- */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(248px, 1fr));
  gap: 18px;
  margin: 26px 0;
}
.stats-cards:empty { display: none; }
.stats-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 22px 26px;
}
.stats-card-good { border-left-color: var(--green); }
.stats-card-warn { border-left-color: var(--yellow); }
.stats-card-bad  { border-left-color: var(--red); }
.stats-card-val {
  font-size: 42px;
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stats-card-label {
  font-size: 15px;
  color: var(--text-dim);
  margin-top: 8px;
  font-weight: 600;
}
.stats-card-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 5px;
}

/* ---- Status / empty ---- */
.stats-status {
  padding: 40px 20px;
  text-align: center;
  font-size: 15px;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.stats-status-error {
  color: var(--red);
  border-color: var(--red);
  border-style: solid;
  background: rgba(248, 113, 113, 0.06);
}

/* ---- Table ---- */
.stats-table-wrap { margin-top: 6px; }
.stats-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 15px;
}
.stats-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface2);
  color: var(--text-dim);
  font-weight: 700;
  text-align: left;
  padding: 14px 16px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.stats-table th.num, .stats-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.stats-table tbody tr:last-child td { border-bottom: none; }
.stats-table tbody tr:hover { background: var(--surface2); }
.stats-table .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-dim);
  font-size: 14px;
}
.stats-model-pill {
  display: inline-block;
  background: var(--surface3);
  border: 1px solid var(--border-hover);
  border-radius: 7px;
  padding: 4px 11px;
  font-size: 14px;
  color: var(--accent-light);
  font-weight: 600;
}
.cell-good { color: var(--green); font-weight: 700; }
.cell-warn { color: var(--yellow); font-weight: 700; }
.cell-bad  { color: var(--red); font-weight: 700; }

/* ---- Pager ---- */
.stats-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 22px;
}
.stats-page-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  font-size: 14px;
  cursor: pointer;
}
.stats-page-btn:hover:not(:disabled) { border-color: var(--accent-light); }
.stats-page-btn:disabled { opacity: .4; cursor: default; }
.stats-page-info { font-size: 14px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

/* Statistics tab accent in the mode switcher */
.mode-tab-stats.active { color: var(--cyan); }
