/* Trang Thống kê */
.stats-head { display: flex; align-items: center; justify-content: space-between; }
.stats-head h1 { font-size: 30px; font-weight: 800; }

.stats-head .seg { display: flex; padding: 3px; border-radius: 999px; background: var(--card); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink); }
.stats-head .seg label { position: relative; }
.stats-head .seg input { position: absolute; opacity: 0; }
.stats-head .seg span { display: flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; font-size: calc(14rem / 17); font-weight: 800; color: var(--muted); transition: background .3s var(--spring), color .2s; }
.stats-head .seg input:checked + span { background: var(--orange); color: var(--ink); }
.stats-head .seg input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 2px; }

.donut-card, .week-card { padding: 18px 16px; border-radius: 26px; display: flex; flex-direction: column; gap: 14px; }
.donut-card h2, .week-card h2 { font-size: calc(19rem / 17); font-weight: 800; }

.donut-wrap { position: relative; align-self: center; width: 220px; height: 220px; perspective: 600px; }
.donut { width: 100%; height: 100%; transform: rotate(-90deg); animation: spin-in 1s var(--spring) both; }
@keyframes spin-in { from { transform: rotate(-270deg) scale(.6); opacity: 0; } }
.donut circle { fill: none; }
.donut .outline { stroke: var(--ink); stroke-width: 8; }   /* viền mực = phần thò ra 2 bên cung màu */
.donut .seg-arc {
  stroke: var(--col); stroke-width: 5;
  stroke-dasharray: var(--p) 100; stroke-dashoffset: var(--o);
  animation: draw 1s var(--soft-spring) var(--d) both;
}
@keyframes draw { from { stroke-dasharray: 0 100; } }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-center .num { font-size: 22px; font-weight: 800; line-height: 1; }
.donut-center .muted { max-width: 110px; font-size: calc(12rem / 17); font-weight: 700; margin-top: 4px; line-height: 1.3; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.legend li { display: grid; grid-template-columns: 36px 84px 1fr auto; align-items: center; gap: 10px; }
.bubble.sm { width: 36px; height: 36px; border-radius: 11px; }
.bubble.sm .i { width: 20px; height: 20px; }
.legend .name { font-size: calc(14rem / 17); font-weight: 800; }
.legend .num { font-size: calc(15rem / 17); font-weight: 700; }
.track-bar { height: 12px; border-radius: 999px; background: var(--soft); border: 2px solid var(--ink); overflow: hidden; }
.track-bar i {
  display: block; height: 100%; width: var(--w); background: var(--col); border-right: 2px solid var(--ink);
  transform-origin: left; animation: grow 1s var(--soft-spring) .5s both;
}

.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; height: 170px; align-items: end; }
.bars > div { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bars i {
  display: block; width: 100%; height: calc(var(--h) * .72); border-radius: 10px; transform-origin: bottom;
  background: var(--ride); border: 2px solid var(--ink); box-shadow: 0 3px 0 var(--ink);
  animation: grow-y .9s var(--spring) var(--d) both;
}
.bars .peak i { background: var(--orange); }
.bars .v { min-height: 15px; font-size: calc(11rem / 17); font-weight: 800; color: var(--muted); }
.bars .peak .v { color: var(--orange-ink); }
.bars .day { font-size: calc(12rem / 17); font-weight: 800; color: var(--muted); }

.tip { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 16px; background: var(--soft); font-size: calc(14rem / 17); font-weight: 700; }
.tip img { flex: none; }
.week-card { margin-bottom: 24px; }
