/* Inventory import — animated progress overlay.
   Appended to <body>, so it uses the GLOBAL theme tokens (--accent/--panel/--line…),
   never the taper-scoped --t* ones. Orbiting rings + a sweeping progress ring + a
   shimmering bar, resolving into a success / partial state. Motion is dropped under
   prefers-reduced-motion. */

body.invImportOpen { overflow: hidden; }

.invImportOverlay {
  position: fixed; inset: 0; z-index: 2200;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in srgb, var(--bg, #07080b) 74%, transparent);
  backdrop-filter: blur(8px);
  animation: invImpFade .28s ease both;
}
@keyframes invImpFade { from { opacity: 0; } to { opacity: 1; } }

.invImportCard {
  position: relative; width: min(420px, 100%);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 30px 28px 26px; border-radius: 24px;
  background:
    radial-gradient(120% 130% at 50% -20%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 60%),
    var(--panel, #12161e);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line, #28303f));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8), 0 0 0 1px color-mix(in srgb, var(--accent) 10%, transparent);
  animation: invImpPop .42s cubic-bezier(.2, .8, .2, 1) both;
  overflow: hidden;
}
.invImportCard::before {   /* slow accent glow breathing behind the ring */
  content: ""; position: absolute; inset: -40% -40% auto -40%; height: 80%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 26%, transparent), transparent);
  animation: invImpBreathe 3.4s ease-in-out infinite; pointer-events: none;
}
@keyframes invImpPop { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes invImpBreathe { 0%, 100% { opacity: .5; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.08); } }

/* ----- ring + orbits ----- */
.invImportStage { position: relative; width: 168px; height: 168px; display: grid; place-items: center; }
.invImportOrbits, .invImportOrbits span {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
}
.invImportOrbits span { border: 1.5px solid transparent; }
.invImportOrbits span:nth-child(1) { border-top-color: color-mix(in srgb, var(--accent) 70%, transparent); animation: invImpSpin 2.1s linear infinite; }
.invImportOrbits span:nth-child(2) { inset: 16px; border-right-color: color-mix(in srgb, var(--accent2, #7dd3fc) 65%, transparent); animation: invImpSpin 3.1s linear infinite reverse; }
.invImportOrbits span:nth-child(3) { inset: 32px; border-bottom-color: color-mix(in srgb, var(--accent) 45%, transparent); animation: invImpSpin 4.6s linear infinite; }
@keyframes invImpSpin { to { transform: rotate(360deg); } }

.invImportRing { position: relative; width: 120px; height: 120px; }
.invImportRing svg { width: 120px; height: 120px; display: block; }
.invImportTrack { fill: none; stroke: color-mix(in srgb, var(--line, #28303f) 90%, transparent); stroke-width: 9; }
.invImportFill {
  fill: none; stroke: url(#invImpGrad); stroke-width: 9; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 60px 60px;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 55%, transparent));
  transition: stroke-dashoffset .55s cubic-bezier(.22, .8, .2, 1);
}
.invImportRingCentre {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  transition: opacity .25s ease;
}
.invImportRingCentre strong { font-size: 1.55rem; font-weight: 800; color: var(--text, #e9edf4); font-variant-numeric: tabular-nums; }
.invImportRingCentre small { font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted, #8a94a6); font-variant-numeric: tabular-nums; }

.invImportCheck {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: scale(.4);
  color: var(--good, #3fb950);
}
.invImportCheck svg { width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40; }

/* ----- text + bar ----- */
.invImportTitle { margin-top: 20px; font-size: 1.06rem; font-weight: 800; color: var(--text, #e9edf4); }
.invImportItem {
  margin-top: 5px; min-height: 1.2em; max-width: 100%; font-size: .82rem; color: var(--muted, #8a94a6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  animation: invImpItemIn .3s ease;
}
@keyframes invImpItemIn { from { opacity: .2; } to { opacity: 1; } }

.invImportBar {
  position: relative; width: 100%; height: 8px; margin-top: 16px; border-radius: 999px; overflow: hidden;
  background: color-mix(in srgb, var(--line, #28303f) 70%, transparent);
}
.invImportBarFill {
  display: block; height: 100%; width: 0; border-radius: 999px; position: relative;
  background: linear-gradient(90deg, var(--accent, #4ea1ff), var(--accent2, #7dd3fc));
  transition: width .5s cubic-bezier(.22, .8, .2, 1);
}
.invImportBarFill::after {   /* travelling sheen */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-100%); animation: invImpSheen 1.25s ease-in-out infinite;
}
@keyframes invImpSheen { to { transform: translateX(100%); } }

.invImportDone {
  margin-top: 18px; padding: 10px 26px; border-radius: 12px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line, #28303f));
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text, #e9edf4);
  font-weight: 700; font-size: .9rem; animation: invImpItemIn .3s ease;
}
.invImportDone:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.invImportDone[hidden] { display: none; }

/* ----- complete state ----- */
.invImportComplete .invImportOrbits { animation: invImpFadeOut .4s ease forwards; }
@keyframes invImpFadeOut { to { opacity: 0; } }
.invImportOk .invImportRingCentre { opacity: 0; }
.invImportOk .invImportFill { stroke: url(#invImpGrad); filter: drop-shadow(0 0 10px color-mix(in srgb, var(--good, #3fb950) 60%, transparent)); }
.invImportOk .invImportCheck { animation: invImpCheckPop .45s cubic-bezier(.2, .9, .3, 1.3) .12s forwards; }
.invImportOk .invImportCheck svg { animation: invImpCheckDraw .5s ease .2s forwards; }
@keyframes invImpCheckPop { to { opacity: 1; transform: scale(1); } }
@keyframes invImpCheckDraw { to { stroke-dashoffset: 0; } }
.invImportPartial .invImportRingCentre strong { color: var(--warn, #f2cc60); font-size: 1.15rem; }
.invImportPartial .invImportFill { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--warn, #f2cc60) 55%, transparent)); }

/* ----- empty / nothing-to-import state ----- */
.invImportEmptyMark {
  position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: scale(.6);
  color: var(--muted, #8a94a6);
  transition: opacity .3s ease, transform .4s cubic-bezier(.2, .9, .3, 1.3);
}
.invImportEmptyMark svg { width: 50px; height: 50px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.invImportEmpty .invImportEmptyMark { opacity: 1; transform: scale(1); }
.invImportEmpty .invImportRingCentre { opacity: 0; }
.invImportEmpty .invImportFill { stroke: color-mix(in srgb, var(--muted, #8a94a6) 45%, transparent); filter: none; }
.invImportEmpty .invImportOrbits span { opacity: .28; animation-duration: 9s; }
.invImportEmpty .invImportBar { display: none; }
.invImportEmpty .invImportItem { white-space: normal; max-width: 320px; line-height: 1.45; }

@media (prefers-reduced-motion: reduce) {
  .invImportOverlay, .invImportCard, .invImportItem, .invImportDone { animation: none; }
  .invImportCard::before, .invImportOrbits span, .invImportBarFill::after { animation: none; }
  .invImportFill { transition: none; }
  .invImportCheck svg { stroke-dashoffset: 0; }
  .invImportOk .invImportCheck { opacity: 1; transform: scale(1); animation: none; }
  .invImportEmptyMark { transition: none; opacity: 1; transform: none; }
}
