/* ============================================================
   Charts — glance stats + paper chart cards
   ============================================================ */

.aggregate-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}

.aggregate-cell {
  background: var(--paper-light);
  background-image: var(--paper-texture);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-4) var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  position: relative;
}

/* Neutral corner marker — these are non-directional stats (events, paired,
   7d avg, missing), so the strict am/pm/leaf accents don't apply here. */
.aggregate-cell::after {
  content: "";
  position: absolute;
  top: var(--sp-3); right: var(--sp-3);
  width: 8px; height: 8px;
  border-radius: var(--r-full);
  background: var(--ink-faint);
}

/* Directional breakdown cells carry the strict am/pm accent (sun = to_work,
   clay = from_work) to match the "太陽色＝上班、黃泥色＝下班" legend. */
.aggregate-cell--am::after { background: var(--am-deep); }
.aggregate-cell--pm::after { background: var(--pm-deep); }

/* Glance numerals stay mono + tnum for tabular alignment (spec §02/§06). */
.aggregate-cell .num {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1;
  font-size: var(--fs-2xl);
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.aggregate-cell .label {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.charts-intro {
  margin: 0 0 var(--sp-6);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--ink-muted);
}

.chart-section {
  background: var(--paper-light);
  background-image: var(--paper-texture);
  border: 1px solid var(--ink-line);
  border-radius: var(--r-sm);
  padding: var(--sp-4);
  margin-bottom: var(--sp-6);
  box-shadow: var(--shadow-1);
}

.chart-section header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px dashed var(--ink-line);
}

.chart-section header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--ink);
}

.chart-section header h2 .icon-sm { color: var(--am-deep); }

.chart-section header .n-count {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-feature-settings: "tnum" 1;
  letter-spacing: 0.04em;
}

.chart-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
}

.chart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ink-muted);
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
}
.chart-empty svg { color: var(--ink-faint); }

.chart-low-sample-banner {
  background: var(--warning-bg);
  color: var(--am-deep);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--am-deep);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-2);
  display: inline-block;
}

@media (min-width: 720px) {
  .aggregate-row {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-6);
  }
  .chart-section { margin-bottom: 0; }
  .chart-wrap { aspect-ratio: 4 / 3; }
}
