/* The Trends section of the Stats tab (administrators): effectiveness cards, a bar
   chart per series and the month-by-month table. Bars only decorate; every value is
   also written as text and in the table. Loaded after stats.css, so it uses its
   tokens. */

.stats-trends { --section: var(--c-stats); margin: 1.5rem 0 1rem; }
.stats-trends > h2 { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.7rem; padding-bottom: 0.35rem; font-size: 1.2rem; color: var(--section); border-bottom: 3px solid var(--section); }
.trends-body h3 { display: flex; align-items: center; gap: 0.45rem; margin: 1.4rem 0 0.6rem; font-size: 1rem; color: var(--text); }
.trends-body h3 .icon { color: var(--section); }

.trend-controls { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: end; }
.trend-controls .field { margin: 0; min-width: 9rem; flex: 1; }

/* Effectiveness cards */
.trend-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.6rem; }
.trend-card { padding: 0.6rem 0.8rem; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--section); border-radius: var(--radius); box-shadow: var(--shadow); }
.trend-card h4 { margin: 0; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.trend-card strong { display: block; font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.trend-card p { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--text); }

/* Bar charts */
.trend-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0.75rem; }
.trend-chart { --series: var(--c-projects); margin: 0; padding: 0.6rem 0.8rem; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--series); border-radius: var(--radius); box-shadow: var(--shadow); }
.trend-chart figcaption { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 0.4rem; }
.trend-title { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.trend-total { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.trend-bars { display: flex; gap: 0.2rem; height: 9rem; }
.trend-col { flex: 1; min-width: 0; display: grid; grid-template-rows: 1.1rem 1fr 1.1rem; justify-items: center; }
.trend-value { font-size: 0.7rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.trend-bar { align-self: end; width: 100%; max-width: 1.6rem; height: var(--pct, 0%); border-radius: 3px 3px 0 0; background: var(--series); }
.trend-month { font-size: 0.65rem; color: var(--muted); white-space: nowrap; overflow: visible; }
.trend-chart.dense .trend-bars { gap: 0.1rem; }

/* The numbers behind the charts */
.trend-table { width: 100%; margin-top: 0.9rem; border-collapse: collapse; font-size: 0.85rem; }
.trend-table caption { padding-bottom: 0.3rem; text-align: left; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.trend-table th, .trend-table td { padding: 0.3rem 0.4rem; border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.trend-table thead th { border-top: 0; border-bottom: 1px solid var(--line); font-size: 0.7rem; font-weight: 600; text-align: left; color: var(--muted); }
.trend-table th[scope="row"] { text-align: left; font-weight: 600; white-space: nowrap; }
.trend-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.trend-table thead th.num { text-align: right; }

@media (max-width: 420px) {
  .trend-charts { grid-template-columns: 1fr; }
  .trend-table { font-size: 0.78rem; }
  .trend-table th, .trend-table td { padding-inline: 0.25rem; }
}
