.skeleton-box,
.skeleton-line {
  display: inline-block;
  height: var(--space-2);
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--skeleton-base), var(--skeleton-highlight), var(--skeleton-base));
  background-size: 200% 100%;
  animation: skeleton-shimmer var(--skeleton-duration) infinite linear;
}

.skeleton-line { display: block; width: 100%; }

.skeleton--sm { width: var(--space-4); }
.skeleton--md { width: var(--space-8); }
.skeleton--lg { width: calc(var(--space-8) * 2); }
.skeleton--icon { width: var(--icon-size-md); height: var(--icon-size-md); }
.skeleton--pill { width: var(--space-8); border-radius: var(--radius-lg); }
.skeleton--w-30pct { width: 30%; }
.skeleton--w-60pct { width: 60%; }
.skeleton--w-90pct { width: 90%; }

@keyframes skeleton-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-box, .skeleton-line { animation: none; }
}

/* Table / page skeleton (table-skeleton.js). Same tokens and shimmer as above; rows reuse .grid td height, so no layout shift. */
.skel__cell {
  display: block; box-sizing: border-box; width: 70%; height: 1lh; padding-block: .3em; background-clip: content-box;
  background-image: linear-gradient(90deg, var(--skeleton-base), var(--skeleton-highlight), var(--skeleton-base));
  background-size: 200% 100%;
  animation: skeleton-shimmer var(--skeleton-duration) infinite linear;
}
.skel__row td.num .skel__cell { margin-left: auto; width: 55%; }
.skel__row td:nth-child(5n+1) .skel__cell { width: 80%; }
.skel__row td:nth-child(5n+3) .skel__cell { width: 90%; }
.skel__row td:nth-child(5n+4) .skel__cell { width: 55%; }
.skel__row:nth-child(3n) td .skel__cell { width: 50%; }
.skel__row td { pointer-events: none; }
/* Page level (sidebar navigation): the real content is hidden, not removed, so a cancelled navigation / bfcache restore only drops the class. */
.is-navigating > .page > :not(.skel-page) { display: none; }
.skel-page { display: flex; flex-direction: column; gap: var(--space-4); --skeleton-base: rgba(130, 130, 130, 0.22); --skeleton-highlight: rgba(130, 130, 130, 0.38); }
.skel-page .skel__cell { height: var(--space-6); padding: 0; background-clip: border-box; border-radius: var(--radius-sm); }
.skel-page__title { width: 30%; height: var(--space-8); }
.skel-page__filters { display: flex; gap: var(--space-2); }
.skel-page__filters .skel__cell { width: 12rem; height: 36px; }
.skel-page .table-wrapper .skel__cell { height: 1lh; padding-block: .3em; background-clip: content-box; border-radius: 0; }
.skel-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1000; overflow: hidden; pointer-events: none;
}
.skel-progress::before {
  content: ""; position: absolute; inset: 0; width: 40%; background: var(--color-accent);
  animation: skel-progress 1.2s ease-in-out infinite;
}
@keyframes skel-progress { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
@media (prefers-reduced-motion: reduce) {
  .skel__cell { animation: none; }
  .skel-progress::before { animation: none; width: 100%; opacity: .6; }
}
.skel-block { margin-top: var(--space-4); }
