/* U12 states kit — skeleton, empty, error, disconnected, toast drain, signing stepper.
   Classes from kit-v0.4; wired by shell.js / tab.js / chrome.js. */

@keyframes x-sk {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -50% 0;
  }
}
@keyframes x-bl {
  50% {
    opacity: 0;
  }
}
@keyframes x-g1 {
  0%,
  100% {
    clip-path: inset(0 0 100% 0);
  }
  10% {
    clip-path: inset(10% 0 60% 0);
    transform: translate(-3px);
  }
  14% {
    clip-path: inset(0 0 100% 0);
  }
  60% {
    clip-path: inset(55% 0 20% 0);
    transform: translate(4px);
  }
  66% {
    clip-path: inset(0 0 100% 0);
  }
}
@keyframes x-g2 {
  0%,
  100% {
    clip-path: inset(0 0 100% 0);
  }
  30% {
    clip-path: inset(70% 0 5% 0);
    transform: translate(3px);
  }
  36% {
    clip-path: inset(0 0 100% 0);
  }
  80% {
    clip-path: inset(30% 0 50% 0);
    transform: translate(-2px);
  }
  84% {
    clip-path: inset(0 0 100% 0);
  }
}
@keyframes x-in {
  from {
    transform: translateX(110%);
  }
}
@keyframes x-out {
  to {
    transform: translateX(110%);
  }
}
@keyframes x-cf {
  to {
    transform: translate(var(--dx), var(--dy));
    opacity: 0;
  }
}

/* Skeleton — kit-v0.4 States tab (byte-identical rules). */
.x-sk {
  display: grid;
  gap: 8px;
}
.x-sk i {
  height: 12px;
  background: linear-gradient(90deg, var(--line) 0 40%, var(--alt) 40% 60%, var(--line) 60%) 0 0 / 300% 100%;
  animation: x-sk 960ms var(--st-6) infinite;
}
.x-sk i:nth-child(1) {
  height: 32px;
  width: 50%;
}
.x-sk i:nth-child(3) {
  width: 75%;
}
/* Post-boot overlay host: fills the tile/stat without shifting layout (no CLS). */
.v2-sk-host {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: stretch;
  padding: 10px 14px;
  background: var(--bg);
  pointer-events: none;
  box-sizing: border-box;
}
.v2-sk-host .x-sk {
  flex: 1;
  width: 100%;
  align-content: start;
}
.v2-stat .v2-sk-host {
  padding: 8px 10px;
  top: 22px; /* leave the label strip visible */
}
.v2-tile:has(> .v2-body),
.v2-stat {
  position: relative;
}

/* Empty — 8-bit CSS blocks + uppercase message */
.x-empty,
.x-em {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
  padding: 16px;
  color: var(--mute);
  font: 400 var(--fs-12) / 1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.x-empty .x-px,
.x-em .x-px {
  width: 72px;
  height: 54px;
  position: relative;
}
.x-empty .x-px i,
.x-em .x-px i {
  position: absolute;
  width: 6px;
  height: 6px;
}

/* Error + glitch text */
.x-err {
  border: 1px solid var(--crit);
  box-shadow: var(--v2-shadow-4) var(--crit);
  padding: 12px;
  background: var(--tile);
}
.x-gl {
  position: relative;
  font: 400 24px / 1.1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--crit-tx);
  text-transform: uppercase;
}
.x-gl::before,
.x-gl::after {
  content: attr(data-t);
  position: absolute;
  inset: 0;
  background: var(--tile);
}
.x-gl::before {
  color: var(--bone);
  animation: x-g1 1.6s var(--st-1) infinite;
}
.x-gl::after {
  color: var(--acc-hi);
  animation: x-g2 1.2s var(--st-1) infinite;
}

/* Disconnected banner (U12 x-dis; kit also called this x-ws) */
.x-dis,
.x-ws {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--warn);
  background: var(--bg);
  color: var(--warn);
  /* Kit .x-ws: Departure 11px, regular, no tracking. */
  font: 400 var(--fs-11) / 1.2 var(--pix);
  font-synthesis: none;
  letter-spacing: 0;
  text-transform: uppercase;
  z-index: 50;
}
.x-dis[hidden],
.x-ws[hidden] {
  display: none !important;
}
.x-dis > i,
.x-ws > i {
  width: 8px;
  height: 8px;
  flex: none;
  background: var(--warn);
  animation: x-bl 960ms var(--st-1) infinite;
}
/* Pinned to the page bottom, above the mobile Long/Short dock (--v2-dock is 0 on desktop). */
.x-dis--bar {
  position: fixed;
  bottom: var(--v2-dock, 0px);
  left: 0;
  right: 0;
  z-index: 99;
  /* Status only: clicks pass through to the rows / buttons it overlaps. */
  pointer-events: none;
}

/* Toast stack + 10-segment drain */
.x-toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 110;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(320px, calc(100% - 32px));
  pointer-events: none;
}
/* Kit toast chrome. Stack children (.x-toasts) are static in-flow; the live
   .v2-toast host keeps shell/mobile fixed + bottom offsets (ticket e2e H). */
.x-toasts .x-toast,
.v2-toast.x-toast {
  pointer-events: auto;
  background: var(--tile);
  border: 1px solid var(--c, var(--acc));
  box-shadow: var(--v2-shadow-4) var(--c, var(--acc));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
  padding: 4px 4px 8px 12px;
  color: var(--tx);
  font: 600 12px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: x-in 160ms var(--st);
}
.x-toasts .x-toast {
  position: static;
  left: auto;
  bottom: auto;
  transform: none;
  z-index: auto;
}
.v2-toast.x-toast {
  display: none;
}
.v2-toast.x-toast.on {
  display: grid;
}
.x-toast.out {
  animation: x-out 160ms var(--st) forwards;
}
.x-toast .x-bar,
.x-bar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
  padding-right: 8px;
}
.x-bar i {
  height: 4px;
  background: var(--c, var(--acc));
}
.x-bar i.off {
  background: var(--line);
}

/* Signing stepper SIGN → PENDING → CONFIRMED (display only) */
.x-stp {
  position: fixed;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%);
  z-index: 105;
  width: min(420px, calc(100% - 32px));
  background: var(--tile);
  border: 1px solid var(--line);
  padding: 8px;
  overflow: hidden;
}
.x-stp[hidden] {
  display: none !important;
}
.x-stp > .x-lab {
  display: block;
  margin-bottom: 6px;
  color: var(--mute);
  font: 400 var(--fs-12) / 1.2 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.x-stp ol,
.x-stp .x-ss {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.x-stp li {
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  font: 500 12px var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: center;
}
.x-stp li.on {
  border-color: var(--warn);
  color: var(--warn);
  animation: x-bl 480ms var(--st-1) infinite;
}
.x-stp li.ok {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--ink);
}
.x-stp li.bad {
  background: var(--crit);
  border-color: var(--crit);
  color: var(--ink);
}
.x-cf {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  background: var(--c);
  pointer-events: none;
  animation: x-cf 720ms var(--st-6) forwards;
}

/* Spinner 2×2 */
.x-spin {
  display: grid;
  grid-template-columns: 4px 4px;
  gap: 2px;
  width: 10px;
  height: 10px;
}
.x-spin i {
  width: 4px;
  height: 4px;
  background: var(--line);
  animation: x-bl 480ms var(--st-1) infinite;
}
.x-spin i:nth-child(2) {
  animation-delay: 120ms;
}
.x-spin i:nth-child(3) {
  animation-delay: 240ms;
}
.x-spin i:nth-child(4) {
  animation-delay: 360ms;
}

@media (prefers-reduced-motion: reduce) {
  .x-sk i,
  .x-gl::before,
  .x-gl::after,
  .x-dis > i,
  .x-ws > i,
  .x-stp li.on,
  .x-spin i,
  .x-cf,
  .x-toast,
  .x-toast.out {
    animation: none !important;
  }
  .x-sk i {
    background: var(--line);
  }
}
