/* Live UI on every page (York, 2026-11-23): loading placeholders where data is coming, and numbers that roll.

   1. Loading placeholders: "I want the UI to be displayed but have a flashing shadow loader on where the data will be
      coming into ... animate like its trying/loading". A placeholder has the shape of what is coming (lines, table rows,
      a number, a card) and a soft light sweeps across it; with reduced motion it only fades gently. The page around it
      is already there, so nothing jumps when the data lands.
      - .sk on any element, plus a shape: .sk-text, .sk-num, .sk-num--lg, .sk-bar, .sk-pill, .sk-circle, .sk-block.
      - data-sk="lines|rows|stats|chart|cards" on a container a script fills: shimmers while it is :empty, gone the moment
        anything is put in it (no script involved).
      - samg-loading.js paints "Loading..." placeholders (.sk-auto, keeping their text and node, which some pages check),
        bare section spinners, and DataTables while they fetch (.sk-dt-first, .sk-dt-refresh).
   2. Rolling numbers (.sn, samg-numbers.js): the reel drawn over a number while it rolls. */
:root {
	--sk-base: rgba(15, 30, 53, .075);
	--sk-glint: rgba(15, 30, 53, .025);
	--sk-shine: rgba(255, 255, 255, .7);
	--sk-speed: 1.5s;
}
[data-theme-mode="dark"] {
	--sk-base: rgba(255, 255, 255, .075);
	--sk-glint: rgba(255, 255, 255, .16);
	--sk-shine: rgba(255, 255, 255, .09);
}

/* ── Shapes ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
.sk {
	position: relative; display: inline-block; overflow: hidden; vertical-align: middle;
	border-radius: 6px; background: var(--sk-base); color: transparent !important; line-height: 1;
	pointer-events: none; user-select: none;
}
.sk::after {
	content: ""; position: absolute; inset: 0; transform: translateX(-100%);
	background: linear-gradient(90deg, transparent 0%, var(--sk-shine) 50%, transparent 100%);
	animation: sk-sweep var(--sk-speed) ease-in-out infinite;
}
.sk-text { width: 8em; height: .78em; border-radius: 4px; }
.sk-num { width: 2.6em; height: .9em; border-radius: 5px; }
.sk-num--lg { width: 5.5rem; height: 1.7rem; border-radius: 8px; }
.sk-bar { display: block; width: 100%; height: 8px; border-radius: 999px; }
.sk-pill { width: 5.5em; height: 1.7em; border-radius: 999px; }
.sk-circle { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.sk-block { display: block; width: 100%; height: 100%; min-height: 1em; border-radius: 10px; }

/* ── Painted placeholders: one pseudo-element in the shimmer, cut to the shape (--sk-mask) of what is coming ──── */
.sk-auto, [data-sk]:empty { position: relative; }
.sk-auto { color: transparent !important; }
.sk-auto > :is(i, .lni, .fa, .fas, .spinner-border, .spinner-grow, svg) { visibility: hidden; }
.sk-auto::before, [data-sk]:empty::before {
	content: ""; position: absolute; inset: var(--sk-inset, 12px 14px); pointer-events: none;
	background: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) 0 0 / 300% 100%;
	animation: sk-pan var(--sk-speed) linear infinite;
	-webkit-mask: var(--sk-mask); mask: var(--sk-mask);
}
/* Three lines of text, the last shorter */
.sk-auto--lines, [data-sk="lines"]:empty {
	min-height: 78px;
	--sk-mask: linear-gradient(#000 0 0) 0 0 / 92% 9px no-repeat, linear-gradient(#000 0 0) 0 20px / 76% 9px no-repeat, linear-gradient(#000 0 0) 0 40px / 54% 9px no-repeat;
}
/* Table rows: four rows of three cells */
.sk-auto--rows, [data-sk="rows"]:empty {
	height: 168px; min-height: 168px;
	--sk-mask:
		linear-gradient(#000 0 0) 0 4px / 24% 10px no-repeat, linear-gradient(#000 0 0) 32% 4px / 30% 10px no-repeat, linear-gradient(#000 0 0) 74% 4px / 18% 10px no-repeat,
		linear-gradient(#000 0 0) 0 40px / 30% 10px no-repeat, linear-gradient(#000 0 0) 32% 40px / 22% 10px no-repeat, linear-gradient(#000 0 0) 74% 40px / 22% 10px no-repeat,
		linear-gradient(#000 0 0) 0 76px / 20% 10px no-repeat, linear-gradient(#000 0 0) 32% 76px / 34% 10px no-repeat, linear-gradient(#000 0 0) 74% 76px / 14% 10px no-repeat,
		linear-gradient(#000 0 0) 0 112px / 27% 10px no-repeat, linear-gradient(#000 0 0) 32% 112px / 26% 10px no-repeat, linear-gradient(#000 0 0) 74% 112px / 20% 10px no-repeat;
}
/* A row of stats: a number over its label, four across */
[data-sk="stats"]:empty {
	min-height: 64px;
	--sk-mask:
		linear-gradient(#000 0 0) 0 0 / 14% 22px no-repeat, linear-gradient(#000 0 0) 0 32px / 18% 8px no-repeat,
		linear-gradient(#000 0 0) 33.3% 0 / 14% 22px no-repeat, linear-gradient(#000 0 0) 30% 32px / 18% 8px no-repeat,
		linear-gradient(#000 0 0) 66.6% 0 / 14% 22px no-repeat, linear-gradient(#000 0 0) 63% 32px / 18% 8px no-repeat,
		linear-gradient(#000 0 0) 100% 0 / 14% 22px no-repeat, linear-gradient(#000 0 0) 96% 32px / 18% 8px no-repeat;
}
/* A chart: one soft block */
[data-sk="chart"]:empty { min-height: 220px; --sk-mask: linear-gradient(#000 0 0); }
[data-sk="chart"]:empty::before { border-radius: 12px; }
/* Cards: a row of three blocks */
[data-sk="cards"]:empty {
	min-height: 150px; --sk-inset: 0;
	--sk-mask: linear-gradient(#000 0 0) 0 0 / 32% 100% no-repeat, linear-gradient(#000 0 0) 50% 0 / 32% 100% no-repeat, linear-gradient(#000 0 0) 100% 0 / 32% 100% no-repeat;
}
/* A short placeholder inside a line of text ("Loading..." in a count or a heading), and an empty one a script fills */
.sk-auto--inline, [data-sk="text"]:empty, [data-sk="num"]:empty { display: inline-block; min-width: 4.5em; min-height: 1em; vertical-align: middle; --sk-inset: 0; --sk-mask: linear-gradient(#000 0 0) 0 50% / 100% .7em no-repeat; }
[data-sk="num"]:empty { min-width: 1.8em; }
/* samg-common.js's loadingSpinnerHTML, wherever a script puts it (a section, the DataTables processing box) */
.sa-spinner.sk-auto { display: block; width: 100%; }

/* ── DataTables while they fetch: shimmering rows on the first load (samg-loading.js puts them in the empty body), then
   a running line under the header over dimmed rows for a search, a sort or another page ── */
.dt-container.sk-dt-first .dt-processing, .dt-container.sk-dt-refresh .dt-processing { display: none !important; }
table.dataTable > tbody > tr.sk-row > td { padding-top: 15px !important; padding-bottom: 15px !important; background: transparent !important; box-shadow: none !important; }
table.dataTable > tbody > tr.sk-row { pointer-events: none; }
table.dataTable > tbody > tr.sk-row .sk { height: 10px; max-width: 220px; }
.dt-container.sk-dt-refresh table.dataTable > tbody { opacity: .55; transition: opacity .2s ease; }
.dt-container.sk-dt-refresh .dt-scroll-head, .dt-container.sk-dt-refresh table.dataTable:not(.dt-scroll-body table) > thead { position: relative; }
.dt-container.sk-dt-refresh .dt-scroll-head::after, .dt-container.sk-dt-refresh table.dataTable:not(.dt-scroll-body table) > thead::after {
	content: ""; position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none;
	background: linear-gradient(90deg, transparent, var(--bs-primary, #1565C0), transparent) 0 0 / 40% 100% no-repeat;
	animation: sk-run 1.1s ease-in-out infinite;
}

/* NuVida's and the platform's stat cards put the loading class on the value itself; the old rule only matched a parent,
   so they showed a grey "--" instead of shimmering. */
.sa-stat-card__value.sa-stat-card--loading, .sa-kpi-card__value.sa-loading {
	display: block; width: min(7.5rem, 100%); min-width: 0; border-radius: 6px; color: transparent !important;
	background: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) 0 0 / 300% 100%;
	animation: sk-pan var(--sk-speed) linear infinite;
}

/* A placeholder's own text ("Loading...", "--") is hidden under its paint. Tables and the glass layer set text colors
   with !important, so this sits in the first layer (atlasmps-custom.css: @layer sa-controls, ..., sa-glass), whose
   !important outranks theirs. */
@layer sa-controls {
	.sk, .sk-auto, .sk-auto :not(.visually-hidden), .sa-stat-card__value.sa-stat-card--loading, .sa-kpi-card__value.sa-loading,
	.dt-container.sk-dt-first table.dataTable > tbody > tr > td.dt-empty { color: transparent !important; -webkit-text-fill-color: transparent !important; }
	/* Dark mode paints these values' background with !important; longhands, so the animation still moves the shine. */
	.sa-stat-card__value.sa-stat-card--loading, .sa-kpi-card__value.sa-loading {
		background-color: transparent !important; background-size: 300% 100% !important; background-repeat: no-repeat !important;
		background-image: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) !important;
	}
}
/* The same in cdpartner, whose layers are lg-* (liquid-glass.css): each app's first layer wins, the other block is
   inert. live-ui.css loads after liquid-glass.css there, so lg-controls is already first. */
@layer lg-controls {
	.sk, .sk-auto, .sk-auto :not(.visually-hidden), .sa-stat-card__value.sa-stat-card--loading, .sa-kpi-card__value.sa-loading,
	.dt-container.sk-dt-first table.dataTable > tbody > tr > td.dt-empty { color: transparent !important; -webkit-text-fill-color: transparent !important; }
	/* Dark mode paints these values' background with !important; longhands, so the animation still moves the shine. */
	.sa-stat-card__value.sa-stat-card--loading, .sa-kpi-card__value.sa-loading {
		background-color: transparent !important; background-size: 300% 100% !important; background-repeat: no-repeat !important;
		background-image: linear-gradient(100deg, var(--sk-base) 0%, var(--sk-base) 40%, var(--sk-glint) 50%, var(--sk-base) 60%, var(--sk-base) 100%) !important;
	}
}

@keyframes sk-sweep { 100% { transform: translateX(100%); } }
@keyframes sk-pan { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes sk-run { from { background-position: -40% 0; } to { background-position: 140% 0; } }
@keyframes sk-fade { 50% { opacity: .5; } }

/* ── Rolling numbers (samg-numbers.js) ───────────────────────────────────────────────────────────────────────────── */
/* .sn replaces a number's text node while it rolls: .sn__sr keeps the real text (screen readers, textContent), and the
   reel draws each digit as a strip 0-9 three times over an invisible copy of the final digit, which gives the column
   the static text's width and baseline, so nothing shifts when the plain text comes back. */
.sn { position: relative; display: inline; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sn__sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.sn__reel { display: inline; }
.sn__c::after { content: attr(data-c); }
.sn__d { position: relative; display: inline-block; clip-path: inset(0 -0.1em); }
.sn__d::after { content: attr(data-d); visibility: hidden; }
.sn__d::before {
	content: "0\A 1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9\A 0\A 1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9\A 0\A 1\A 2\A 3\A 4\A 5\A 6\A 7\A 8\A 9";
	position: absolute; left: 0; right: 0; top: 0; white-space: pre; text-align: center; line-height: var(--lh, 1.2em);
	transform: translateY(calc(var(--a) * var(--lh, 1.2em) * -1));
}
.sn.is-rolling .sn__d::before {
	transform: translateY(calc(var(--b) * var(--lh, 1.2em) * -1));
	transition: transform var(--dur, 400ms) cubic-bezier(.16, .84, .24, 1) calc(var(--i, 0) * var(--stagger, 0ms));
}
/* A new leading digit (999 to 1,000) rises in */
.sn__new { opacity: 0; }
.sn.is-rolling .sn__new { opacity: 1; transition: opacity var(--dur, 400ms) ease calc(var(--i, 0) * var(--stagger, 0ms)); }

@media (prefers-reduced-motion: reduce) {
	.sk::after { display: none; }
	.sk, .sk-auto::before, [data-sk]:empty::before,
	.sa-stat-card__value.sa-stat-card--loading, .sa-kpi-card__value.sa-loading { animation: sk-fade 2s ease-in-out infinite; }
	.dt-container.sk-dt-refresh .dt-scroll-head::after, .dt-container.sk-dt-refresh table.dataTable:not(.dt-scroll-body table) > thead::after { animation: none; background-size: 100% 100%; opacity: .4; }
}
@media (forced-colors: active) {
	.sk { background: Canvas; outline: 1px solid GrayText; }
}
