/* A signal travels while real work is pending. Skeletons reserve content space;
   only three small marks move, rather than repainting every placeholder. */
.loading-status {display:inline-flex;align-items:center;gap:12px;color:var(--brand-muted);font:inherit;font-size:13px;line-height:1.5;min-height:24px}
.loading-signal {display:inline-flex;align-items:center;gap:4px;width:36px;height:16px;flex:none}
.loading-signal i {display:block;width:6px;height:6px;border-radius:1px;background:var(--brand-ink);animation:loading-signal-pass 1.8s cubic-bezier(.22,1,.36,1) infinite}
.loading-signal i:nth-child(2) {background:var(--brand-pink);animation-delay:120ms}
.loading-signal i:nth-child(3) {background:var(--brand-blue);animation-delay:240ms}
@keyframes loading-signal-pass {0%,65%,100% {transform:translateY(0);opacity:.35} 25% {transform:translateY(-3px);opacity:1}}
.loading-state {width:100%;min-width:0;padding:24px 0;grid-column:1 / -1}
.loading-layout {display:grid;gap:16px;margin-top:24px;overflow:hidden}
.loading-shape {display:flex;align-items:center;gap:18px;min-width:0;min-height:72px;padding:16px 0}
.loading-mark,.loading-lines i {display:block;background:color-mix(in srgb,var(--brand-ink) 7%,transparent);border-radius:3px}
.loading-mark {width:32px;height:32px;flex:none}
.loading-lines {display:grid;gap:12px;flex:1;min-width:0}
.loading-lines i {height:10px;width:62%}
.loading-lines i:nth-child(2) {width:88%;opacity:.65}
.loading-lines i:nth-child(3) {width:42%;opacity:.45}
.loading-shape:nth-child(even) .loading-lines i:first-child {width:48%}
[data-loading-shape="catalog"] .loading-layout,[data-loading-shape="plans"] .loading-layout,[data-loading-shape="metrics"] .loading-layout {grid-template-columns:repeat(3,minmax(0,1fr));gap:20px}
[data-loading-shape="catalog"] .loading-shape,[data-loading-shape="plans"] .loading-shape {flex-direction:column;align-items:stretch;padding:24px;min-height:210px;background:color-mix(in srgb,var(--brand-ink) 2%,transparent);border-radius:12px}
[data-loading-shape="plans"] .loading-shape {min-height:340px}
[data-loading-shape="catalog"] .loading-lines,[data-loading-shape="plans"] .loading-lines {flex:0;gap:20px}
[data-loading-shape="detail"] .loading-shape {min-height:120px;max-width:840px}
[data-loading-shape="detail"] .loading-shape:first-child .loading-lines i:first-child {height:32px;width:50%}
[data-loading-shape="code"] .loading-layout {gap:12px;padding:24px;background:color-mix(in srgb,var(--brand-ink) 3%,transparent);border-radius:12px}
[data-loading-shape="code"] .loading-shape {min-height:16px;padding:0}
[data-loading-shape="code"] .loading-mark,[data-loading-shape="code"] .loading-lines i:not(:first-child) {display:none}
[data-loading-shape="metrics"] .loading-shape {min-height:130px;align-items:start}
.loading-page-content {max-width:1240px;margin:0 auto;padding:48px 32px}
.loading-page-content h1 {margin:0 0 8px}
.quick-search-results .loading-state {padding:16px 20px}
.quick-search-results .loading-layout {gap:0;margin-top:8px}
.quick-search-results .loading-shape {min-height:48px;padding:8px 0}
.quick-search-results .loading-lines i:nth-child(3) {display:none}
/* Refresh retains data. Existing aria-busy owners remain responsible for completion. */
#keys-content[aria-busy="true"]:not(:has(.loading-state)) {opacity:.7;transition:opacity 160ms ease}
.user-points .loading-signal {vertical-align:middle}
/* Shared activity grammar for existing workspace placeholders. */
.loader::before {border:0;border-radius:1px;width:6px;height:6px;background:var(--brand-ink);box-shadow:10px 0 var(--brand-pink),20px 0 var(--brand-blue);margin-right:20px;animation:loading-signal-pass 1.8s cubic-bezier(.22,1,.36,1) infinite}
@media(max-width:900px) {[data-loading-shape="catalog"] .loading-layout {grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px) {
  .loading-page-content {padding:28px 20px}
  [data-loading-shape="catalog"] .loading-layout,[data-loading-shape="plans"] .loading-layout {grid-template-columns:1fr;gap:12px}
  [data-loading-shape="catalog"] .loading-shape {min-height:190px;padding:20px}
  [data-loading-shape="catalog"] .loading-shape:nth-child(n+4) {display:none}
  [data-loading-shape="metrics"] .loading-layout {grid-template-columns:1fr}
  [data-loading-shape="metrics"] .loading-shape {min-height:72px}
}
@media(prefers-reduced-motion:reduce) {.loading-signal i,.loader::before {animation:none;opacity:.7} #keys-content[aria-busy="true"] {transition:none}}

.admin-list-panel[aria-busy=true]:has(.key-skeleton)::before {display:none}
[aria-busy=true] .key-placeholder,.admin-detail-loading .key-placeholder {animation:none}

.loading-paused .loading-signal i,.loading-paused .loader::before {animation-play-state:paused}

/* The catalog already owns a status/count line. Keep the grid's origin fixed. */
.catalog-grid > .loading-state {padding:0}
.catalog-grid > .loading-state > .loading-status {display:none}
.catalog-grid > .loading-state > .loading-layout {margin:0;gap:16px}
[data-loading-shape="catalog"] .loading-shape {min-height:300px}
[data-loading-shape="directory"] .loading-layout {gap:0;background:var(--brand-surface);border-radius:12px;padding:0 20px}
[data-loading-shape="directory"] .loading-shape {min-height:92px}
[data-loading-shape="directory"] .loading-lines {grid-template-columns:1.4fr 1fr .6fr;align-items:center}
[data-loading-shape="directory"] .loading-lines i {width:80%}
@media(max-width:600px) {
 [data-loading-shape="directory"] .loading-lines {grid-template-columns:1fr}
 [data-loading-shape="directory"] .loading-shape {min-height:112px}
}
/* A long wait label must not wrap the adjacent Cards/Table controls on mobile. */
.catalog-meta #result-count {flex:1;min-width:0}
.catalog-meta .loading-status {display:flex;max-width:100%}
.catalog-meta .loading-status > span:last-child {min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Match the featured slot before catalog data arrives, including its mobile wrap. */
.featured-placeholder {box-sizing:border-box;min-height:192px}
.featured-placeholder .loading-lines {max-width:620px;gap:22px}
.featured-placeholder .loading-lines i:nth-child(2) {height:32px}
.featured-placeholder .loading-mark {width:88px;height:88px;border-radius:22px}
.workspace-page:has(.workspace-switch-status) {position:relative}
.workspace-switch-status {position:absolute;top:16px;right:0;padding:8px 12px;background:var(--brand-surface);border-radius:8px}
@media(max-width:600px) {
  #catalog-featured .featured-spotlight {min-height:232px;box-sizing:border-box}
  .featured-placeholder .loading-mark {width:52px;height:52px;border-radius:14px}
}
/* The list toolbar already announces pending work; its skeleton only previews rows. */
.admin-list-panel > .loading-state {padding:20px 24px;box-sizing:border-box}
.admin-list-panel > .loading-state > .loading-status {display:none}
.admin-list-panel > .loading-state > .loading-layout {margin-top:0}
