/* ═══════════════════════════════════════════
   ADMIN DASHBOARD
   ═══════════════════════════════════════════ */

.admin-section {
  padding: var(--space-md) 0 var(--space-xl);
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: var(--space-lg);
}

.admin-last-update {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-refresh-btn {
  font-size: 11px;
  padding: 6px 12px;
}

/* ── Loading ── */
.admin-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: var(--space-xl);
  color: var(--text2);
  font-size: 13px;
  font-weight: 700;
}

/* ── Stat cards ── */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: var(--space-lg);
}

.admin-stat-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
  box-shadow: var(--sh-sm);
}

.admin-stat-icon {
  font-size: 20px;
  margin-bottom: 6px;
  font-family: var(--font-jp);
}

.admin-stat-num {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 4px;
}

.admin-stat-lbl {
  font-size: 10px;
  font-weight: 800;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Charts row ── */
.admin-charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: var(--space-lg);
}

.admin-chart-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-md);
  box-shadow: var(--sh-sm);
}

.admin-chart-title {
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 12px;
}

/* ── Bar chart ── */
.admin-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding-bottom: 36px;
  position: relative;
}

.admin-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}

.admin-bar-fill {
  width: 100%;
  min-height: 2px;
  border-radius: 3px 3px 0 0;
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  transition: height var(--t-base);
}

.admin-bar-val {
  font-size: 8px;
  font-weight: 900;
  color: #fff;
  padding-top: 2px;
}

.admin-bar-lbl {
  position: absolute;
  bottom: -18px;
  font-size: 8px;
  font-weight: 700;
  color: var(--text3);
  white-space: nowrap;
}

/* ── Donut chart ── */
.admin-donut-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-donut-svg {
  width: 100px;
  min-width: 100px;
}

.admin-donut-total-label {
  font-size: 10px;
  font-weight: 700;
  fill: var(--text2);
  font-family: var(--font-ui);
}

.admin-donut-total-num {
  font-size: 18px;
  font-weight: 900;
  fill: var(--text);
  font-family: var(--font-ui);
}

.admin-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.admin-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.admin-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-legend-label {
  flex: 1;
  font-weight: 700;
  color: var(--text);
}

.admin-legend-val {
  font-weight: 900;
  color: var(--text2);
}

/* ── Progress bars chart ── */
.admin-progress-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-progress-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-progress-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
}

.admin-progress-bar-wrap {
  height: 8px;
  background: var(--surface2);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.admin-progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width var(--t-base);
}

.admin-progress-val {
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
}

.admin-progress-val span {
  font-weight: 600;
  color: var(--text2);
}

/* ── Tabella ── */
.admin-table-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}

.admin-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md);
  border-bottom: 2px solid var(--border);
  gap: 12px;
}

.admin-search {
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface2);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  outline: none;
  transition: border var(--t-fast);
  width: 220px;
}
.admin-search:focus { border-color: var(--sky); }

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

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.admin-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 900;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .08em;
  background: var(--surface2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--sky-s); }

.admin-td-name  { font-weight: 800; }
.admin-td-email { color: var(--text2); font-size: 11px; }

.admin-progress-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(90deg, var(--sky-s) var(--p), var(--surface2) var(--p));
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 2px 8px;
}

.admin-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  margin-right: 5px;
  vertical-align: middle;
}
.admin-status-dot.active { background: var(--mint); box-shadow: 0 0 0 2px var(--mint-s); }

.admin-table-footer {
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text2);
  border-top: 2px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .admin-stats-row   { grid-template-columns: repeat(3, 1fr); }
  .admin-charts-row  { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .admin-stats-row   { grid-template-columns: repeat(2, 1fr); }
  .admin-charts-row  { grid-template-columns: 1fr; }
  .admin-search      { width: 100%; }
  .admin-table-header { flex-direction: column; align-items: flex-start; }
}

/* ── Bar chart label rotazione ── */
.admin-bar-lbl {
  position: absolute;
  bottom: -28px;
  font-size: 8px;
  font-weight: 700;
  color: var(--text3);
  white-space: pre;
  text-align: center;
  line-height: 1.3;
}